Merge branch 'beta' into prabbydMirrorArmor

This commit is contained in:
PrabbyDD 2024-10-31 16:26:34 -07:00 committed by GitHub
commit 34d2a9c400
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 1762 additions and 140 deletions

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,7 +1,7 @@
{ {
"textures": [ "textures": [
{ {
"image": "statuses_es.png", "image": "statuses_es-ES.png",
"format": "RGBA8888", "format": "RGBA8888",
"size": { "size": {
"w": 22, "w": 22,

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

@ -1,7 +1,7 @@
{ {
"textures": [ "textures": [
{ {
"image": "types_es.png", "image": "types_es-ES.png",
"format": "RGBA8888", "format": "RGBA8888",
"size": { "size": {
"w": 32, "w": 32,

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -1 +1 @@
Subproject commit 71390cba88f4103d0d2273d59a6dd8340a4fa54f Subproject commit 3cf6d553541d79ba165387bc73fb06544d00f1f9

View File

@ -3658,22 +3658,19 @@ export class MoodyAbAttr extends PostTurnAbAttr {
} }
} }
export class PostTurnStatStageChangeAbAttr extends PostTurnAbAttr { export class SpeedBoostAbAttr extends PostTurnAbAttr {
private stats: BattleStat[];
private stages: number;
constructor(stats: BattleStat[], stages: number) { constructor() {
super(true); super(true);
this.stats = Array.isArray(stats)
? stats
: [ stats ];
this.stages = stages;
} }
applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
if (!simulated) { if (!simulated) {
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.stages)); if (!pokemon.turnData.switchedInThisTurn && !pokemon.turnData.failedRunAway) {
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ Stat.SPD ], 1));
} else {
return false;
}
} }
return true; return true;
} }
@ -4747,6 +4744,84 @@ export class PreventBypassSpeedChanceAbAttr extends AbAttr {
} }
} }
/**
* This applies a terrain-based type change to the Pokemon.
* Used by Mimicry.
*/
export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
constructor() {
super(true);
}
override apply(pokemon: Pokemon, _passive: boolean, _simulated: boolean, _cancelled: Utils.BooleanHolder, _args: any[]): boolean {
if (pokemon.isTerastallized()) {
return false;
}
const currentTerrain = pokemon.scene.arena.getTerrainType();
const typeChange: Type[] = this.determineTypeChange(pokemon, currentTerrain);
if (typeChange.length !== 0) {
if (pokemon.summonData.addedType && typeChange.includes(pokemon.summonData.addedType)) {
pokemon.summonData.addedType = null;
}
pokemon.summonData.types = typeChange;
pokemon.updateInfo();
}
return true;
}
/**
* Retrieves the type(s) the Pokemon should change to in response to a terrain
* @param pokemon
* @param currentTerrain {@linkcode TerrainType}
* @returns a list of type(s)
*/
private determineTypeChange(pokemon: Pokemon, currentTerrain: TerrainType): Type[] {
const typeChange: Type[] = [];
switch (currentTerrain) {
case TerrainType.ELECTRIC:
typeChange.push(Type.ELECTRIC);
break;
case TerrainType.MISTY:
typeChange.push(Type.FAIRY);
break;
case TerrainType.GRASSY:
typeChange.push(Type.GRASS);
break;
case TerrainType.PSYCHIC:
typeChange.push(Type.PSYCHIC);
break;
default:
pokemon.getTypes(false, false, true).forEach(t => {
typeChange.push(t);
});
break;
}
return typeChange;
}
/**
* Checks if the Pokemon should change types if summoned into an active terrain
* @returns `true` if there is an active terrain requiring a type change | `false` if not
*/
override applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
if (pokemon.scene.arena.getTerrainType() !== TerrainType.NONE) {
return this.apply(pokemon, passive, simulated, new Utils.BooleanHolder(false), []);
}
return false;
}
override getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) {
const currentTerrain = pokemon.scene.arena.getTerrainType();
const pokemonNameWithAffix = getPokemonNameWithAffix(pokemon);
if (currentTerrain === TerrainType.NONE) {
return i18next.t("abilityTriggers:pokemonTypeChangeRevert", { pokemonNameWithAffix });
} else {
const moveType = i18next.t(`pokemonInfo:Type.${Type[this.determineTypeChange(pokemon, currentTerrain)[0]]}`);
return i18next.t("abilityTriggers:pokemonTypeChange", { pokemonNameWithAffix, moveType });
}
}
}
async function applyAbAttrsInternal<TAttr extends AbAttr>( async function applyAbAttrsInternal<TAttr extends AbAttr>(
attrType: Constructor<TAttr>, attrType: Constructor<TAttr>,
pokemon: Pokemon | null, pokemon: Pokemon | null,
@ -4977,7 +5052,7 @@ export function initAbilities() {
.attr(PostSummonWeatherChangeAbAttr, WeatherType.RAIN) .attr(PostSummonWeatherChangeAbAttr, WeatherType.RAIN)
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.RAIN), .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.RAIN),
new Ability(Abilities.SPEED_BOOST, 3) new Ability(Abilities.SPEED_BOOST, 3)
.attr(PostTurnStatStageChangeAbAttr, [ Stat.SPD ], 1), .attr(SpeedBoostAbAttr),
new Ability(Abilities.BATTLE_ARMOR, 3) new Ability(Abilities.BATTLE_ARMOR, 3)
.attr(BlockCritAbAttr) .attr(BlockCritAbAttr)
.ignorable(), .ignorable(),
@ -5811,7 +5886,7 @@ export function initAbilities() {
new Ability(Abilities.POWER_SPOT, 8) new Ability(Abilities.POWER_SPOT, 8)
.attr(AllyMoveCategoryPowerBoostAbAttr, [ MoveCategory.SPECIAL, MoveCategory.PHYSICAL ], 1.3), .attr(AllyMoveCategoryPowerBoostAbAttr, [ MoveCategory.SPECIAL, MoveCategory.PHYSICAL ], 1.3),
new Ability(Abilities.MIMICRY, 8) new Ability(Abilities.MIMICRY, 8)
.unimplemented(), .attr(TerrainEventTypeChangeAbAttr),
new Ability(Abilities.SCREEN_CLEANER, 8) new Ability(Abilities.SCREEN_CLEANER, 8)
.attr(PostSummonRemoveArenaTagAbAttr, [ ArenaTagType.AURORA_VEIL, ArenaTagType.LIGHT_SCREEN, ArenaTagType.REFLECT ]), .attr(PostSummonRemoveArenaTagAbAttr, [ ArenaTagType.AURORA_VEIL, ArenaTagType.LIGHT_SCREEN, ArenaTagType.REFLECT ]),
new Ability(Abilities.STEELY_SPIRIT, 8) new Ability(Abilities.STEELY_SPIRIT, 8)
@ -5968,7 +6043,7 @@ export function initAbilities() {
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5), .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
new Ability(Abilities.SUPREME_OVERLORD, 9) new Ability(Abilities.SUPREME_OVERLORD, 9)
.attr(VariableMovePowerBoostAbAttr, (user, target, move) => 1 + 0.1 * Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 5)) .attr(VariableMovePowerBoostAbAttr, (user, target, move) => 1 + 0.1 * Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 5))
.partial(), // Counter resets every wave .partial(), // Counter resets every wave instead of on arena reset
new Ability(Abilities.COSTAR, 9) new Ability(Abilities.COSTAR, 9)
.attr(PostSummonCopyAllyStatsAbAttr), .attr(PostSummonCopyAllyStatsAbAttr),
new Ability(Abilities.TOXIC_DEBRIS, 9) new Ability(Abilities.TOXIC_DEBRIS, 9)

View File

@ -1443,7 +1443,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
], ],
[Species.ROCKRUFF]: [ [Species.ROCKRUFF]: [
new SpeciesFormEvolution(Species.LYCANROC, "", "midday", 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DAWN || p.scene.arena.getTimeOfDay() === TimeOfDay.DAY) && (p.formIndex === 0))), new SpeciesFormEvolution(Species.LYCANROC, "", "midday", 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DAWN || p.scene.arena.getTimeOfDay() === TimeOfDay.DAY) && (p.formIndex === 0))),
new SpeciesFormEvolution(Species.LYCANROC, "", "dusk", 25, null, new SpeciesEvolutionCondition(p => p.formIndex === 1)), new SpeciesFormEvolution(Species.LYCANROC, "own-tempo", "dusk", 25, null, new SpeciesEvolutionCondition(p => p.formIndex === 1)),
new SpeciesFormEvolution(Species.LYCANROC, "", "midnight", 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DUSK || p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT) && (p.formIndex === 0))) new SpeciesFormEvolution(Species.LYCANROC, "", "midnight", 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DUSK || p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT) && (p.formIndex === 0)))
], ],
[Species.STEENEE]: [ [Species.STEENEE]: [

File diff suppressed because it is too large Load Diff

View File

@ -1420,6 +1420,11 @@ export class RecoilAttr extends MoveEffectAttr {
return false; return false;
} }
// Chloroblast and Struggle should not deal recoil damage if the move was not successful
if (this.useHp && [ MoveResult.FAIL, MoveResult.MISS ].includes(user.getLastXMoves(1)[0]?.result)) {
return false;
}
const damageValue = (!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio; const damageValue = (!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio;
const minValue = user.turnData.damageDealt ? 1 : 0; const minValue = user.turnData.damageDealt ? 1 : 0;
const recoilDamage = Utils.toDmgValue(damageValue, minValue); const recoilDamage = Utils.toDmgValue(damageValue, minValue);
@ -2177,7 +2182,10 @@ export class StatusEffectAttr extends MoveEffectAttr {
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
const moveChance = this.getMoveChance(user, target, move, this.selfTarget, false); const moveChance = this.getMoveChance(user, target, move, this.selfTarget, false);
return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(this.effect, true, false, user) ? Math.floor(moveChance * -0.1) : 0; const score = (moveChance < 0) ? -10 : Math.floor(moveChance * -0.1);
const pokemon = this.selfTarget ? user : target;
return !pokemon.status && pokemon.canSetStatus(this.effect, true, false, user) ? score : 0;
} }
} }
@ -2197,7 +2205,10 @@ export class MultiStatusEffectAttr extends StatusEffectAttr {
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
const moveChance = this.getMoveChance(user, target, move, this.selfTarget, false); const moveChance = this.getMoveChance(user, target, move, this.selfTarget, false);
return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(this.effect, true, false, user) ? Math.floor(moveChance * -0.1) : 0; const score = (moveChance < 0) ? -10 : Math.floor(moveChance * -0.1);
const pokemon = this.selfTarget ? user : target;
return !pokemon.status && pokemon.canSetStatus(this.effect, true, false, user) ? score : 0;
} }
} }
@ -2228,7 +2239,7 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
} }
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(user.status?.effect, true, false, user) ? Math.floor(move.chance * -0.1) : 0; return !target.status && target.canSetStatus(user.status?.effect, true, false, user) ? -10 : 0;
} }
} }
/** /**
@ -5858,6 +5869,9 @@ export class RemoveTypeAttr extends MoveEffectAttr {
const userTypes = user.getTypes(true); const userTypes = user.getTypes(true);
const modifiedTypes = userTypes.filter(type => type !== this.removedType); const modifiedTypes = userTypes.filter(type => type !== this.removedType);
if (modifiedTypes.length === 0) {
modifiedTypes.push(Type.UNKNOWN);
}
user.summonData.types = modifiedTypes; user.summonData.types = modifiedTypes;
user.updateInfo(); user.updateInfo();
@ -5880,7 +5894,11 @@ export class CopyTypeAttr extends MoveEffectAttr {
return false; return false;
} }
user.summonData.types = target.getTypes(true); const targetTypes = target.getTypes(true);
if (targetTypes.includes(Type.UNKNOWN) && targetTypes.indexOf(Type.UNKNOWN) > -1) {
targetTypes[targetTypes.indexOf(Type.UNKNOWN)] = Type.NORMAL;
}
user.summonData.types = targetTypes;
user.updateInfo(); user.updateInfo();
user.scene.queueMessage(i18next.t("moveTriggers:copyType", { pokemonName: getPokemonNameWithAffix(user), targetPokemonName: getPokemonNameWithAffix(target) })); user.scene.queueMessage(i18next.t("moveTriggers:copyType", { pokemonName: getPokemonNameWithAffix(user), targetPokemonName: getPokemonNameWithAffix(target) }));
@ -5889,7 +5907,7 @@ export class CopyTypeAttr extends MoveEffectAttr {
} }
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return (user, target, move) => target.getTypes()[0] !== Type.UNKNOWN; return (user, target, move) => target.getTypes()[0] !== Type.UNKNOWN || target.summonData.addedType !== null;
} }
} }
@ -5947,11 +5965,7 @@ 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 target.summonData.addedType = this.type;
if (this.type !== Type.UNKNOWN) {
types.push(this.type);
}
target.summonData.types = types;
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) }));
@ -8983,8 +8997,7 @@ export function initMoves() {
.ignoresProtect() .ignoresProtect()
.ignoresVirtual(), .ignoresVirtual(),
new StatusMove(Moves.TRICK_OR_TREAT, Type.GHOST, 100, 20, -1, 0, 6) new StatusMove(Moves.TRICK_OR_TREAT, Type.GHOST, 100, 20, -1, 0, 6)
.attr(AddTypeAttr, Type.GHOST) .attr(AddTypeAttr, Type.GHOST),
.edgeCase(), // Weird interaction with Forest's Curse, reflect type, burn up
new StatusMove(Moves.NOBLE_ROAR, Type.NORMAL, 100, 30, -1, 0, 6) new StatusMove(Moves.NOBLE_ROAR, Type.NORMAL, 100, 30, -1, 0, 6)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1) .attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1)
.soundBased(), .soundBased(),
@ -8996,8 +9009,7 @@ export function initMoves() {
.target(MoveTarget.ALL_NEAR_OTHERS) .target(MoveTarget.ALL_NEAR_OTHERS)
.triageMove(), .triageMove(),
new StatusMove(Moves.FORESTS_CURSE, Type.GRASS, 100, 20, -1, 0, 6) new StatusMove(Moves.FORESTS_CURSE, Type.GRASS, 100, 20, -1, 0, 6)
.attr(AddTypeAttr, Type.GRASS) .attr(AddTypeAttr, Type.GRASS),
.edgeCase(), // Weird interaction with Trick or Treat, reflect type, burn up
new AttackMove(Moves.PETAL_BLIZZARD, Type.GRASS, MoveCategory.PHYSICAL, 90, 100, 15, -1, 0, 6) new AttackMove(Moves.PETAL_BLIZZARD, Type.GRASS, MoveCategory.PHYSICAL, 90, 100, 15, -1, 0, 6)
.windMove() .windMove()
.makesContact(false) .makesContact(false)
@ -9491,7 +9503,7 @@ export function initMoves() {
.edgeCase() // I assume it needs clanging scales and Kommo-O .edgeCase() // I assume it needs clanging scales and Kommo-O
.ignoresVirtual(), .ignoresVirtual(),
/* End Unused */ /* End Unused */
new AttackMove(Moves.ZIPPY_ZAP, Type.ELECTRIC, MoveCategory.PHYSICAL, 50, 100, 15, -1, 2, 7) //LGPE Implementation new AttackMove(Moves.ZIPPY_ZAP, Type.ELECTRIC, MoveCategory.PHYSICAL, 50, 100, 15, -1, 2, 7) // LGPE Implementation
.attr(CritOnlyAttr), .attr(CritOnlyAttr),
new AttackMove(Moves.SPLISHY_SPLASH, Type.WATER, MoveCategory.SPECIAL, 90, 100, 15, 30, 0, 7) new AttackMove(Moves.SPLISHY_SPLASH, Type.WATER, MoveCategory.SPECIAL, 90, 100, 15, 30, 0, 7)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS) .attr(StatusEffectAttr, StatusEffect.PARALYSIS)
@ -9501,7 +9513,7 @@ export function initMoves() {
new AttackMove(Moves.PIKA_PAPOW, Type.ELECTRIC, MoveCategory.SPECIAL, -1, -1, 20, -1, 0, 7) new AttackMove(Moves.PIKA_PAPOW, Type.ELECTRIC, MoveCategory.SPECIAL, -1, -1, 20, -1, 0, 7)
.attr(FriendshipPowerAttr), .attr(FriendshipPowerAttr),
new AttackMove(Moves.BOUNCY_BUBBLE, Type.WATER, MoveCategory.SPECIAL, 60, 100, 20, -1, 0, 7) new AttackMove(Moves.BOUNCY_BUBBLE, Type.WATER, MoveCategory.SPECIAL, 60, 100, 20, -1, 0, 7)
.attr(HitHealAttr, 1.0) .attr(HitHealAttr) // Custom
.triageMove() .triageMove()
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.BUZZY_BUZZ, Type.ELECTRIC, MoveCategory.SPECIAL, 60, 100, 20, 100, 0, 7) new AttackMove(Moves.BUZZY_BUZZ, Type.ELECTRIC, MoveCategory.SPECIAL, 60, 100, 20, 100, 0, 7)
@ -10005,6 +10017,7 @@ export function initMoves() {
.attr(ConfuseAttr) .attr(ConfuseAttr)
.recklessMove(), .recklessMove(),
new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9) new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
.partial() // Counter resets every wave instead of on arena reset
.attr(MovePowerMultiplierAttr, (user, target, move) => 1 + Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 100)) .attr(MovePowerMultiplierAttr, (user, target, move) => 1 + Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 100))
.makesContact(false), .makesContact(false),
new AttackMove(Moves.LUMINA_CRASH, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9) new AttackMove(Moves.LUMINA_CRASH, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)

