Skip to content

Commit

Permalink
Merge beta
Browse files Browse the repository at this point in the history
  • Loading branch information
xsn34kzx committed Aug 24, 2024
2 parents 9e1e403 + 4867ffb commit e40b78c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/data/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4231,7 +4231,7 @@ export class FormBlockDamageAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
(args[0] as Utils.NumberHolder).value = this.multiplier;
pokemon.removeTag(this.tagType);
if (this.recoilDamageFunc) {
pokemon.damageAndUpdate(this.recoilDamageFunc(pokemon), HitResult.OTHER);
pokemon.damageAndUpdate(this.recoilDamageFunc(pokemon), HitResult.OTHER, false, false, true, true);
}
}
return true;
Expand Down
5 changes: 1 addition & 4 deletions src/overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { type PokeballCounts } from "./battle-scene";
import { Gender } from "./data/gender";
import { allSpecies } from "./data/pokemon-species"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Variant } from "./data/variant";
import { Stat } from "./enums/stat";
import { type ModifierOverride } from "./modifier/modifier-type";

/**
Expand All @@ -30,9 +29,7 @@ import { type ModifierOverride } from "./modifier/modifier-type";
* }
* ```
*/
const overrides = {
ITEM_REWARD_OVERRIDE: [{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }, { name: "BASE_STAT_BOOSTER" }, { name: "DIRE_HIT" }]
} satisfies Partial<InstanceType<typeof DefaultOverrides>>;
const overrides = {} satisfies Partial<InstanceType<typeof DefaultOverrides>>;

/**
* If you need to add Overrides values for local testing do that inside {@linkcode overrides}
Expand Down
14 changes: 14 additions & 0 deletions src/test/abilities/disguise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,18 @@ describe("Abilities - Disguise", () => {

expect(mimikyu1.formIndex).toBe(disguisedForm);
}, TIMEOUT);

it("doesn't faint twice when fainting due to Disguise break damage, nor prevent faint from Disguise break damage if using Endure", async () => {
game.override.enemyMoveset(Array(4).fill(Moves.ENDURE));
await game.startBattle();

const mimikyu = game.scene.getEnemyPokemon()!;
mimikyu.hp = 1;

game.move.select(Moves.SHADOW_SNEAK);
await game.toNextWave();

expect(game.scene.getCurrentPhase()?.constructor.name).toBe("CommandPhase");
expect(game.scene.currentBattle.waveIndex).toBe(2);
}, TIMEOUT);
});
30 changes: 19 additions & 11 deletions src/ui/starter-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ const starterCandyCosts: { passive: integer, costReduction: [integer, integer],
{ passive: 10, costReduction: [5, 15], egg: 10 }, // 10 Cost
];

const valueReductionMax = 2;

// Position of UI elements
const filterBarHeight = 17;
const speciesContainerX = 109; // if team on the RIGHT: 109 / if on the LEFT: 143
Expand Down Expand Up @@ -1009,11 +1011,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const starterData = this.scene.gameData.starterData[speciesId];

return starterData.candyCount >= getValueReductionCandyCounts(speciesStarters[speciesId])[starterData.valueReduction]
&& starterData.valueReduction < 2;
&& starterData.valueReduction < valueReductionMax;
}

/**
* Determines if an same species egg can be baught for the given species ID
* Determines if an same species egg can be bought for the given species ID
* @param speciesId The ID of the species to check the value reduction of
* @returns true if the user has enough candies
*/
Expand Down Expand Up @@ -1062,15 +1064,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
],};

const passiveAvailable = this.isPassiveAvailable(species.speciesId);
// 'Only Passives' mode
const isPassiveAvailable = this.isPassiveAvailable(species.speciesId);
const isValueReductionAvailable = this.isValueReductionAvailable(species.speciesId);
const isSameSpeciesEggAvailable = this.isSameSpeciesEggAvailable(species.speciesId);

// 'Passives Only' mode
if (this.scene.candyUpgradeNotification === 1) {
if (passiveAvailable) {
if (isPassiveAvailable) {
this.scene.tweens.chain(tweenChain).paused = startPaused;
}
// 'On' mode
} else if (this.scene.candyUpgradeNotification === 2) {
if (passiveAvailable || this.isValueReductionAvailable(species.speciesId)) {
if (isPassiveAvailable || isValueReductionAvailable || isSameSpeciesEggAvailable) {
this.scene.tweens.chain(tweenChain).paused = startPaused;
}
}
Expand All @@ -1089,16 +1094,19 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
return;
}

const passiveAvailable = this.isPassiveAvailable(species.speciesId);
// 'Only Passive Unlocks' mode
const isPassiveAvailable = this.isPassiveAvailable(species.speciesId);
const isValueReductionAvailable = this.isValueReductionAvailable(species.speciesId);
const isSameSpeciesEggAvailable = this.isSameSpeciesEggAvailable(species.speciesId);

// 'Passive Only' mode
if (this.scene.candyUpgradeNotification === 1) {
starter.candyUpgradeIcon.setVisible(slotVisible && passiveAvailable);
starter.candyUpgradeIcon.setVisible(slotVisible && isPassiveAvailable);
starter.candyUpgradeOverlayIcon.setVisible(slotVisible && starter.candyUpgradeIcon.visible);

// 'On' mode
} else if (this.scene.candyUpgradeNotification === 2) {
starter.candyUpgradeIcon.setVisible(
slotVisible && ( passiveAvailable || this.isValueReductionAvailable(species.speciesId)));
slotVisible && ( isPassiveAvailable || isValueReductionAvailable || isSameSpeciesEggAvailable ));
starter.candyUpgradeOverlayIcon.setVisible(slotVisible && starter.candyUpgradeIcon.visible);
}
}
Expand Down Expand Up @@ -1630,7 +1638,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
});
}
const valueReduction = starterData.valueReduction;
if (valueReduction < 2) {
if (valueReduction < valueReductionMax) {
const reductionCost = getValueReductionCandyCounts(speciesStarters[this.lastSpecies.speciesId])[valueReduction];
options.push({
label: `x${reductionCost} ${i18next.t("starterSelectUiHandler:reduceCost")}`,
Expand Down

0 comments on commit e40b78c

Please sign in to comment.