mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 16:26:25 +00:00
[Balance] Add Memory Mushroom to Shop (#4555)
* Add Memory Mushroom to Shop + escape TM selection * consolidate learn move type params into an enum * Rewrite lock capsule test * Disable luck upgrades for copied SMPhases * Mem Mushroom Cost 4x Update modifier-type.ts * Add undefined cost check to `addModifier` * Increase shop options row limit * Prevent SMPhase copies from updating the seed --------- Co-authored-by: damocleas <damocleas25@gmail.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
parent
c04d81bd65
commit
093f3d90f5
@ -4,7 +4,7 @@ import Pokemon, { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
|||||||
import PokemonSpecies, { allSpecies, getPokemonSpecies, PokemonSpeciesFilter } from "#app/data/pokemon-species";
|
import PokemonSpecies, { allSpecies, getPokemonSpecies, PokemonSpeciesFilter } from "#app/data/pokemon-species";
|
||||||
import { Constructor, isNullOrUndefined, randSeedInt } from "#app/utils";
|
import { Constructor, isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||||
import * as Utils from "#app/utils";
|
import * as Utils from "#app/utils";
|
||||||
import { ConsumableModifier, ConsumablePokemonModifier, DoubleBattleChanceBoosterModifier, ExpBalanceModifier, ExpShareModifier, FusePokemonModifier, HealingBoosterModifier, Modifier, ModifierBar, ModifierPredicate, MultipleParticipantExpBonusModifier, overrideHeldItems, overrideModifiers, PersistentModifier, PokemonExpBoosterModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, PokemonHpRestoreModifier, PokemonIncrementingStatModifier, TerastallizeModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
|
import { ConsumableModifier, ConsumablePokemonModifier, DoubleBattleChanceBoosterModifier, ExpBalanceModifier, ExpShareModifier, FusePokemonModifier, HealingBoosterModifier, Modifier, ModifierBar, ModifierPredicate, MultipleParticipantExpBonusModifier, overrideHeldItems, overrideModifiers, PersistentModifier, PokemonExpBoosterModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, PokemonHpRestoreModifier, PokemonIncrementingStatModifier, RememberMoveModifier, TerastallizeModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
|
||||||
import { PokeballType } from "#app/data/pokeball";
|
import { PokeballType } from "#app/data/pokeball";
|
||||||
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from "#app/data/battle-anims";
|
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from "#app/data/battle-anims";
|
||||||
import { Phase } from "#app/phase";
|
import { Phase } from "#app/phase";
|
||||||
@ -2425,7 +2425,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return Math.floor(moneyValue / 10) * 10;
|
return Math.floor(moneyValue / 10) * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
addModifier(modifier: Modifier | null, ignoreUpdate?: boolean, playSound?: boolean, virtual?: boolean, instant?: boolean): Promise<boolean> {
|
addModifier(modifier: Modifier | null, ignoreUpdate?: boolean, playSound?: boolean, virtual?: boolean, instant?: boolean, cost?: number): Promise<boolean> {
|
||||||
if (!modifier) {
|
if (!modifier) {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
@ -2482,6 +2482,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
} else if (modifier instanceof FusePokemonModifier) {
|
} else if (modifier instanceof FusePokemonModifier) {
|
||||||
args.push(this.getPokemonById(modifier.fusePokemonId) as PlayerPokemon);
|
args.push(this.getPokemonById(modifier.fusePokemonId) as PlayerPokemon);
|
||||||
|
} else if (modifier instanceof RememberMoveModifier && !Utils.isNullOrUndefined(cost)) {
|
||||||
|
args.push(cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modifier.shouldApply(pokemon, ...args)) {
|
if (modifier.shouldApply(pokemon, ...args)) {
|
||||||
|
@ -2227,7 +2227,8 @@ export function getPlayerShopModifierTypeOptionsForWave(waveIndex: integer, base
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
new ModifierTypeOption(modifierTypes.HYPER_POTION(), 0, baseCost * 0.8),
|
new ModifierTypeOption(modifierTypes.HYPER_POTION(), 0, baseCost * 0.8),
|
||||||
new ModifierTypeOption(modifierTypes.MAX_REVIVE(), 0, baseCost * 2.75)
|
new ModifierTypeOption(modifierTypes.MAX_REVIVE(), 0, baseCost * 2.75),
|
||||||
|
new ModifierTypeOption(modifierTypes.MEMORY_MUSHROOM(), 0, baseCost * 4)
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new ModifierTypeOption(modifierTypes.MAX_POTION(), 0, baseCost * 1.5),
|
new ModifierTypeOption(modifierTypes.MAX_POTION(), 0, baseCost * 1.5),
|
||||||
|
@ -11,7 +11,7 @@ import Pokemon, { type PlayerPokemon } from "#app/field/pokemon";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import Overrides from "#app/overrides";
|
import Overrides from "#app/overrides";
|
||||||
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
import { LearnMovePhase, LearnMoveType } from "#app/phases/learn-move-phase";
|
||||||
import { LevelUpPhase } from "#app/phases/level-up-phase";
|
import { LevelUpPhase } from "#app/phases/level-up-phase";
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { achvs } from "#app/system/achv";
|
import { achvs } from "#app/system/achv";
|
||||||
@ -2235,7 +2235,7 @@ export class TmModifier extends ConsumablePokemonModifier {
|
|||||||
*/
|
*/
|
||||||
override apply(playerPokemon: PlayerPokemon): boolean {
|
override apply(playerPokemon: PlayerPokemon): boolean {
|
||||||
|
|
||||||
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), this.type.moveId, true));
|
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), this.type.moveId, LearnMoveType.TM));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2255,8 +2255,9 @@ export class RememberMoveModifier extends ConsumablePokemonModifier {
|
|||||||
* @param playerPokemon The {@linkcode PlayerPokemon} that should remember the move
|
* @param playerPokemon The {@linkcode PlayerPokemon} that should remember the move
|
||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(playerPokemon: PlayerPokemon): boolean {
|
override apply(playerPokemon: PlayerPokemon, cost?: number): boolean {
|
||||||
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), playerPokemon.getLearnableLevelMoves()[this.levelMoveIndex]));
|
|
||||||
|
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), playerPokemon.getLearnableLevelMoves()[this.levelMoveIndex], LearnMoveType.MEMORY, cost));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,37 @@ import BattleScene from "#app/battle-scene";
|
|||||||
import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims";
|
import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims";
|
||||||
import Move, { allMoves } from "#app/data/move";
|
import Move, { allMoves } from "#app/data/move";
|
||||||
import { SpeciesFormChangeMoveLearnedTrigger } from "#app/data/pokemon-forms";
|
import { SpeciesFormChangeMoveLearnedTrigger } from "#app/data/pokemon-forms";
|
||||||
import { Moves } from "#app/enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
|
import Overrides from "#app/overrides";
|
||||||
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||||
import Pokemon from "#app/field/pokemon";
|
import Pokemon from "#app/field/pokemon";
|
||||||
|
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||||
|
|
||||||
|
export enum LearnMoveType {
|
||||||
|
/** For learning a move via level-up, evolution, or other non-item-based event */
|
||||||
|
LEARN_MOVE,
|
||||||
|
/** For learning a move via Memory Mushroom */
|
||||||
|
MEMORY,
|
||||||
|
/** For learning a move via TM */
|
||||||
|
TM
|
||||||
|
}
|
||||||
|
|
||||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private moveId: Moves;
|
private moveId: Moves;
|
||||||
private messageMode: Mode;
|
private messageMode: Mode;
|
||||||
private fromTM: boolean;
|
private learnMoveType;
|
||||||
|
private cost: number;
|
||||||
|
|
||||||
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves, fromTM?: boolean) {
|
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
||||||
super(scene, partyMemberIndex);
|
super(scene, partyMemberIndex);
|
||||||
this.moveId = moveId;
|
this.moveId = moveId;
|
||||||
this.fromTM = fromTM ?? false;
|
this.learnMoveType = learnMoveType;
|
||||||
|
this.cost = cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@ -136,11 +149,23 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
* @param Pokemon The Pokemon learning the move
|
* @param Pokemon The Pokemon learning the move
|
||||||
*/
|
*/
|
||||||
async learnMove(index: number, move: Move, pokemon: Pokemon, textMessage?: string) {
|
async learnMove(index: number, move: Move, pokemon: Pokemon, textMessage?: string) {
|
||||||
if (this.fromTM) {
|
if (this.learnMoveType === LearnMoveType.TM) {
|
||||||
if (!pokemon.usedTMs) {
|
if (!pokemon.usedTMs) {
|
||||||
pokemon.usedTMs = [];
|
pokemon.usedTMs = [];
|
||||||
}
|
}
|
||||||
pokemon.usedTMs.push(this.moveId);
|
pokemon.usedTMs.push(this.moveId);
|
||||||
|
this.scene.tryRemovePhase((phase) => phase instanceof SelectModifierPhase);
|
||||||
|
} else if (this.learnMoveType === LearnMoveType.MEMORY) {
|
||||||
|
if (this.cost !== -1) {
|
||||||
|
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
|
this.scene.money -= this.cost;
|
||||||
|
this.scene.updateMoneyText();
|
||||||
|
this.scene.animateMoneyChanged(false);
|
||||||
|
}
|
||||||
|
this.scene.playSound("se/buy");
|
||||||
|
} else {
|
||||||
|
this.scene.tryRemovePhase((phase) => phase instanceof SelectModifierPhase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pokemon.setMove(index, this.moveId);
|
pokemon.setMove(index, this.moveId);
|
||||||
initMoveAnim(this.scene, this.moveId).then(() => {
|
initMoveAnim(this.scene, this.moveId).then(() => {
|
||||||
|
@ -16,26 +16,32 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
private rerollCount: integer;
|
private rerollCount: integer;
|
||||||
private modifierTiers?: ModifierTier[];
|
private modifierTiers?: ModifierTier[];
|
||||||
private customModifierSettings?: CustomModifierSettings;
|
private customModifierSettings?: CustomModifierSettings;
|
||||||
|
private isCopy: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings) {
|
private typeOptions: ModifierTypeOption[];
|
||||||
|
|
||||||
|
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings, isCopy: boolean = false) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.rerollCount = rerollCount;
|
this.rerollCount = rerollCount;
|
||||||
this.modifierTiers = modifierTiers;
|
this.modifierTiers = modifierTiers;
|
||||||
this.customModifierSettings = customModifierSettings;
|
this.customModifierSettings = customModifierSettings;
|
||||||
|
this.isCopy = isCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
if (!this.rerollCount) {
|
if (!this.rerollCount && !this.isCopy) {
|
||||||
this.updateSeed();
|
this.updateSeed();
|
||||||
} else {
|
} else if (this.rerollCount) {
|
||||||
this.scene.reroll = false;
|
this.scene.reroll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const party = this.scene.getParty();
|
const party = this.scene.getParty();
|
||||||
|
if (!this.isCopy) {
|
||||||
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||||
|
}
|
||||||
const modifierCount = new Utils.IntegerHolder(3);
|
const modifierCount = new Utils.IntegerHolder(3);
|
||||||
if (this.isPlayer()) {
|
if (this.isPlayer()) {
|
||||||
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
||||||
@ -54,7 +60,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeOptions: ModifierTypeOption[] = this.getModifierTypeOptions(modifierCount.value);
|
this.typeOptions = this.getModifierTypeOptions(modifierCount.value);
|
||||||
|
|
||||||
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
||||||
if (rowCursor < 0 || cursor < 0) {
|
if (rowCursor < 0 || cursor < 0) {
|
||||||
@ -63,13 +69,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
this.scene.ui.revertMode();
|
this.scene.ui.revertMode();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
super.end();
|
super.end();
|
||||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)));
|
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers)));
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let modifierType: ModifierType;
|
let modifierType: ModifierType;
|
||||||
let cost: integer;
|
let cost: integer;
|
||||||
const rerollCost = this.getRerollCost(typeOptions, this.scene.lockModifierTiers);
|
const rerollCost = this.getRerollCost(this.scene.lockModifierTiers);
|
||||||
switch (rowCursor) {
|
switch (rowCursor) {
|
||||||
case 0:
|
case 0:
|
||||||
switch (cursor) {
|
switch (cursor) {
|
||||||
@ -79,7 +85,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.scene.reroll = true;
|
this.scene.reroll = true;
|
||||||
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type?.tier).filter(t => t !== undefined) as ModifierTier[]));
|
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, this.typeOptions.map(o => o.type?.tier).filter(t => t !== undefined) as ModifierTier[]));
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
@ -98,13 +104,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
const itemModifier = itemModifiers[itemIndex];
|
const itemModifier = itemModifiers[itemIndex];
|
||||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, itemQuantity);
|
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, itemQuantity);
|
||||||
} else {
|
} else {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||||
}
|
}
|
||||||
}, PartyUiHandler.FilterItemMaxStacks);
|
}, PartyUiHandler.FilterItemMaxStacks);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.CHECK, -1, () => {
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -115,21 +121,21 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
||||||
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
||||||
uiHandler.setRerollCost(this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
uiHandler.setRerollCost(this.getRerollCost(this.scene.lockModifierTiers));
|
||||||
uiHandler.updateLockRaritiesText();
|
uiHandler.updateLockRaritiesText();
|
||||||
uiHandler.updateRerollCostText();
|
uiHandler.updateRerollCostText();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case 1:
|
case 1:
|
||||||
if (typeOptions.length === 0) {
|
if (this.typeOptions.length === 0) {
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
super.end();
|
super.end();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (typeOptions[cursor].type) {
|
if (this.typeOptions[cursor].type) {
|
||||||
modifierType = typeOptions[cursor].type;
|
modifierType = this.typeOptions[cursor].type;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -151,8 +157,16 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
|
const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
|
||||||
const result = this.scene.addModifier(modifier, false, playSound);
|
const result = this.scene.addModifier(modifier, false, playSound, undefined, undefined, cost);
|
||||||
if (cost) {
|
// Queue a copy of this phase when applying a TM or Memory Mushroom.
|
||||||
|
// If the player selects either of these, then escapes out of consuming them,
|
||||||
|
// they are returned to a shop in the same state.
|
||||||
|
if (modifier.type instanceof RememberMoveModifierType ||
|
||||||
|
modifier.type instanceof TmModifierType) {
|
||||||
|
this.scene.unshiftPhase(this.copy());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cost && !(modifier.type instanceof RememberMoveModifierType)) {
|
||||||
result.then(success => {
|
result.then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
@ -189,7 +203,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
applyModifier(modifier, true);
|
applyModifier(modifier, true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||||
}
|
}
|
||||||
}, modifierType.selectFilter);
|
}, modifierType.selectFilter);
|
||||||
} else {
|
} else {
|
||||||
@ -216,7 +230,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
applyModifier(modifier!, true); // TODO: is the bang correct?
|
applyModifier(modifier!, true); // TODO: is the bang correct?
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||||
}
|
}
|
||||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId, isPpRestoreModifier);
|
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId, isPpRestoreModifier);
|
||||||
}
|
}
|
||||||
@ -226,7 +240,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
|
|
||||||
return !cost!;// TODO: is the bang correct?
|
return !cost!;// TODO: is the bang correct?
|
||||||
};
|
};
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSeed(): void {
|
updateSeed(): void {
|
||||||
@ -237,13 +251,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): number {
|
getRerollCost(lockRarities: boolean): number {
|
||||||
let baseValue = 0;
|
let baseValue = 0;
|
||||||
if (Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
if (Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
return baseValue;
|
return baseValue;
|
||||||
} else if (lockRarities) {
|
} else if (lockRarities) {
|
||||||
const tierValues = [ 50, 125, 300, 750, 2000 ];
|
const tierValues = [ 50, 125, 300, 750, 2000 ];
|
||||||
for (const opt of typeOptions) {
|
for (const opt of this.typeOptions) {
|
||||||
baseValue += tierValues[opt.type.tier ?? 0];
|
baseValue += tierValues[opt.type.tier ?? 0];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -271,6 +285,16 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy(): SelectModifierPhase {
|
||||||
|
return new SelectModifierPhase(
|
||||||
|
this.scene,
|
||||||
|
this.rerollCount,
|
||||||
|
this.modifierTiers,
|
||||||
|
{ guaranteedModifierTypeOptions: this.typeOptions, rerollMultiplier: this.customModifierSettings?.rerollMultiplier, allowLuckUpgrades: false },
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
addModifier(modifier: Modifier): Promise<boolean> {
|
addModifier(modifier: Modifier): Promise<boolean> {
|
||||||
return this.scene.addModifier(modifier, false, true);
|
return this.scene.addModifier(modifier, false, true);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Abilities } from "#app/enums/abilities";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
import { Moves } from "#app/enums/moves";
|
import { Moves } from "#app/enums/moves";
|
||||||
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type";
|
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||||
|
import { Mode } from "#app/ui/ui";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phase from "phaser";
|
import Phase from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
@ -32,15 +33,16 @@ describe("Items - Lock Capsule", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("doesn't set the cost of common tier items to 0", async () => {
|
it("doesn't set the cost of common tier items to 0", async () => {
|
||||||
await game.startBattle();
|
await game.classicMode.startBattle();
|
||||||
|
game.scene.overridePhase(new SelectModifierPhase(game.scene, 0, undefined, { guaranteedModifierTiers: [ ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.COMMON ], fillRemaining: false }));
|
||||||
game.move.select(Moves.SURF);
|
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
|
||||||
|
|
||||||
const rewards = game.scene.getCurrentPhase() as SelectModifierPhase;
|
|
||||||
const potion = new ModifierTypeOption(modifierTypes.POTION(), 0, 40); // Common tier item
|
|
||||||
const rerollCost = rewards.getRerollCost([ potion, potion, potion ], true);
|
|
||||||
|
|
||||||
|
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
|
||||||
|
const selectModifierPhase = game.scene.getCurrentPhase() as SelectModifierPhase;
|
||||||
|
const rerollCost = selectModifierPhase.getRerollCost(true);
|
||||||
expect(rerollCost).toBe(150);
|
expect(rerollCost).toBe(150);
|
||||||
|
});
|
||||||
|
|
||||||
|
game.doSelectModifier();
|
||||||
|
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||||
}, 20000);
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
@ -63,11 +63,11 @@ describe("SelectModifierPhase", () => {
|
|||||||
new ModifierTypeOption(modifierTypes.REVIVE(), 0, 1000)
|
new ModifierTypeOption(modifierTypes.REVIVE(), 0, 1000)
|
||||||
];
|
];
|
||||||
|
|
||||||
const selectModifierPhase1 = new SelectModifierPhase(scene);
|
const selectModifierPhase1 = new SelectModifierPhase(scene, 0, undefined, { guaranteedModifierTypeOptions: options });
|
||||||
const selectModifierPhase2 = new SelectModifierPhase(scene, 0, undefined, { rerollMultiplier: 2 });
|
const selectModifierPhase2 = new SelectModifierPhase(scene, 0, undefined, { guaranteedModifierTypeOptions: options, rerollMultiplier: 2 });
|
||||||
|
|
||||||
const cost1 = selectModifierPhase1.getRerollCost(options, false);
|
const cost1 = selectModifierPhase1.getRerollCost(false);
|
||||||
const cost2 = selectModifierPhase2.getRerollCost(options, false);
|
const cost2 = selectModifierPhase2.getRerollCost(false);
|
||||||
expect(cost2).toEqual(cost1 * 2);
|
expect(cost2).toEqual(cost1 * 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import { ShopCursorTarget } from "#app/enums/shop-cursor-target";
|
|||||||
import { IntegerHolder } from "./../utils";
|
import { IntegerHolder } from "./../utils";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
|
|
||||||
export const SHOP_OPTIONS_ROW_LIMIT = 6;
|
export const SHOP_OPTIONS_ROW_LIMIT = 7;
|
||||||
|
|
||||||
export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
private modifierContainer: Phaser.GameObjects.Container;
|
private modifierContainer: Phaser.GameObjects.Container;
|
||||||
@ -211,7 +211,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
const row = m < SHOP_OPTIONS_ROW_LIMIT ? 0 : 1;
|
const row = m < SHOP_OPTIONS_ROW_LIMIT ? 0 : 1;
|
||||||
const col = m < SHOP_OPTIONS_ROW_LIMIT ? m : m - SHOP_OPTIONS_ROW_LIMIT;
|
const col = m < SHOP_OPTIONS_ROW_LIMIT ? m : m - SHOP_OPTIONS_ROW_LIMIT;
|
||||||
const rowOptions = shopTypeOptions.slice(row ? SHOP_OPTIONS_ROW_LIMIT : 0, row ? undefined : SHOP_OPTIONS_ROW_LIMIT);
|
const rowOptions = shopTypeOptions.slice(row ? SHOP_OPTIONS_ROW_LIMIT : 0, row ? undefined : SHOP_OPTIONS_ROW_LIMIT);
|
||||||
const sliceWidth = (this.scene.game.canvas.width / SHOP_OPTIONS_ROW_LIMIT) / (rowOptions.length + 2);
|
const sliceWidth = (this.scene.game.canvas.width / 6) / (rowOptions.length + 2);
|
||||||
const option = new ModifierOption(this.scene, sliceWidth * (col + 1) + (sliceWidth * 0.5), ((-this.scene.game.canvas.height / 12) - (this.scene.game.canvas.height / 32) - (40 - (28 * row - 1))), shopTypeOptions[m]);
|
const option = new ModifierOption(this.scene, sliceWidth * (col + 1) + (sliceWidth * 0.5), ((-this.scene.game.canvas.height / 12) - (this.scene.game.canvas.height / 32) - (40 - (28 * row - 1))), shopTypeOptions[m]);
|
||||||
option.setScale(0.375);
|
option.setScale(0.375);
|
||||||
this.scene.add.existing(option);
|
this.scene.add.existing(option);
|
||||||
|
Loading…
Reference in New Issue
Block a user