mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-24 16:29:27 +02:00
Merge branch 'beta' into pledge-moves
This commit is contained in:
commit
1dca228aff
43
package-lock.json
generated
43
package-lock.json
generated
@ -37,7 +37,7 @@
|
|||||||
"typedoc": "^0.26.4",
|
"typedoc": "^0.26.4",
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"typescript-eslint": "^8.0.0-alpha.54",
|
"typescript-eslint": "^8.0.0-alpha.54",
|
||||||
"vite": "^5.3.5",
|
"vite": "^5.4.8",
|
||||||
"vite-tsconfig-paths": "^4.3.2",
|
"vite-tsconfig-paths": "^4.3.2",
|
||||||
"vitest": "^2.0.4",
|
"vitest": "^2.0.4",
|
||||||
"vitest-canvas-mock": "^0.3.3"
|
"vitest-canvas-mock": "^0.3.3"
|
||||||
@ -3650,7 +3650,6 @@
|
|||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"darwin"
|
||||||
@ -5042,7 +5041,6 @@
|
|||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"nanoid": "bin/nanoid.cjs"
|
"nanoid": "bin/nanoid.cjs"
|
||||||
},
|
},
|
||||||
@ -5441,9 +5439,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.4.39",
|
"version": "8.4.47",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz",
|
||||||
"integrity": "sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==",
|
"integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -5459,16 +5457,21 @@
|
|||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.7",
|
"nanoid": "^3.3.7",
|
||||||
"picocolors": "^1.0.1",
|
"picocolors": "^1.1.0",
|
||||||
"source-map-js": "^1.2.0"
|
"source-map-js": "^1.2.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/postcss/node_modules/picocolors": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/prelude-ls": {
|
"node_modules/prelude-ls": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||||
@ -5865,11 +5868,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
|
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@ -6469,15 +6471,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "5.3.5",
|
"version": "5.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz",
|
||||||
"integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==",
|
"integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.21.3",
|
"esbuild": "^0.21.3",
|
||||||
"postcss": "^8.4.39",
|
"postcss": "^8.4.43",
|
||||||
"rollup": "^4.13.0"
|
"rollup": "^4.20.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"vite": "bin/vite.js"
|
"vite": "bin/vite.js"
|
||||||
@ -6496,6 +6497,7 @@
|
|||||||
"less": "*",
|
"less": "*",
|
||||||
"lightningcss": "^1.21.0",
|
"lightningcss": "^1.21.0",
|
||||||
"sass": "*",
|
"sass": "*",
|
||||||
|
"sass-embedded": "*",
|
||||||
"stylus": "*",
|
"stylus": "*",
|
||||||
"sugarss": "*",
|
"sugarss": "*",
|
||||||
"terser": "^5.4.0"
|
"terser": "^5.4.0"
|
||||||
@ -6513,6 +6515,9 @@
|
|||||||
"sass": {
|
"sass": {
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"sass-embedded": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"stylus": {
|
"stylus": {
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
"typedoc": "^0.26.4",
|
"typedoc": "^0.26.4",
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"typescript-eslint": "^8.0.0-alpha.54",
|
"typescript-eslint": "^8.0.0-alpha.54",
|
||||||
"vite": "^5.3.5",
|
"vite": "^5.4.8",
|
||||||
"vite-tsconfig-paths": "^4.3.2",
|
"vite-tsconfig-paths": "^4.3.2",
|
||||||
"vitest": "^2.0.4",
|
"vitest": "^2.0.4",
|
||||||
"vitest-canvas-mock": "^0.3.3"
|
"vitest-canvas-mock": "^0.3.3"
|
||||||
|
@ -1040,10 +1040,6 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
this.gameMode = getGameMode(GameModes.CLASSIC);
|
this.gameMode = getGameMode(GameModes.CLASSIC);
|
||||||
|
|
||||||
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
|
|
||||||
console.log("Seed:", this.seed);
|
|
||||||
this.resetSeed(); // Properly resets RNG after saving and quitting a session
|
|
||||||
|
|
||||||
this.disableMenu = false;
|
this.disableMenu = false;
|
||||||
|
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
@ -1078,6 +1074,12 @@ export default class BattleScene extends SceneBase {
|
|||||||
//@ts-ignore - allowing `null` for currentBattle causes a lot of trouble
|
//@ts-ignore - allowing `null` for currentBattle causes a lot of trouble
|
||||||
this.currentBattle = null; // TODO: resolve ts-ignore
|
this.currentBattle = null; // TODO: resolve ts-ignore
|
||||||
|
|
||||||
|
// Reset RNG after end of game or save & quit.
|
||||||
|
// This needs to happen after clearing this.currentBattle or the seed will be affected by the last wave played
|
||||||
|
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
|
||||||
|
console.log("Seed:", this.seed);
|
||||||
|
this.resetSeed();
|
||||||
|
|
||||||
this.biomeWaveText.setText(startingWave.toString());
|
this.biomeWaveText.setText(startingWave.toString());
|
||||||
this.biomeWaveText.setVisible(false);
|
this.biomeWaveText.setVisible(false);
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[], rand
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 1/3 chance for evil team grunts to be double battles */
|
/* 1/3 chance for evil team grunts to be double battles */
|
||||||
const evilTeamGrunts = [TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT];
|
const evilTeamGrunts = [TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.AETHER_GRUNT, TrainerType.SKULL_GRUNT, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT];
|
||||||
const isEvilTeamGrunt = evilTeamGrunts.includes(trainerTypes[rand]);
|
const isEvilTeamGrunt = evilTeamGrunts.includes(trainerTypes[rand]);
|
||||||
|
|
||||||
if (trainerConfigs[trainerTypes[rand]].hasDouble && isEvilTeamGrunt) {
|
if (trainerConfigs[trainerTypes[rand]].hasDouble && isEvilTeamGrunt) {
|
||||||
|
@ -4,7 +4,7 @@ import { Constructor } from "#app/utils";
|
|||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { getPokemonNameWithAffix } from "../messages";
|
import { getPokemonNameWithAffix } from "../messages";
|
||||||
import { Weather, WeatherType } from "./weather";
|
import { Weather, WeatherType } from "./weather";
|
||||||
import { BattlerTag, GroundedTag, GulpMissileTag, SemiInvulnerableTag } from "./battler-tags";
|
import { BattlerTag, GroundedTag } from "./battler-tags";
|
||||||
import { StatusEffect, getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
import { StatusEffect, getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
||||||
import { Gender } from "./gender";
|
import { Gender } from "./gender";
|
||||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, MoveAttr, MultiHitAttr, ChargeAttr, SacrificialAttr, SacrificialAttrOnHit, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move";
|
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, MoveAttr, MultiHitAttr, ChargeAttr, SacrificialAttr, SacrificialAttrOnHit, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move";
|
||||||
@ -536,53 +536,6 @@ export class PostDefendAbAttr extends AbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the effects of Gulp Missile when the user is hit by an attack.
|
|
||||||
* @extends PostDefendAbAttr
|
|
||||||
*/
|
|
||||||
export class PostDefendGulpMissileAbAttr extends PostDefendAbAttr {
|
|
||||||
constructor() {
|
|
||||||
super(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Damages the attacker and triggers the secondary effect based on the form or the BattlerTagType.
|
|
||||||
* @param {Pokemon} pokemon - The defending Pokemon.
|
|
||||||
* @param passive - n/a
|
|
||||||
* @param {Pokemon} attacker - The attacking Pokemon.
|
|
||||||
* @param {Move} move - The move being used.
|
|
||||||
* @param {HitResult} hitResult - n/a
|
|
||||||
* @param {any[]} args - n/a
|
|
||||||
* @returns Whether the effects of the ability are applied.
|
|
||||||
*/
|
|
||||||
applyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean | Promise<boolean> {
|
|
||||||
const battlerTag = pokemon.getTag(GulpMissileTag);
|
|
||||||
if (!battlerTag || move.category === MoveCategory.STATUS || pokemon.getTag(SemiInvulnerableTag)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (simulated) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
|
||||||
applyAbAttrs(BlockNonDirectDamageAbAttr, attacker, cancelled);
|
|
||||||
|
|
||||||
if (!cancelled.value) {
|
|
||||||
attacker.damageAndUpdate(Math.max(1, Math.floor(attacker.getMaxHp() / 4)), HitResult.OTHER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (battlerTag.tagType === BattlerTagType.GULP_MISSILE_ARROKUDA) {
|
|
||||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, attacker.getBattlerIndex(), false, [ Stat.DEF ], -1));
|
|
||||||
} else {
|
|
||||||
attacker.trySetStatus(StatusEffect.PARALYSIS, true, pokemon);
|
|
||||||
}
|
|
||||||
|
|
||||||
pokemon.removeTag(battlerTag.tagType);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FieldPriorityMoveImmunityAbAttr extends PreDefendAbAttr {
|
export class FieldPriorityMoveImmunityAbAttr extends PreDefendAbAttr {
|
||||||
applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
const attackPriority = new Utils.IntegerHolder(move.priority);
|
const attackPriority = new Utils.IntegerHolder(move.priority);
|
||||||
@ -5210,8 +5163,7 @@ export function initAbilities() {
|
|||||||
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonMoldBreaker", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
|
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonMoldBreaker", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
|
||||||
.attr(MoveAbilityBypassAbAttr),
|
.attr(MoveAbilityBypassAbAttr),
|
||||||
new Ability(Abilities.SUPER_LUCK, 4)
|
new Ability(Abilities.SUPER_LUCK, 4)
|
||||||
.attr(BonusCritAbAttr)
|
.attr(BonusCritAbAttr),
|
||||||
.partial(),
|
|
||||||
new Ability(Abilities.AFTERMATH, 4)
|
new Ability(Abilities.AFTERMATH, 4)
|
||||||
.attr(PostFaintContactDamageAbAttr, 4)
|
.attr(PostFaintContactDamageAbAttr, 4)
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
@ -5669,13 +5621,19 @@ export function initAbilities() {
|
|||||||
new Ability(Abilities.MIRROR_ARMOR, 8)
|
new Ability(Abilities.MIRROR_ARMOR, 8)
|
||||||
.ignorable()
|
.ignorable()
|
||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
|
/**
|
||||||
|
* Right now, the logic is attached to Surf and Dive moves. Ideally, the post-defend/hit should be an
|
||||||
|
* ability attribute but the current implementation of move effects for BattlerTag does not support this- in the case
|
||||||
|
* where Cramorant is fainted.
|
||||||
|
* @see {@linkcode GulpMissileTagAttr} and {@linkcode GulpMissileTag} for Gulp Missile implementation
|
||||||
|
*/
|
||||||
new Ability(Abilities.GULP_MISSILE, 8)
|
new Ability(Abilities.GULP_MISSILE, 8)
|
||||||
.attr(UnsuppressableAbilityAbAttr)
|
.attr(UnsuppressableAbilityAbAttr)
|
||||||
.attr(NoTransformAbilityAbAttr)
|
.attr(NoTransformAbilityAbAttr)
|
||||||
.attr(NoFusionAbilityAbAttr)
|
.attr(NoFusionAbilityAbAttr)
|
||||||
.attr(UncopiableAbilityAbAttr)
|
.attr(UncopiableAbilityAbAttr)
|
||||||
.attr(UnswappableAbilityAbAttr)
|
.attr(UnswappableAbilityAbAttr)
|
||||||
.attr(PostDefendGulpMissileAbAttr),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.STALWART, 8)
|
new Ability(Abilities.STALWART, 8)
|
||||||
.attr(BlockRedirectAbAttr),
|
.attr(BlockRedirectAbAttr),
|
||||||
new Ability(Abilities.STEAM_ENGINE, 8)
|
new Ability(Abilities.STEAM_ENGINE, 8)
|
||||||
|
@ -2123,7 +2123,36 @@ export class StockpilingTag extends BattlerTag {
|
|||||||
*/
|
*/
|
||||||
export class GulpMissileTag extends BattlerTag {
|
export class GulpMissileTag extends BattlerTag {
|
||||||
constructor(tagType: BattlerTagType, sourceMove: Moves) {
|
constructor(tagType: BattlerTagType, sourceMove: Moves) {
|
||||||
super(tagType, BattlerTagLapseType.CUSTOM, 0, sourceMove);
|
super(tagType, BattlerTagLapseType.HIT, 0, sourceMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
|
if (pokemon.getTag(BattlerTagType.UNDERWATER)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const moveEffectPhase = pokemon.scene.getCurrentPhase();
|
||||||
|
if (moveEffectPhase instanceof MoveEffectPhase) {
|
||||||
|
const attacker = moveEffectPhase.getUserPokemon();
|
||||||
|
|
||||||
|
if (!attacker) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancelled = new Utils.BooleanHolder(false);
|
||||||
|
applyAbAttrs(BlockNonDirectDamageAbAttr, attacker, cancelled);
|
||||||
|
|
||||||
|
if (!cancelled.value) {
|
||||||
|
attacker.damageAndUpdate(Math.max(1, Math.floor(attacker.getMaxHp() / 4)), HitResult.OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.tagType === BattlerTagType.GULP_MISSILE_ARROKUDA) {
|
||||||
|
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, attacker.getBattlerIndex(), false, [ Stat.DEF ], -1));
|
||||||
|
} else {
|
||||||
|
attacker.trySetStatus(StatusEffect.PARALYSIS, true, pokemon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2589,6 +2618,43 @@ export class ImprisonTag extends MoveRestrictionBattlerTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Battler Tag that applies the effects of Syrup Bomb to the target Pokemon.
|
||||||
|
* For three turns, starting from the turn of hit, at the end of each turn, the target Pokemon's speed will decrease by 1.
|
||||||
|
* The tag can also expire by taking the target Pokemon off the field.
|
||||||
|
*/
|
||||||
|
export class SyrupBombTag extends BattlerTag {
|
||||||
|
constructor() {
|
||||||
|
super(BattlerTagType.SYRUP_BOMB, BattlerTagLapseType.TURN_END, 3, Moves.SYRUP_BOMB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the Syrup Bomb battler tag to the target Pokemon.
|
||||||
|
* @param {Pokemon} pokemon the target Pokemon
|
||||||
|
*/
|
||||||
|
override onAdd(pokemon: Pokemon) {
|
||||||
|
super.onAdd(pokemon);
|
||||||
|
pokemon.scene.queueMessage(i18next.t("battlerTags:syrupBombOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the single-stage speed down to the target Pokemon and decrements the tag's turn count
|
||||||
|
* @param {Pokemon} pokemon the target Pokemon
|
||||||
|
* @param {BattlerTagLapseType} _lapseType
|
||||||
|
* @returns `true` if the turnCount is still greater than 0 | `false` if the turnCount is 0 or the target Pokemon has been removed from the field
|
||||||
|
*/
|
||||||
|
override lapse(pokemon: Pokemon, _lapseType: BattlerTagLapseType): boolean {
|
||||||
|
if (!pokemon.isActive(true)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pokemon.scene.queueMessage(i18next.t("battlerTags:syrupBombLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })); // Custom message in lieu of an animation in mainline
|
||||||
|
pokemon.scene.unshiftPhase(new StatStageChangePhase(
|
||||||
|
pokemon.scene, pokemon.getBattlerIndex(), true,
|
||||||
|
[Stat.SPD], -1, true, false, true
|
||||||
|
));
|
||||||
|
return --this.turnCount > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
||||||
@ -2763,6 +2829,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||||||
return new TauntTag();
|
return new TauntTag();
|
||||||
case BattlerTagType.IMPRISON:
|
case BattlerTagType.IMPRISON:
|
||||||
return new ImprisonTag(sourceId);
|
return new ImprisonTag(sourceId);
|
||||||
|
case BattlerTagType.SYRUP_BOMB:
|
||||||
|
return new SyrupBombTag();
|
||||||
case BattlerTagType.NONE:
|
case BattlerTagType.NONE:
|
||||||
default:
|
default:
|
||||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||||
|
@ -9111,7 +9111,7 @@ export function initMoves() {
|
|||||||
.partial()
|
.partial()
|
||||||
.ignoresVirtual(),
|
.ignoresVirtual(),
|
||||||
/* End Unused */
|
/* End Unused */
|
||||||
new AttackMove(Moves.ZIPPY_ZAP, Type.ELECTRIC, MoveCategory.PHYSICAL, 50, 100, 15, 100, 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)
|
||||||
@ -9796,9 +9796,8 @@ export function initMoves() {
|
|||||||
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
||||||
.triageMove(),
|
.triageMove(),
|
||||||
new AttackMove(Moves.SYRUP_BOMB, Type.GRASS, MoveCategory.SPECIAL, 60, 85, 10, -1, 0, 9)
|
new AttackMove(Moves.SYRUP_BOMB, Type.GRASS, MoveCategory.SPECIAL, 60, 85, 10, -1, 0, 9)
|
||||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1) //Temporary
|
.attr(AddBattlerTagAttr, BattlerTagType.SYRUP_BOMB, false, false, 3)
|
||||||
.ballBombMove()
|
.ballBombMove(),
|
||||||
.partial(),
|
|
||||||
new AttackMove(Moves.IVY_CUDGEL, Type.GRASS, MoveCategory.PHYSICAL, 100, 100, 10, -1, 0, 9)
|
new AttackMove(Moves.IVY_CUDGEL, Type.GRASS, MoveCategory.PHYSICAL, 100, 100, 10, -1, 0, 9)
|
||||||
.attr(IvyCudgelTypeAttr)
|
.attr(IvyCudgelTypeAttr)
|
||||||
.attr(HighCritAttr)
|
.attr(HighCritAttr)
|
||||||
|
@ -85,4 +85,5 @@ export enum BattlerTagType {
|
|||||||
TORMENT = "TORMENT",
|
TORMENT = "TORMENT",
|
||||||
TAUNT = "TAUNT",
|
TAUNT = "TAUNT",
|
||||||
IMPRISON = "IMPRISON",
|
IMPRISON = "IMPRISON",
|
||||||
|
SYRUP_BOMB = "SYRUP_BOMB",
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,12 @@ import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
|
|||||||
import { MysteryEncounterPokemonData } from "#app/data/mystery-encounters/mystery-encounter-pokemon-data";
|
import { MysteryEncounterPokemonData } from "#app/data/mystery-encounters/mystery-encounter-pokemon-data";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
|
|
||||||
|
/** `64/65536 -> 1/1024` */
|
||||||
|
const BASE_SHINY_CHANCE = 64;
|
||||||
|
|
||||||
|
/** `1/256` */
|
||||||
|
const BASE_HIDDEN_ABILITY_CHANCE = 256;
|
||||||
|
|
||||||
export enum FieldPosition {
|
export enum FieldPosition {
|
||||||
CENTER,
|
CENTER,
|
||||||
LEFT,
|
LEFT,
|
||||||
@ -139,7 +145,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
throw `Cannot create a player Pokemon for species '${species.getName(formIndex)}'`;
|
throw `Cannot create a player Pokemon for species '${species.getName(formIndex)}'`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hiddenAbilityChance = new Utils.IntegerHolder(256);
|
const hiddenAbilityChance = new Utils.IntegerHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
||||||
if (!this.hasTrainer()) {
|
if (!this.hasTrainer()) {
|
||||||
this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
||||||
}
|
}
|
||||||
@ -1824,7 +1830,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* The exact mechanic is that it calculates E as the XOR of the player's trainer ID and secret ID.
|
* The exact mechanic is that it calculates E as the XOR of the player's trainer ID and secret ID.
|
||||||
* F is calculated as the XOR of the first 16 bits of the Pokemon's ID with the last 16 bits.
|
* F is calculated as the XOR of the first 16 bits of the Pokemon's ID with the last 16 bits.
|
||||||
* The XOR of E and F are then compared to the {@linkcode shinyThreshold} (or {@linkcode thresholdOverride} if set) to see whether or not to generate a shiny.
|
* The XOR of E and F are then compared to the {@linkcode shinyThreshold} (or {@linkcode thresholdOverride} if set) to see whether or not to generate a shiny.
|
||||||
* The base shiny odds are {@linkcode baseShinyChance} / 65536
|
* The base shiny odds are {@linkcode BASE_SHINY_CHANCE} / 65536
|
||||||
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance, overrides {@linkcode shinyThreshold} if set (bypassing shiny rate modifiers such as Shiny Charm)
|
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance, overrides {@linkcode shinyThreshold} if set (bypassing shiny rate modifiers such as Shiny Charm)
|
||||||
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -1840,9 +1846,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const E = this.scene.gameData.trainerId ^ this.scene.gameData.secretId;
|
const E = this.scene.gameData.trainerId ^ this.scene.gameData.secretId;
|
||||||
const F = rand1 ^ rand2;
|
const F = rand1 ^ rand2;
|
||||||
|
|
||||||
/** `64/65536 -> 1/1024` */
|
const shinyThreshold = new Utils.IntegerHolder(BASE_SHINY_CHANCE);
|
||||||
const baseShinyChance = 64;
|
|
||||||
const shinyThreshold = new Utils.IntegerHolder(baseShinyChance);
|
|
||||||
if (thresholdOverride === undefined) {
|
if (thresholdOverride === undefined) {
|
||||||
if (this.scene.eventManager.isEventActive()) {
|
if (this.scene.eventManager.isEventActive()) {
|
||||||
shinyThreshold.value *= this.scene.eventManager.getShinyMultiplier();
|
shinyThreshold.value *= this.scene.eventManager.getShinyMultiplier();
|
||||||
@ -1867,15 +1871,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* Function that tries to set a Pokemon shiny based on seed.
|
* Function that tries to set a Pokemon shiny based on seed.
|
||||||
* For manual use only, usually to roll a Pokemon's shiny chance a second time.
|
* For manual use only, usually to roll a Pokemon's shiny chance a second time.
|
||||||
*
|
*
|
||||||
* The base shiny odds are {@linkcode baseShinyChance} / 65536
|
* The base shiny odds are {@linkcode BASE_SHINY_CHANCE} / 65536
|
||||||
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance, overrides {@linkcode shinyThreshold} if set (bypassing shiny rate modifiers such as Shiny Charm)
|
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance, overrides {@linkcode shinyThreshold} if set (bypassing shiny rate modifiers such as Shiny Charm)
|
||||||
* @param applyModifiersToOverride If {@linkcode thresholdOverride} is set and this is true, will apply Shiny Charm and event modifiers to {@linkcode thresholdOverride}
|
* @param applyModifiersToOverride If {@linkcode thresholdOverride} is set and this is true, will apply Shiny Charm and event modifiers to {@linkcode thresholdOverride}
|
||||||
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
||||||
*/
|
*/
|
||||||
trySetShinySeed(thresholdOverride?: integer, applyModifiersToOverride?: boolean): boolean {
|
trySetShinySeed(thresholdOverride?: integer, applyModifiersToOverride?: boolean): boolean {
|
||||||
/** `64/65536 -> 1/1024` */
|
const shinyThreshold = new Utils.IntegerHolder(BASE_SHINY_CHANCE);
|
||||||
const baseShinyChance = 64;
|
|
||||||
const shinyThreshold = new Utils.IntegerHolder(baseShinyChance);
|
|
||||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
||||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
||||||
shinyThreshold.value = thresholdOverride;
|
shinyThreshold.value = thresholdOverride;
|
||||||
@ -1933,7 +1935,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateFusionSpecies(forStarter?: boolean): void {
|
generateFusionSpecies(forStarter?: boolean): void {
|
||||||
const hiddenAbilityChance = new Utils.IntegerHolder(256);
|
const hiddenAbilityChance = new Utils.IntegerHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
||||||
if (!this.hasTrainer()) {
|
if (!this.hasTrainer()) {
|
||||||
this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
this.scene.applyModifiers(HiddenAbilityRateBoosterModifier, true, hiddenAbilityChance);
|
||||||
}
|
}
|
||||||
@ -3982,7 +3984,8 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
let compatible = false;
|
let compatible = false;
|
||||||
for (const p of tmSpecies[tm]) {
|
for (const p of tmSpecies[tm]) {
|
||||||
if (Array.isArray(p)) {
|
if (Array.isArray(p)) {
|
||||||
if (p[0] === this.species.speciesId || (this.fusionSpecies && p[0] === this.fusionSpecies.speciesId) && p.slice(1).indexOf(this.species.forms[this.formIndex]) > -1) {
|
const [pkm, form] = p;
|
||||||
|
if ((pkm === this.species.speciesId || this.fusionSpecies && pkm === this.fusionSpecies.speciesId) && form === this.getFormKey()) {
|
||||||
compatible = true;
|
compatible = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,5 +78,7 @@
|
|||||||
"tormentOnAdd": "{{pokemonNameWithAffix}} was subjected to torment!",
|
"tormentOnAdd": "{{pokemonNameWithAffix}} was subjected to torment!",
|
||||||
"tauntOnAdd": "{{pokemonNameWithAffix}} fell for the taunt!",
|
"tauntOnAdd": "{{pokemonNameWithAffix}} fell for the taunt!",
|
||||||
"imprisonOnAdd": "{{pokemonNameWithAffix}} sealed the opponents move(s)!",
|
"imprisonOnAdd": "{{pokemonNameWithAffix}} sealed the opponents move(s)!",
|
||||||
"autotomizeOnAdd": "{{pokemonNameWithAffix}} became nimble!"
|
"autotomizeOnAdd": "{{pokemonNameWithAffix}} became nimble!",
|
||||||
|
"syrupBombOnAdd": "{{pokemonNameWithAffix}} got covered in sticky, candy syrup!",
|
||||||
|
"syrupBombLapse": "The sticky syrup slowed down {{pokemonNameWithAffix}}!"
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
"blockRecoilDamage": "{{pokemonName}}は {{abilityName}}で 反動ダメージを 受けない!",
|
"blockRecoilDamage": "{{pokemonName}}は {{abilityName}}で 反動ダメージを 受けない!",
|
||||||
"badDreams": "{{pokemonName}}は ナイトメアに うなされている!",
|
"badDreams": "{{pokemonName}}は ナイトメアに うなされている!",
|
||||||
"costar": "{{pokemonName}}は {{allyName}}の\n能力変化を コピーした!",
|
"costar": "{{pokemonName}}は {{allyName}}の\n能力変化を コピーした!",
|
||||||
"iceFaceAvoidedDamage": "{{pokemonNameWithAffix}}は\n{{abilityName}}で ダメージを 受けない!",
|
"iceFaceAvoidedDamage": "{{pokemonNameWithAffix}} は\n{{abilityName}}で ダメージを 受けない!",
|
||||||
"perishBody": "{{pokemonName}}の {{abilityName}}で\nおたがいは 3ターン後に ほろびいてしまう!",
|
"perishBody": "{{pokemonName}}の {{abilityName}}で\nおたがいは 3ターン後に ほろびいてしまう!",
|
||||||
"poisonHeal": "{{pokemonName}}は {{abilityName}}で 回復した!",
|
"poisonHeal": "{{pokemonName}}は {{abilityName}}で 回復した!",
|
||||||
"trace": "{{pokemonName}}は 相手の {{targetName}}の\n{{abilityName}}を トレースした!",
|
"trace": "{{pokemonName}}は 相手の {{targetName}}の\n{{abilityName}}を トレースした!",
|
||||||
"windPowerCharged": "{{pokemonNameWithAffix}}は\n{{moveName}}を 受けて じゅうでんした!",
|
"windPowerCharged": "{{pokemonName}} は\n{{moveName}}を 受けて じゅうでんした!",
|
||||||
"quickDraw": "{{pokemonName}}は クイックドロウで\n行動が はやくなった!",
|
"quickDraw": "{{pokemonName}}は クイックドロウで\n行動が はやくなった!",
|
||||||
"disguiseAvoidedDamage": "{{pokemonNameWithAffix}}の\nばけのかわが はがれた!",
|
"disguiseAvoidedDamage": "{{pokemonNameWithAffix}}の\nばけのかわが はがれた!",
|
||||||
"blockItemTheft": "{{pokemonNameWithAffix}}の {{abilityName}}で\n道具を うばわれない!",
|
"blockItemTheft": "{{pokemonNameWithAffix}}の {{abilityName}}で\n道具を うばわれない!",
|
||||||
@ -48,8 +48,8 @@
|
|||||||
"weatherEffectDisappeared": "天候の影響が なくなった!",
|
"weatherEffectDisappeared": "天候の影響が なくなった!",
|
||||||
"postSummonMoldBreaker": "{{pokemonNameWithAffix}}は\nかたやぶりだ!",
|
"postSummonMoldBreaker": "{{pokemonNameWithAffix}}は\nかたやぶりだ!",
|
||||||
"postSummonAnticipation": "{{pokemonNameWithAffix}}は\nみぶるいした!",
|
"postSummonAnticipation": "{{pokemonNameWithAffix}}は\nみぶるいした!",
|
||||||
"postSummonTurboblaze": "{{pokemonNameWithAffix}}は\n燃え盛(もえさか)る オーラを 放っている!",
|
"postSummonTurboblaze": "{{pokemonNameWithAffix}}は\n燃え盛る オーラを 放っている!",
|
||||||
"postSummonTeravolt": "{{pokemonNameWithAffix}}は\n弾(はじ)ける オーラを 放っている!",
|
"postSummonTeravolt": "{{pokemonNameWithAffix}}は\n弾ける オーラを 放っている!",
|
||||||
"postSummonDarkAura": "{{pokemonNameWithAffix}}は\nダークオーラを 放っている!",
|
"postSummonDarkAura": "{{pokemonNameWithAffix}}は\nダークオーラを 放っている!",
|
||||||
"postSummonFairyAura": "{{pokemonNameWithAffix}}は\nフェアリーオーラを 放っている!",
|
"postSummonFairyAura": "{{pokemonNameWithAffix}}は\nフェアリーオーラを 放っている!",
|
||||||
"postSummonAuraBreak": "{{pokemonNameWithAffix}}は\nすべての オーラを 制圧する!",
|
"postSummonAuraBreak": "{{pokemonNameWithAffix}}は\nすべての オーラを 制圧する!",
|
||||||
|
@ -43,20 +43,17 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
orderedTargets = Utils.randSeedShuffle(orderedTargets);
|
orderedTargets = Utils.randSeedShuffle(orderedTargets);
|
||||||
}, this.scene.currentBattle.turn, this.scene.waveSeed);
|
}, this.scene.currentBattle.turn, this.scene.waveSeed);
|
||||||
|
|
||||||
orderedTargets.sort((a: Pokemon, b: Pokemon) => {
|
// Next, a check for Trick Room is applied to determine sort order.
|
||||||
const aSpeed = a?.getEffectiveStat(Stat.SPD) || 0;
|
|
||||||
const bSpeed = b?.getEffectiveStat(Stat.SPD) || 0;
|
|
||||||
|
|
||||||
return bSpeed - aSpeed;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Next, a check for Trick Room is applied. If Trick Room is present, the order is reversed.
|
|
||||||
const speedReversed = new Utils.BooleanHolder(false);
|
const speedReversed = new Utils.BooleanHolder(false);
|
||||||
this.scene.arena.applyTags(TrickRoomTag, speedReversed);
|
this.scene.arena.applyTags(TrickRoomTag, speedReversed);
|
||||||
|
|
||||||
if (speedReversed.value) {
|
// Adjust the sort function based on whether Trick Room is active.
|
||||||
orderedTargets = orderedTargets.reverse();
|
orderedTargets.sort((a: Pokemon, b: Pokemon) => {
|
||||||
}
|
const aSpeed = a?.getEffectiveStat(Stat.SPD) ?? 0;
|
||||||
|
const bSpeed = b?.getEffectiveStat(Stat.SPD) ?? 0;
|
||||||
|
|
||||||
|
return speedReversed.value ? aSpeed - bSpeed : bSpeed - aSpeed;
|
||||||
|
});
|
||||||
|
|
||||||
return orderedTargets.map(t => t.getFieldIndex() + (!t.isPlayer() ? BattlerIndex.ENEMY : BattlerIndex.PLAYER));
|
return orderedTargets.map(t => t.getFieldIndex() + (!t.isPlayer() ? BattlerIndex.ENEMY : BattlerIndex.PLAYER));
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { StatusEffect } from "#app/enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import Pokemon from "#app/field/pokemon";
|
import Pokemon from "#app/field/pokemon";
|
||||||
import { BerryPhase } from "#app/phases/berry-phase";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
|
||||||
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
||||||
import { TurnStartPhase } from "#app/phases/turn-start-phase";
|
|
||||||
import GameManager from "#app/test/utils/gameManager";
|
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
@ -53,13 +49,13 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("changes to Gulping Form if HP is over half when Surf or Dive is used", async () => {
|
it("changes to Gulping Form if HP is over half when Surf or Dive is used", async () => {
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
game.move.select(Moves.DIVE);
|
game.move.select(Moves.DIVE);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
game.move.select(Moves.DIVE);
|
game.move.select(Moves.DIVE);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getHpRatio()).toBeGreaterThanOrEqual(.5);
|
expect(cramorant.getHpRatio()).toBeGreaterThanOrEqual(.5);
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
@ -67,21 +63,21 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("changes to Gorging Form if HP is under half when Surf or Dive is used", async () => {
|
it("changes to Gorging Form if HP is under half when Surf or Dive is used", async () => {
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.49);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.49);
|
||||||
expect(cramorant.getHpRatio()).toBe(.49);
|
expect(cramorant.getHpRatio()).toBe(.49);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_PIKACHU)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_PIKACHU)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GORGING_FORM);
|
expect(cramorant.formIndex).toBe(GORGING_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("changes to base form when switched out after Surf or Dive is used", async () => {
|
it("changes to base form when switched out after Surf or Dive is used", async () => {
|
||||||
await game.startBattle([Species.CRAMORANT, Species.MAGIKARP]);
|
await game.classicMode.startBattle([Species.CRAMORANT, Species.MAGIKARP]);
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
@ -96,51 +92,51 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("changes form during Dive's charge turn", async () => {
|
it("changes form during Dive's charge turn", async () => {
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
game.move.select(Moves.DIVE);
|
game.move.select(Moves.DIVE);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("deals 1/4 of the attacker's maximum HP when hit by a damaging attack", async () => {
|
it("deals 1/4 of the attacker's maximum HP when hit by a damaging attack", async () => {
|
||||||
game.override.enemyMoveset([Moves.TACKLE]);
|
game.override.enemyMoveset(Moves.TACKLE);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
vi.spyOn(enemy, "damageAndUpdate");
|
vi.spyOn(enemy, "damageAndUpdate");
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
|
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not have any effect when hit by non-damaging attack", async () => {
|
it("does not have any effect when hit by non-damaging attack", async () => {
|
||||||
game.override.enemyMoveset([Moves.TAIL_WHIP]);
|
game.override.enemyMoveset(Moves.TAIL_WHIP);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("lowers attacker's DEF stat stage by 1 when hit in Gulping form", async () => {
|
it("lowers attacker's DEF stat stage by 1 when hit in Gulping form", async () => {
|
||||||
game.override.enemyMoveset([Moves.TACKLE]);
|
game.override.enemyMoveset(Moves.TACKLE);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
@ -149,12 +145,12 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
|
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
|
||||||
expect(enemy.getStatStage(Stat.DEF)).toBe(-1);
|
expect(enemy.getStatStage(Stat.DEF)).toBe(-1);
|
||||||
@ -163,8 +159,8 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("paralyzes the enemy when hit in Gorging form", async () => {
|
it("paralyzes the enemy when hit in Gorging form", async () => {
|
||||||
game.override.enemyMoveset([Moves.TACKLE]);
|
game.override.enemyMoveset(Moves.TACKLE);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
@ -173,12 +169,12 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.45);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.45);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_PIKACHU)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_PIKACHU)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GORGING_FORM);
|
expect(cramorant.formIndex).toBe(GORGING_FORM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
|
expect(enemy.damageAndUpdate).toHaveReturnedWith(getEffectDamage(enemy));
|
||||||
expect(enemy.status?.effect).toBe(StatusEffect.PARALYSIS);
|
expect(enemy.status?.effect).toBe(StatusEffect.PARALYSIS);
|
||||||
@ -187,21 +183,21 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not activate the ability when underwater", async () => {
|
it("does not activate the ability when underwater", async () => {
|
||||||
game.override.enemyMoveset([Moves.SURF]);
|
game.override.enemyMoveset(Moves.SURF);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
game.move.select(Moves.DIVE);
|
game.move.select(Moves.DIVE);
|
||||||
await game.phaseInterceptor.to(BerryPhase, false);
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("prevents effect damage but inflicts secondary effect on attacker with Magic Guard", async () => {
|
it("prevents effect damage but inflicts secondary effect on attacker with Magic Guard", async () => {
|
||||||
game.override.enemyMoveset([Moves.TACKLE]).enemyAbility(Abilities.MAGIC_GUARD);
|
game.override.enemyMoveset(Moves.TACKLE).enemyAbility(Abilities.MAGIC_GUARD);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
@ -209,13 +205,13 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
const enemyHpPreEffect = enemy.hp;
|
const enemyHpPreEffect = enemy.hp;
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(enemy.hp).toBe(enemyHpPreEffect);
|
expect(enemy.hp).toBe(enemyHpPreEffect);
|
||||||
expect(enemy.getStatStage(Stat.DEF)).toBe(-1);
|
expect(enemy.getStatStage(Stat.DEF)).toBe(-1);
|
||||||
@ -223,20 +219,36 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
expect(cramorant.formIndex).toBe(NORMAL_FORM);
|
expect(cramorant.formIndex).toBe(NORMAL_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("activates on faint", async () => {
|
||||||
|
game.override.enemyMoveset(Moves.THUNDERBOLT);
|
||||||
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.SURF);
|
||||||
|
await game.phaseInterceptor.to("FaintPhase");
|
||||||
|
|
||||||
|
expect(cramorant.hp).toBe(0);
|
||||||
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeUndefined();
|
||||||
|
expect(cramorant.formIndex).toBe(NORMAL_FORM);
|
||||||
|
expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.DEF)).toBe(-1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it("cannot be suppressed", async () => {
|
it("cannot be suppressed", async () => {
|
||||||
game.override.enemyMoveset([Moves.GASTRO_ACID]);
|
game.override.enemyMoveset(Moves.GASTRO_ACID);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(cramorant.hasAbility(Abilities.GULP_MISSILE)).toBe(true);
|
expect(cramorant.hasAbility(Abilities.GULP_MISSILE)).toBe(true);
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
@ -244,19 +256,19 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("cannot be swapped with another ability", async () => {
|
it("cannot be swapped with another ability", async () => {
|
||||||
game.override.enemyMoveset([Moves.SKILL_SWAP]);
|
game.override.enemyMoveset(Moves.SKILL_SWAP);
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
|
|
||||||
const cramorant = game.scene.getPlayerPokemon()!;
|
const cramorant = game.scene.getPlayerPokemon()!;
|
||||||
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
vi.spyOn(cramorant, "getHpRatio").mockReturnValue(.55);
|
||||||
|
|
||||||
game.move.select(Moves.SURF);
|
game.move.select(Moves.SURF);
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
expect(cramorant.formIndex).toBe(GULPING_FORM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
expect(cramorant.hasAbility(Abilities.GULP_MISSILE)).toBe(true);
|
expect(cramorant.hasAbility(Abilities.GULP_MISSILE)).toBe(true);
|
||||||
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
expect(cramorant.getTag(BattlerTagType.GULP_MISSILE_ARROKUDA)).toBeDefined();
|
||||||
@ -266,9 +278,9 @@ describe("Abilities - Gulp Missile", () => {
|
|||||||
it("cannot be copied", async () => {
|
it("cannot be copied", async () => {
|
||||||
game.override.enemyAbility(Abilities.TRACE);
|
game.override.enemyAbility(Abilities.TRACE);
|
||||||
|
|
||||||
await game.startBattle([Species.CRAMORANT]);
|
await game.classicMode.startBattle([Species.CRAMORANT]);
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
await game.phaseInterceptor.to(TurnStartPhase);
|
await game.phaseInterceptor.to("TurnStartPhase");
|
||||||
|
|
||||||
expect(game.scene.getEnemyPokemon()?.hasAbility(Abilities.GULP_MISSILE)).toBe(false);
|
expect(game.scene.getEnemyPokemon()?.hasAbility(Abilities.GULP_MISSILE)).toBe(false);
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|||||||
import GameManager from "../utils/gameManager";
|
import GameManager from "../utils/gameManager";
|
||||||
import { PokeballType } from "#app/enums/pokeball";
|
import { PokeballType } from "#app/enums/pokeball";
|
||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
|
import { Moves } from "#app/enums/moves";
|
||||||
|
|
||||||
describe("Spec - Pokemon", () => {
|
describe("Spec - Pokemon", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -63,4 +64,15 @@ describe("Spec - Pokemon", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should not share tms between different forms", async () => {
|
||||||
|
game.override.starterForms({ [Species.ROTOM]: 4 });
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([Species.ROTOM]);
|
||||||
|
|
||||||
|
const fanRotom = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
|
expect(fanRotom.compatibleTms).not.toContain(Moves.BLIZZARD);
|
||||||
|
expect(fanRotom.compatibleTms).toContain(Moves.AIR_SLASH);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
82
src/test/moves/syrup_bomb.test.ts
Normal file
82
src/test/moves/syrup_bomb.test.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { allMoves } from "#app/data/move";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
import { Stat } from "#enums/stat";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - SYRUP BOMB", () => {
|
||||||
|
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
|
||||||
|
.starterSpecies(Species.MAGIKARP)
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.startingLevel(30)
|
||||||
|
.enemyLevel(100)
|
||||||
|
.moveset([Moves.SYRUP_BOMB, Moves.SPLASH])
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
vi.spyOn(allMoves[Moves.SYRUP_BOMB], "accuracy", "get").mockReturnValue(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/syrup_bomb_(move)
|
||||||
|
|
||||||
|
it("decreases the target Pokemon's speed stat once per turn for 3 turns",
|
||||||
|
async () => {
|
||||||
|
await game.startBattle([Species.MAGIKARP]);
|
||||||
|
|
||||||
|
const targetPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
expect(targetPokemon.getStatStage(Stat.SPD)).toBe(0);
|
||||||
|
|
||||||
|
game.move.select(Moves.SYRUP_BOMB);
|
||||||
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
||||||
|
await game.move.forceHit();
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(targetPokemon.getTag(BattlerTagType.SYRUP_BOMB)).toBeDefined();
|
||||||
|
expect(targetPokemon.getStatStage(Stat.SPD)).toBe(-1);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(targetPokemon.getTag(BattlerTagType.SYRUP_BOMB)).toBeDefined();
|
||||||
|
expect(targetPokemon.getStatStage(Stat.SPD)).toBe(-2);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(targetPokemon.getTag(BattlerTagType.SYRUP_BOMB)).toBeUndefined();
|
||||||
|
expect(targetPokemon.getStatStage(Stat.SPD)).toBe(-3);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it("does not affect Pokemon with the ability Bulletproof",
|
||||||
|
async () => {
|
||||||
|
game.override.enemyAbility(Abilities.BULLETPROOF);
|
||||||
|
await game.startBattle([Species.MAGIKARP]);
|
||||||
|
|
||||||
|
const targetPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.SYRUP_BOMB);
|
||||||
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
||||||
|
await game.move.forceHit();
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(targetPokemon.isFullHp()).toBe(true);
|
||||||
|
expect(targetPokemon.getTag(BattlerTagType.SYRUP_BOMB)).toBeUndefined();
|
||||||
|
expect(targetPokemon.getStatStage(Stat.SPD)).toBe(0);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
@ -99,8 +99,9 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
super.clear();
|
super.clear();
|
||||||
this.cursor = -1;
|
|
||||||
this.scrollGridHandler.reset();
|
this.scrollGridHandler.reset();
|
||||||
|
this.cursor = -1;
|
||||||
|
|
||||||
this.summaryContainer.setVisible(false);
|
this.summaryContainer.setVisible(false);
|
||||||
this.pokemonIconsContainer.removeAll(true);
|
this.pokemonIconsContainer.removeAll(true);
|
||||||
this.pokemonContainers = [];
|
this.pokemonContainers = [];
|
||||||
@ -164,8 +165,8 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
this.scrollGridHandler.setTotalElements(this.eggHatchData.length);
|
this.scrollGridHandler.setTotalElements(this.eggHatchData.length);
|
||||||
this.updatePokemonIcons();
|
this.updatePokemonIcons();
|
||||||
|
|
||||||
this.setCursor(0);
|
this.setCursor(0);
|
||||||
|
|
||||||
this.scene.playSoundWithoutBgm("evolution_fanfare");
|
this.scene.playSoundWithoutBgm("evolution_fanfare");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { TextStyle, addTextObject, getTextStyleOptions } from "./text";
|
|||||||
import { getSplashMessages } from "../data/splash-messages";
|
import { getSplashMessages } from "../data/splash-messages";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { TimedEventDisplay } from "#app/timed-event-manager";
|
import { TimedEventDisplay } from "#app/timed-event-manager";
|
||||||
|
import { version } from "../../package.json";
|
||||||
|
|
||||||
export default class TitleUiHandler extends OptionSelectUiHandler {
|
export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||||
/** If the stats can not be retrieved, use this fallback value */
|
/** If the stats can not be retrieved, use this fallback value */
|
||||||
@ -16,6 +17,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
private splashMessage: string;
|
private splashMessage: string;
|
||||||
private splashMessageText: Phaser.GameObjects.Text;
|
private splashMessageText: Phaser.GameObjects.Text;
|
||||||
private eventDisplay: TimedEventDisplay;
|
private eventDisplay: TimedEventDisplay;
|
||||||
|
private appVersionText: Phaser.GameObjects.Text;
|
||||||
|
|
||||||
private titleStatsTimer: NodeJS.Timeout | null;
|
private titleStatsTimer: NodeJS.Timeout | null;
|
||||||
|
|
||||||
@ -68,6 +70,11 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
loop: -1,
|
loop: -1,
|
||||||
yoyo: true,
|
yoyo: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.appVersionText = addTextObject(this.scene, logo.x - 60, logo.y + logo.displayHeight + 4, "", TextStyle.MONEY, { fontSize: "54px" });
|
||||||
|
this.appVersionText.setOrigin(0.5, 0.5);
|
||||||
|
this.appVersionText.setAngle(0);
|
||||||
|
this.titleContainer.add(this.appVersionText);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTitleStats(): void {
|
updateTitleStats(): void {
|
||||||
@ -91,6 +98,8 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
this.splashMessage = Utils.randItem(getSplashMessages());
|
this.splashMessage = Utils.randItem(getSplashMessages());
|
||||||
this.splashMessageText.setText(i18next.t(this.splashMessage, { count: TitleUiHandler.BATTLES_WON_FALLBACK }));
|
this.splashMessageText.setText(i18next.t(this.splashMessage, { count: TitleUiHandler.BATTLES_WON_FALLBACK }));
|
||||||
|
|
||||||
|
this.appVersionText.setText("v"+version);
|
||||||
|
|
||||||
const ui = this.getUi();
|
const ui = this.getUi();
|
||||||
|
|
||||||
if (this.scene.eventManager.isEventActive()) {
|
if (this.scene.eventManager.isEventActive()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user