mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-25 16:59:27 +02:00
Initial Commit
This commit is contained in:
parent
c8fd11658b
commit
c79daed18e
@ -5449,11 +5449,23 @@ export class AddTypeAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
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
|
const targetSpecies = target.getSpeciesForm();
|
||||||
if (this.type !== Type.UNKNOWN) {
|
const originalTypes : Type[] = [targetSpecies.type1];
|
||||||
types.push(this.type);
|
if (targetSpecies.type2) {
|
||||||
|
originalTypes.push(targetSpecies.type2);
|
||||||
}
|
}
|
||||||
target.summonData.types = types;
|
// the way we know that the types have been changed is if the original types conflicts with the current types
|
||||||
|
const currentTypes = target.getTypes(); // TODO: Figure out some way to actually check if another version of this effect is already applied
|
||||||
|
const addedTypeIndex = currentTypes.findIndex((t, i) => t !== originalTypes[i] && i >= 0);
|
||||||
|
if (this.type !== Type.UNKNOWN) {
|
||||||
|
if (originalTypes.length === currentTypes.length && addedTypeIndex <= 0) {
|
||||||
|
currentTypes.push(this.type);
|
||||||
|
} else {
|
||||||
|
const addedTypeIndex = currentTypes.findIndex((t, i) => t !== originalTypes[i]);
|
||||||
|
currentTypes[addedTypeIndex] = this.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
target.summonData.types = currentTypes;
|
||||||
target.updateInfo();
|
target.updateInfo();
|
||||||
|
|
||||||
user.scene.queueMessage(i18next.t("moveTriggers:addType", {typeName: i18next.t(`pokemonInfo:Type.${Type[this.type]}`), pokemonName: getPokemonNameWithAffix(target)}));
|
user.scene.queueMessage(i18next.t("moveTriggers:addType", {typeName: i18next.t(`pokemonInfo:Type.${Type[this.type]}`), pokemonName: getPokemonNameWithAffix(target)}));
|
||||||
|
0
src/test/moves/forests_curse.test.ts
Normal file
0
src/test/moves/forests_curse.test.ts
Normal file
0
src/test/moves/trick_or_treat.test.ts
Normal file
0
src/test/moves/trick_or_treat.test.ts
Normal file
Loading…
Reference in New Issue
Block a user