summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emap/battle.c25
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;
}