var turnsToLast = 10;
// Message displayed when ability is used
caster.log(caster.name, 'Prepares to retaliate against attackers');
caster.addStatus({
// Status effect name
name: 'Realiation',
// Description of status effect
desc: 'Whenever this character is dealt damage, it retaliates',
onHit: function(data) {
var attacker = data.dealer;
var defender = data.target;
// This line here is why its tricky to do with GUI, its important to
// enforce these condtions, but GUI doesn't have an if statment.
if (!attacker|| !defender || data.attributes.uncounterable === true) {
return;
}
// Message displayed when responce damage occurs
defender.log(defender.name, 'retaliates against', attacker.name);
// Change math.roll to however much damage you want (currently 2 six sided dice)
// This damage needs to be uncounterable, so it doesn't risk a counter loop
defender.dealDamage(attacker, math.roll(2, 6), {type: 'physical', uncounterable:true});
},
tick: function() {
this.magnitude -= 1;
return this.magnitude <= 0;
},
evaluator: function () {
return this.magnitude * 4;
}
}, turnsToLast);