Skip to content

Commit

Permalink
Merge branch 'beta' into instruct
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeTappert authored Nov 28, 2024
2 parents 99dcbab + c86b635 commit f0c0865
Show file tree
Hide file tree
Showing 23 changed files with 214 additions and 85 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Check out [Github Issues](https://github.com/pagefaultgames/pokerogue/issues) to
- Involuntary-Twitch
- selstar
- koda_want_to_sleep
- thedreadedden

### 🎨 Move Animations
- Pokémon Reborn
87 changes: 87 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"i18next-http-backend": "^2.6.1",
"i18next-korean-postposition-processor": "^1.0.0",
"json-stable-stringify": "^1.1.0",
"jszip": "^3.10.1",
"phaser": "^3.70.0",
"phaser3-rex-plugins": "^1.1.84"
},
Expand Down
3 changes: 1 addition & 2 deletions src/data/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6340,8 +6340,7 @@ export function initAbilities() {
.attr(IgnoreOpponentStatStagesAbAttr, [ Stat.EVA ])
.ignorable(),
new Ability(Abilities.SUPERSWEET_SYRUP, 9)
.attr(PostSummonStatStageChangeAbAttr, [ Stat.EVA ], -1)
.condition(getOncePerBattleCondition(Abilities.SUPERSWEET_SYRUP)),
.attr(PostSummonStatStageChangeAbAttr, [ Stat.EVA ], -1),
new Ability(Abilities.HOSPITALITY, 9)
.attr(PostSummonAllyHealAbAttr, 4, true),
new Ability(Abilities.TOXIC_CHAIN, 9)
Expand Down
4 changes: 2 additions & 2 deletions src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { getPokemonNameWithAffix } from "#app/messages";
import { DamagePhase } from "#app/phases/damage-phase";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { FaintPhase } from "#app/phases/faint-phase";
import { LearnMovePhase } from "#app/phases/learn-move-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
Expand Down Expand Up @@ -3005,7 +3005,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @returns integer of damage done
*/
damageAndUpdate(damage: integer, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon): integer {
const damagePhase = new DamagePhase(this.scene, this.getBattlerIndex(), damage, result as DamageResult, critical);
const damagePhase = new DamageAnimPhase(this.scene, this.getBattlerIndex(), damage, result as DamageResult, critical);
this.scene.unshiftPhase(damagePhase);
damage = this.damage(damage, ignoreSegments, preventEndure, ignoreFaintPhase);
// Damage amount may have changed, but needed to be queued before calling damage function
Expand Down
16 changes: 8 additions & 8 deletions src/phases/damage-phase.ts → src/phases/damage-anim-phase.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import BattleScene from "#app/battle-scene";
import { BattlerIndex } from "#app/battle";
import { BattleSpec } from "#app/enums/battle-spec";
import { DamageResult, HitResult } from "#app/field/pokemon";
import * as Utils from "#app/utils";
import { PokemonPhase } from "./pokemon-phase";
import type BattleScene from "#app/battle-scene";
import { type BattlerIndex } from "#app/battle";
import { BattleSpec } from "#enums/battle-spec";
import { type DamageResult, HitResult } from "#app/field/pokemon";
import { fixedInt } from "#app/utils";
import { PokemonPhase } from "#app/phases/pokemon-phase";

export class DamagePhase extends PokemonPhase {
export class DamageAnimPhase extends PokemonPhase {
private amount: integer;
private damageResult: DamageResult;
private critical: boolean;
Expand All @@ -25,7 +25,7 @@ export class DamagePhase extends PokemonPhase {
if (this.scene.moveAnimations) {
this.scene.toggleInvert(true);
}
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
this.scene.time.delayedCall(fixedInt(1000), () => {
this.scene.toggleInvert(false);
this.applyDamage();
});
Expand Down
4 changes: 2 additions & 2 deletions src/phases/faint-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
import { PokemonInstantReviveModifier } from "#app/modifier/modifier";
import { SwitchType } from "#enums/switch-type";
import i18next from "i18next";
import { DamagePhase } from "./damage-phase";
import { DamageAnimPhase } from "./damage-anim-phase";
import { GameOverPhase } from "./game-over-phase";
import { PokemonPhase } from "./pokemon-phase";
import { SwitchPhase } from "./switch-phase";
Expand Down Expand Up @@ -206,7 +206,7 @@ export class FaintPhase extends PokemonPhase {
} else {
// Final boss' HP threshold has been bypassed; cancel faint and force check for 2nd phase
enemy.hp++;
this.scene.unshiftPhase(new DamagePhase(this.scene, enemy.getBattlerIndex(), 0, HitResult.OTHER));
this.scene.unshiftPhase(new DamageAnimPhase(this.scene, enemy.getBattlerIndex(), 0, HitResult.OTHER));
this.end();
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/test/abilities/forecast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BattlerIndex } from "#app/battle";
import { allAbilities } from "#app/data/ability";
import { Abilities } from "#app/enums/abilities";
import { WeatherType } from "#app/enums/weather-type";
import { DamagePhase } from "#app/phases/damage-phase";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { MovePhase } from "#app/phases/move-phase";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
Expand Down Expand Up @@ -273,7 +273,7 @@ describe("Abilities - Forecast", () => {
const castform = game.scene.getPlayerPokemon()!;

// Damage phase should come first
await game.phaseInterceptor.to(DamagePhase);
await game.phaseInterceptor.to(DamageAnimPhase);
expect(castform.hp).toBeLessThan(castform.getMaxHp());

// Then change form
Expand Down
6 changes: 3 additions & 3 deletions src/test/abilities/hustle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("Abilities - Hustle", () => {

game.move.select(Moves.TACKLE);
await game.move.forceHit();
await game.phaseInterceptor.to("DamagePhase");
await game.phaseInterceptor.to("DamageAnimPhase");

expect(pikachu.getEffectiveStat).toHaveReturnedWith(Math.floor(atk * 1.5));
});
Expand All @@ -68,7 +68,7 @@ describe("Abilities - Hustle", () => {
vi.spyOn(pikachu, "getAccuracyMultiplier");

game.move.select(Moves.GIGA_DRAIN);
await game.phaseInterceptor.to("DamagePhase");
await game.phaseInterceptor.to("DamageAnimPhase");

expect(pikachu.getEffectiveStat).toHaveReturnedWith(spatk);
expect(pikachu.getAccuracyMultiplier).toHaveReturnedWith(1);
Expand All @@ -86,7 +86,7 @@ describe("Abilities - Hustle", () => {
vi.spyOn(allMoves[Moves.FISSURE], "calculateBattleAccuracy");

game.move.select(Moves.FISSURE);
await game.phaseInterceptor.to("DamagePhase");
await game.phaseInterceptor.to("DamageAnimPhase");

expect(enemyPokemon.turnData.damageTaken).toBe(enemyPokemon.getMaxHp());
expect(pikachu.getAccuracyMultiplier).toHaveReturnedWith(1);
Expand Down
Loading

0 comments on commit f0c0865

Please sign in to comment.