View File

@ -3,6 +3,8 @@
* or {@linkcode SwitchSummonPhase} will carry out. * or {@linkcode SwitchSummonPhase} will carry out.
*/ */
export enum SwitchType { export enum SwitchType {
/** Switchout specifically for when combat starts and the player is prompted if they will switch Pokemon */
INITIAL_SWITCH,
/** Basic switchout where the Pokemon to switch in is selected */ /** Basic switchout where the Pokemon to switch in is selected */
SWITCH, SWITCH,
/** Transfers stat stages and other effects from the returning Pokemon to the switched in Pokemon */ /** Transfers stat stages and other effects from the returning Pokemon to the switched in Pokemon */

View File

@ -10,7 +10,14 @@ import Move from "#app/data/move";
import { ArenaTag, ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag"; import { ArenaTag, ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag";
import { BattlerIndex } from "#app/battle"; import { BattlerIndex } from "#app/battle";
import { Terrain, TerrainType } from "#app/data/terrain"; import { Terrain, TerrainType } from "#app/data/terrain";
import { applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs, PostTerrainChangeAbAttr, PostWeatherChangeAbAttr } from "#app/data/ability"; import {
applyAbAttrs,
applyPostTerrainChangeAbAttrs,
applyPostWeatherChangeAbAttrs,
PostTerrainChangeAbAttr,
PostWeatherChangeAbAttr,
TerrainEventTypeChangeAbAttr
} from "#app/data/ability";
import Pokemon from "#app/field/pokemon"; import Pokemon from "#app/field/pokemon";
import Overrides from "#app/overrides"; import Overrides from "#app/overrides";
import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena"; import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";
@ -387,6 +394,7 @@ export class Arena {
this.scene.getField(true).filter(p => p.isOnField()).map(pokemon => { this.scene.getField(true).filter(p => p.isOnField()).map(pokemon => {
pokemon.findAndRemoveTags(t => "terrainTypes" in t && !(t.terrainTypes as TerrainType[]).find(t => t === terrain)); pokemon.findAndRemoveTags(t => "terrainTypes" in t && !(t.terrainTypes as TerrainType[]).find(t => t === terrain));
applyPostTerrainChangeAbAttrs(PostTerrainChangeAbAttr, pokemon, terrain); applyPostTerrainChangeAbAttrs(PostTerrainChangeAbAttr, pokemon, terrain);
applyAbAttrs(TerrainEventTypeChangeAbAttr, pokemon, null, false);
}); });
return true; return true;
@ -786,7 +794,7 @@ export class Arena {
case Biome.VOLCANO: case Biome.VOLCANO:
return 17.637; return 17.637;
case Biome.GRAVEYARD: case Biome.GRAVEYARD:
return 3.232; return 13.711;
case Biome.DOJO: case Biome.DOJO:
return 6.205; return 6.205;
case Biome.FACTORY: case Biome.FACTORY:

View File

@ -1258,6 +1258,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 (!ignoreOverride && this.summonData && this.summonData.addedType && !types.includes(this.summonData.addedType)) {
types.push(this.summonData.addedType);
}
// If both types are the same (can happen in weird custom typing scenarios), reduce to single type // If both types are the same (can happen in weird custom typing scenarios), reduce to single type
if (types.length > 1 && types[0] === types[1]) { if (types.length > 1 && types[0] === types[1]) {
types.splice(0, 1); types.splice(0, 1);
@ -5100,6 +5105,7 @@ export class PokemonSummonData {
public moveset: (PokemonMove | null)[]; public moveset: (PokemonMove | null)[];
// If not initialized this value will not be populated from save data. // If not initialized this value will not be populated from save data.
public types: Type[] = []; public types: Type[] = [];
public addedType: Type | null = null;
} }
export class PokemonBattleData { export class PokemonBattleData {
@ -5137,6 +5143,8 @@ export class PokemonTurnData {
public statStagesDecreased: boolean = false; public statStagesDecreased: boolean = false;
public moveEffectiveness: TypeDamageMultiplier | null = null; public moveEffectiveness: TypeDamageMultiplier | null = null;
public combiningPledge?: Moves; public combiningPledge?: Moves;
public switchedInThisTurn: boolean = false;
public failedRunAway: boolean = false;
} }
export enum AiType { export enum AiType {

View File

@ -244,7 +244,7 @@ export class LoadingScene extends SceneBase {
this.loadAtlas("statuses", ""); this.loadAtlas("statuses", "");
this.loadAtlas("types", ""); this.loadAtlas("types", "");
} }
const availableLangs = [ "en", "de", "it", "fr", "ja", "ko", "es", "pt-BR", "zh-CN" ]; const availableLangs = [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ];
if (lang && availableLangs.includes(lang)) { if (lang && availableLangs.includes(lang)) {
this.loadImage("halloween2024-event-" + lang, "events"); this.loadImage("halloween2024-event-" + lang, "events");
} else { } else {

View File

@ -502,45 +502,25 @@ export class BerryModifierType extends PokemonHeldItemModifierType implements Ge
} }
} }
function getAttackTypeBoosterItemName(type: Type) { enum AttackTypeBoosterItem {
switch (type) { SILK_SCARF,
case Type.NORMAL: BLACK_BELT,
return "Silk Scarf"; SHARP_BEAK,
case Type.FIGHTING: POISON_BARB,
return "Black Belt"; SOFT_SAND,
case Type.FLYING: HARD_STONE,
return "Sharp Beak"; SILVER_POWDER,
case Type.POISON: SPELL_TAG,
return "Poison Barb"; METAL_COAT,
case Type.GROUND: CHARCOAL,
return "Soft Sand"; MYSTIC_WATER,
case Type.ROCK: MIRACLE_SEED,
return "Hard Stone"; MAGNET,
case Type.BUG: TWISTED_SPOON,
return "Silver Powder"; NEVER_MELT_ICE,
case Type.GHOST: DRAGON_FANG,
return "Spell Tag"; BLACK_GLASSES,
case Type.STEEL: FAIRY_FEATHER
return "Metal Coat";
case Type.FIRE:
return "Charcoal";
case Type.WATER:
return "Mystic Water";
case Type.GRASS:
return "Miracle Seed";
case Type.ELECTRIC:
return "Magnet";
case Type.PSYCHIC:
return "Twisted Spoon";
case Type.ICE:
return "Never-Melt Ice";
case Type.DRAGON:
return "Dragon Fang";
case Type.DARK:
return "Black Glasses";
case Type.FAIRY:
return "Fairy Feather";
}
} }
export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType { export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
@ -548,7 +528,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
public boostPercent: integer; public boostPercent: integer;
constructor(moveType: Type, boostPercent: integer) { constructor(moveType: Type, boostPercent: integer) {
super("", `${getAttackTypeBoosterItemName(moveType)?.replace(/[ \-]/g, "_").toLowerCase()}`, super("", `${AttackTypeBoosterItem[moveType]?.toLowerCase()}`,
(_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent)); (_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent));
this.moveType = moveType; this.moveType = moveType;
@ -556,7 +536,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
} }
get name(): string { get name(): string {
return i18next.t(`modifierType:AttackTypeBoosterItem.${getAttackTypeBoosterItemName(this.moveType)?.replace(/[ \-]/g, "_").toLowerCase()}`); return i18next.t(`modifierType:AttackTypeBoosterItem.${AttackTypeBoosterItem[this.moveType]?.toLowerCase()}`);
} }
getDescription(scene: BattleScene): string { getDescription(scene: BattleScene): string {

View File

@ -10,6 +10,10 @@ import { NewBattlePhase } from "./new-battle-phase";
import { PokemonPhase } from "./pokemon-phase"; import { PokemonPhase } from "./pokemon-phase";
export class AttemptRunPhase extends PokemonPhase { export class AttemptRunPhase extends PokemonPhase {
/** For testing purposes: this is to force the pokemon to fail and escape */
public forceFailEscape = false;
constructor(scene: BattleScene, fieldIndex: number) { constructor(scene: BattleScene, fieldIndex: number) {
super(scene, fieldIndex); super(scene, fieldIndex);
} }
@ -28,7 +32,7 @@ export class AttemptRunPhase extends PokemonPhase {
applyAbAttrs(RunSuccessAbAttr, playerPokemon, null, false, escapeChance); applyAbAttrs(RunSuccessAbAttr, playerPokemon, null, false, escapeChance);
if (playerPokemon.randSeedInt(100) < escapeChance.value) { if (playerPokemon.randSeedInt(100) < escapeChance.value && !this.forceFailEscape) {
this.scene.playSound("se/flee"); this.scene.playSound("se/flee");
this.scene.queueMessage(i18next.t("battle:runAwaySuccess"), null, true, 500); this.scene.queueMessage(i18next.t("battle:runAwaySuccess"), null, true, 500);
@ -51,6 +55,7 @@ export class AttemptRunPhase extends PokemonPhase {
this.scene.pushPhase(new BattleEndPhase(this.scene)); this.scene.pushPhase(new BattleEndPhase(this.scene));
this.scene.pushPhase(new NewBattlePhase(this.scene)); this.scene.pushPhase(new NewBattlePhase(this.scene));
} else { } else {
playerPokemon.turnData.failedRunAway = true;
this.scene.queueMessage(i18next.t("battle:runAwayCannotEscape"), null, true, 500); this.scene.queueMessage(i18next.t("battle:runAwayCannotEscape"), null, true, 500);
} }

View File

@ -51,7 +51,7 @@ export class CheckSwitchPhase extends BattlePhase {
this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
this.scene.tryRemovePhase(p => p instanceof PostSummonPhase && p.player && p.fieldIndex === this.fieldIndex); this.scene.tryRemovePhase(p => p instanceof PostSummonPhase && p.player && p.fieldIndex === this.fieldIndex);
this.scene.unshiftPhase(new SwitchPhase(this.scene, SwitchType.SWITCH, this.fieldIndex, false, true)); this.scene.unshiftPhase(new SwitchPhase(this.scene, SwitchType.INITIAL_SWITCH, this.fieldIndex, false, true));
this.end(); this.end();
}, () => { }, () => {
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);

View File

@ -65,6 +65,15 @@ export class FaintPhase extends PokemonPhase {
} }
} }
/** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */
this.scene.getPlayerField().forEach((pokemon, i) => {
if (pokemon?.isActive(true)) {
if (pokemon.isPlayer()) {
this.scene.currentBattle.addParticipant(pokemon as PlayerPokemon);
}
}
});
if (!this.tryOverrideForBattleSpec()) { if (!this.tryOverrideForBattleSpec()) {
this.doFaint(); this.doFaint();
} }

View File

@ -3,7 +3,7 @@ import BattleScene from "#app/battle-scene";
import { applyAbAttrs, applyPostMoveUsedAbAttrs, applyPreAttackAbAttrs, BlockRedirectAbAttr, IncreasePpAbAttr, PokemonTypeChangeAbAttr, PostMoveUsedAbAttr, RedirectMoveAbAttr, ReduceStatusEffectDurationAbAttr } from "#app/data/ability"; import { applyAbAttrs, applyPostMoveUsedAbAttrs, applyPreAttackAbAttrs, BlockRedirectAbAttr, IncreasePpAbAttr, PokemonTypeChangeAbAttr, PostMoveUsedAbAttr, RedirectMoveAbAttr, ReduceStatusEffectDurationAbAttr } from "#app/data/ability";
import { CommonAnim } from "#app/data/battle-anims"; import { CommonAnim } from "#app/data/battle-anims";
import { BattlerTagLapseType, CenterOfAttentionTag } from "#app/data/battler-tags"; import { BattlerTagLapseType, CenterOfAttentionTag } from "#app/data/battler-tags";
import { allMoves, applyMoveAttrs, BypassRedirectAttr, BypassSleepAttr, CopyMoveAttr, HealStatusEffectAttr, MoveFlags, PreMoveMessageAttr } from "#app/data/move"; import { allMoves, applyMoveAttrs, BypassRedirectAttr, BypassSleepAttr, CopyMoveAttr, frenzyMissFunc, HealStatusEffectAttr, MoveFlags, PreMoveMessageAttr } from "#app/data/move";
import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms"; import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms";
import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect"; import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect";
import { Type } from "#app/data/type"; import { Type } from "#app/data/type";
@ -470,6 +470,10 @@ export class MovePhase extends BattlePhase {
this.scene.eventTarget.dispatchEvent(new MoveUsedEvent(this.pokemon?.id, this.move.getMove(), ppUsed)); this.scene.eventTarget.dispatchEvent(new MoveUsedEvent(this.pokemon?.id, this.move.getMove(), ppUsed));
} }
if (this.cancelled && this.pokemon.summonData?.tags?.find(t => t.tagType === BattlerTagType.FRENZY)) {
frenzyMissFunc(this.pokemon, this.move.getMove());
}
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL }); this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);

View File

@ -64,10 +64,8 @@ export class SwitchSummonPhase extends SummonPhase {
} }
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
(this.player ? this.scene.getEnemyField() : this.scene.getPlayerField()).forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id)); (this.player ? this.scene.getEnemyField() : this.scene.getPlayerField()).forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
if (this.switchType === SwitchType.SWITCH || this.switchType === SwitchType.INITIAL_SWITCH) {
if (this.switchType === SwitchType.SWITCH) {
const substitute = pokemon.getTag(SubstituteTag); const substitute = pokemon.getTag(SubstituteTag);
if (substitute) { if (substitute) {
this.scene.tweens.add({ this.scene.tweens.add({
@ -186,6 +184,11 @@ export class SwitchSummonPhase extends SummonPhase {
} }
} }
if (this.switchType !== SwitchType.INITIAL_SWITCH) {
pokemon.resetTurnData();
pokemon.turnData.switchedInThisTurn = true;
}
this.lastPokemon?.resetSummonData(); this.lastPokemon?.resetSummonData();
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true); this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true);

View File

@ -153,7 +153,7 @@ export async function initI18n(): Promise<void> {
i18next.use(new KoreanPostpositionProcessor()); i18next.use(new KoreanPostpositionProcessor());
await i18next.init({ await i18next.init({
fallbackLng: "en", fallbackLng: "en",
supportedLngs: [ "en", "es", "fr", "it", "de", "zh-CN", "zh-TW", "pt-BR", "ko", "ja", "ca-ES" ], supportedLngs: [ "en", "es-ES", "fr", "it", "de", "zh-CN", "zh-TW", "pt-BR", "ko", "ja", "ca-ES" ],
backend: { backend: {
loadPath(lng: string, [ ns ]: string[]) { loadPath(lng: string, [ ns ]: string[]) {
let fileName: string; let fileName: string;

View File

@ -866,8 +866,8 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
handler: () => changeLocaleHandler("en") handler: () => changeLocaleHandler("en")
}, },
{ {
label: "Español", label: "Español (ES)",
handler: () => changeLocaleHandler("es") handler: () => changeLocaleHandler("es-ES")
}, },
{ {
label: "Italiano", label: "Italiano",

View File

@ -0,0 +1,91 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Type } from "#app/data/type";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Mimicry", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.SPLASH ])
.ability(Abilities.MIMICRY)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyMoveset(Moves.SPLASH);
});
it("Mimicry activates after the Pokémon with Mimicry is switched in while terrain is present, or whenever there is a change in terrain", async () => {
game.override.enemyAbility(Abilities.MISTY_SURGE);
await game.classicMode.startBattle([ Species.FEEBAS, Species.ABRA ]);
const [ playerPokemon1, playerPokemon2 ] = game.scene.getParty();
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon1.getTypes().includes(Type.FAIRY)).toBe(true);
game.doSwitchPokemon(1);
await game.toNextTurn();
expect(playerPokemon2.getTypes().includes(Type.FAIRY)).toBe(true);
});
it("Pokemon should revert back to its original, root type once terrain ends", async () => {
game.override
.moveset([ Moves.SPLASH, Moves.TRANSFORM ])
.enemyAbility(Abilities.MIMICRY)
.enemyMoveset([ Moves.SPLASH, Moves.PSYCHIC_TERRAIN ]);
await game.classicMode.startBattle([ Species.REGIELEKI ]);
const playerPokemon = game.scene.getPlayerPokemon();
game.move.select(Moves.TRANSFORM);
await game.forceEnemyMove(Moves.PSYCHIC_TERRAIN);
await game.toNextTurn();
expect(playerPokemon?.getTypes().includes(Type.PSYCHIC)).toBe(true);
if (game.scene.arena.terrain) {
game.scene.arena.terrain.turnsLeft = 1;
}
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon?.getTypes().includes(Type.ELECTRIC)).toBe(true);
});
it("If the Pokemon is under the effect of a type-adding move and an equivalent terrain activates, the move's effect disappears", async () => {
game.override
.enemyMoveset([ Moves.FORESTS_CURSE, Moves.GRASSY_TERRAIN ]);
await game.classicMode.startBattle([ Species.FEEBAS ]);
const playerPokemon = game.scene.getPlayerPokemon();
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.FORESTS_CURSE);
await game.toNextTurn();
expect(playerPokemon?.summonData.addedType).toBe(Type.GRASS);
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.GRASSY_TERRAIN);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon?.summonData.addedType).toBeNull();
expect(playerPokemon?.getTypes().includes(Type.GRASS)).toBe(true);
});
});

View File

@ -0,0 +1,125 @@
import { Stat } from "#enums/stat";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler";
import { AttemptRunPhase } from "#app/phases/attempt-run-phase";
describe("Abilities - Speed Boost", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleType("single")
.enemySpecies(Species.DRAGAPULT)
.ability(Abilities.SPEED_BOOST)
.enemyMoveset(Moves.SPLASH)
.moveset([ Moves.SPLASH, Moves.U_TURN ]);
});
it("should increase speed by 1 stage at end of turn",
async () => {
await game.classicMode.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
});
it("should not trigger this turn if pokemon was switched into combat via attack, but the turn after",
async () => {
await game.classicMode.startBattle([
Species.SHUCKLE,
Species.NINJASK
]);
game.move.select(Moves.U_TURN);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
});
it("checking back to back swtiches",
async () => {
await game.classicMode.startBattle([
Species.SHUCKLE,
Species.NINJASK
]);
game.move.select(Moves.U_TURN);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
let playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
game.move.select(Moves.U_TURN);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
});
it("should not trigger this turn if pokemon was switched into combat via normal switch, but the turn after",
async () => {
await game.classicMode.startBattle([
Species.SHUCKLE,
Species.NINJASK
]);
game.doSwitchPokemon(1);
await game.toNextTurn();
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
});
it("should not trigger if pokemon fails to escape",
async () => {
await game.classicMode.startBattle([ Species.SHUCKLE ]);
const commandPhase = game.scene.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
const runPhase = game.scene.getCurrentPhase() as AttemptRunPhase;
runPhase.forceFailEscape = true;
await game.phaseInterceptor.to(AttemptRunPhase);
await game.toNextTurn();
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
game.move.select(Moves.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
});
});

View File

@ -0,0 +1,42 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Chloroblast", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.CHLOROBLAST ])
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.PROTECT);
});
it("should not deal recoil damage if the opponent uses protect", async () => {
await game.classicMode.startBattle([ Species.FEEBAS ]);
game.move.select(Moves.CHLOROBLAST);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getPlayerPokemon()!.isFullHp()).toBe(true);
});
});

