diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-09-07 03:52:41 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-09-07 03:52:41 -0300 |
commit | 7e0517e296e713a03b805b1b27dec0da370044b8 (patch) | |
tree | 0f70c5415982112def50b9c8c60b53a0653e0a2f /src/emap | |
parent | 4d3a66b4eab50397d6b4ee02b8e2f2b5c00aa527 (diff) | |
download | plugin-7e0517e296e713a03b805b1b27dec0da370044b8.tar.gz plugin-7e0517e296e713a03b805b1b27dec0da370044b8.tar.bz2 plugin-7e0517e296e713a03b805b1b27dec0da370044b8.tar.xz plugin-7e0517e296e713a03b805b1b27dec0da370044b8.zip |
Record four new temporary variables tracking your combat (hits/def)
Probably will need to track more stuff (eg. nÂș of crits and misses) as well.
Diffstat (limited to 'src/emap')
-rw-r--r-- | src/emap/battle.c | 27 | ||||
-rw-r--r-- | src/emap/status.c | 6 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/emap/battle.c b/src/emap/battle.c index e0b7942..1b311b7 100644 --- a/src/emap/battle.c +++ b/src/emap/battle.c @@ -131,6 +131,7 @@ 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); return retVal; } @@ -149,9 +150,20 @@ enum damage_lv ebattle_weapon_attack_pre(struct block_list **srcPtr, if (sd == NULL) return ATK_NONE; - const int weaponIndex = sd->equip_index[EQI_HAND_L]; - if (weaponIndex < 0) + const int weaponIndex = sd->equip_index[EQI_HAND_R]; + if (weaponIndex < 0) { + const int oldWeapon = pc->readreg(sd, script->add_variable("@weaponId")); + if (oldWeapon < 1) + { + pc->setreg(sd, script->add_variable("@weaponId"), 1); + } + else if (1 != oldWeapon) + { + pc->setreg(sd, script->add_variable("@weaponId"), 1); + pc->setreg(sd, script->add_variable("@weaponNew"), 1); + } return ATK_NONE; + } struct ItemdExt *data = itemd_get(sd->inventory_data[weaponIndex]); if (!data) @@ -162,5 +174,16 @@ enum damage_lv ebattle_weapon_attack_pre(struct block_list **srcPtr, hookStop(); return ATK_NONE; } + + const int oldWeapon = pc->readreg(sd,script->add_variable("@weaponId")); + if (oldWeapon < 1) + { + pc->setreg(sd, script->add_variable("@weaponId"), sd->inventory_data[weaponIndex]->nameid); + } + else if (sd->inventory_data[weaponIndex]->nameid != oldWeapon) + { + pc->setreg(sd, script->add_variable("@weaponId"), sd->inventory_data[weaponIndex]->nameid); + pc->setreg(sd, script->add_variable("@weaponNew"), 1); + } return ATK_NONE; } diff --git a/src/emap/status.c b/src/emap/status.c index 7b42fa1..1f9ddfb 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -172,6 +172,12 @@ defType estatus_calc_def_post(defType retVal, if (sc->data[SC_PHYSICAL_SHIELD]) retVal += sc->data[SC_PHYSICAL_SHIELD]->val1; + if (bl->type == BL_PC) { + struct map_session_data *sd = NULL; + sd = BL_UCAST(BL_PC, bl); + if (sd) + pc->setreg(sd, script->add_variable("@defend"), pc->readreg(sd, script->add_variable("@defend"))+retVal); + } return (defType)cap_value(retVal, DEFTYPE_MIN, DEFTYPE_MAX); } |