Generation 4: Fix Transform's interaction with item-based forme changes

Causes Dittos transforming into Giratina-O without Griseous Orb to revert
to Giratina-A in Generation 4, etc.
This commit is contained in:
Kevin Lau 2015-03-21 19:05:42 -07:00
parent a7d5199236
commit 2eebf29d92

View File

@ -367,6 +367,30 @@ BattlePokemon = (function () {
}
if (init) return;
// Change formes based on held items (for Transform)
// Only ever relevant in Generation 4 since Generation 3 didn't have item-based forme changes
if (this.battle.gen === 4) {
if (this.template.num === 487) {
// Giratina formes
if (this.template.species === 'Giratina' && this.item === 'griseousorb') {
this.formeChange('Giratina-Origin');
this.battle.add('-formechange', this, 'Giratina-Origin');
} else if (this.template.species === 'Giratina-Origin' && this.item !== 'griseousorb') {
this.formeChange('Giratina');
this.battle.add('-formechange', this, 'Giratina');
}
}
if (this.template.num === 493) {
// Arceus formes
var item = Tools.getItem(this.item);
var targetForme = (item && item.onPlate ? 'Arceus-' + item.onPlate : 'Arceus');
if (this.template.species !== targetForme) {
this.formeChange(targetForme);
this.battle.add('-formechange', this, targetForme);
}
}
}
if (this.runImmunity('trapped')) this.battle.runEvent('MaybeTrapPokemon', this);
// Disable the faculty to cancel switches if a foe may have a trapping ability
for (var i = 0; i < this.battle.sides.length; ++i) {