Fixes damage reduction statuses/skills (#5453)

* Resolves an issue with damage not being passed back to the parent function after it has been reduced by various statuses or skills.
Thanks to @teededung!
This commit is contained in:
Aleos 2020-10-19 14:04:36 -04:00 committed by GitHub
parent aa4c1da450
commit 3f36c0d60a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1053,12 +1053,12 @@ static void battle_absorb_damage(struct block_list *bl, struct Damage *d) {
* @param target: Target of attack
* @param sc: Status Change data
* @param d: Damage data
* @param damage: Damage received
* @param damage: Damage received as a reference
* @param skill_id: Skill ID
* @param skill_lv: Skill level
* @return True: Damage inflicted, False: Missed
**/
bool battle_status_block_damage(struct block_list *src, struct block_list *target, struct status_change *sc, struct Damage *d, int64 damage, uint16 skill_id, uint16 skill_lv) {
bool battle_status_block_damage(struct block_list *src, struct block_list *target, struct status_change *sc, struct Damage *d, int64 &damage, uint16 skill_id, uint16 skill_lv) {
if (!src || !target || !sc || !d)
return true;
@ -5281,8 +5281,9 @@ static void battle_calc_attack_plant(struct Damage* wd, struct block_list *src,s
if (attack_hits && target->type == BL_MOB) {
struct status_change *sc = status_get_sc(target);
int64 damage_dummy = 1;
if (sc && !battle_status_block_damage(src, target, sc, wd, 1, skill_id, skill_lv)) { // Statuses that reduce damage to 0.
if (sc && !battle_status_block_damage(src, target, sc, wd, damage_dummy, skill_id, skill_lv)) { // Statuses that reduce damage to 0.
wd->damage = wd->damage2 = 0;
return;
}