mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-30 20:22:32 +02:00
Merge branch 'beta' into evolution-condition-refactor
This commit is contained in:
commit
1c4b53f992
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
@ -1 +1 @@
|
||||
Subproject commit 7bfcbccb9b8192b1059ca7c4c7e7d24901cf579d
|
||||
Subproject commit e07ab625f2080afe36b61fad291b0ec5eff4000c
|
@ -3606,6 +3606,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
if (!this.canSetStatus(effect, asPhase, false, sourcePokemon)) {
|
||||
return false;
|
||||
}
|
||||
if (this.isFainted() && effect !== StatusEffect.FAINT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this Pokemon falls asleep or freezes in the middle of a multi-hit attack,
|
||||
|
@ -400,4 +400,42 @@ describe("Status Effects", () => {
|
||||
expect(player.getLastXMoves(1)[0].result).toBe(MoveResult.SUCCESS);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Behavior", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.moveset([ Moves.SPLASH ])
|
||||
.ability(Abilities.BALL_FETCH)
|
||||
.battleType("single")
|
||||
.disableCrits()
|
||||
.enemySpecies(Species.MAGIKARP)
|
||||
.enemyAbility(Abilities.BALL_FETCH)
|
||||
.enemyMoveset(Moves.NUZZLE)
|
||||
.enemyLevel(2000);
|
||||
});
|
||||
|
||||
it("should not inflict a 0 HP mon with a status", async () => {
|
||||
await game.classicMode.startBattle([ Species.FEEBAS, Species.MILOTIC ]);
|
||||
|
||||
const player = game.scene.getPlayerPokemon()!;
|
||||
player.hp = 0;
|
||||
|
||||
expect(player.trySetStatus(StatusEffect.BURN)).toBe(false);
|
||||
expect(player.status?.effect).not.toBe(StatusEffect.BURN);
|
||||
});
|
||||
});
|
||||
});
|
@ -7,7 +7,9 @@ export enum DropDownState {
|
||||
ON = 0,
|
||||
OFF = 1,
|
||||
EXCLUDE = 2,
|
||||
UNLOCKABLE = 3
|
||||
UNLOCKABLE = 3,
|
||||
ONE = 4,
|
||||
TWO = 5
|
||||
}
|
||||
|
||||
export enum DropDownType {
|
||||
@ -27,7 +29,9 @@ export enum SortCriteria {
|
||||
COST = 1,
|
||||
CANDY = 2,
|
||||
IV = 3,
|
||||
NAME = 4
|
||||
NAME = 4,
|
||||
CAUGHT = 5,
|
||||
HATCHED = 6
|
||||
}
|
||||
|
||||
export class DropDownLabel {
|
||||
@ -55,6 +59,8 @@ export class DropDownOption extends Phaser.GameObjects.Container {
|
||||
private offColor = 0x272727;
|
||||
private excludeColor = 0xff5555;
|
||||
private unlockableColor = 0xffff00;
|
||||
private oneColor = 0x33bbff;
|
||||
private twoColor = 0x33bbff;
|
||||
|
||||
constructor(val: any, labels: DropDownLabel | DropDownLabel[]) {
|
||||
super(globalScene);
|
||||
@ -126,6 +132,12 @@ export class DropDownOption extends Phaser.GameObjects.Container {
|
||||
case DropDownState.UNLOCKABLE:
|
||||
this.toggle.setTint(this.unlockableColor);
|
||||
break;
|
||||
case DropDownState.ONE:
|
||||
this.toggle.setTint(this.oneColor);
|
||||
break;
|
||||
case DropDownState.TWO:
|
||||
this.toggle.setTint(this.twoColor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,6 +450,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
const costReductionLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:costReduction"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionUnlocked"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionUnlockedOne"), undefined, DropDownState.ONE),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionUnlockedTwo"), undefined, DropDownState.TWO),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionUnlockable"), undefined, DropDownState.UNLOCKABLE),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionLocked"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
@ -500,7 +502,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
new DropDownOption(SortCriteria.COST, new DropDownLabel(i18next.t("filterBar:sortByCost"))),
|
||||
new DropDownOption(SortCriteria.CANDY, new DropDownLabel(i18next.t("filterBar:sortByCandies"))),
|
||||
new DropDownOption(SortCriteria.IV, new DropDownLabel(i18next.t("filterBar:sortByIVs"))),
|
||||
new DropDownOption(SortCriteria.NAME, new DropDownLabel(i18next.t("filterBar:sortByName")))
|
||||
new DropDownOption(SortCriteria.NAME, new DropDownLabel(i18next.t("filterBar:sortByName"))),
|
||||
new DropDownOption(SortCriteria.CAUGHT, new DropDownLabel(i18next.t("filterBar:sortByNumCaught"))),
|
||||
new DropDownOption(SortCriteria.HATCHED, new DropDownLabel(i18next.t("filterBar:sortByNumHatched")))
|
||||
];
|
||||
this.filterBar.addFilter(DropDownColumn.SORT, i18next.t("filterBar:sortFilter"), new DropDown(0, 0, sortOptions, this.updateStarters, DropDownType.SINGLE));
|
||||
this.filterBarContainer.add(this.filterBar);
|
||||
@ -2585,13 +2589,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
});
|
||||
|
||||
// Cost Reduction Filter
|
||||
const isCostReduced = starterData.valueReduction > 0;
|
||||
const isCostReducedByOne = starterData.valueReduction === 1;
|
||||
const isCostReducedByTwo = starterData.valueReduction === 2;
|
||||
const isCostReductionUnlockable = this.isValueReductionAvailable(container.species.speciesId);
|
||||
const fitsCostReduction = this.filterBar.getVals(DropDownColumn.UNLOCKS).some(unlocks => {
|
||||
if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.ON) {
|
||||
return isCostReduced;
|
||||
return isCostReducedByOne || isCostReducedByTwo;
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.ONE) {
|
||||
return isCostReducedByOne;
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.TWO) {
|
||||
return isCostReducedByTwo;
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.EXCLUDE) {
|
||||
return isStarterProgressable && !isCostReduced;
|
||||
return isStarterProgressable && !(isCostReducedByOne || isCostReducedByTwo);
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.UNLOCKABLE) {
|
||||
return isCostReductionUnlockable;
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.OFF) {
|
||||
@ -2691,6 +2700,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
return (avgIVsA - avgIVsB) * -sort.dir;
|
||||
case SortCriteria.NAME:
|
||||
return a.species.name.localeCompare(b.species.name) * -sort.dir;
|
||||
case SortCriteria.CAUGHT:
|
||||
return (globalScene.gameData.dexData[a.species.speciesId].caughtCount - globalScene.gameData.dexData[b.species.speciesId].caughtCount) * -sort.dir;
|
||||
case SortCriteria.HATCHED:
|
||||
return (globalScene.gameData.dexData[a.species.speciesId].hatchedCount - globalScene.gameData.dexData[b.species.speciesId].hatchedCount) * -sort.dir;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
10
src/utils.ts
10
src/utils.ts
@ -349,14 +349,14 @@ export class IntegerHolder extends NumberHolder {
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated Use {@linkcode NumberHolder}*/
|
||||
export class FixedInt extends IntegerHolder {
|
||||
constructor(value: integer) {
|
||||
super(value);
|
||||
export class FixedInt {
|
||||
public readonly value: number;
|
||||
|
||||
constructor(value: number) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function fixedInt(value: integer): integer {
|
||||
return new FixedInt(value) as unknown as integer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user