diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-09-07 04:20:39 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-09-07 04:20:39 -0300 |
commit | c98d734b22e0fa9d3f72693531414efa7657eb23 (patch) | |
tree | 6fb84583839e6b7c432eb751ee6835d541941493 | |
parent | 7e0517e296e713a03b805b1b27dec0da370044b8 (diff) | |
download | plugin-c98d734b22e0fa9d3f72693531414efa7657eb23.tar.gz plugin-c98d734b22e0fa9d3f72693531414efa7657eb23.tar.bz2 plugin-c98d734b22e0fa9d3f72693531414efa7657eb23.tar.xz plugin-c98d734b22e0fa9d3f72693531414efa7657eb23.zip |
Track criticals, misses, dodges and undefended damagejesusalva/xstats
-rw-r--r-- | src/emap/battle.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/emap/battle.c b/src/emap/battle.c index 1b311b7..66097ca 100644 --- a/src/emap/battle.c +++ b/src/emap/battle.c @@ -97,6 +97,18 @@ struct Damage ebattle_calc_weapon_attack_post(struct Damage retVal, if (src == NULL) return retVal; + /* Player Variable updates (target) */ + if (target->type == BL_PC) { + struct map_session_data *tsd = BL_CAST(BL_PC, target); + pc->setreg(tsd, script->add_variable("@weaponDef"), pc->readreg(tsd,script->add_variable("@weaponDef"))+retVal.damage); + + if (retVal.type == BDT_PDODGE) + pc->setreg(tsd, script->add_variable("@weaponDodge"), pc->readreg(tsd,script->add_variable("@weaponDodge"))+10); + + if (retVal.dmg_lv == ATK_FLEE) + pc->setreg(tsd, script->add_variable("@weaponDodge"), pc->readreg(tsd,script->add_variable("@weaponDodge"))+1); + } + struct map_session_data *sd = BL_CAST(BL_PC, src); if (sd == NULL) return retVal; @@ -131,7 +143,18 @@ struct Damage ebattle_calc_weapon_attack_post(struct Damage retVal, } retVal.damage = apply_percentrate64(retVal.damage, mod, 10000); retVal.damage2 = apply_percentrate64(retVal.damage2, mod, 10000); - pc->setreg(sd, script->add_variable("@weaponAtk"), pc->readreg(sd,script->add_variable("@weaponAtk"))+1); + + /* Player Variable updates (source) */ + if (src->type == BL_PC) { + pc->setreg(sd, script->add_variable("@weaponAtk"), pc->readreg(sd,script->add_variable("@weaponAtk"))+1); + + if (retVal.type == BDT_CRIT) + pc->setreg(sd, script->add_variable("@weaponCrit"), pc->readreg(sd,script->add_variable("@weaponCrit"))+1); + + if (retVal.dmg_lv == ATK_FLEE) + pc->setreg(sd, script->add_variable("@weaponMiss"), pc->readreg(sd,script->add_variable("@weaponMiss"))+1); + } + return retVal; } |