Pass 'repelled' in callbackOMeleeAttackBonuses table

Moderator: Moderator

Post Reply
Message
Author
Lokean
Halfling
Posts: 88
Joined: Sun Dec 10, 2017 12:27 am

Pass 'repelled' in callbackOMeleeAttackBonuses table

#1 Post by Lokean »

In combat.lua, the attackTargetWith function has the local variable repelled initialized just prior to the hook/callback 'combat:attackTargetWith:attackerBonuses', but not included in the passed table. This means the only way to add a new per-weapon evasion mechanic appears to be to superload the whole function.

The variables repelled, crit, evaded and deflect should be declared prior to the callback and passed. This would allow for easy insertion of new per-weapon defensive effects, and a nice refactoring of the function code as well.

EDIT: And I realize this is module code, so should really go in the ToME 4 Development subforum.

Post Reply