2018-04-18 16:06:41 -05:00
|
|
|
require("modifiers")
|
|
|
|
require("battleutils")
|
|
|
|
|
|
|
|
--This is the untraited version of decoy.
|
2018-06-25 23:36:18 -05:00
|
|
|
function onPreAction(effect, caster, target, skill, action, actionContainer)
|
2018-04-18 16:06:41 -05:00
|
|
|
--Evade single ranged or magic attack
|
|
|
|
--Traited allows for physical attacks
|
2018-06-25 23:36:18 -05:00
|
|
|
if target.allegiance != caster.allegiance and (skill.isRanged or action.actionType == ActionType.Magic) then
|
2018-04-18 16:06:41 -05:00
|
|
|
--Set action's hit rate to 0
|
|
|
|
action.hirRate = 0.0;
|
2018-06-25 23:36:18 -05:00
|
|
|
|
|
|
|
--Remove status and add message
|
|
|
|
actionContainer.AddAction(target.statusEffects.RemoveStatusEffectForBattleAction(effect));
|
2018-04-18 16:06:41 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end;
|