Weapon Blocking can now trigger on ATK_MISS (#7042)
* Fixes #6886. * Weapon Blocking is able to trigger on missed attacks. * Weapon Blocking can still be triggered even if the target has Kyrie, Safety Wall, or other damage nullification statuses. Thanks to @Atemo!
This commit is contained in:
parent
96208f28ba
commit
563a7012ff
@ -1165,6 +1165,14 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe
|
|||||||
status_change_end(target, SC_GUARDIAN_S, INVALID_TIMER);
|
status_change_end(target, SC_GUARDIAN_S, INVALID_TIMER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Weapon Blocking can be triggered while the above statuses are active.
|
||||||
|
if ((sce = sc->data[SC_WEAPONBLOCKING]) && flag & (BF_SHORT | BF_WEAPON) && rnd() % 100 < sce->val2) {
|
||||||
|
clif_skill_nodamage(target, src, GC_WEAPONBLOCKING, sce->val1, 1);
|
||||||
|
sc_start(src, target, SC_WEAPONBLOCK_ON, 100, src->id, skill_get_time2(GC_WEAPONBLOCKING, sce->val1));
|
||||||
|
d->dmg_lv = ATK_BLOCK;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (damage == 0)
|
if (damage == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1238,13 +1246,6 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sce = sc->data[SC_WEAPONBLOCKING]) && flag&(BF_SHORT | BF_WEAPON) && rnd() % 100 < sce->val2) {
|
|
||||||
clif_skill_nodamage(target, src, GC_WEAPONBLOCKING, sce->val1, 1);
|
|
||||||
sc_start(src, target, SC_WEAPONBLOCK_ON, 100, src->id, skill_get_time2(GC_WEAPONBLOCKING, sce->val1));
|
|
||||||
d->dmg_lv = ATK_BLOCK;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((sce = sc->data[SC_MILLENNIUMSHIELD]) && sce->val2 > 0 && damage > 0) {
|
if ((sce = sc->data[SC_MILLENNIUMSHIELD]) && sce->val2 > 0 && damage > 0) {
|
||||||
sce->val3 -= static_cast<int>(cap_value(damage, INT_MIN, INT_MAX)); // absorb damage
|
sce->val3 -= static_cast<int>(cap_value(damage, INT_MIN, INT_MAX)); // absorb damage
|
||||||
d->dmg_lv = ATK_BLOCK;
|
d->dmg_lv = ATK_BLOCK;
|
||||||
@ -8266,6 +8267,18 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
|
|||||||
if (d.dmg_lv == ATK_DEF /*&& attack_type&(BF_MAGIC|BF_MISC)*/) // Isn't it that additional effects don't apply if miss?
|
if (d.dmg_lv == ATK_DEF /*&& attack_type&(BF_MAGIC|BF_MISC)*/) // Isn't it that additional effects don't apply if miss?
|
||||||
d.dmg_lv = ATK_MISS;
|
d.dmg_lv = ATK_MISS;
|
||||||
d.dmotion = 0;
|
d.dmotion = 0;
|
||||||
|
|
||||||
|
status_change *tsc = status_get_sc(target);
|
||||||
|
|
||||||
|
// Weapon Blocking has the ability to trigger on ATK_MISS as well.
|
||||||
|
if (tsc != nullptr && tsc->data[SC_WEAPONBLOCKING]) {
|
||||||
|
status_change_entry *tsce = tsc->data[SC_WEAPONBLOCKING];
|
||||||
|
|
||||||
|
if (attack_type == BF_WEAPON && rnd() % 100 < tsce->val2) {
|
||||||
|
clif_skill_nodamage(target, bl, GC_WEAPONBLOCKING, tsce->val1, 1);
|
||||||
|
sc_start(bl, target, SC_WEAPONBLOCK_ON, 100, bl->id, skill_get_time2(GC_WEAPONBLOCKING, tsce->val1));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // Some skills like Weaponry Research will cause damage even if attack is dodged
|
else // Some skills like Weaponry Research will cause damage even if attack is dodged
|
||||||
d.dmg_lv = ATK_DEF;
|
d.dmg_lv = ATK_DEF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user