View File

@ -0,0 +1,47 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Type } from "#app/data/type";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Forest's Curse", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.FORESTS_CURSE, Moves.TRICK_OR_TREAT ])
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});
it("will replace the added type from Trick Or Treat", async () => {
await game.classicMode.startBattle([ Species.FEEBAS ]);
const enemyPokemon = game.scene.getEnemyPokemon();
game.move.select(Moves.TRICK_OR_TREAT);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon!.summonData.addedType).toBe(Type.GHOST);
game.move.select(Moves.FORESTS_CURSE);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon?.summonData.addedType).toBe(Type.GRASS);
});
});

View File

@ -0,0 +1,59 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Type } from "#app/data/type";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Reflect Type", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
.enemyAbility(Abilities.BALL_FETCH);
});
it("will make the user Normal/Grass if targetting a typeless Pokemon affected by Forest's Curse", async () => {
game.override
.moveset([ Moves.FORESTS_CURSE, Moves.REFLECT_TYPE ])
.startingLevel(60)
.enemySpecies(Species.CHARMANDER)
.enemyMoveset([ Moves.BURN_UP, Moves.SPLASH ]);
await game.classicMode.startBattle([ Species.FEEBAS ]);
const playerPokemon = game.scene.getPlayerPokemon();
const enemyPokemon = game.scene.getEnemyPokemon();
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.BURN_UP);
await game.toNextTurn();
game.move.select(Moves.FORESTS_CURSE);
await game.forceEnemyMove(Moves.SPLASH);
await game.toNextTurn();
expect(enemyPokemon?.getTypes().includes(Type.UNKNOWN)).toBe(true);
expect(enemyPokemon?.getTypes().includes(Type.GRASS)).toBe(true);
game.move.select(Moves.REFLECT_TYPE);
await game.forceEnemyMove(Moves.SPLASH);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon?.getTypes()[0]).toBe(Type.NORMAL);
expect(playerPokemon?.getTypes().includes(Type.GRASS)).toBe(true);
});
});

