From a4ef465477e3701d5aebf419ab19823e685889c7 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 11 Oct 2020 16:38:01 +0000 Subject: This is a basic implementation so wands use MATK instead of ATK. This causes wands, defined as W_STAFF (2H) or W_BOOK (1H, not planned AFAIK) to use MATK instead of ATK. These basic magic attacks have a few quirks: * Physical Defense will absorb them (needed) * Can be evaded * Use no mana Inefficient, optimize later. --- src/emap/battle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/emap/battle.c b/src/emap/battle.c index 5a24927..3889c18 100644 --- a/src/emap/battle.c +++ b/src/emap/battle.c @@ -91,8 +91,8 @@ struct Damage ebattle_calc_weapon_attack_post(struct Damage retVal, struct block_list *src, struct block_list *target, uint16 skill_id, - uint16 skill_lv __attribute__ ((unused)), - int wflag __attribute__ ((unused))) + uint16 skill_lv, + int wflag) { if (src == NULL) return retVal; @@ -101,6 +101,14 @@ struct Damage ebattle_calc_weapon_attack_post(struct Damage retVal, if (sd == NULL) return retVal; + // Staffs and Books will use MATK instead of ATK. + // These regular attacks are still subject to regular DEF/Evade/etc. + // And base attack bonus might still be gained from STR instead of INT. + // TODO: Move this to a pre-hook to avoid extra calculation + if (!skill_id && (sd->weapontype == W_STAFF || sd->weapontype == W_BOOK)) { + retVal=battle->calc_magic_attack(src, target, skill_id, skill_lv, wflag); + } + struct mob_data *md = BL_CAST(BL_MOB, target); if (md == NULL) return retVal; -- cgit v1.2.3-70-g09d2