diff --git a/battle-engine.js b/battle-engine.js index f13ae93e2a..f62c3433d2 100644 --- a/battle-engine.js +++ b/battle-engine.js @@ -363,16 +363,17 @@ BattlePokemon = (function () { if (side === this.side) continue; for (var j = 0; j < side.active.length; ++j) { var pokemon = side.active[j]; - if (!pokemon || pokemon.fainted || - !pokemon.template.abilities) continue; - for (var k in pokemon.template.abilities) { - var ability = pokemon.template.abilities[k]; + if (!pokemon || pokemon.fainted) continue; + var template = (pokemon.illusion || pokemon).template; + if (!template.abilities) continue; + for (var k in template.abilities) { + var ability = template.abilities[k]; if (ability === pokemon.ability) { // This event was already run above so we don't need // to run it again. continue; } - if ((k === 'H') && pokemon.template.unreleasedHidden) { + if ((k === 'H') && template.unreleasedHidden) { // unreleased hidden ability continue; }