Compare commits

...

7 Commits

Author SHA1 Message Date
Enoch
15106b83fb
[Localization(ja)] Translated ability-trigger.ts, status-effect.ts (#3428)
* Translated ability-trigger.ts, status-effect.ts

* Apply suggestions from code review

Co-authored-by: Chapybara-jp <charlie.beer@hotmail.com>

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Chapybara-jp <charlie.beer@hotmail.com>

---------

Co-authored-by: Chapybara-jp <charlie.beer@hotmail.com>
2024-08-08 14:04:04 -04:00
innerthunder
b4a891cc71
[Move] Reimplement Beak Blast (#3427)
* Re-Implement Beak Blast

* Fix charge animation loading issues
2024-08-08 14:03:28 -04:00
Jannik Tappert
b5a40bfdfc
[Localization] German missing keys (#3436)
* Add all keys that are in english but missing in german

* useless change

* Revert "useless change"

This reverts commit 15cff42d8d.
2024-08-08 14:02:26 -04:00
NightKev
f0d4dfa09e
[Test] Mock turn order in Miracle Eye test (#3437) 2024-08-08 14:02:02 -04:00
Opaque02
49bb681554
[Bug] Starter UI challenge form fix (#3373)
* First issue with soft attribute on challenges as well as incorrect sprites appearing on the starter select ui

* Updated logic to fix starter party icons, forms and shinies in starter selection area

* Fixed issue where some pokemon were being shown in challenges originally if the default form didn't meet the criteria

* Updated docs and tests to account for new behaviour

* Removed some debugging comments

* Fixed rotom form not counting as valid party

* Fixed a bug where the cursor's last known position would be used when pokemon forms were being changed when other forms were available when updated from your party directly

* Fixed issue with starter party icons' forms updating incorrectly when removing pokemon from party

* Fixed docs

* Updated code to allow for starter icons to remember their previous state after a reload
2024-08-08 09:16:27 -04:00
Alex Van Liew
aaad2241ae
[Dev] Add typecheck command (#3409)
* add test command for typechecking

* change command name
2024-08-08 13:58:07 +01:00
Opaque02
cff3adf2e6
Updating locale folder from ca-ES to ca_ES (#3429)
* Updating locale folder from ca-ES to ca_ES

* Updated the i18n config file to include ca_ES instead of ca-ES
2024-08-08 13:55:56 +01:00
65 changed files with 447 additions and 171 deletions

View File

@ -13,6 +13,7 @@
"test:cov": "vitest run --project pre && vitest run --project main --coverage",
"test:watch": "vitest run --project pre && vitest watch --project main --coverage",
"test:silent": "vitest run --project pre && vitest run --project main --silent",
"typecheck": "tsc --noEmit",
"eslint": "eslint --fix .",
"eslint-ci": "eslint .",
"docs": "typedoc",

View File

@ -1,6 +1,6 @@
//import { battleAnimRawData } from "./battle-anim-raw-data";
import BattleScene from "../battle-scene";
import { AttackMove, ChargeAttr, DelayedAttackAttr, MoveFlags, SelfStatusMove, allMoves } from "./move";
import { AttackMove, BeakBlastHeaderAttr, ChargeAttr, DelayedAttackAttr, MoveFlags, SelfStatusMove, allMoves } from "./move";
import Pokemon from "../field/pokemon";
import * as Utils from "../utils";
import { BattlerIndex } from "../battle";
@ -499,7 +499,9 @@ export function initMoveAnim(scene: BattleScene, move: Moves): Promise<void> {
} else {
populateMoveAnim(move, ba);
}
const chargeAttr = allMoves[move].getAttrs(ChargeAttr)[0] || allMoves[move].getAttrs(DelayedAttackAttr)[0];
const chargeAttr = allMoves[move].getAttrs(ChargeAttr)[0]
|| allMoves[move].getAttrs(DelayedAttackAttr)[0]
|| allMoves[move].getAttrs(BeakBlastHeaderAttr)[0];
if (chargeAttr) {
initMoveChargeAnim(scene, chargeAttr.chargeAnim).then(() => resolve());
} else {
@ -570,7 +572,9 @@ export function loadMoveAnimAssets(scene: BattleScene, moveIds: Moves[], startLo
return new Promise(resolve => {
const moveAnimations = moveIds.map(m => moveAnims.get(m) as AnimConfig).flat();
for (const moveId of moveIds) {
const chargeAttr = allMoves[moveId].getAttrs(ChargeAttr)[0] || allMoves[moveId].getAttrs(DelayedAttackAttr)[0];
const chargeAttr = allMoves[moveId].getAttrs(ChargeAttr)[0]
|| allMoves[moveId].getAttrs(DelayedAttackAttr)[0]
|| allMoves[moveId].getAttrs(BeakBlastHeaderAttr)[0];
if (chargeAttr) {
const moveChargeAnims = chargeAnims.get(chargeAttr.chargeAnim);
moveAnimations.push(moveChargeAnims instanceof AnimConfig ? moveChargeAnims : moveChargeAnims![0]); // TODO: is the bang correct?

View File

@ -1,4 +1,4 @@
import { CommonAnim, CommonBattleAnim } from "./battle-anims";
import { ChargeAnim, CommonAnim, CommonBattleAnim, MoveChargeAnim } from "./battle-anims";
import { CommonAnimPhase, MoveEffectPhase, MovePhase, PokemonHealPhase, ShowAbilityPhase, StatChangeCallback, StatChangePhase } from "../phases";
import { getPokemonNameWithAffix } from "../messages";
import Pokemon, { MoveResult, HitResult } from "../field/pokemon";
@ -118,6 +118,44 @@ export class RechargingTag extends BattlerTag {
}
}
/**
* BattlerTag representing the "charge phase" of Beak Blast
* Pokemon with this tag will inflict BURN status on any attacker that makes contact.
* @see {@link https://bulbapedia.bulbagarden.net/wiki/Beak_Blast_(move) | Beak Blast}
*/
export class BeakBlastChargingTag extends BattlerTag {
constructor() {
super(BattlerTagType.BEAK_BLAST_CHARGING, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END ], 1, Moves.BEAK_BLAST);
}
onAdd(pokemon: Pokemon): void {
// Play Beak Blast's charging animation
new MoveChargeAnim(ChargeAnim.BEAK_BLAST_CHARGING, this.sourceMove, pokemon).play(pokemon.scene);
// Queue Beak Blast's header message
pokemon.scene.queueMessage(i18next.t("moveTriggers:startedHeatingUpBeak", { pokemonName: getPokemonNameWithAffix(pokemon) }));
}
/**
* Inflicts `BURN` status on attackers that make contact, and causes this tag
* to be removed after the source makes a move (or the turn ends, whichever comes first)
* @param pokemon {@linkcode Pokemon} the owner of this tag
* @param lapseType {@linkcode BattlerTagLapseType} the type of functionality invoked in battle
* @returns `true` if invoked with the CUSTOM lapse type; `false` otherwise
*/
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
if (lapseType === BattlerTagLapseType.CUSTOM) {
const effectPhase = pokemon.scene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon();
attacker.trySetStatus(StatusEffect.BURN, true, pokemon);
}
return true;
}
return super.lapse(pokemon, lapseType);
}
}
export class TrappedTag extends BattlerTag {
constructor(tagType: BattlerTagType, lapseType: BattlerTagLapseType, turnCount: number, sourceMove: Moves, sourceId: number) {
super(tagType, lapseType, turnCount, sourceMove, sourceId);
@ -1738,6 +1776,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
switch (tagType) {
case BattlerTagType.RECHARGING:
return new RechargingTag(sourceMove);
case BattlerTagType.BEAK_BLAST_CHARGING:
return new BeakBlastChargingTag();
case BattlerTagType.FLINCHED:
return new FlinchedTag(sourceMove);
case BattlerTagType.INTERRUPTED:

View File

@ -273,11 +273,9 @@ export abstract class Challenge {
* @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @param soft {@link boolean} If true, allow it if it could become a valid pokemon.
* @param checkEvolutions {@link boolean} If true, check the pokemon's future evolutions
* @param checkForms {@link boolean} If true, check the pokemon's alternative forms
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false, checkEvolutions?: boolean, checkForms?: boolean): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean {
return false;
}
@ -405,14 +403,13 @@ export class SingleGenerationChallenge extends Challenge {
super(Challenges.SINGLE_GENERATION, 9);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false, checkEvolutions?: boolean): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean {
const generations = [pokemon.generation];
const checkPokemonEvolutions = checkEvolutions ?? true as boolean;
if (soft) {
const speciesToCheck = [pokemon.speciesId];
while (speciesToCheck.length) {
const checking = speciesToCheck.pop();
if (checking && pokemonEvolutions.hasOwnProperty(checking) && checkPokemonEvolutions) {
if (checking && pokemonEvolutions.hasOwnProperty(checking)) {
pokemonEvolutions[checking].forEach(e => {
speciesToCheck.push(e.speciesId);
generations.push(getPokemonSpecies(e.speciesId).generation);
@ -533,22 +530,20 @@ export class SingleTypeChallenge extends Challenge {
super(Challenges.SINGLE_TYPE, 18);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false, checkEvolutions?: boolean, checkForms?: boolean): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean {
const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex);
const types = [speciesForm.type1, speciesForm.type2];
const checkPokemonEvolutions = checkEvolutions ?? true as boolean;
const checkPokemonForms = checkForms ?? true as boolean;
if (soft) {
const speciesToCheck = [pokemon.speciesId];
while (speciesToCheck.length) {
const checking = speciesToCheck.pop();
if (checking && pokemonEvolutions.hasOwnProperty(checking) && checkPokemonEvolutions) {
if (checking && pokemonEvolutions.hasOwnProperty(checking)) {
pokemonEvolutions[checking].forEach(e => {
speciesToCheck.push(e.speciesId);
types.push(getPokemonSpecies(e.speciesId).type1, getPokemonSpecies(e.speciesId).type2);
});
}
if (checking && pokemonFormChanges.hasOwnProperty(checking) && checkPokemonForms) {
if (checking && pokemonFormChanges.hasOwnProperty(checking)) {
pokemonFormChanges[checking].forEach(f1 => {
getPokemonSpecies(checking).forms.forEach(f2 => {
if (f1.formKey === f2.formKey) {
@ -746,7 +741,7 @@ export class LowerStarterPointsChallenge extends Challenge {
* @param soft {@link boolean} If true, allow it if it could become a valid pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_CHOICE, pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean, checkEvolutions?: boolean, checkForms?: boolean): boolean;
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_CHOICE, pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean): boolean;
/**
* Apply all challenges that modify available total starter points.
* @param gameMode {@link GameMode} The current gameMode
@ -854,7 +849,7 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
if (c.value !== 0) {
switch (challengeType) {
case ChallengeType.STARTER_CHOICE:
ret ||= c.applyStarterChoice(args[0], args[1], args[2], args[3], args[4], args[5]);
ret ||= c.applyStarterChoice(args[0], args[1], args[2], args[3]);
break;
case ChallengeType.STARTER_POINTS:
ret ||= c.applyStarterPoints(args[0]);

View File

@ -1021,6 +1021,22 @@ export class MessageHeaderAttr extends MoveHeaderAttr {
}
}
/**
* Header attribute to implement the "charge phase" of Beak Blast at the
* beginning of a turn.
* @see {@link https://bulbapedia.bulbagarden.net/wiki/Beak_Blast_(move) | Beak Blast}
* @see {@linkcode BeakBlastChargingTag}
*/
export class BeakBlastHeaderAttr extends MoveHeaderAttr {
/** Required to initialize Beak Blast's charge animation correctly */
public chargeAnim = ChargeAnim.BEAK_BLAST_CHARGING;
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
user.addTag(BattlerTagType.BEAK_BLAST_CHARGING);
return true;
}
}
export class PreMoveMessageAttr extends MoveAttr {
private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string);
@ -2391,24 +2407,21 @@ export class ChargeAttr extends OverrideMoveEffectAttr {
private chargeText: string;
private tagType: BattlerTagType | null;
private chargeEffect: boolean;
public sameTurn: boolean;
public followUpPriority: integer | null;
constructor(chargeAnim: ChargeAnim, chargeText: string, tagType?: BattlerTagType | null, chargeEffect: boolean = false, sameTurn: boolean = false, followUpPriority?: integer) {
constructor(chargeAnim: ChargeAnim, chargeText: string, tagType?: BattlerTagType | null, chargeEffect: boolean = false) {
super();
this.chargeAnim = chargeAnim;
this.chargeText = chargeText;
this.tagType = tagType!; // TODO: is this bang correct?
this.chargeEffect = chargeEffect;
this.sameTurn = sameTurn;
this.followUpPriority = followUpPriority!; // TODO: is this bang correct?
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
return new Promise(resolve => {
const lastMove = user.getLastXMoves().find(() => true);
if (!lastMove || lastMove.move !== move.id || (lastMove.result !== MoveResult.OTHER && (this.sameTurn || lastMove.turn !== user.scene.currentBattle.turn))) {
if (!lastMove || lastMove.move !== move.id || (lastMove.result !== MoveResult.OTHER && lastMove.turn !== user.scene.currentBattle.turn)) {
(args[0] as Utils.BooleanHolder).value = true;
new MoveChargeAnim(this.chargeAnim, move.id, user).play(user.scene, () => {
user.scene.queueMessage(this.chargeText.replace("{TARGET}", getPokemonNameWithAffix(target)).replace("{USER}", getPokemonNameWithAffix(user)));
@ -2420,13 +2433,6 @@ export class ChargeAttr extends OverrideMoveEffectAttr {
}
user.pushMoveHistory({ move: move.id, targets: [ target.getBattlerIndex() ], result: MoveResult.OTHER });
user.getMoveQueue().push({ move: move.id, targets: [ target.getBattlerIndex() ], ignorePP: true });
if (this.sameTurn) {
let movesetMove = user.moveset.find(m => m?.moveId === move.id);
if (!movesetMove) { // account for any move that calls a ChargeAttr move when the ChargeAttr move does not exist in moveset
movesetMove = new PokemonMove(move.id, 0, 0, true);
}
user.scene.pushMovePhase(new MovePhase(user.scene, user, [ target.getBattlerIndex() ], movesetMove, true), this.followUpPriority!); // TODO: is this bang correct?
}
user.addTag(BattlerTagType.CHARGING, 1, move.id, user.id);
resolve(true);
});
@ -8081,11 +8087,10 @@ export function initMoves() {
.attr(StatChangeAttr, BattleStat.ATK, -1),
new StatusMove(Moves.INSTRUCT, Type.PSYCHIC, -1, 15, -1, 0, 7)
.unimplemented(),
new AttackMove(Moves.BEAK_BLAST, Type.FLYING, MoveCategory.PHYSICAL, 100, 100, 15, -1, 5, 7)
.attr(ChargeAttr, ChargeAnim.BEAK_BLAST_CHARGING, i18next.t("moveTriggers:startedHeatingUpBeak", {pokemonName: "{USER}"}), undefined, false, true, -3)
new AttackMove(Moves.BEAK_BLAST, Type.FLYING, MoveCategory.PHYSICAL, 100, 100, 15, -1, -3, 7)
.attr(BeakBlastHeaderAttr)
.ballBombMove()
.makesContact(false)
.partial(),
.makesContact(false),
new AttackMove(Moves.CLANGING_SCALES, Type.DRAGON, MoveCategory.SPECIAL, 110, 100, 5, -1, 0, 7)
.attr(StatChangeAttr, BattleStat.DEF, -1, true, null, true, false, MoveEffectTrigger.HIT, true)
.soundBased()

View File

@ -66,5 +66,6 @@ export enum BattlerTagType {
IGNORE_GHOST = "IGNORE_GHOST",
IGNORE_DARK = "IGNORE_DARK",
GULP_MISSILE_ARROKUDA = "GULP_MISSILE_ARROKUDA",
GULP_MISSILE_PIKACHU = "GULP_MISSILE_PIKACHU"
GULP_MISSILE_PIKACHU = "GULP_MISSILE_PIKACHU",
BEAK_BLAST_CHARGING = "BEAK_BLAST_CHARGING"
}

View File

@ -5,4 +5,5 @@ export const pokemonInfoContainer: SimpleTranslationEntries = {
"gender": "Geschlecht:",
"ability": "Fähigkeit:",
"nature": "Wesen:",
"form": "Form:",
} as const;

View File

@ -3,6 +3,7 @@ import { PokemonInfoTranslationEntries } from "#app/interfaces/locales";
export const pokemonInfo: PokemonInfoTranslationEntries = {
Stat: {
"HP": "KP",
"HPStat": "KP",
"HPshortened": "KP",
"ATK": "Angriff",
"ATKshortened": "Ang",

View File

@ -1,62 +1,63 @@
import { SimpleTranslationEntries } from "#app/interfaces/locales";
export const abilityTriggers: SimpleTranslationEntries = {
"blockRecoilDamage" : "{{pokemonName}}は {{abilityName}}で\nはんどうダメージを うけない!",
"badDreams": "{{pokemonName}}は ナイトメアに うなされている!",
"costar": "{{pokemonName}} copied {{allyName}}'s stat changes!",
"iceFaceAvoidedDamage": "{{pokemonName}}は\n{{abilityName}}で ダメージを うけない!",
"perishBody": "{{pokemonName}}の {{abilityName}}で\nおたがいは 3ターンごに ほろびてしまう!",
"poisonHeal": "{{pokemonName}}は {{abilityName}}で\nかいふくした",
"trace": "{{pokemonName}} copied {{targetName}}'s\n{{abilityName}}!",
"windPowerCharged": "{{pokemonName}}は\n{{moveName}}を うけて じゅうでんした!",
"quickDraw": "{{pokemonName}} can act faster than normal, thanks to its Quick Draw!",
"blockItemTheft": "{{pokemonNameWithAffix}}'s {{abilityName}}\nprevents item theft!",
"typeImmunityHeal": "{{pokemonNameWithAffix}}'s {{abilityName}}\nrestored its HP a little!",
"nonSuperEffectiveImmunity": "{{pokemonNameWithAffix}} avoided damage\nwith {{abilityName}}!",
"postDefendDisguise": "{{pokemonNameWithAffix}}'s disguise was busted!",
"moveImmunity": "It doesn't affect {{pokemonNameWithAffix}}!",
"reverseDrain": "{{pokemonNameWithAffix}} sucked up the liquid ooze!",
"postDefendTypeChange": "{{pokemonNameWithAffix}}'s {{abilityName}}\nmade it the {{typeName}} type!",
"postDefendContactDamage": "{{pokemonNameWithAffix}}'s {{abilityName}}\nhurt its attacker!",
"postDefendAbilitySwap": "{{pokemonNameWithAffix}} swapped\nabilities with its target!",
"postDefendAbilityGive": "{{pokemonNameWithAffix}} gave its target\n{{abilityName}}!",
"postDefendMoveDisable": "{{pokemonNameWithAffix}}'s {{moveName}}\nwas disabled!",
"pokemonTypeChange": "{{pokemonNameWithAffix}} transformed into the {{moveType}} type!",
"postAttackStealHeldItem": "{{pokemonNameWithAffix}} stole\n{{defenderName}}'s {{stolenItemType}}!",
"postDefendStealHeldItem": "{{pokemonNameWithAffix}} stole\n{{attackerName}}'s {{stolenItemType}}!",
"copyFaintedAllyAbility": "{{pokemonNameWithAffix}}'s {{abilityName}} was taken over!",
"intimidateImmunity": "{{pokemonNameWithAffix}}'s {{abilityName}} prevented it from being Intimidated!",
"postSummonAllyHeal": "{{pokemonNameWithAffix}} drank down all the\nmatcha that {{pokemonName}} made!",
"postSummonClearAllyStats": "{{pokemonNameWithAffix}}'s stat changes\nwere removed!",
"postSummonTransform": "{{pokemonNameWithAffix}} transformed\ninto {{targetName}}!",
"protectStat": "{{pokemonNameWithAffix}}'s {{abilityName}}\nprevents lowering its {{statName}}!",
"statusEffectImmunityWithName": "{{pokemonNameWithAffix}}'s {{abilityName}}\nprevents {{statusEffectName}}!",
"statusEffectImmunity": "{{pokemonNameWithAffix}}'s {{abilityName}}\nprevents status problems!",
"battlerTagImmunity": "{{pokemonNameWithAffix}}'s {{abilityName}}\nprevents {{battlerTagName}}!",
"forewarn": "{{pokemonNameWithAffix}} was forewarned about {{moveName}}!",
"frisk": "{{pokemonNameWithAffix}} frisked {{opponentName}}'s {{opponentAbilityName}}!",
"postWeatherLapseHeal": "{{pokemonNameWithAffix}}'s {{abilityName}}\nrestored its HP a little!",
"postWeatherLapseDamage": "{{pokemonNameWithAffix}} is hurt\nby its {{abilityName}}!",
"postTurnLootCreateEatenBerry": "{{pokemonNameWithAffix}} harvested one {{berryName}}!",
"postTurnHeal": "{{pokemonNameWithAffix}}'s {{abilityName}}\nrestored its HP a little!",
"fetchBall": "{{pokemonNameWithAffix}} found a\n{{pokeballName}}!",
"healFromBerryUse": "{{pokemonNameWithAffix}}'s {{abilityName}}\nrestored its HP!",
"arenaTrap": "{{pokemonNameWithAffix}}'s {{abilityName}}\nprevents switching!",
"postBattleLoot": "{{pokemonNameWithAffix}} picked up\n{{itemName}}!",
"postFaintContactDamage": "{{pokemonNameWithAffix}}'s {{abilityName}}\nhurt its attacker!",
"postFaintHpDamage": "{{pokemonNameWithAffix}}'s {{abilityName}}\nhurt its attacker!",
"postSummonPressure": "{{pokemonNameWithAffix}} is exerting its Pressure!",
"postSummonMoldBreaker": "{{pokemonNameWithAffix}} breaks the mold!",
"postSummonAnticipation": "{{pokemonNameWithAffix}} shuddered!",
"postSummonTurboblaze": "{{pokemonNameWithAffix}} is radiating a blazing aura!",
"postSummonTeravolt": "{{pokemonNameWithAffix}} is radiating a bursting aura!",
"postSummonDarkAura": "{{pokemonNameWithAffix}} is radiating a Dark Aura!",
"postSummonFairyAura": "{{pokemonNameWithAffix}} is radiating a Fairy Aura!",
"postSummonNeutralizingGas": "{{pokemonNameWithAffix}}'s Neutralizing Gas filled the area!",
"postSummonAsOneGlastrier": "{{pokemonNameWithAffix}} has two Abilities!",
"postSummonAsOneSpectrier": "{{pokemonNameWithAffix}} has two Abilities!",
"postSummonVesselOfRuin": "{{pokemonNameWithAffix}}'s Vessel of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
"postSummonSwordOfRuin": "{{pokemonNameWithAffix}}'s Sword of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
"postSummonTabletsOfRuin": "{{pokemonNameWithAffix}}'s Tablets of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
"postSummonBeadsOfRuin": "{{pokemonNameWithAffix}}'s Beads of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
"blockRecoilDamage" : "{{pokemonName}}は {{abilityName}}で 反動ダメージを 受けない!",
"badDreams": "{{pokemonName}}は ナイトメアに うなされている!",
"costar": "{{pokemonName}}は {{allyName}}の\n能力変化を コピーした",
"iceFaceAvoidedDamage": "{{pokemonName}}は\n{{abilityName}}で ダメージを 受けない!",
"perishBody": "{{pokemonName}}の {{abilityName}}で\nおたがいは 3ターン後に ほろびいてしまう",
"poisonHeal": "{{pokemonName}}は {{abilityName}}で 回復した!",
"trace": "{{pokemonName}}は 相手の {{targetName}}の\n{{abilityName}}を トレースした!",
"windPowerCharged": "{{pokemonName}}は\n{{moveName}}を 受けて じゅうでんした!",
"quickDraw": "{{pokemonName}}は クイックドロウで\n行動が はやくなった",
"blockItemTheft": "{{pokemonNameWithAffix}}の {{abilityName}}で\n道具を うばわれない",
"typeImmunityHeal": "{{pokemonNameWithAffix}}は {{abilityName}}で\n体力を 回復した",
"nonSuperEffectiveImmunity": "{{pokemonNameWithAffix}}は {{abilityName}}で\nダメージを 受けない。",
"postDefendDisguise": "{{pokemonNameWithAffix}}の\nばけのかわが はがれた",
"moveImmunity": "{{pokemonNameWithAffix}}には\n効果が ないようだ…",
"reverseDrain": "{{pokemonNameWithAffix}}は\nヘドロえきを 吸い取った",
"postDefendTypeChange": "{{pokemonNameWithAffix}}は {{abilityName}}で\n{{typeName}}タイプに なった!",
"postDefendContactDamage": "{{pokemonNameWithAffix}}は {{abilityName}}で\n相手を キズつけた",
"postDefendAbilitySwap": "{{pokemonNameWithAffix}}は\nおたがいの 特性を 入れ替えた",
"postDefendAbilityGive": "{{pokemonNameWithAffix}}は\n特性が {{abilityName}}に なっちゃった!",
"postDefendMoveDisable": "{{pokemonNameWithAffix}}の\n{{moveName}}を 封じこめた!",
"pokemonTypeChange": "{{pokemonNameWithAffix}}は\n{{moveType}}タイプに なった!",
"postAttackStealHeldItem": "{{pokemonNameWithAffix}}は {{defenderName}}から\n{{stolenItemType}}を うばいとった!",
"postDefendStealHeldItem": "{{pokemonNameWithAffix}}は {{attackerName}}から\n{{stolenItemType}}を うばいとった!",
"copyFaintedAllyAbility": "{{pokemonNameWithAffix}}の\n{{abilityName}}を 引き継いだ!",
"intimidateImmunity": "{{pokemonNameWithAffix}}は\n{{abilityName}}の 効果で 能力が 下がらない!",
"postSummonAllyHeal": "{{pokemonNameWithAffix}}が たてた お茶を\n{{pokemonName}}は 飲みほした!",
"postSummonClearAllyStats": "{{pokemonNameWithAffix}}の\n能力変化が 元に戻った",
"postSummonTransform": "{{pokemonNameWithAffix}}は\n{{targetName}}に 変身した!",
"protectStat": "{{pokemonNameWithAffix}}は {{abilityName}}の 効果で\n{{statName}}が 下がらない!",
"statusEffectImmunityWithName": "{{pokemonNameWithAffix}}は {{abilityName}}で\{{statusEffectName}}に ならない!",
"statusEffectImmunity": "{{pokemonNameWithAffix}}は {{abilityName}}で\n状態異常に ならない",
"battlerTagImmunity": "{{pokemonNameWithAffix}}は {{abilityName}}で]\n{{battlerTagName}}を 無視した!",
"forewarn": "{{pokemonNameWithAffix}}の\n{{moveName}}を 読み取った!",
"frisk": "{{pokemonNameWithAffix}}は {{opponentName}}の\n{{opponentAbilityName}}を お見通しだ!",
"postWeatherLapseHeal": "{{pokemonNameWithAffix}}は {{abilityName}}で\n体力を 回復した",
"postWeatherLapseDamage": "{{pokemonNameWithAffix}}は\n{{abilityName}}の ダメージを 受けた!",
"postTurnLootCreateEatenBerry": "{{pokemonNameWithAffix}}は\n{{berryName}}を 収穫した!",
"postTurnHeal": "{{pokemonNameWithAffix}}は {{abilityName}}で\n体力を 回復した",
"fetchBall": "{{pokemonNameWithAffix}}は\n{{pokeballName}}を 拾ってきた!",
"healFromBerryUse": "{{pokemonNameWithAffix}}は {{abilityName}}で\n体力を 回復した",
"arenaTrap": "{{pokemonNameWithAffix}}の {{abilityName}}で\n入れ替えることが できない",
"postBattleLoot": "{{pokemonNameWithAffix}}は\n{{itemName}}を 拾った!",
"postFaintContactDamage": "{{pokemonNameWithAffix}}は {{abilityName}}で\n相手に ダメージを 与えた!",
"postFaintHpDamage": "{{pokemonNameWithAffix}}は {{abilityName}}で\n相手に ダメージを 与えた",
"postSummonPressure": "{{pokemonNameWithAffix}}は\nプレッシャーを 放っている",
"postSummonMoldBreaker": "{{pokemonNameWithAffix}}は\nかたやぶりだ",
"postSummonAnticipation": "{{pokemonNameWithAffix}}は\nみぶるいした",
"postSummonTurboblaze": "{{pokemonNameWithAffix}}は\n燃え盛(もえさか)る オーラを 放っている!",
"postSummonTeravolt": "{{pokemonNameWithAffix}}は\n弾(はじ)ける オーラを 放っている!",
"postSummonDarkAura": "{{pokemonNameWithAffix}}は\nダークオーラを 放っている",
"postSummonFairyAura": "{{pokemonNameWithAffix}}は\nフェアリーオーラを 放っている",
"postSummonNeutralizingGas": "あたりに かがくへんかガスが 充満した!",
"postSummonAsOneGlastrier": "{{pokemonNameWithAffix}}は\nふたつの 特性を あわせ持つ",
"postSummonAsOneSpectrier": "{{pokemonNameWithAffix}}は\nふたつの 特性を あわせ持つ",
"postSummonVesselOfRuin": "{{pokemonNameWithAffix}}の わざわいのうつわで\nまわりの {{statName}}が 弱まった!",
"postSummonSwordOfRuin": "{{pokemonNameWithAffix}}の わざわいのつるぎで\nまわりの {{statName}}が 弱まった!",
"postSummonTabletsOfRuin": "{{pokemonNameWithAffix}}の わざわいのおふだ\nまわりの {{statName}}が 弱まった!",
"postSummonBeadsOfRuin": "{{pokemonNameWithAffix}}の わざわいのたまで\nまわりの {{statName}}が 弱まった!",
"preventBerryUse": "{{pokemonNameWithAffix}}は 緊張して\nきのみが 食べられなくなった",
} as const;

View File

@ -2,7 +2,7 @@ import { StatusEffectTranslationEntries } from "#app/interfaces/locales.js";
export const statusEffect: StatusEffectTranslationEntries = {
none: {
name: "None",
name: "なし",
description: "",
obtain: "",
obtainSource: "",
@ -11,57 +11,57 @@ export const statusEffect: StatusEffectTranslationEntries = {
heal: ""
},
poison: {
name: "Poison",
description: "poisoning",
obtain: "{{pokemonNameWithAffix}}\nwas poisoned!",
obtainSource: "{{pokemonNameWithAffix}}\nwas poisoned by the {{sourceText}}!",
activation: "{{pokemonNameWithAffix}} is hurt\nby poison!",
overlap: "{{pokemonNameWithAffix}} is\nalready poisoned!",
heal: "{{pokemonNameWithAffix}} was\ncured of its poison!"
name: "どく",
description: "どく",
obtain: "{{pokemonNameWithAffix}}は\n毒を あびた",
obtainSource: "{{pokemonNameWithAffix}}は\n{{sourceText}}で 毒を あびた!",
activation: "{{pokemonNameWithAffix}}は\n毒の ダメージを 受けた",
overlap: "{{pokemonNameWithAffix}}は すでに\n毒を あびている",
heal: "{{pokemonNameWithAffix}}の 毒は\nきれいさっぱり なくなった"
},
toxic: {
name: "Toxic",
description: "poisoning",
obtain: "{{pokemonNameWithAffix}}\nwas badly poisoned!",
obtainSource: "{{pokemonNameWithAffix}}\nwas badly poisoned by the {{sourceText}}!",
activation: "{{pokemonNameWithAffix}} is hurt\nby poison!",
overlap: "{{pokemonNameWithAffix}} is\nalready poisoned!",
heal: "{{pokemonNameWithAffix}} was\ncured of its poison!"
name: "もうどく",
description: "もうどく",
obtain: "{{pokemonNameWithAffix}}は\n猛毒を あびた",
obtainSource: "{{pokemonNameWithAffix}}は\n{{sourceText}}で 猛毒を あびた!",
activation: "{{pokemonNameWithAffix}}は\n毒の ダメージを受けた",
overlap: "{{pokemonNameWithAffix}}は すでに\n毒を あびている",
heal: "{{pokemonNameWithAffix}}の 毒は\nきれいさっぱり なくなった"
},
paralysis: {
name: "Paralysis",
description: "paralysis",
obtain: "{{pokemonNameWithAffix}} was paralyzed,\nIt may be unable to move!",
obtainSource: "{{pokemonNameWithAffix}} was paralyzed by the {{sourceText}}!\nIt may be unable to move!",
activation: "{{pokemonNameWithAffix}} is paralyzed!\nIt can't move!",
overlap: "{{pokemonNameWithAffix}} is\nalready paralyzed!",
heal: "{{pokemonNameWithAffix}} was\nhealed of paralysis!"
name: "まひ",
description: "まひ",
obtain: "{{pokemonNameWithAffix}}は まひして\n技が でにくくなった",
obtainSource: "{{pokemonNameWithAffix}}は {{sourceText}}で まひして\n技が でにくくなった",
activation: "{{pokemonNameWithAffix}}は\n体が しびれて 動けない",
overlap: "{{pokemonNameWithAffix}}は\nすでに まひしている",
heal: "{{pokemonNameWithAffix}}の\nしびれが とれた"
},
sleep: {
name: "Sleep",
description: "sleep",
obtain: "{{pokemonNameWithAffix}}\nfell asleep!",
obtainSource: "{{pokemonNameWithAffix}}\nfell asleep from the {{sourceText}}!",
activation: "{{pokemonNameWithAffix}} is fast asleep.",
overlap: "{{pokemonNameWithAffix}} is\nalready asleep!",
heal: "{{pokemonNameWithAffix}} woke up!"
name: "ねむり",
description: "ねむり",
obtain: "{{pokemonNameWithAffix}}は\n眠ってしまった",
obtainSource: "{{pokemonNameWithAffix}}は\n{{sourceText}}で 眠ってしまった!",
activation: "{{pokemonNameWithAffix}}は\nぐうぐう 眠っている",
overlap: "{{pokemonNameWithAffix}}は\nすでに 眠っている",
heal: "{{pokemonNameWithAffix}}は\n目を 覚ました"
},
freeze: {
name: "Freeze",
description: "freezing",
obtain: "{{pokemonNameWithAffix}}\nwas frozen solid!",
obtainSource: "{{pokemonNameWithAffix}}\nwas frozen solid by the {{sourceText}}!",
activation: "{{pokemonNameWithAffix}} is\nfrozen solid!",
overlap: "{{pokemonNameWithAffix}} is\nalready frozen!",
heal: "{{pokemonNameWithAffix}} was\ndefrosted!"
name: "こおり",
description: "こおり",
obtain: "{{pokemonNameWithAffix}}は\n凍りついた",
obtainSource: "{{pokemonNameWithAffix}}は\n{{sourceText}}で 凍りついた!",
activation: "{{pokemonNameWithAffix}}は\n凍ってしまって 動けない",
overlap: "{{pokemonNameWithAffix}}は\nすでに 凍っている",
heal: "{{pokemonNameWithAffix}}は\nこおり状態が 治った"
},
burn: {
name: "Burn",
description: "burn",
obtain: "{{pokemonNameWithAffix}}\nwas burned!",
obtainSource: "{{pokemonNameWithAffix}}\nwas burned by the {{sourceText}}!",
activation: "{{pokemonNameWithAffix}} is hurt\nby its burn!",
overlap: "{{pokemonNameWithAffix}} is\nalready burned!",
heal: "{{pokemonNameWithAffix}} was\nhealed of its burn!"
name: "やけど",
description: "やけど",
obtain: "{{pokemonNameWithAffix}}は\nやけどを 負った",
obtainSource: "{{pokemonNameWithAffix}}は\n{{sourceText}}で やけどを 負った!",
activation: "{{pokemonNameWithAffix}}は\nやけどの ダメージを 受けた",
overlap: "{{pokemonNameWithAffix}}は すでに\nやけどを 負っている",
heal: "{{pokemonNameWithAffix}}の\nやけどが 治った"
},
} as const;

View File

@ -3087,6 +3087,7 @@ export class MoveEffectPhase extends PokemonPhase {
Utils.executeIf(!isProtected && !chargeEffect, () => applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.HIT
&& (!attr.firstHitOnly || firstHit) && (!attr.lastHitOnly || lastHit) && (!attr.firstTargetOnly || firstTarget), user, target, this.move.getMove()).then(() => {
return Utils.executeIf(!target.isFainted() || target.canApplyAbility(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move.getMove(), hitResult).then(() => {
target.lapseTag(BattlerTagType.BEAK_BLAST_CHARGING);
if (!user.isPlayer() && this.move.getMove() instanceof AttackMove) {
user.scene.applyShuffledModifiers(this.scene, EnemyAttackStatusEffectChanceModifier, false, target);
}

View File

@ -2,7 +2,7 @@ import i18next from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import processor, { KoreanPostpositionProcessor } from "i18next-korean-postposition-processor";
import { caESConfig} from "#app/locales/ca-ES/config.js";
import { caESConfig} from "#app/locales/ca_ES/config.js";
import { deConfig } from "#app/locales/de/config.js";
import { enConfig } from "#app/locales/en/config.js";
import { esConfig } from "#app/locales/es/config.js";

View File

@ -197,6 +197,7 @@ export interface StarterAttributes {
variant?: integer;
form?: integer;
female?: boolean;
shiny?: boolean;
}
export interface StarterPreferences {

View File

@ -0,0 +1,135 @@
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "#test/utils/gameManager";
import { Species } from "#enums/species";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { BerryPhase, MovePhase, TurnEndPhase } from "#app/phases";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { StatusEffect } from "#app/enums/status-effect.js";
const TIMEOUT = 20 * 1000;
describe("Moves - Beak Blast", () => {
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")
.ability(Abilities.UNNERVE)
.moveset([Moves.BEAK_BLAST])
.enemySpecies(Species.SNORLAX)
.enemyAbility(Abilities.INSOMNIA)
.enemyMoveset(Array(4).fill(Moves.TACKLE))
.startingLevel(100)
.enemyLevel(100);
});
it(
"should add a charge effect that burns attackers on contact",
async () => {
await game.startBattle([Species.BLASTOISE]);
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN);
}, TIMEOUT
);
it(
"should still charge and burn opponents if the user is sleeping",
async () => {
game.override.statusEffect(StatusEffect.SLEEP);
await game.startBattle([Species.BLASTOISE]);
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN);
}, TIMEOUT
);
it(
"should not burn attackers that don't make contact",
async () => {
game.override.enemyMoveset(Array(4).fill(Moves.WATER_GUN));
await game.startBattle([Species.BLASTOISE]);
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.status?.effect).not.toBe(StatusEffect.BURN);
}, TIMEOUT
);
it(
"should only hit twice with Multi-Lens",
async () => {
game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.BLASTOISE]);
const leadPokemon = game.scene.getPlayerPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
await game.phaseInterceptor.to(BerryPhase, false);
expect(leadPokemon.turnData.hitCount).toBe(2);
}, TIMEOUT
);
it(
"should be blocked by Protect",
async () => {
game.override.enemyMoveset(Array(4).fill(Moves.PROTECT));
await game.startBattle([Species.BLASTOISE]);
const leadPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BEAK_BLAST));
await game.phaseInterceptor.to(MovePhase, false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeUndefined();
}, TIMEOUT
);
});

View File

@ -2,10 +2,11 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/utils/gameManager";
import { Species } from "#app/enums/species.js";
import { SPLASH_ONLY } from "../utils/testUtils";
import { mockTurnOrder, SPLASH_ONLY } from "../utils/testUtils";
import { Moves } from "#app/enums/moves.js";
import { getMovePosition } from "../utils/gameManagerUtils";
import { MoveEffectPhase } from "#app/phases.js";
import { BattlerIndex } from "#app/battle.js";
describe("Internals", () => {
let phaserGame: Phaser.Game;
@ -38,6 +39,7 @@ describe("Internals", () => {
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.CONFUSION));
await mockTurnOrder(game, [BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.toNextTurn();
expect(enemy.hp).toBe(enemy.getMaxHp());

View File

@ -51,6 +51,9 @@ describe("UI - Starter select", () => {
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
handler.processInput(Button.RIGHT);
handler.processInput(Button.LEFT);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.V);
handler.processInput(Button.V);
handler.processInput(Button.ACTION);
game.phaseInterceptor.unlock();
});
@ -112,6 +115,9 @@ describe("UI - Starter select", () => {
handler.processInput(Button.RIGHT);
handler.processInput(Button.LEFT);
handler.processInput(Button.CYCLE_GENDER);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.V);
handler.processInput(Button.V);
handler.processInput(Button.ACTION);
game.phaseInterceptor.unlock();
});
@ -176,6 +182,9 @@ describe("UI - Starter select", () => {
handler.processInput(Button.CYCLE_GENDER);
handler.processInput(Button.CYCLE_NATURE);
handler.processInput(Button.CYCLE_ABILITY);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.V);
handler.processInput(Button.V);
handler.processInput(Button.ACTION);
game.phaseInterceptor.unlock();
});
@ -238,6 +247,9 @@ describe("UI - Starter select", () => {
handler.processInput(Button.RIGHT);
handler.processInput(Button.LEFT);
handler.processInput(Button.CYCLE_GENDER);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.V);
handler.processInput(Button.V);
handler.processInput(Button.ACTION);
game.phaseInterceptor.unlock();
});
@ -298,7 +310,6 @@ describe("UI - Starter select", () => {
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
handler.processInput(Button.RIGHT);
handler.processInput(Button.LEFT);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.ACTION);
game.phaseInterceptor.unlock();
});
@ -358,7 +369,7 @@ describe("UI - Starter select", () => {
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
handler.processInput(Button.RIGHT);
handler.processInput(Button.LEFT);
handler.processInput(Button.V);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.V);
handler.processInput(Button.ACTION);
game.phaseInterceptor.unlock();
@ -419,7 +430,7 @@ describe("UI - Starter select", () => {
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
handler.processInput(Button.RIGHT);
handler.processInput(Button.LEFT);
handler.processInput(Button.V);
handler.processInput(Button.CYCLE_SHINY);
handler.processInput(Button.V);
handler.processInput(Button.V);
handler.processInput(Button.ACTION);

View File

@ -1303,11 +1303,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const isPartyValid = this.isPartyValid();
const isValidForChallenge = new Utils.BooleanHolder(true);
if (isPartyValid) {
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true)), this.starterSpecies.length !== 0);
} else {
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true)), this.starterSpecies.length !== 0, false, false);
}
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)), isPartyValid);
const currentPartyValue = this.starterSpecies.map(s => s.generation).reduce((total: number, gen: number, i: number) => total += this.scene.gameData.getSpeciesStarterValue(this.starterSpecies[i].speciesId), 0);
const newCost = this.scene.gameData.getSpeciesStarterValue(species.speciesId);
@ -1661,7 +1658,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
success = true;
}
} else {
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.dexAttrCursor);
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.getCurrentDexProps(this.lastSpecies.speciesId));
// prepare persistent starter data to store changes
let starterAttributes = this.starterPreferences[this.lastSpecies.speciesId];
if (!starterAttributes) {
@ -1671,8 +1668,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
case Button.CYCLE_SHINY:
if (this.canCycleShiny) {
const newVariant = props.variant;
starterAttributes.shiny = starterAttributes.shiny ? !starterAttributes.shiny : true;
this.setSpeciesDetails(this.lastSpecies, !props.shiny, undefined, undefined, props.shiny ? 0 : undefined, undefined, undefined);
if (this.dexAttrCursor & DexAttr.SHINY) {
if (starterAttributes.shiny) {
this.scene.playSound("sparkle");
// Set the variant label to the shiny tint
const tint = getVariantTint(newVariant);
@ -1680,6 +1678,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonShinyIcon.setTint(tint);
this.pokemonShinyIcon.setVisible(true);
} else {
// starterAttributes.variant = 0;
if (starterAttributes?.variant) {
delete starterAttributes.variant;
}
this.pokemonShinyIcon.setVisible(false);
success = true;
}
@ -1948,6 +1950,13 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.updateInstructions();
}
updatePartyIcon(species: PokemonSpecies, index: number) {
const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId));
this.starterIcons[index].setTexture(species.getIconAtlasKey(props.formIndex, props.shiny, props.variant));
this.starterIcons[index].setFrame(species.getIconId(props.female, props.formIndex, props.shiny, props.variant));
this.checkIconId(this.starterIcons[index], species, props.female, props.formIndex, props.shiny, props.variant);
}
switchMoveHandler(i: number, newMove: Moves, move: Moves) {
const speciesId = this.lastSpecies.speciesId;
const existingMoveIndex = this.starterMoveset?.indexOf(newMove)!; // TODO: is this bang correct?
@ -2099,9 +2108,24 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
// pre filter for challenges
if (this.scene.gameMode.modeId === GameModes.CHALLENGE) {
this.starterContainers.forEach(container => {
const species = container.species;
let allFormsValid = false;
if (species.forms?.length > 0) {
for (let i = 0; i < species.forms.length; i++) {
/* Here we are making a fake form index dex props for challenges
* Since some pokemon rely on forms to be valid (i.e. blaze tauros for fire challenges), we make a fake form and dex props to use in the challenge
*/
const tempFormProps = BigInt(Math.pow(2, i)) * DexAttr.DEFAULT_FORM;
const isValidForChallenge = new Utils.BooleanHolder(true);
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, container.species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(container.species, this.scene.gameData.getSpeciesDefaultDexAttr(container.species, false, true)), true);
if (isValidForChallenge.value) {
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, container.species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, tempFormProps), true);
allFormsValid = allFormsValid || isValidForChallenge.value;
}
} else {
const isValidForChallenge = new Utils.BooleanHolder(true);
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, container.species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(container.species, false, true)), true);
allFormsValid = isValidForChallenge.value;
}
if (allFormsValid) {
this.validStarterContainers.push(container);
} else {
container.setVisible(false);
@ -2111,6 +2135,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.validStarterContainers = this.starterContainers;
}
// this updates icons for previously saved pokemon
for (let i = 0; i < this.validStarterContainers.length; i++) {
const currentFilteredContainer = this.validStarterContainers[i];
const starterSprite = currentFilteredContainer.icon as Phaser.GameObjects.Sprite;
const currentDexAttr = this.getCurrentDexProps(currentFilteredContainer.species.speciesId);
const props = this.scene.gameData.getSpeciesDexAttrProps(currentFilteredContainer.species, currentDexAttr);
starterSprite.setTexture(currentFilteredContainer.species.getIconAtlasKey(props.formIndex, props.shiny, props.variant), currentFilteredContainer.species.getIconId(props.female!, props.formIndex, props.shiny, props.variant));
currentFilteredContainer.checkIconId(props.female, props.formIndex, props.shiny, props.variant);
}
// filter
this.validStarterContainers.forEach(container => {
container.setVisible(false);
@ -2336,9 +2372,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const species = this.filteredStarterContainers[cursor]?.species;
if (species) {
const defaultDexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true);
const defaultDexAttr = this.getCurrentDexProps(species.speciesId);
const defaultProps = this.scene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
const variant = defaultProps.variant;
const variant = this.starterPreferences[species.speciesId]?.variant ? this.starterPreferences[species.speciesId].variant as Variant : defaultProps.variant;
const tint = getVariantTint(variant);
this.pokemonShinyIcon.setFrame(getVariantIcon(variant));
this.pokemonShinyIcon.setTint(tint);
@ -2384,7 +2420,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
setSpecies(species: PokemonSpecies | null) {
this.speciesStarterDexEntry = species ? this.scene.gameData.dexData[species.speciesId] : null;
this.dexAttrCursor = species ? this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true) : 0n;
this.dexAttrCursor = species ? this.getCurrentDexProps(species.speciesId) : 0n;
this.abilityCursor = species ? this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species) : 0;
this.natureCursor = species ? this.scene.gameData.getSpeciesDefaultNature(species) : 0;
@ -2454,7 +2490,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
if (this.lastSpecies) {
const dexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(this.lastSpecies, false, true);
const dexAttr = this.getCurrentDexProps(this.lastSpecies.speciesId);
const props = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, dexAttr);
const speciesIndex = this.allSpecies.indexOf(this.lastSpecies);
const lastSpeciesIcon = this.starterContainers[speciesIndex].icon;
@ -2480,7 +2516,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonLuckText.setText(luck.toString());
this.pokemonLuckText.setTint(getVariantTint(Math.min(luck - 1, 2) as Variant));
this.pokemonLuckLabelText.setVisible(this.pokemonLuckText.visible);
this.pokemonShinyIcon.setVisible(this.pokemonLuckText.visible);
this.pokemonShinyIcon.setVisible(this.starterPreferences[species.speciesId]?.shiny ?? false);
//Growth translate
let growthReadable = Utils.toReadableString(GrowthRate[species.growthRate]);
@ -2504,7 +2540,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonHatchedIcon.setFrame(getEggTierForSpecies(species));
}
this.pokemonHatchedCountText.setText(`${this.speciesStarterDexEntry.hatchedCount}`);
const defaultDexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true);
const defaultDexAttr = this.getCurrentDexProps(species.speciesId);
const defaultProps = this.scene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
const variant = defaultProps.variant;
const tint = getVariantTint(variant);
@ -2578,13 +2614,13 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
props = this.scene.gameData.getSpeciesDexAttrProps(species, this.starterAttr[starterIndex]);
this.setSpeciesDetails(species, props.shiny, props.formIndex, props.female, props.variant, this.starterAbilityIndexes[starterIndex], this.starterNatures[starterIndex]);
} else {
const defaultDexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true);
const defaultDexAttr = this.getCurrentDexProps(species.speciesId);
const defaultAbilityIndex = starterAttributes?.ability ?? this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species);
// load default nature from stater save data, if set
const defaultNature = starterAttributes?.nature || this.scene.gameData.getSpeciesDefaultNature(species);
props = this.scene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
if (starterAttributes?.variant && !isNaN(starterAttributes.variant)) {
if (props.shiny = (starterAttributes.variant >= 0)) {
if (props.shiny) {
props.variant = starterAttributes.variant as Variant;
}
}
@ -2679,6 +2715,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.dexAttrCursor |= this.scene.gameData.getFormAttr(formIndex !== undefined ? formIndex : (formIndex = oldProps!.formIndex)); // TODO: is this bang correct?
this.abilityCursor = abilityIndex !== undefined ? abilityIndex : (abilityIndex = oldAbilityIndex);
this.natureCursor = natureIndex !== undefined ? natureIndex : (natureIndex = oldNatureIndex);
const [isInParty, partyIndex]: [boolean, number] = this.isInParty(species); // we use this to firstly check if the pokemon is in the party, and if so, to get the party index in order to update the icon image
if (isInParty) {
this.updatePartyIcon(species, partyIndex);
}
}
this.pokemonSprite.setVisible(false);
@ -2695,7 +2735,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const dexEntry = this.scene.gameData.dexData[species.speciesId];
const abilityAttr = this.scene.gameData.starterData[species.speciesId].abilityAttr;
if (!dexEntry.caughtAttr) {
const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(species, forSeen, !forSeen));
const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId));
const defaultAbilityIndex = this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species);
const defaultNature = this.scene.gameData.getSpeciesDefaultNature(species);
if (shiny === undefined || shiny !== props.shiny) {
@ -2750,9 +2790,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const isValidForChallenge = new Utils.BooleanHolder(true);
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor), !!this.starterSpecies.length);
const starterSprite = this.filteredStarterContainers[this.cursor].icon as Phaser.GameObjects.Sprite;
starterSprite.setTexture(species.getIconAtlasKey(formIndex, shiny, variant), species.getIconId(female!, formIndex, shiny, variant)); // TODO: is this bang correct?
this.filteredStarterContainers[this.cursor].checkIconId(female, formIndex, shiny, variant);
const currentFilteredContainer = this.filteredStarterContainers.find(p => p.species.speciesId === species.speciesId)!;
const starterSprite = currentFilteredContainer.icon as Phaser.GameObjects.Sprite;
starterSprite.setTexture(species.getIconAtlasKey(formIndex, shiny, variant), species.getIconId(female!, formIndex, shiny, variant));
currentFilteredContainer.checkIconId(female, formIndex, shiny, variant);
this.canCycleShiny = !!(dexEntry.caughtAttr & DexAttr.NON_SHINY && dexEntry.caughtAttr & DexAttr.SHINY);
this.canCycleGender = !!(dexEntry.caughtAttr & DexAttr.MALE && dexEntry.caughtAttr & DexAttr.FEMALE);
this.canCycleAbility = [ abilityAttr & AbilityAttr.ABILITY_1, (abilityAttr & AbilityAttr.ABILITY_2) && species.ability2, abilityAttr & AbilityAttr.ABILITY_HIDDEN ].filter(a => a).length > 1;
@ -2876,6 +2917,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonAdditionalMoveCountLabel.setText(`(+${Math.max(this.speciesStarterMoves.length - 4, 0)})`);
this.pokemonAdditionalMoveCountLabel.setVisible(this.speciesStarterMoves.length > 4);
this.tryUpdateValue();
this.updateInstructions();
}
@ -2903,7 +2946,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
for (let s = 0; s < this.starterSpecies.length; s++) {
const species = this.starterSpecies[s];
const currentDexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true);
const currentDexAttr = this.getCurrentDexProps(species.speciesId);
const props = this.scene.gameData.getSpeciesDexAttrProps(species, currentDexAttr);
this.starterIcons[s].setTexture(species.getIconAtlasKey(props.formIndex, props.shiny, props.variant));
this.starterIcons[s].setFrame(species.getIconId(props.female, props.formIndex, props.shiny, props.variant));
@ -2984,7 +3027,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
if (addingToParty) { // this does a check to see if the pokemon being added is valid; if so, it will update the isPartyValid boolean
const isNewPokemonValid = new Utils.BooleanHolder(true);
const species = this.filteredStarterContainers[this.cursor].species;
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isNewPokemonValid, this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(species, false, true)), !!(this.starterSpecies.length), false, false);
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isNewPokemonValid, this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)), false);
isPartyValid = isPartyValid || isNewPokemonValid.value;
}
@ -3013,11 +3056,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
* we change to can AddParty value to true since the user has enough cost to choose this pokemon and this pokemon registered too.
*/
const isValidForChallenge = new Utils.BooleanHolder(true);
if (isPartyValid) { // we have two checks here - one for the party being valid and one for not. This comes from mono type challenges - if the party is valid it will check pokemon's evolutions and forms, and if it's not valid it won't check their evolutions and forms
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, this.allSpecies[s], isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(this.allSpecies[s], this.scene.gameData.getSpeciesDefaultDexAttr(this.allSpecies[s], false, true)), !!(this.starterSpecies.length + (add ? 1 : 0)));
} else {
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, this.allSpecies[s], isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(this.allSpecies[s], this.scene.gameData.getSpeciesDefaultDexAttr(this.allSpecies[s], false, true)), !!(this.starterSpecies.length + (add ? 1 : 0)), false, false);
}
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, this.allSpecies[s], isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(this.allSpecies[s], this.getCurrentDexProps(this.allSpecies[s].speciesId)), isPartyValid);
const canBeChosen = remainValue >= speciesStarterValue && isValidForChallenge.value;
@ -3132,12 +3171,50 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
for (let s = 0; s < this.starterSpecies.length; s++) {
const isValidForChallenge = new Utils.BooleanHolder(true);
const species = this.starterSpecies[s];
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor), this.starterSpecies.length !== 0, false, false);
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)), false);
canStart = canStart || isValidForChallenge.value;
}
return canStart;
}
/* this creates a temporary dex attr props that we use to check whether a pokemon is valid for a challenge.
* when checking for certain challenges (i.e. mono type), we need to check for form changes AND evolutions
* However, since some pokemon can evolve based on their intial gender/form, we need a way to look for that
* This temporary dex attr will therefore ONLY look at gender and form, since there's no cases of shinies/variants
* having different evolutions to their non shiny/variant part, and so those can be ignored
* Since the current form and gender is stored in the starter preferences, this is where we get the values from
*/
getCurrentDexProps(speciesId: number): bigint {
let props = 0n;
if (this.starterPreferences[speciesId]?.female) { // this checks the gender of the pokemon
props += DexAttr.FEMALE;
} else {
props += DexAttr.MALE;
}
if (this.starterPreferences[speciesId]?.shiny) {
props += DexAttr.SHINY;
if (this.starterPreferences[speciesId]?.variant) {
props += BigInt(Math.pow(2, this.starterPreferences[speciesId]?.variant)) * DexAttr.DEFAULT_VARIANT;
} else {
props += DexAttr.DEFAULT_VARIANT;
}
} else {
props += DexAttr.NON_SHINY;
if (this.starterPreferences[speciesId]?.variant) {
delete this.starterPreferences[speciesId].variant;
}
props += DexAttr.DEFAULT_VARIANT; // we add the default variant here because non shiny versions are listed as default variant
}
if (this.starterPreferences[speciesId]?.form) { // this checks for the form of the pokemon
props += BigInt(Math.pow(2, this.starterPreferences[speciesId]?.form)) * DexAttr.DEFAULT_FORM;
} else {
props += DexAttr.DEFAULT_FORM;
}
return props;
}
toggleStatsMode(on?: boolean): void {
if (on === undefined) {
on = !this.statsMode;