mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-17 20:23:52 +00:00
[Quest API] Added NPC special ability to modify Riposte/Dodge/Parry/Block chance (#1683)
* Update attack.cpp * u * Update attack.cpp * spellchecked
This commit is contained in:
parent
5c7972345a
commit
785926a584
@ -382,18 +382,32 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
ultimately end up being more useful as fields in npc_types.
|
||||
*/
|
||||
|
||||
int counter_all = 0;
|
||||
int counter_all = 0;
|
||||
int counter_riposte = 0;
|
||||
int counter_block = 0;
|
||||
int counter_parry = 0;
|
||||
int counter_dodge = 0;
|
||||
int counter_block = 0;
|
||||
int counter_parry = 0;
|
||||
int counter_dodge = 0;
|
||||
|
||||
if (attacker->GetSpecialAbility(COUNTER_AVOID_DAMAGE)) {
|
||||
counter_all = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 0);
|
||||
counter_all = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 0);
|
||||
counter_riposte = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 1);
|
||||
counter_block = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 2);
|
||||
counter_parry = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 3);
|
||||
counter_dodge = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 4);
|
||||
counter_block = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 2);
|
||||
counter_parry = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 3);
|
||||
counter_dodge = attacker->GetSpecialAbilityParam(COUNTER_AVOID_DAMAGE, 4);
|
||||
}
|
||||
|
||||
int modify_all = 0;
|
||||
int modify_riposte = 0;
|
||||
int modify_block = 0;
|
||||
int modify_parry = 0;
|
||||
int modify_dodge = 0;
|
||||
|
||||
if (GetSpecialAbility(MODIFY_AVOID_DAMAGE)) {
|
||||
modify_all = GetSpecialAbilityParam(MODIFY_AVOID_DAMAGE, 0);
|
||||
modify_riposte = GetSpecialAbilityParam(MODIFY_AVOID_DAMAGE, 1);
|
||||
modify_block = GetSpecialAbilityParam(MODIFY_AVOID_DAMAGE, 2);
|
||||
modify_parry = GetSpecialAbilityParam(MODIFY_AVOID_DAMAGE, 3);
|
||||
modify_dodge = GetSpecialAbilityParam(MODIFY_AVOID_DAMAGE, 4);
|
||||
}
|
||||
|
||||
// riposte -- it may seem crazy, but if the attacker has SPA 173 on them, they are immune to Ripo
|
||||
@ -420,6 +434,10 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
float counter = (counter_riposte + counter_all) / 100.0f;
|
||||
chance -= chance * counter;
|
||||
}
|
||||
if (modify_riposte || modify_all) {
|
||||
float npc_modifier = (modify_riposte + modify_all) / 100.0f;
|
||||
chance += chance * npc_modifier;
|
||||
}
|
||||
// AA Slippery Attacks
|
||||
if (hit.hand == EQ::invslot::slotSecondary) {
|
||||
int slip = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail;
|
||||
@ -459,6 +477,10 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
float counter = (counter_block + counter_all) / 100.0f;
|
||||
chance -= chance * counter;
|
||||
}
|
||||
if (modify_block || modify_all) {
|
||||
float npc_modifier = (modify_block + modify_all) / 100.0f;
|
||||
chance += chance * npc_modifier;
|
||||
}
|
||||
if (zone->random.Roll(chance)) {
|
||||
hit.damage_done = DMG_BLOCKED;
|
||||
return true;
|
||||
@ -482,6 +504,10 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
float counter = (counter_parry + counter_all) / 100.0f;
|
||||
chance -= chance * counter;
|
||||
}
|
||||
if (modify_parry || modify_all) {
|
||||
float npc_modifier = (modify_parry + modify_all) / 100.0f;
|
||||
chance += chance * npc_modifier;
|
||||
}
|
||||
if (zone->random.Roll(chance)) {
|
||||
hit.damage_done = DMG_PARRIED;
|
||||
return true;
|
||||
@ -505,6 +531,10 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
float counter = (counter_dodge + counter_all) / 100.0f;
|
||||
chance -= chance * counter;
|
||||
}
|
||||
if (modify_dodge || modify_all) {
|
||||
float npc_modifier = (modify_dodge + modify_all) / 100.0f;
|
||||
chance += chance * npc_modifier;
|
||||
}
|
||||
if (zone->random.Roll(chance)) {
|
||||
hit.damage_done = DMG_DODGED;
|
||||
return true;
|
||||
|
||||
@ -201,14 +201,15 @@ enum {
|
||||
ALLOW_TO_TANK = 41,
|
||||
IGNORE_ROOT_AGGRO_RULES = 42,
|
||||
CASTING_RESIST_DIFF = 43,
|
||||
COUNTER_AVOID_DAMAGE = 44,
|
||||
COUNTER_AVOID_DAMAGE = 44, //Modify by percent NPC's opponents chance to riposte, block, parry or dodge individually, or for all skills
|
||||
PROX_AGGRO = 45,
|
||||
IMMUNE_RANGED_ATTACKS = 46,
|
||||
IMMUNE_DAMAGE_CLIENT = 47,
|
||||
IMMUNE_DAMAGE_NPC = 48,
|
||||
IMMUNE_AGGRO_CLIENT = 49,
|
||||
IMMUNE_AGGRO_NPC = 50,
|
||||
MAX_SPECIAL_ATTACK = 51
|
||||
MODIFY_AVOID_DAMAGE = 51, //Modify by percent the NPCs chance to riposte, block, parry or dodge individually, or for all skills
|
||||
MAX_SPECIAL_ATTACK = 52
|
||||
};
|
||||
|
||||
typedef enum { //fear states
|
||||
|
||||
106
zone/lua_mob.cpp
106
zone/lua_mob.cpp
@ -2841,58 +2841,60 @@ luabind::scope lua_register_mob() {
|
||||
|
||||
luabind::scope lua_register_special_abilities() {
|
||||
return luabind::class_<SpecialAbilities>("SpecialAbility")
|
||||
.enum_("constants")
|
||||
[
|
||||
luabind::value("summon", static_cast<int>(SPECATK_SUMMON)),
|
||||
luabind::value("enrage", static_cast<int>(SPECATK_ENRAGE)),
|
||||
luabind::value("rampage", static_cast<int>(SPECATK_RAMPAGE)),
|
||||
luabind::value("area_rampage", static_cast<int>(SPECATK_AREA_RAMPAGE)),
|
||||
luabind::value("flurry", static_cast<int>(SPECATK_FLURRY)),
|
||||
luabind::value("triple_attack", static_cast<int>(SPECATK_TRIPLE)),
|
||||
luabind::value("quad_attack", static_cast<int>(SPECATK_QUAD)),
|
||||
luabind::value("innate_dual_wield", static_cast<int>(SPECATK_INNATE_DW)),
|
||||
luabind::value("bane_attack", static_cast<int>(SPECATK_BANE)),
|
||||
luabind::value("magical_attack", static_cast<int>(SPECATK_MAGICAL)),
|
||||
luabind::value("ranged_attack", static_cast<int>(SPECATK_RANGED_ATK)),
|
||||
luabind::value("unslowable", static_cast<int>(UNSLOWABLE)),
|
||||
luabind::value("unmezable", static_cast<int>(UNMEZABLE)),
|
||||
luabind::value("uncharmable", static_cast<int>(UNCHARMABLE)),
|
||||
luabind::value("unstunable", static_cast<int>(UNSTUNABLE)),
|
||||
luabind::value("unsnareable", static_cast<int>(UNSNAREABLE)),
|
||||
luabind::value("unfearable", static_cast<int>(UNFEARABLE)),
|
||||
luabind::value("undispellable", static_cast<int>(UNDISPELLABLE)),
|
||||
luabind::value("immune_melee", static_cast<int>(IMMUNE_MELEE)),
|
||||
luabind::value("immune_magic", static_cast<int>(IMMUNE_MAGIC)),
|
||||
luabind::value("immune_fleeing", static_cast<int>(IMMUNE_FLEEING)),
|
||||
luabind::value("immune_melee_except_bane", static_cast<int>(IMMUNE_MELEE_EXCEPT_BANE)),
|
||||
luabind::value("immune_melee_except_magical", static_cast<int>(IMMUNE_MELEE_NONMAGICAL)),
|
||||
luabind::value("immune_aggro", static_cast<int>(IMMUNE_AGGRO)),
|
||||
luabind::value("immune_aggro_on", static_cast<int>(IMMUNE_AGGRO_ON)),
|
||||
luabind::value("immune_casting_from_range", static_cast<int>(IMMUNE_CASTING_FROM_RANGE)),
|
||||
luabind::value("immune_feign_death", static_cast<int>(IMMUNE_FEIGN_DEATH)),
|
||||
luabind::value("immune_taunt", static_cast<int>(IMMUNE_TAUNT)),
|
||||
luabind::value("tunnelvision", static_cast<int>(NPC_TUNNELVISION)),
|
||||
luabind::value("dont_buff_friends", static_cast<int>(NPC_NO_BUFFHEAL_FRIENDS)),
|
||||
luabind::value("immune_pacify", static_cast<int>(IMMUNE_PACIFY)),
|
||||
luabind::value("leash", static_cast<int>(LEASH)),
|
||||
luabind::value("tether", static_cast<int>(TETHER)),
|
||||
luabind::value("destructible_object", static_cast<int>(DESTRUCTIBLE_OBJECT)),
|
||||
luabind::value("no_harm_from_client", static_cast<int>(NO_HARM_FROM_CLIENT)),
|
||||
luabind::value("always_flee", static_cast<int>(ALWAYS_FLEE)),
|
||||
luabind::value("flee_percent", static_cast<int>(FLEE_PERCENT)),
|
||||
luabind::value("allow_beneficial", static_cast<int>(ALLOW_BENEFICIAL)),
|
||||
luabind::value("disable_melee", static_cast<int>(DISABLE_MELEE)),
|
||||
luabind::value("npc_chase_distance", static_cast<int>(NPC_CHASE_DISTANCE)),
|
||||
luabind::value("allow_to_tank", static_cast<int>(ALLOW_TO_TANK)),
|
||||
luabind::value("ignore_root_aggro_rules", static_cast<int>(IGNORE_ROOT_AGGRO_RULES)),
|
||||
luabind::value("casting_resist_diff", static_cast<int>(CASTING_RESIST_DIFF)),
|
||||
luabind::value("counter_avoid_damage", static_cast<int>(COUNTER_AVOID_DAMAGE)),
|
||||
luabind::value("immune_ranged_attacks", static_cast<int>(IMMUNE_RANGED_ATTACKS)),
|
||||
luabind::value("immune_damage_client", static_cast<int>(IMMUNE_DAMAGE_CLIENT)),
|
||||
luabind::value("immune_damage_npc", static_cast<int>(IMMUNE_DAMAGE_NPC)),
|
||||
luabind::value("immune_aggro_client", static_cast<int>(IMMUNE_AGGRO_CLIENT)),
|
||||
luabind::value("immune_aggro_npc", static_cast<int>(IMMUNE_AGGRO_NPC))
|
||||
];
|
||||
|
||||
.enum_("constants")
|
||||
[
|
||||
luabind::value("summon", static_cast<int>(SPECATK_SUMMON)),
|
||||
luabind::value("enrage", static_cast<int>(SPECATK_ENRAGE)),
|
||||
luabind::value("rampage", static_cast<int>(SPECATK_RAMPAGE)),
|
||||
luabind::value("area_rampage", static_cast<int>(SPECATK_AREA_RAMPAGE)),
|
||||
luabind::value("flurry", static_cast<int>(SPECATK_FLURRY)),
|
||||
luabind::value("triple_attack", static_cast<int>(SPECATK_TRIPLE)),
|
||||
luabind::value("quad_attack", static_cast<int>(SPECATK_QUAD)),
|
||||
luabind::value("innate_dual_wield", static_cast<int>(SPECATK_INNATE_DW)),
|
||||
luabind::value("bane_attack", static_cast<int>(SPECATK_BANE)),
|
||||
luabind::value("magical_attack", static_cast<int>(SPECATK_MAGICAL)),
|
||||
luabind::value("ranged_attack", static_cast<int>(SPECATK_RANGED_ATK)),
|
||||
luabind::value("unslowable", static_cast<int>(UNSLOWABLE)),
|
||||
luabind::value("unmezable", static_cast<int>(UNMEZABLE)),
|
||||
luabind::value("uncharmable", static_cast<int>(UNCHARMABLE)),
|
||||
luabind::value("unstunable", static_cast<int>(UNSTUNABLE)),
|
||||
luabind::value("unsnareable", static_cast<int>(UNSNAREABLE)),
|
||||
luabind::value("unfearable", static_cast<int>(UNFEARABLE)),
|
||||
luabind::value("undispellable", static_cast<int>(UNDISPELLABLE)),
|
||||
luabind::value("immune_melee", static_cast<int>(IMMUNE_MELEE)),
|
||||
luabind::value("immune_magic", static_cast<int>(IMMUNE_MAGIC)),
|
||||
luabind::value("immune_fleeing", static_cast<int>(IMMUNE_FLEEING)),
|
||||
luabind::value("immune_melee_except_bane", static_cast<int>(IMMUNE_MELEE_EXCEPT_BANE)),
|
||||
luabind::value("immune_melee_except_magical", static_cast<int>(IMMUNE_MELEE_NONMAGICAL)),
|
||||
luabind::value("immune_aggro", static_cast<int>(IMMUNE_AGGRO)),
|
||||
luabind::value("immune_aggro_on", static_cast<int>(IMMUNE_AGGRO_ON)),
|
||||
luabind::value("immune_casting_from_range", static_cast<int>(IMMUNE_CASTING_FROM_RANGE)),
|
||||
luabind::value("immune_feign_death", static_cast<int>(IMMUNE_FEIGN_DEATH)),
|
||||
luabind::value("immune_taunt", static_cast<int>(IMMUNE_TAUNT)),
|
||||
luabind::value("tunnelvision", static_cast<int>(NPC_TUNNELVISION)),
|
||||
luabind::value("dont_buff_friends", static_cast<int>(NPC_NO_BUFFHEAL_FRIENDS)),
|
||||
luabind::value("immune_pacify", static_cast<int>(IMMUNE_PACIFY)),
|
||||
luabind::value("leash", static_cast<int>(LEASH)),
|
||||
luabind::value("tether", static_cast<int>(TETHER)),
|
||||
luabind::value("destructible_object", static_cast<int>(DESTRUCTIBLE_OBJECT)),
|
||||
luabind::value("no_harm_from_client", static_cast<int>(NO_HARM_FROM_CLIENT)),
|
||||
luabind::value("always_flee", static_cast<int>(ALWAYS_FLEE)),
|
||||
luabind::value("flee_percent", static_cast<int>(FLEE_PERCENT)),
|
||||
luabind::value("allow_beneficial", static_cast<int>(ALLOW_BENEFICIAL)),
|
||||
luabind::value("disable_melee", static_cast<int>(DISABLE_MELEE)),
|
||||
luabind::value("npc_chase_distance", static_cast<int>(NPC_CHASE_DISTANCE)),
|
||||
luabind::value("allow_to_tank", static_cast<int>(ALLOW_TO_TANK)),
|
||||
luabind::value("ignore_root_aggro_rules", static_cast<int>(IGNORE_ROOT_AGGRO_RULES)),
|
||||
luabind::value("casting_resist_diff", static_cast<int>(CASTING_RESIST_DIFF)),
|
||||
luabind::value("counter_avoid_damage", static_cast<int>(COUNTER_AVOID_DAMAGE)),
|
||||
luabind::value("immune_ranged_attacks", static_cast<int>(IMMUNE_RANGED_ATTACKS)),
|
||||
luabind::value("immune_damage_client", static_cast<int>(IMMUNE_DAMAGE_CLIENT)),
|
||||
luabind::value("immune_damage_npc", static_cast<int>(IMMUNE_DAMAGE_NPC)),
|
||||
luabind::value("immune_aggro_client", static_cast<int>(IMMUNE_AGGRO_CLIENT)),
|
||||
luabind::value("immune_aggro_npc", static_cast<int>(IMMUNE_AGGRO_NPC)),
|
||||
luabind::value("modify_avoid_damage", static_cast<int>(MODIFY_AVOID_DAMAGE))
|
||||
];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user