View File

@ -0,0 +1,47 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Type } from "#app/data/type";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Trick Or Treat", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([ Moves.FORESTS_CURSE, Moves.TRICK_OR_TREAT ])
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});
it("will replace added type from Forest's Curse", async () => {
await game.classicMode.startBattle([ Species.FEEBAS ]);
const enemyPokemon = game.scene.getEnemyPokemon();
game.move.select(Moves.FORESTS_CURSE);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon!.summonData.addedType).toBe(Type.GRASS);
game.move.select(Moves.TRICK_OR_TREAT);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon?.summonData.addedType).toBe(Type.GHOST);
});
});

View File

@ -0,0 +1,72 @@
import { BattlerIndex } from "#app/battle";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { StatusEffect } from "#enums/status-effect";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
describe("Frenzy Move Reset", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleType("single")
.disableCrits()
.starterSpecies(Species.MAGIKARP)
.moveset(Moves.THRASH)
.statusEffect(StatusEffect.PARALYSIS)
.enemyMoveset(Moves.SPLASH)
.enemyLevel(100)
.enemySpecies(Species.SHUCKLE)
.enemyAbility(Abilities.BALL_FETCH);
});
/*
* Thrash (or frenzy moves in general) should not continue to run if attack fails due to paralysis
*
* This is a 3-turn Thrash test:
* 1. Thrash is selected and succeeds to hit the enemy -> Enemy Faints
*
* 2. Thrash is automatically selected but misses due to paralysis
* Note: After missing the Pokemon should stop automatically attacking
*
* 3. At the start of the 3rd turn the Player should be able to select a move/switch Pokemon/etc.
* Note: This means that BattlerTag.FRENZY is not anymore in pokemon.summonData.tags and pokemon.summonData.moveQueue is empty
*
*/
it("should cancel frenzy move if move fails turn 2", async () => {
await game.classicMode.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(Moves.THRASH);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.move.forceStatusActivation(false);
await game.toNextTurn();
expect(playerPokemon.summonData.moveQueue.length).toBe(2);
expect(playerPokemon.summonData.tags.some(tag => tag.tagType === BattlerTagType.FRENZY)).toBe(true);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.move.forceStatusActivation(true);
await game.toNextTurn();
expect(playerPokemon.summonData.moveQueue.length).toBe(0);
expect(playerPokemon.summonData.tags.some(tag => tag.tagType === BattlerTagType.FRENZY)).toBe(false);
});
});

