resolve conflicts, import issues, and cleanup from rebase
This commit is contained in:
parent
8907073b6e
commit
ce55c13c12
|
@ -240,7 +240,7 @@ export default class BattleScene extends SceneBase {
|
|||
public money: integer;
|
||||
public pokemonInfoContainer: PokemonInfoContainer;
|
||||
private party: PlayerPokemon[];
|
||||
public mysteryEncounterFlags: MysteryEncounterFlags = new MysteryEncounterFlags(null);
|
||||
public mysteryEncounterData: MysteryEncounterData = new MysteryEncounterData(null);
|
||||
public lastMysteryEncounter: MysteryEncounter;
|
||||
/** Combined Biome and Wave count text */
|
||||
private biomeWaveText: Phaser.GameObjects.Text;
|
||||
|
@ -1222,7 +1222,6 @@ export default class BattleScene extends SceneBase {
|
|||
pokemon.resetBattleData();
|
||||
applyPostBattleInitAbAttrs(PostBattleInitAbAttr, pokemon);
|
||||
}
|
||||
}
|
||||
|
||||
this.unshiftPhase(new ShowTrainerPhase(this));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import { PlayerGender } from "#enums/player-gender";
|
|||
import { Species } from "#enums/species";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import MysteryEncounter, { MysteryEncounterVariant } from "./data/mystery-encounter";
|
||||
import MysteryEncounter, { MysteryEncounterVariant } from "./data/mystery-encounters/mystery-encounter";
|
||||
|
||||
export enum BattleType {
|
||||
WILD,
|
||||
|
|
|
@ -7,35 +7,12 @@ import { Status, StatusEffect } from "../status-effect";
|
|||
import { TrainerConfig, trainerConfigs, TrainerSlot } from "../trainer-config";
|
||||
import Pokemon, { FieldPosition, PlayerPokemon } from "#app/field/pokemon";
|
||||
import Trainer, { TrainerVariant } from "../../field/trainer";
|
||||
import {
|
||||
ExpBalanceModifier,
|
||||
ExpShareModifier,
|
||||
MultipleParticipantExpBonusModifier,
|
||||
PokemonExpBoosterModifier
|
||||
} from "#app/modifier/modifier";
|
||||
import {
|
||||
CustomModifierSettings,
|
||||
getModifierPoolForType,
|
||||
ModifierPoolType,
|
||||
ModifierType,
|
||||
ModifierTypeFunc,
|
||||
ModifierTypeGenerator,
|
||||
modifierTypes,
|
||||
PokemonHeldItemModifierType,
|
||||
regenerateModifierPoolThresholds
|
||||
} from "#app/modifier/modifier-type";
|
||||
import {
|
||||
BattleEndPhase,
|
||||
EggLapsePhase,
|
||||
ExpPhase,
|
||||
ModifierRewardPhase,
|
||||
ShowPartyExpBarPhase,
|
||||
TrainerVictoryPhase
|
||||
} from "#app/phases";
|
||||
import { ExpBalanceModifier, ExpShareModifier, MultipleParticipantExpBonusModifier, PokemonExpBoosterModifier } from "#app/modifier/modifier";
|
||||
import { CustomModifierSettings, getModifierPoolForType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeGenerator, modifierTypes, PokemonHeldItemModifierType, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||
import { BattleEndPhase, EggLapsePhase, ExpPhase, ModifierRewardPhase, SelectModifierPhase, ShowPartyExpBarPhase, TrainerVictoryPhase } from "#app/phases";
|
||||
import { MysteryEncounterBattlePhase, MysteryEncounterRewardsPhase } from "#app/phases/mystery-encounter-phase";
|
||||
import * as Utils from "../../utils";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { Type } from "#app/data/type";
|
||||
|
|
|
@ -8,9 +8,8 @@ import Pokemon, { EnemyPokemon, PlayerPokemon } from "./field/pokemon";
|
|||
import { Mode } from "./ui/ui";
|
||||
import PartyUiHandler from "./ui/party-ui-handler";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { MovePhase, PokemonHealPhase } from "./phases";
|
||||
import { BattlePhase, MovePhase, PokemonHealPhase } from "./phases";
|
||||
import { getTypeRgb } from "./data/type";
|
||||
import { BattlePhase } from "#app/phases/battle-phase";
|
||||
|
||||
export class FormChangePhase extends EvolutionPhase {
|
||||
private formChange: SpeciesFormChange;
|
||||
|
|
305
src/phases.ts
305
src/phases.ts
|
@ -5,7 +5,7 @@ import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMov
|
|||
import { Mode } from "./ui/ui";
|
||||
import { Command } from "./ui/command-ui-handler";
|
||||
import { Stat } from "./data/pokemon-stat";
|
||||
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, FlinchChanceModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems, BypassSpeedChanceModifier, TurnStatusEffectModifier } from "./modifier/modifier";
|
||||
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, FlinchChanceModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems, BypassSpeedChanceModifier, TurnStatusEffectModifier, ExtraModifierModifier } from "./modifier/modifier";
|
||||
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
|
||||
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
|
||||
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
|
||||
|
@ -17,7 +17,7 @@ import { Phase } from "./phase";
|
|||
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
|
||||
import { biomeLinks, getBiomeName } from "./data/biomes";
|
||||
import { ModifierTier } from "./modifier/modifier-tier";
|
||||
import { ModifierPoolType, ModifierType, ModifierTypeFunc, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
||||
import { ModifierPoolType, ModifierType, ModifierTypeFunc, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, modifierTypes, regenerateModifierPoolThresholds, CustomModifierSettings, ModifierTypeOption, getPlayerShopModifierTypeOptionsForWave, PokemonModifierType, FusePokemonModifierType, PokemonMoveModifierType, TmModifierType, RememberMoveModifierType, PokemonPpRestoreModifierType, PokemonPpUpModifierType, getPlayerModifierTypeOptions } from "./modifier/modifier-type";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
import { BattlerTagLapseType, CenterOfAttentionTag, EncoreTag, ProtectedTag, SemiInvulnerableTag, TrappedTag, MysteryEncounterPostSummonTag } from "./data/battler-tags";
|
||||
import { getPokemonMessage, getPokemonNameWithAffix } from "./messages";
|
||||
|
@ -64,11 +64,11 @@ import { Moves } from "#enums/moves";
|
|||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { Species } from "#enums/species";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { BattlePhase } from "#app/phases/battle-phase";
|
||||
import { MysteryEncounterVariant } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phase";
|
||||
import { getEncounterText, handleMysteryEncounterVictory } from "#app/data/mystery-encounters/mystery-encounter-utils";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler";
|
||||
import { isNullOrUndefined } from "./utils";
|
||||
|
||||
const { t } = i18next;
|
||||
|
||||
|
@ -671,6 +671,17 @@ export class BattlePhase extends Phase {
|
|||
duration: 750
|
||||
});
|
||||
}
|
||||
|
||||
hideEnemyTrainer(): void {
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.currentBattle.trainer,
|
||||
x: "+=16",
|
||||
y: "-=16",
|
||||
alpha: 0,
|
||||
ease: "Sine.easeInOut",
|
||||
duration: 750
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
type PokemonFunc = (pokemon: Pokemon) => void;
|
||||
|
@ -1660,57 +1671,6 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||
});
|
||||
}
|
||||
|
||||
summonWild(): void {
|
||||
const pokemon = this.getPokemon();
|
||||
|
||||
if (this.fieldIndex === 1) {
|
||||
pokemon.setFieldPosition(FieldPosition.RIGHT, 0);
|
||||
} else {
|
||||
const availablePartyMembers = this.getParty().filter(p => !p.isFainted()).length;
|
||||
pokemon.setFieldPosition(!this.scene.currentBattle.double || availablePartyMembers === 1 ? FieldPosition.CENTER : FieldPosition.LEFT);
|
||||
}
|
||||
|
||||
this.scene.add.existing(pokemon);
|
||||
this.scene.field.add(pokemon);
|
||||
if (!this.player) {
|
||||
const playerPokemon = this.scene.getPlayerPokemon() as Pokemon;
|
||||
if (playerPokemon?.visible) {
|
||||
this.scene.field.moveBelow(pokemon, playerPokemon);
|
||||
}
|
||||
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
||||
}
|
||||
this.scene.updateModifiers(this.player);
|
||||
this.scene.updateFieldScale();
|
||||
pokemon.showInfo();
|
||||
pokemon.playAnim();
|
||||
pokemon.setVisible(true);
|
||||
pokemon.getSprite().setVisible(true);
|
||||
pokemon.setScale(0.75);
|
||||
pokemon.tint(getPokeballTintColor(pokemon.pokeball));
|
||||
pokemon.untint(250, "Sine.easeIn");
|
||||
this.scene.updateFieldScale();
|
||||
pokemon.x += 16;
|
||||
pokemon.y -= 16;
|
||||
pokemon.alpha = 0;
|
||||
|
||||
// Ease pokemon in
|
||||
this.scene.tweens.add({
|
||||
targets: pokemon,
|
||||
x: "-=16",
|
||||
y: "+=16",
|
||||
alpha: 1,
|
||||
duration: 1000,
|
||||
ease: "Sine.easeIn",
|
||||
scale: pokemon.getSpriteScale(),
|
||||
onComplete: () => {
|
||||
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
|
||||
pokemon.getSprite().clearTint();
|
||||
pokemon.resetSummonData();
|
||||
this.scene.time.delayedCall(1000, () => this.end());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onEnd(): void {
|
||||
const pokemon = this.getPokemon();
|
||||
|
||||
|
@ -5296,6 +5256,241 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||
}
|
||||
}
|
||||
|
||||
export class SelectModifierPhase extends BattlePhase {
|
||||
private rerollCount: integer;
|
||||
private modifierTiers: ModifierTier[];
|
||||
private customModifierSettings: CustomModifierSettings;
|
||||
|
||||
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings) {
|
||||
super(scene);
|
||||
|
||||
this.rerollCount = rerollCount;
|
||||
this.modifierTiers = modifierTiers;
|
||||
this.customModifierSettings = customModifierSettings;
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
if (!this.rerollCount) {
|
||||
this.updateSeed();
|
||||
} else {
|
||||
this.scene.reroll = false;
|
||||
}
|
||||
|
||||
const party = this.scene.getParty();
|
||||
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||
const modifierCount = new Utils.IntegerHolder(3);
|
||||
if (this.isPlayer()) {
|
||||
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
||||
}
|
||||
|
||||
// If custom modifiers are specified, overrides default item count
|
||||
if (!!this.customModifierSettings) {
|
||||
const newItemCount = (this.customModifierSettings.guaranteedModifierTiers?.length || 0) +
|
||||
(this.customModifierSettings.guaranteedModifierTypeOptions?.length || 0) +
|
||||
(this.customModifierSettings.guaranteedModifierTypeFuncs?.length || 0);
|
||||
if (this.customModifierSettings.fillRemaining) {
|
||||
const originalCount = modifierCount.value;
|
||||
modifierCount.value = originalCount > newItemCount ? originalCount : newItemCount;
|
||||
} else {
|
||||
modifierCount.value = newItemCount;
|
||||
}
|
||||
}
|
||||
|
||||
const typeOptions: ModifierTypeOption[] = this.getModifierTypeOptions(modifierCount.value);
|
||||
|
||||
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
||||
if (rowCursor < 0 || cursor < 0) {
|
||||
this.scene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
||||
this.scene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)));
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let modifierType: ModifierType;
|
||||
let cost: integer;
|
||||
switch (rowCursor) {
|
||||
case 0:
|
||||
switch (cursor) {
|
||||
case 0:
|
||||
const rerollCost = this.getRerollCost(typeOptions, this.scene.lockModifierTiers);
|
||||
if (rerollCost === 0 || this.scene.money < rerollCost) {
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
} else {
|
||||
this.scene.reroll = true;
|
||||
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type.tier)));
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
this.scene.money -= rerollCost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
this.scene.playSound("buy");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, itemQuantity: integer, toSlotIndex: integer) => {
|
||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||
const itemModifier = itemModifiers[itemIndex];
|
||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, itemQuantity);
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, PartyUiHandler.FilterItemMaxStacks);
|
||||
break;
|
||||
case 2:
|
||||
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));
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
||||
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
||||
uiHandler.setRerollCost(this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
uiHandler.updateLockRaritiesText();
|
||||
uiHandler.updateRerollCostText();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case 1:
|
||||
if (typeOptions.length === 0) {
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
}
|
||||
modifierType = typeOptions[cursor].type;
|
||||
break;
|
||||
default:
|
||||
const shopOptions = getPlayerShopModifierTypeOptionsForWave(this.scene.currentBattle.waveIndex, this.scene.getWaveMoneyAmount(1));
|
||||
const shopOption = shopOptions[rowCursor > 2 || shopOptions.length <= SHOP_OPTIONS_ROW_LIMIT ? cursor : cursor + SHOP_OPTIONS_ROW_LIMIT];
|
||||
modifierType = shopOption.type;
|
||||
cost = shopOption.cost;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cost && this.scene.money < cost) {
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
}
|
||||
|
||||
const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
|
||||
const result = this.scene.addModifier(modifier, false, playSound);
|
||||
if (cost) {
|
||||
result.then(success => {
|
||||
if (success) {
|
||||
this.scene.money -= cost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
this.scene.playSound("buy");
|
||||
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
|
||||
} else {
|
||||
this.scene.ui.playError();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const doEnd = () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
};
|
||||
if (result instanceof Promise) {
|
||||
result.then(() => doEnd());
|
||||
} else {
|
||||
doEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (modifierType instanceof PokemonModifierType) {
|
||||
if (modifierType instanceof FusePokemonModifierType) {
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: integer, spliceSlotIndex: integer) => {
|
||||
if (spliceSlotIndex !== undefined && fromSlotIndex < 6 && spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex) {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex]);
|
||||
applyModifier(modifier, true);
|
||||
});
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, modifierType.selectFilter);
|
||||
} else {
|
||||
const pokemonModifierType = modifierType as PokemonModifierType;
|
||||
const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
|
||||
const isTmModifier = modifierType instanceof TmModifierType;
|
||||
const isRememberMoveModifier = modifierType instanceof RememberMoveModifierType;
|
||||
const isPpRestoreModifier = (modifierType instanceof PokemonPpRestoreModifierType || modifierType instanceof PokemonPpUpModifierType);
|
||||
const partyUiMode = isMoveModifier ? PartyUiMode.MOVE_MODIFIER
|
||||
: isTmModifier ? PartyUiMode.TM_MODIFIER
|
||||
: isRememberMoveModifier ? PartyUiMode.REMEMBER_MOVE_MODIFIER
|
||||
: PartyUiMode.MODIFIER;
|
||||
const tmMoveId = isTmModifier
|
||||
? (modifierType as TmModifierType).moveId
|
||||
: undefined;
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: integer, option: PartyOption) => {
|
||||
if (slotIndex < 6) {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
const modifier = !isMoveModifier
|
||||
? !isRememberMoveModifier
|
||||
? modifierType.newModifier(party[slotIndex])
|
||||
: modifierType.newModifier(party[slotIndex], option as integer)
|
||||
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
||||
applyModifier(modifier, true);
|
||||
});
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId, isPpRestoreModifier);
|
||||
}
|
||||
} else {
|
||||
applyModifier(modifierType.newModifier());
|
||||
}
|
||||
|
||||
return !cost;
|
||||
};
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
|
||||
updateSeed(): void {
|
||||
this.scene.resetSeed();
|
||||
}
|
||||
|
||||
isPlayer(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer {
|
||||
let baseValue = 0;
|
||||
if (lockRarities) {
|
||||
const tierValues = [50, 125, 300, 750, 2000];
|
||||
for (const opt of typeOptions) {
|
||||
baseValue += tierValues[opt.type.tier];
|
||||
}
|
||||
} else {
|
||||
baseValue = 250;
|
||||
}
|
||||
const multiplier = !isNullOrUndefined(this.customModifierSettings?.rerollMultiplier) ? this.customModifierSettings.rerollMultiplier : 1;
|
||||
return Math.min(Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount) * multiplier, Number.MAX_SAFE_INTEGER);
|
||||
}
|
||||
|
||||
getPoolType(): ModifierPoolType {
|
||||
return ModifierPoolType.PLAYER;
|
||||
}
|
||||
|
||||
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
||||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
||||
}
|
||||
|
||||
addModifier(modifier: Modifier): Promise<boolean> {
|
||||
return this.scene.addModifier(modifier, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
export class EggLapsePhase extends Phase {
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene);
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
import { Phase } from "#app/phase";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
|
||||
export class BattlePhase extends Phase {
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene);
|
||||
}
|
||||
|
||||
showEnemyTrainer(trainerSlot: TrainerSlot = TrainerSlot.NONE): void {
|
||||
const sprites = this.scene.currentBattle.trainer.getSprites();
|
||||
const tintSprites = this.scene.currentBattle.trainer.getTintSprites();
|
||||
for (let i = 0; i < sprites.length; i++) {
|
||||
const visible = !trainerSlot || !i === (trainerSlot === TrainerSlot.TRAINER) || sprites.length < 2;
|
||||
[sprites[i], tintSprites[i]].map(sprite => {
|
||||
if (visible) {
|
||||
sprite.x = trainerSlot || sprites.length < 2 ? 0 : i ? 16 : -16;
|
||||
}
|
||||
sprite.setVisible(visible);
|
||||
sprite.clearTint();
|
||||
});
|
||||
sprites[i].setVisible(visible);
|
||||
tintSprites[i].setVisible(visible);
|
||||
sprites[i].clearTint();
|
||||
tintSprites[i].clearTint();
|
||||
}
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.currentBattle.trainer,
|
||||
x: "-=16",
|
||||
y: "+=16",
|
||||
alpha: 1,
|
||||
ease: "Sine.easeInOut",
|
||||
duration: 750
|
||||
});
|
||||
}
|
||||
|
||||
hideEnemyTrainer(): void {
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.currentBattle.trainer,
|
||||
x: "+=16",
|
||||
y: "-=16",
|
||||
alpha: 0,
|
||||
ease: "Sine.easeInOut",
|
||||
duration: 750
|
||||
});
|
||||
}
|
||||
}
|
|
@ -5,16 +5,15 @@ import { Mode } from "../ui/ui";
|
|||
import {
|
||||
getEncounterText
|
||||
} from "../data/mystery-encounters/mystery-encounter-utils";
|
||||
import { CheckSwitchPhase, NewBattlePhase, PostSummonPhase, ReturnPhase, ScanIvsPhase, SummonPhase, ToggleDoublePositionPhase } from "../phases";
|
||||
import { CheckSwitchPhase, NewBattlePhase, PostSummonPhase, ReturnPhase, ScanIvsPhase, SelectModifierPhase, SummonPhase, ToggleDoublePositionPhase } from "../phases";
|
||||
import MysteryEncounterOption from "../data/mystery-encounters/mystery-encounter-option";
|
||||
import { MysteryEncounterVariant } from "../data/mystery-encounters/mystery-encounter";
|
||||
import { getCharVariantFromDialogue } from "../data/dialogue";
|
||||
import { TrainerSlot } from "../data/trainer-config";
|
||||
import { BattleSpec } from "../enums/battle-spec";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { Tutorial, handleTutorial } from "../tutorial";
|
||||
import { IvScannerModifier } from "../modifier/modifier";
|
||||
import * as Utils from "../utils";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import { isNullOrUndefined } from "../utils";
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,259 +0,0 @@
|
|||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import {
|
||||
CustomModifierSettings,
|
||||
FusePokemonModifierType, getPlayerModifierTypeOptions,
|
||||
getPlayerShopModifierTypeOptionsForWave, ModifierPoolType,
|
||||
ModifierType,
|
||||
ModifierTypeOption,
|
||||
PokemonModifierType,
|
||||
PokemonMoveModifierType,
|
||||
PokemonPpRestoreModifierType,
|
||||
PokemonPpUpModifierType,
|
||||
regenerateModifierPoolThresholds,
|
||||
RememberMoveModifierType,
|
||||
TmModifierType
|
||||
} from "#app/modifier/modifier-type";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import * as Utils from "#app/utils";
|
||||
import { ExtraModifierModifier, Modifier, PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import PartyUiHandler, { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler";
|
||||
import { BattlePhase } from "#app/phases/battle-phase";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
|
||||
export class SelectModifierPhase extends BattlePhase {
|
||||
private rerollCount: integer;
|
||||
private modifierTiers: ModifierTier[];
|
||||
private customModifierSettings: CustomModifierSettings;
|
||||
|
||||
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings) {
|
||||
super(scene);
|
||||
|
||||
this.rerollCount = rerollCount;
|
||||
this.modifierTiers = modifierTiers;
|
||||
this.customModifierSettings = customModifierSettings;
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
if (!this.rerollCount) {
|
||||
this.updateSeed();
|
||||
} else {
|
||||
this.scene.reroll = false;
|
||||
}
|
||||
|
||||
const party = this.scene.getParty();
|
||||
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||
const modifierCount = new Utils.IntegerHolder(3);
|
||||
if (this.isPlayer()) {
|
||||
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
||||
}
|
||||
|
||||
// If custom modifiers are specified, overrides default item count
|
||||
if (!!this.customModifierSettings) {
|
||||
const newItemCount = (this.customModifierSettings.guaranteedModifierTiers?.length || 0) +
|
||||
(this.customModifierSettings.guaranteedModifierTypeOptions?.length || 0) +
|
||||
(this.customModifierSettings.guaranteedModifierTypeFuncs?.length || 0);
|
||||
if (this.customModifierSettings.fillRemaining) {
|
||||
const originalCount = modifierCount.value;
|
||||
modifierCount.value = originalCount > newItemCount ? originalCount : newItemCount;
|
||||
} else {
|
||||
modifierCount.value = newItemCount;
|
||||
}
|
||||
}
|
||||
|
||||
const typeOptions: ModifierTypeOption[] = this.getModifierTypeOptions(modifierCount.value);
|
||||
|
||||
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
||||
if (rowCursor < 0 || cursor < 0) {
|
||||
this.scene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
||||
this.scene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)));
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let modifierType: ModifierType;
|
||||
let cost: integer;
|
||||
switch (rowCursor) {
|
||||
case 0:
|
||||
switch (cursor) {
|
||||
case 0:
|
||||
const rerollCost = this.getRerollCost(typeOptions, this.scene.lockModifierTiers);
|
||||
if (rerollCost === 0 || this.scene.money < rerollCost) {
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
} else {
|
||||
this.scene.reroll = true;
|
||||
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type.tier)));
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
this.scene.money -= rerollCost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
this.scene.playSound("buy");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, itemQuantity: integer, toSlotIndex: integer) => {
|
||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||
const itemModifier = itemModifiers[itemIndex];
|
||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, itemQuantity);
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, PartyUiHandler.FilterItemMaxStacks);
|
||||
break;
|
||||
case 2:
|
||||
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));
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
||||
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
||||
uiHandler.setRerollCost(this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
uiHandler.updateLockRaritiesText();
|
||||
uiHandler.updateRerollCostText();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case 1:
|
||||
if (typeOptions.length === 0) {
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
}
|
||||
modifierType = typeOptions[cursor].type;
|
||||
break;
|
||||
default:
|
||||
const shopOptions = getPlayerShopModifierTypeOptionsForWave(this.scene.currentBattle.waveIndex, this.scene.getWaveMoneyAmount(1));
|
||||
const shopOption = shopOptions[rowCursor > 2 || shopOptions.length <= SHOP_OPTIONS_ROW_LIMIT ? cursor : cursor + SHOP_OPTIONS_ROW_LIMIT];
|
||||
modifierType = shopOption.type;
|
||||
cost = shopOption.cost;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cost && this.scene.money < cost) {
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
}
|
||||
|
||||
const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
|
||||
const result = this.scene.addModifier(modifier, false, playSound);
|
||||
if (cost) {
|
||||
result.then(success => {
|
||||
if (success) {
|
||||
this.scene.money -= cost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
this.scene.playSound("buy");
|
||||
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
|
||||
} else {
|
||||
this.scene.ui.playError();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const doEnd = () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
};
|
||||
if (result instanceof Promise) {
|
||||
result.then(() => doEnd());
|
||||
} else {
|
||||
doEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (modifierType instanceof PokemonModifierType) {
|
||||
if (modifierType instanceof FusePokemonModifierType) {
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: integer, spliceSlotIndex: integer) => {
|
||||
if (spliceSlotIndex !== undefined && fromSlotIndex < 6 && spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex) {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex]);
|
||||
applyModifier(modifier, true);
|
||||
});
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, modifierType.selectFilter);
|
||||
} else {
|
||||
const pokemonModifierType = modifierType as PokemonModifierType;
|
||||
const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
|
||||
const isTmModifier = modifierType instanceof TmModifierType;
|
||||
const isRememberMoveModifier = modifierType instanceof RememberMoveModifierType;
|
||||
const isPpRestoreModifier = (modifierType instanceof PokemonPpRestoreModifierType || modifierType instanceof PokemonPpUpModifierType);
|
||||
const partyUiMode = isMoveModifier ? PartyUiMode.MOVE_MODIFIER
|
||||
: isTmModifier ? PartyUiMode.TM_MODIFIER
|
||||
: isRememberMoveModifier ? PartyUiMode.REMEMBER_MOVE_MODIFIER
|
||||
: PartyUiMode.MODIFIER;
|
||||
const tmMoveId = isTmModifier
|
||||
? (modifierType as TmModifierType).moveId
|
||||
: undefined;
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: integer, option: PartyOption) => {
|
||||
if (slotIndex < 6) {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||
const modifier = !isMoveModifier
|
||||
? !isRememberMoveModifier
|
||||
? modifierType.newModifier(party[slotIndex])
|
||||
: modifierType.newModifier(party[slotIndex], option as integer)
|
||||
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
||||
applyModifier(modifier, true);
|
||||
});
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId, isPpRestoreModifier);
|
||||
}
|
||||
} else {
|
||||
applyModifier(modifierType.newModifier());
|
||||
}
|
||||
|
||||
return !cost;
|
||||
};
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
|
||||
updateSeed(): void {
|
||||
this.scene.resetSeed();
|
||||
}
|
||||
|
||||
isPlayer(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer {
|
||||
let baseValue = 0;
|
||||
if (lockRarities) {
|
||||
const tierValues = [50, 125, 300, 750, 2000];
|
||||
for (const opt of typeOptions) {
|
||||
baseValue += tierValues[opt.type.tier];
|
||||
}
|
||||
} else {
|
||||
baseValue = 250;
|
||||
}
|
||||
const multiplier = !isNullOrUndefined(this.customModifierSettings?.rerollMultiplier) ? this.customModifierSettings.rerollMultiplier : 1;
|
||||
return Math.min(Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount) * multiplier, Number.MAX_SAFE_INTEGER);
|
||||
}
|
||||
|
||||
getPoolType(): ModifierPoolType {
|
||||
return ModifierPoolType.PLAYER;
|
||||
}
|
||||
|
||||
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
||||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
||||
}
|
||||
|
||||
addModifier(modifier: Modifier): Promise<boolean> {
|
||||
return this.scene.addModifier(modifier, false, true);
|
||||
}
|
||||
}
|
|
@ -125,7 +125,7 @@ export interface SessionSaveData {
|
|||
timestamp: integer;
|
||||
challenges: ChallengeData[];
|
||||
mysteryEncounter: MysteryEncounter;
|
||||
mysteryEncounterFlags: MysteryEncounterData;
|
||||
mysteryEncounterData: MysteryEncounterData;
|
||||
}
|
||||
|
||||
interface Unlocks {
|
||||
|
@ -842,7 +842,7 @@ export class GameData {
|
|||
timestamp: new Date().getTime(),
|
||||
challenges: scene.gameMode.challenges.map(c => new ChallengeData(c)),
|
||||
mysteryEncounter: scene.currentBattle.mysteryEncounter,
|
||||
mysteryEncounterFlags: scene.mysteryEncounterData
|
||||
mysteryEncounterData: scene.mysteryEncounterData
|
||||
} as SessionSaveData;
|
||||
}
|
||||
|
||||
|
@ -933,7 +933,7 @@ export class GameData {
|
|||
scene.score = sessionData.score;
|
||||
scene.updateScoreText();
|
||||
|
||||
scene.mysteryEncounterData = sessionData?.mysteryEncounterFlags ? sessionData?.mysteryEncounterFlags : new MysteryEncounterData(null);
|
||||
scene.mysteryEncounterData = sessionData?.mysteryEncounterData ? sessionData?.mysteryEncounterData : new MysteryEncounterData(null);
|
||||
|
||||
scene.newArena(sessionData.arena.biome);
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ export class GameData {
|
|||
return new MysteryEncounter(v);
|
||||
}
|
||||
|
||||
if (k === "mysteryEncounterFlags") {
|
||||
if (k === "mysteryEncounterData") {
|
||||
return new MysteryEncounterData(v);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
EncounterPhase,
|
||||
EnemyCommandPhase,
|
||||
LoginPhase,
|
||||
SelectGenderPhase,
|
||||
SelectGenderPhase, SelectModifierPhase,
|
||||
SelectStarterPhase,
|
||||
SummonPhase,
|
||||
TitlePhase,
|
||||
|
@ -23,7 +23,6 @@ import { Abilities } from "#enums/abilities";
|
|||
import { Moves } from "#enums/moves";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { Species } from "#enums/species";
|
||||
import {SelectModifierPhase} from "#app/phases/select-modifier-phase";
|
||||
|
||||
describe("Test Battle Phase", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import {
|
||||
|
@ -6,14 +6,14 @@ import {
|
|||
getRandomPlayerPokemon, getRandomSpeciesByStarterTier, getEncounterText,
|
||||
koPlayerPokemon, queueEncounterMessage, showEncounterDialogue, showEncounterText,
|
||||
} from "#app/data/mystery-encounters/mystery-encounter-utils";
|
||||
import {initSceneWithoutEncounterPhase} from "#test/utils/gameManagerUtils";
|
||||
import {Species} from "#enums/species";
|
||||
import { initSceneWithoutEncounterPhase } from "#test/utils/gameManagerUtils";
|
||||
import { Species } from "#enums/species";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import {StatusEffect} from "#app/data/status-effect";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import {MessagePhase} from "#app/phases";
|
||||
import {getPokemonSpecies, speciesStarters} from "#app/data/pokemon-species";
|
||||
import {Type} from "#app/data/type";
|
||||
import { MessagePhase } from "#app/phases";
|
||||
import { getPokemonSpecies, speciesStarters } from "#app/data/pokemon-species";
|
||||
import { Type } from "#app/data/type";
|
||||
|
||||
describe("Mystery Encounter Utils", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
|
@ -40,14 +40,14 @@ describe("Mystery Encounter Utils", () => {
|
|||
it("gets a random pokemon from player party", () => {
|
||||
// Seeds are calculated to return index 0 first, 1 second (if both pokemon are legal)
|
||||
scene.waveSeed = "random";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
let result = getRandomPlayerPokemon(scene);
|
||||
expect(result.species.speciesId).toBe(Species.MANAPHY);
|
||||
|
||||
scene.waveSeed = "random2";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
result = getRandomPlayerPokemon(scene);
|
||||
|
@ -64,14 +64,14 @@ describe("Mystery Encounter Utils", () => {
|
|||
|
||||
// Seeds are calculated to return index 0 first, 1 second (if both pokemon are legal)
|
||||
scene.waveSeed = "random";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
let result = getRandomPlayerPokemon(scene);
|
||||
expect(result.species.speciesId).toBe(Species.MANAPHY);
|
||||
|
||||
scene.waveSeed = "random2";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
result = getRandomPlayerPokemon(scene);
|
||||
|
@ -87,14 +87,14 @@ describe("Mystery Encounter Utils", () => {
|
|||
|
||||
// Seeds are calculated to return index 0 first, 1 second (if both pokemon are legal)
|
||||
scene.waveSeed = "random";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
let result = getRandomPlayerPokemon(scene, true);
|
||||
expect(result.species.speciesId).toBe(Species.MANAPHY);
|
||||
|
||||
scene.waveSeed = "random2";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
result = getRandomPlayerPokemon(scene, true);
|
||||
|
@ -110,14 +110,14 @@ describe("Mystery Encounter Utils", () => {
|
|||
|
||||
// Seeds are calculated to return index 0 first, 1 second (if both pokemon are legal)
|
||||
scene.waveSeed = "random";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
let result = getRandomPlayerPokemon(scene, true, false);
|
||||
expect(result.species.speciesId).toBe(Species.MANAPHY);
|
||||
|
||||
scene.waveSeed = "random2";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
result = getRandomPlayerPokemon(scene, true, false);
|
||||
|
@ -133,14 +133,14 @@ describe("Mystery Encounter Utils", () => {
|
|||
|
||||
// Seeds are calculated to return index 0 first, 1 second (if both pokemon are legal)
|
||||
scene.waveSeed = "random";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
let result = getRandomPlayerPokemon(scene, true, true);
|
||||
expect(result.species.speciesId).toBe(Species.ARCEUS);
|
||||
|
||||
scene.waveSeed = "random2";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
|
||||
result = getRandomPlayerPokemon(scene, true, true);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {afterEach, beforeAll, beforeEach, expect, describe, it, vi} from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, expect, describe, it, vi } from "vitest";
|
||||
import * as overrides from "../../overrides";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import {Species} from "#enums/species";
|
||||
import {MysteryEncounterPhase} from "#app/phases/mystery-encounter-phase";
|
||||
import {MysteryEncounterType} from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phase";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
|
||||
describe("Mystery Encounters", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
|
@ -29,12 +29,12 @@ describe("Mystery Encounters", () => {
|
|||
// Seed guarantees wild encounter to be replaced by ME
|
||||
vi.spyOn(game.scene, "resetSeed").mockImplementation(() => {
|
||||
game.scene.waveSeed = "test";
|
||||
Phaser.Math.RND.sow([ game.scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([game.scene.waveSeed]);
|
||||
game.scene.rngCounter = 0;
|
||||
});
|
||||
});
|
||||
|
||||
it("Spawns a mystery encounter", async() => {
|
||||
it("Spawns a mystery encounter", async () => {
|
||||
await game.runToMysteryEncounter([
|
||||
Species.CHARIZARD,
|
||||
Species.VOLCARONA
|
||||
|
@ -44,7 +44,7 @@ describe("Mystery Encounters", () => {
|
|||
expect(game.scene.getCurrentPhase().constructor.name).toBe(MysteryEncounterPhase.name);
|
||||
});
|
||||
|
||||
it("", async() => {
|
||||
it("", async () => {
|
||||
await game.runToMysteryEncounter([
|
||||
Species.CHARIZARD,
|
||||
Species.VOLCARONA
|
||||
|
@ -54,16 +54,16 @@ describe("Mystery Encounters", () => {
|
|||
expect(game.scene.getCurrentPhase().constructor.name).toBe(MysteryEncounterPhase.name);
|
||||
});
|
||||
|
||||
it("spawns mysterious challengers encounter", async() => {
|
||||
it("spawns mysterious challengers encounter", async () => {
|
||||
});
|
||||
|
||||
it("spawns mysterious chest encounter", async() => {
|
||||
it("spawns mysterious chest encounter", async () => {
|
||||
});
|
||||
|
||||
it("spawns dark deal encounter", async() => {
|
||||
it("spawns dark deal encounter", async () => {
|
||||
});
|
||||
|
||||
it("spawns fight or flight encounter", async() => {
|
||||
it("spawns fight or flight encounter", async () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import Phaser from "phaser";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import {initSceneWithoutEncounterPhase} from "#app/test/utils/gameManagerUtils";
|
||||
import { initSceneWithoutEncounterPhase } from "#app/test/utils/gameManagerUtils";
|
||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||
import {ModifierTier} from "#app/modifier/modifier-tier";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import * as Utils from "#app/utils";
|
||||
import {CustomModifierSettings, ModifierTypeOption, modifierTypes} from "#app/modifier/modifier-type";
|
||||
import { CustomModifierSettings, ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import {SelectModifierPhase} from "#app/phases/select-modifier-phase";
|
||||
import {Species} from "#enums/species";
|
||||
import {Mode} from "#app/ui/ui";
|
||||
import {PlayerPokemon} from "#app/field/pokemon";
|
||||
import {getPokemonSpecies} from "#app/data/pokemon-species";
|
||||
import { Species } from "#enums/species";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { SelectModifierPhase } from "#app/phases";
|
||||
|
||||
describe("SelectModifierPhase", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
|
@ -30,7 +30,7 @@ describe("SelectModifierPhase", () => {
|
|||
|
||||
vi.spyOn(scene, "resetSeed").mockImplementation(() => {
|
||||
scene.waveSeed = "test";
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
scene.rngCounter = 0;
|
||||
});
|
||||
|
||||
|
@ -73,7 +73,7 @@ describe("SelectModifierPhase", () => {
|
|||
];
|
||||
|
||||
const selectModifierPhase1 = new SelectModifierPhase(scene);
|
||||
const selectModifierPhase2 = new SelectModifierPhase(scene, 0, null, { rerollMultiplier: 2});
|
||||
const selectModifierPhase2 = new SelectModifierPhase(scene, 0, null, { rerollMultiplier: 2 });
|
||||
|
||||
const cost1 = selectModifierPhase1.getRerollCost(options, false);
|
||||
const cost2 = selectModifierPhase2.getRerollCost(options, false);
|
||||
|
@ -109,7 +109,7 @@ describe("SelectModifierPhase", () => {
|
|||
// Just use fully random seed for this test
|
||||
vi.spyOn(scene, "resetSeed").mockImplementation(() => {
|
||||
scene.waveSeed = Utils.shiftCharCodes(scene.seed, 5);
|
||||
Phaser.Math.RND.sow([ scene.waveSeed ]);
|
||||
Phaser.Math.RND.sow([scene.waveSeed]);
|
||||
console.log("Wave Seed:", scene.waveSeed, 5);
|
||||
scene.rngCounter = 0;
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Species } from "#app/enums/species";
|
|||
import { Button } from "#app/enums/buttons";
|
||||
import * as overrides from "#app/overrides";
|
||||
import {
|
||||
BattleEndPhase,
|
||||
BattleEndPhase, SelectModifierPhase,
|
||||
} from "#app/phases";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||
|
@ -14,7 +14,6 @@ import Phaser from "phaser";
|
|||
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { getMovePosition } from "../utils/gameManagerUtils";
|
||||
import {SelectModifierPhase} from "#app/phases/select-modifier-phase";
|
||||
|
||||
|
||||
describe("UI - Transfer Items", () => {
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
NewBattlePhase,
|
||||
NextEncounterPhase,
|
||||
PostSummonPhase,
|
||||
SelectGenderPhase,
|
||||
SelectGenderPhase, SelectModifierPhase,
|
||||
SelectStarterPhase,
|
||||
SelectTargetPhase,
|
||||
ShinySparklePhase,
|
||||
|
@ -33,11 +33,10 @@ import {
|
|||
UnavailablePhase,
|
||||
VictoryPhase
|
||||
} from "#app/phases";
|
||||
import UI, {Mode} from "#app/ui/ui";
|
||||
import {Phase} from "#app/phase";
|
||||
import UI, { Mode } from "#app/ui/ui";
|
||||
import { Phase } from "#app/phase";
|
||||
import ErrorInterceptor from "#app/test/utils/errorInterceptor";
|
||||
import {QuietFormChangePhase} from "#app/form-change-phase";
|
||||
import {SelectModifierPhase} from "#app/phases/select-modifier-phase";
|
||||
import { QuietFormChangePhase } from "#app/form-change-phase";
|
||||
import {
|
||||
MysteryEncounterBattlePhase,
|
||||
MysteryEncounterOptionSelectedPhase,
|
||||
|
|
|
@ -9,13 +9,13 @@ import { initMoves } from "#app/data/move";
|
|||
import { initPokemonPrevolutions } from "#app/data/pokemon-evolutions";
|
||||
import { initPokemonForms } from "#app/data/pokemon-forms";
|
||||
import { initSpecies } from "#app/data/pokemon-species";
|
||||
import { initAchievements } from "#app/system/achv.js";
|
||||
import { initVouchers } from "#app/system/voucher.js";
|
||||
import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
|
||||
import { beforeAll, beforeEach, vi } from "vitest";
|
||||
import * as overrides from "#app/overrides";
|
||||
import { initMysteryEncounterDialogue } from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue";
|
||||
import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters";
|
||||
import { initMysteryEncounterDialogue } from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
||||
import { initVouchers } from "#app/system/voucher";
|
||||
import { initAchievements } from "#app/system/achv";
|
||||
|
||||
initVouchers();
|
||||
initAchievements();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CommandPhase } from "../phases";
|
||||
import { CommandPhase, SelectModifierPhase } from "../phases";
|
||||
import BattleScene from "../battle-scene";
|
||||
import { PlayerPokemon, PokemonMove } from "../field/pokemon";
|
||||
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "./text";
|
||||
|
@ -21,7 +21,6 @@ import MoveInfoOverlay from "./move-info-overlay";
|
|||
import i18next from "i18next";
|
||||
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
|
||||
const defaultMessage = i18next.t("partyUiHandler:choosePokemon");
|
||||
|
||||
|
|
Loading…
Reference in New Issue