addedType variable

This commit is contained in:
frutescens 2024-10-17 19:07:02 -07:00 committed by NightKev
parent 61cf937cab
commit b20ca6b1eb
2 changed files with 9 additions and 9 deletions

View File

@ -5947,11 +5947,7 @@ export class AddTypeAttr extends MoveEffectAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const types = target.getTypes().slice(0, 2).filter(t => t !== Type.UNKNOWN); // TODO: Figure out some way to actually check if another version of this effect is already applied
if (this.type !== Type.UNKNOWN) {
types.push(this.type);
}
target.summonData.types = types;
target.summonData.addedType = this.type;
target.updateInfo();
user.scene.queueMessage(i18next.t("moveTriggers:addType", { typeName: i18next.t(`pokemonInfo:Type.${Type[this.type]}`), pokemonName: getPokemonNameWithAffix(target) }));
@ -8983,8 +8979,7 @@ export function initMoves() {
.ignoresProtect()
.ignoresVirtual(),
new StatusMove(Moves.TRICK_OR_TREAT, Type.GHOST, 100, 20, -1, 0, 6)
.attr(AddTypeAttr, Type.GHOST)
.edgeCase(), // Weird interaction with Forest's Curse, reflect type, burn up
.attr(AddTypeAttr, Type.GHOST),
new StatusMove(Moves.NOBLE_ROAR, Type.NORMAL, 100, 30, -1, 0, 6)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1)
.soundBased(),
@ -8996,8 +8991,7 @@ export function initMoves() {
.target(MoveTarget.ALL_NEAR_OTHERS)
.triageMove(),
new StatusMove(Moves.FORESTS_CURSE, Type.GRASS, 100, 20, -1, 0, 6)
.attr(AddTypeAttr, Type.GRASS)
.edgeCase(), // Weird interaction with Trick or Treat, reflect type, burn up
.attr(AddTypeAttr, Type.GRASS),
new AttackMove(Moves.PETAL_BLIZZARD, Type.GRASS, MoveCategory.PHYSICAL, 90, 100, 15, -1, 0, 6)
.windMove()
.makesContact(false)

View File

@ -1244,6 +1244,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
}
// the type added to Pokemon from moves like Forest's Curse or Trick Or Treat
if (this.summonData?.addedType) {
types.push(this.summonData?.addedType);
}
// this.scene potentially can be undefined for a fainted pokemon in doubles
// use optional chaining to avoid runtime errors
@ -5090,6 +5095,7 @@ export class PokemonSummonData {
public moveset: (PokemonMove | null)[];
// If not initialized this value will not be populated from save data.
public types: Type[] = [];
public addedType: Type | null = null;
}
export class PokemonBattleData {