View File

@ -35,7 +35,7 @@ const timedEvents: TimedEvent[] = [
endDate: new Date(Date.UTC(2024, 10, 4, 0)), endDate: new Date(Date.UTC(2024, 10, 4, 0)),
bannerKey: "halloween2024-event-", bannerKey: "halloween2024-event-",
scale: 0.21, scale: 0.21,
availableLangs: [ "en", "de", "it", "fr", "ja", "ko", "es", "pt-BR", "zh-CN" ] availableLangs: [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ]
} }
]; ];

View File

@ -107,7 +107,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
let pokemonIconX = -20; let pokemonIconX = -20;
let pokemonIconY = 6; let pokemonIconY = 6;
if ([ "de", "es", "fr", "ko", "pt-BR" ].includes(currentLanguage)) { if ([ "de", "es-ES", "fr", "ko", "pt-BR" ].includes(currentLanguage)) {
gachaTextStyle = TextStyle.SMALLER_WINDOW_ALT; gachaTextStyle = TextStyle.SMALLER_WINDOW_ALT;
gachaX = 2; gachaX = 2;
gachaY = 2; gachaY = 2;
@ -115,7 +115,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
let legendaryLabelX = gachaX; let legendaryLabelX = gachaX;
let legendaryLabelY = gachaY; let legendaryLabelY = gachaY;
if ([ "de", "es" ].includes(currentLanguage)) { if ([ "de", "es-ES" ].includes(currentLanguage)) {
pokemonIconX = -25; pokemonIconX = -25;
pokemonIconY = 10; pokemonIconY = 10;
legendaryLabelX = -6; legendaryLabelX = -6;
@ -128,7 +128,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
switch (gachaType as GachaType) { switch (gachaType as GachaType) {
case GachaType.LEGENDARY: case GachaType.LEGENDARY:
if ([ "de", "es" ].includes(currentLanguage)) { if ([ "de", "es-ES" ].includes(currentLanguage)) {
gachaUpLabel.setAlign("center"); gachaUpLabel.setAlign("center");
gachaUpLabel.setY(0); gachaUpLabel.setY(0);
} }
@ -149,7 +149,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
gachaInfoContainer.add(pokemonIcon); gachaInfoContainer.add(pokemonIcon);
break; break;
case GachaType.MOVE: case GachaType.MOVE:
if ([ "de", "es", "fr", "pt-BR" ].includes(currentLanguage)) { if ([ "de", "es-ES", "fr", "pt-BR" ].includes(currentLanguage)) {
gachaUpLabel.setAlign("center"); gachaUpLabel.setAlign("center");
gachaUpLabel.setY(0); gachaUpLabel.setY(0);
} }

View File

@ -32,7 +32,7 @@ let wikiUrl = "https://wiki.pokerogue.net/start";
const discordUrl = "https://discord.gg/uWpTfdKG49"; const discordUrl = "https://discord.gg/uWpTfdKG49";
const githubUrl = "https://github.com/pagefaultgames/pokerogue"; const githubUrl = "https://github.com/pagefaultgames/pokerogue";
const redditUrl = "https://www.reddit.com/r/pokerogue"; const redditUrl = "https://www.reddit.com/r/pokerogue";
const donateUrl = "https://github.com/sponsors/patapancakes"; const donateUrl = "https://github.com/sponsors/pagefaultgames";
export default class MenuUiHandler extends MessageUiHandler { export default class MenuUiHandler extends MessageUiHandler {
private readonly textPadding = 8; private readonly textPadding = 8;

View File

@ -21,24 +21,6 @@ interface LanguageSetting {
} }
const languageSettings: { [key: string]: LanguageSetting } = { const languageSettings: { [key: string]: LanguageSetting } = {
"en": {
infoContainerTextSize: "64px"
},
"de": {
infoContainerTextSize: "64px",
},
"es": {
infoContainerTextSize: "64px"
},
"fr": {
infoContainerTextSize: "64px"
},
"it": {
infoContainerTextSize: "64px"
},
"zh": {
infoContainerTextSize: "64px"
},
"pt": { "pt": {
infoContainerTextSize: "60px", infoContainerTextSize: "60px",
infoContainerLabelXPos: -15, infoContainerLabelXPos: -15,
@ -237,14 +219,20 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
const formKey = (pokemon.species?.forms?.[pokemon.formIndex!]?.formKey); const formKey = (pokemon.species?.forms?.[pokemon.formIndex!]?.formKey);
const formText = Utils.capitalizeString(formKey, "-", false, false) || ""; const formText = Utils.capitalizeString(formKey, "-", false, false) || "";
const speciesName = Utils.capitalizeString(Species[pokemon.species.getRootSpeciesId()], "_", true, false); const speciesName = Utils.capitalizeString(Species[pokemon.species.speciesId], "_", true, false);
let formName = ""; let formName = "";
if (pokemon.species.speciesId === Species.ARCEUS) { if (pokemon.species.speciesId === Species.ARCEUS) {
formName = i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`); formName = i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`);
} else { } else {
const i18key = `pokemonForm:${speciesName}${formText}`; const i18key = `pokemonForm:${speciesName}${formText}`;
formName = i18next.exists(i18key) ? i18next.t(i18key) : formText; if (i18next.exists(i18key)) {
formName = i18next.t(i18key);
} else {
const rootSpeciesName = Utils.capitalizeString(Species[pokemon.species.getRootSpeciesId()], "_", true, false);
const i18RootKey = `pokemonForm:${rootSpeciesName}${formText}`;
formName = i18next.exists(i18RootKey) ? i18next.t(i18RootKey) : formText;
}
} }
if (formName) { if (formName) {

View File

@ -13,7 +13,7 @@ interface LanguageSetting {
} }
const languageSettings: { [key: string]: LanguageSetting } = { const languageSettings: { [key: string]: LanguageSetting } = {
"es":{ "es-ES": {
inputFieldFontSize: "50px", inputFieldFontSize: "50px",
errorMessageFontSize: "40px", errorMessageFontSize: "40px",
} }

View File

@ -674,7 +674,7 @@ export default class RunInfoUiHandler extends UiHandler {
const def = i18next.t("pokemonInfo:Stat.DEFshortened") + ": " + pStats[2]; const def = i18next.t("pokemonInfo:Stat.DEFshortened") + ": " + pStats[2];
const spatk = i18next.t("pokemonInfo:Stat.SPATKshortened") + ": " + pStats[3]; const spatk = i18next.t("pokemonInfo:Stat.SPATKshortened") + ": " + pStats[3];
const spdef = i18next.t("pokemonInfo:Stat.SPDEFshortened") + ": " + pStats[4]; const spdef = i18next.t("pokemonInfo:Stat.SPDEFshortened") + ": " + pStats[4];
const speedLabel = (currentLanguage === "es" || currentLanguage === "pt_BR") ? i18next.t("runHistory:SPDshortened") : i18next.t("pokemonInfo:Stat.SPDshortened"); const speedLabel = (currentLanguage === "es-ES" || currentLanguage === "pt_BR") ? i18next.t("runHistory:SPDshortened") : i18next.t("pokemonInfo:Stat.SPDshortened");
const speed = speedLabel + ": " + pStats[5]; const speed = speedLabel + ": " + pStats[5];
// Column 1: HP Atk Def // Column 1: HP Atk Def
const pokeStatText1 = addBBCodeTextObject(this.scene, -5, 0, hp, TextStyle.SUMMARY, { fontSize: textContainerFontSize, lineSpacing: lineSpacing }); const pokeStatText1 = addBBCodeTextObject(this.scene, -5, 0, hp, TextStyle.SUMMARY, { fontSize: textContainerFontSize, lineSpacing: lineSpacing });

View File

@ -29,10 +29,10 @@ export default class SettingsDisplayUiHandler extends AbstractSettingsUiHandler
label: "English", label: "English",
}; };
break; break;
case "es": case "es-ES":
this.settings[languageIndex].options[0] = { this.settings[languageIndex].options[0] = {
value: "Español", value: "Español (ES)",
label: "Español", label: "Español (ES)",
}; };
break; break;
case "it": case "it":

View File

@ -81,7 +81,7 @@ const languageSettings: { [key: string]: LanguageSetting } = {
instructionTextSize: "35px", instructionTextSize: "35px",
starterInfoXPos: 33, starterInfoXPos: 33,
}, },
"es":{ "es-ES":{
starterInfoTextSize: "56px", starterInfoTextSize: "56px",
instructionTextSize: "35px", instructionTextSize: "35px",
}, },

View File

@ -184,6 +184,7 @@ export default class TargetSelectUiHandler extends UiHandler {
} }
clear() { clear() {
this.cursor = -1;
super.clear(); super.clear();
this.eraseCursor(); this.eraseCursor();
} }

View File

@ -487,7 +487,7 @@ export function verifyLang(lang?: string): boolean {
} }
switch (lang) { switch (lang) {
case "es": case "es-ES":
case "fr": case "fr":
case "de": case "de":
case "it": case "it":