Add a source parameter to BattlePokemon#transformInto

This allows it to send a proper [from] tag to the client.
This commit is contained in:
Kevin Lau 2015-09-14 17:00:59 -07:00
parent 489fe131ce
commit 002ea198f7
2 changed files with 7 additions and 4 deletions

View File

@ -744,7 +744,7 @@ BattlePokemon = (function () {
this.battle.singleEvent('Copy', this.getVolatile(i), this.volatiles[i], this);
}
};
BattlePokemon.prototype.transformInto = function (pokemon, user) {
BattlePokemon.prototype.transformInto = function (pokemon, user, effect) {
var template = pokemon.template;
if (pokemon.fainted || pokemon.illusion || (pokemon.volatiles['substitute'] && this.battle.gen >= 5)) {
return false;
@ -793,7 +793,11 @@ BattlePokemon = (function () {
for (var j in pokemon.boosts) {
this.boosts[j] = pokemon.boosts[j];
}
this.battle.add('-transform', this, pokemon);
if (effect) {
this.battle.add('-transform', this, pokemon, '[from] ' + effect);
} else {
this.battle.add('-transform', this, pokemon);
}
this.setAbility(pokemon.ability);
this.update();
return true;

View File

@ -1175,8 +1175,7 @@ exports.BattleAbilities = {
onStart: function (pokemon) {
var target = pokemon.side.foe.active[pokemon.side.foe.active.length - 1 - pokemon.position];
if (target) {
this.add('-ability', pokemon, 'Imposter');
pokemon.transformInto(target, pokemon);
pokemon.transformInto(target, pokemon, this.getAbility('imposter'));
}
},
id: "imposter",