Refactor source files and add berries

pull/1/head
Flashfyre 2023-04-20 15:46:05 -04:00
parent 6135243641
commit 3546f3b5a7
103 changed files with 2598 additions and 1171 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,4 @@
{ {
"id": 1001,
"graphic": "", "graphic": "",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2008,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2017,
"graphic": "PRAS- Bide", "graphic": "PRAS- Bide",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2009,
"graphic": "PRAS- Wrapping", "graphic": "PRAS- Wrapping",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2006,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2023,
"graphic": "PRAS- Shell Smash", "graphic": "PRAS- Shell Smash",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2007,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2015,
"graphic": "PRAS- Covet", "graphic": "PRAS- Covet",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2011,
"graphic": "PRAS- CURSE2", "graphic": "PRAS- CURSE2",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2021,
"graphic": "PRAS- Curse", "graphic": "PRAS- Curse",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2111,
"graphic": "PRAS- Electric", "graphic": "PRAS- Electric",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2013,
"graphic": "PRAS- Fire Spin", "graphic": "PRAS- Fire Spin",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2005,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2112,
"graphic": "PRAS- Grass", "graphic": "PRAS- Grass",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2103,
"graphic": "PRAS- Weather", "graphic": "PRAS- Weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2106,
"graphic": "weather", "graphic": "weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2000,
"graphic": "PRAS- Recovery", "graphic": "PRAS- Recovery",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2105,
"graphic": "PRAS- Weather", "graphic": "PRAS- Weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2012,
"graphic": "PRAS- Absorption2", "graphic": "PRAS- Absorption2",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2022,
"graphic": "PRAS- Magma Storm", "graphic": "PRAS- Magma Storm",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2110,
"graphic": "PRAS- Orbs", "graphic": "PRAS- Orbs",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2003,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2001,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2014,
"graphic": "PRAS- Protect", "graphic": "PRAS- Protect",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2113,
"graphic": "PRAS- Mirror Coat", "graphic": "PRAS- Mirror Coat",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2019,
"graphic": "PRAS- Lucky Chant", "graphic": "PRAS- Lucky Chant",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2101,
"graphic": "PRAS- Weather", "graphic": "PRAS- Weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2018,
"graphic": "PRAS- Sand Tomb", "graphic": "PRAS- Sand Tomb",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2102,
"graphic": "weather", "graphic": "weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2004,
"graphic": "PRAS- Status", "graphic": "PRAS- Status",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2107,
"graphic": "PRAS- Gust", "graphic": "PRAS- Gust",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2100,
"graphic": "weather", "graphic": "weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2002,
"graphic": "PRAS- Poison", "graphic": "PRAS- Poison",
"frames": [ "frames": [
[ [

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
{ {
"id": 2016,
"graphic": "PRAS- Whirlpool", "graphic": "PRAS- Whirlpool",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2020,
"graphic": "PRAS- Lucky Chant", "graphic": "PRAS- Lucky Chant",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2104,
"graphic": "weather", "graphic": "weather",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 2010,
"graphic": "PRAS- Wrapping", "graphic": "PRAS- Wrapping",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1002,
"graphic": "PRAS- Dig", "graphic": "PRAS- Dig",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1003,
"graphic": "PRAS- Dive", "graphic": "PRAS- Dive",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1011,
"graphic": "PRAS- Wish", "graphic": "PRAS- Wish",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1000,
"graphic": "PRAS- Fly", "graphic": "PRAS- Fly",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1007,
"graphic": "PRAS- Freeze Shock", "graphic": "PRAS- Freeze Shock",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1010,
"graphic": "PRAS- Ice Burn", "graphic": "PRAS- Ice Burn",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1012,
"graphic": "PRAS- Gust", "graphic": "PRAS- Gust",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1005,
"graphic": "", "graphic": "",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1006,
"graphic": "", "graphic": "",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1009,
"graphic": "", "graphic": "",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1008,
"graphic": "", "graphic": "",
"frames": [ "frames": [
[ [

View File

@ -1,5 +1,4 @@
{ {
"id": 1004,
"graphic": "PRAS- Orbs", "graphic": "PRAS- Orbs",
"frames": [ "frames": [
[ [

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

View File

@ -1,14 +1,14 @@
import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import BattleScene from "./battle-scene"; import BattleScene from "./battle-scene";
import { Biome, BiomePoolTier, BiomeTierPools, biomePools } from "./biome"; import { Biome, BiomePoolTier, BiomeTierPools, biomePools } from "./data/biome";
import * as Utils from "./utils"; import * as Utils from "./utils";
import PokemonSpecies, { getPokemonSpecies } from "./pokemon-species"; import PokemonSpecies, { getPokemonSpecies } from "./data/pokemon-species";
import { Species } from "./species"; import { Species } from "./data/species";
import { Weather, WeatherType, getWeatherClearMessage, getWeatherStartMessage } from "./weather"; import { Weather, WeatherType, getWeatherClearMessage, getWeatherStartMessage } from "./data/weather";
import { CommonAnimPhase, MessagePhase } from "./battle-phases"; import { CommonAnimPhase, MessagePhase } from "./battle-phases";
import { CommonAnim } from "./battle-anims"; import { CommonAnim } from "./data/battle-anims";
import { Type } from "./type"; import { Type } from "./data/type";
import Move from "./move"; import Move from "./data/move";
export class Arena { export class Arena {
private scene: BattleScene; private scene: BattleScene;

View File

@ -1,28 +1,29 @@
import BattleScene, { startingLevel, startingWave } from "./battle-scene"; import BattleScene, { startingLevel, startingWave } from "./battle-scene";
import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult } from "./pokemon"; import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult } from "./pokemon";
import * as Utils from './utils'; import * as Utils from './utils';
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, ConditionalMoveAttr, HitsTagAttr, MissEffectAttr, MoveCategory, MoveEffectAttr, MoveFlags, MoveHitEffectAttr, Moves, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr } from "./move"; import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, ConditionalMoveAttr, HitsTagAttr, MissEffectAttr, MoveCategory, MoveEffectAttr, MoveFlags, MoveHitEffectAttr, Moves, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr } from "./data/move";
import { Mode } from './ui/ui'; import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler"; import { Command } from "./ui/command-ui-handler";
import { Stat } from "./pokemon-stat"; import { Stat } from "./data/pokemon-stat";
import { ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, HitHealModifier, PokemonExpBoosterModifier, TempBattleStatBoosterModifier } from "./modifier"; import { BerryModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, HealingBoosterModifier, HitHealModifier, PokemonExpBoosterModifier, TempBattleStatBoosterModifier } from "./modifier/modifier";
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler"; import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./pokeball"; import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims"; import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
import { StatusEffect, getStatusEffectActivationText, getStatusEffectCatchRateMultiplier, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "./status-effect"; import { StatusEffect, getStatusEffectActivationText, getStatusEffectCatchRateMultiplier, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "./data/status-effect";
import { SummaryUiMode } from "./ui/summary-ui-handler"; import { SummaryUiMode } from "./ui/summary-ui-handler";
import EvolutionSceneHandler from "./ui/evolution-scene-handler"; import EvolutionSceneHandler from "./ui/evolution-scene-handler";
import { EvolutionPhase } from "./evolution-phase"; import { EvolutionPhase } from "./evolution-phase";
import { BattlePhase } from "./battle-phase"; import { BattlePhase } from "./battle-phase";
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./battle-stat"; import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
import { Biome, biomeLinks } from "./biome"; import { Biome, biomeLinks } from "./data/biome";
import { ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, TempBattleStat, getModifierTypeOptionsForWave, regenerateModifierPoolThresholds } from "./modifier-type"; import { ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, getModifierTypeOptionsForWave, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import { BattleTagLapseType, BattleTagType, HideSpriteTag as HiddenTag } from "./battle-tag"; import { BattleTagLapseType, BattleTagType, HideSpriteTag as HiddenTag } from "./data/battle-tag";
import { getPokemonMessage } from "./messages"; import { getPokemonMessage } from "./messages";
import { Starter } from "./ui/starter-select-ui-handler"; import { Starter } from "./ui/starter-select-ui-handler";
import { Gender } from "./gender"; import { Gender } from "./data/gender";
import { Weather, WeatherType, getRandomWeatherType, getWeatherDamageMessage, getWeatherLapseMessage } from "./weather"; import { Weather, WeatherType, getRandomWeatherType, getWeatherDamageMessage, getWeatherLapseMessage } from "./data/weather";
import { TempBattleStat } from "./data/temp-battle-stat";
export class SelectStarterPhase extends BattlePhase { export class SelectStarterPhase extends BattlePhase {
constructor(scene: BattleScene) { constructor(scene: BattleScene) {
@ -593,6 +594,10 @@ export class TurnEndPhase extends BattlePhase {
this.scene.pushPhase(new MessagePhase(this.scene, `${dm.getName()} is disabled\nno more!`)); this.scene.pushPhase(new MessagePhase(this.scene, `${dm.getName()} is disabled\nno more!`));
} }
const hasUsableBerry = pokemon.isPlayer() && !!this.scene.findModifier(m => m instanceof BerryModifier && m.shouldApply([ pokemon ]));
if (hasUsableBerry)
this.scene.pushPhase(new BerryPhase(this.scene, pokemon.isPlayer()));
pokemon.battleSummonData.turnCount++; pokemon.battleSummonData.turnCount++;
}; };
@ -670,7 +675,7 @@ export class CommonAnimPhase extends PokemonPhase {
} }
start() { start() {
new CommonBattleAnim(this.anim, this.getPokemon()).play(this.scene, () => { new CommonBattleAnim(this.anim, this.getPokemon(), this.getPokemon().isPlayer() ? this.scene.getEnemyPokemon() : this.scene.getPlayerPokemon()).play(this.scene, () => {
this.end(); this.end();
}); });
} }
@ -775,7 +780,7 @@ export abstract class MovePhase extends BattlePhase {
this.scene.unshiftPhase(new MessagePhase(this.scene, this.scene.unshiftPhase(new MessagePhase(this.scene,
getPokemonMessage(this.pokemon, getStatusEffectHealText(this.pokemon.status.effect)))); getPokemonMessage(this.pokemon, getStatusEffectHealText(this.pokemon.status.effect))));
this.pokemon.resetStatus(); this.pokemon.resetStatus();
this.pokemon.updateInfo(true); this.pokemon.updateInfo();
} }
doMove(); doMove();
} }
@ -1536,6 +1541,32 @@ export class LearnMovePhase extends PartyMemberPokemonPhase {
} }
} }
export class BerryPhase extends CommonAnimPhase {
constructor(scene: BattleScene, player: boolean) {
super(scene, player, CommonAnim.USE_ITEM);
}
start() {
let berryModifier: BerryModifier;
if (this.player) {
if ((berryModifier = this.scene.applyModifier(BerryModifier, this.getPokemon()) as BerryModifier)) {
if (berryModifier.consumed) {
if (!--berryModifier.stackCount)
this.scene.removeModifier(berryModifier);
else
berryModifier.consumed = false;
this.scene.updateModifiers();
}
super.start();
return;
}
}
this.end();
}
}
export class PokemonHealPhase extends CommonAnimPhase { export class PokemonHealPhase extends CommonAnimPhase {
private hpHealed: integer; private hpHealed: integer;
private message: string; private message: string;
@ -1564,7 +1595,10 @@ export class PokemonHealPhase extends CommonAnimPhase {
const fullHp = pokemon.getHpRatio() >= 1; const fullHp = pokemon.getHpRatio() >= 1;
if (!fullHp) { if (!fullHp) {
pokemon.hp = Math.min(pokemon.hp + this.hpHealed, pokemon.getMaxHp()); const hpRestoreMultiplier = new Utils.IntegerHolder(1);
if (this.player)
this.scene.applyModifiers(HealingBoosterModifier, hpRestoreMultiplier);
pokemon.hp = Math.min(pokemon.hp + this.hpHealed * hpRestoreMultiplier.value, pokemon.getMaxHp());
pokemon.updateInfo().then(() => super.end()); pokemon.updateInfo().then(() => super.end());
} else if (this.showFullHpMessage) } else if (this.showFullHpMessage)
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`); this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);

View File

@ -1,24 +1,24 @@
import Phaser from 'phaser'; import Phaser from 'phaser';
import { Biome } from './biome'; import { Biome } from './data/biome';
import UI from './ui/ui'; import UI from './ui/ui';
import { EncounterPhase, SummonPhase, CommandPhase, NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, SelectStarterPhase, MessagePhase } from './battle-phases'; import { EncounterPhase, SummonPhase, CommandPhase, NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, SelectStarterPhase, MessagePhase } from './battle-phases';
import { PlayerPokemon, EnemyPokemon } from './pokemon'; import { PlayerPokemon, EnemyPokemon } from './pokemon';
import PokemonSpecies, { allSpecies, getPokemonSpecies } from './pokemon-species'; import PokemonSpecies, { allSpecies, getPokemonSpecies } from './data/pokemon-species';
import * as Utils from './utils'; import * as Utils from './utils';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PartyShareModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ConsumablePokemonMoveModifier, ModifierPredicate } from './modifier'; import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PartyShareModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ConsumablePokemonMoveModifier, ModifierPredicate } from './modifier/modifier';
import { PokeballType } from './pokeball'; import { PokeballType } from './data/pokeball';
import { Species } from './species'; import { Species } from './data/species';
import { initAutoPlay } from './auto-play'; import { initAutoPlay } from './system/auto-play';
import { Battle } from './battle'; import { Battle } from './battle';
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './battle-anims'; import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims';
import { BattlePhase } from './battle-phase'; import { BattlePhase } from './battle-phase';
import { initGameSpeed } from './game-speed'; import { initGameSpeed } from './system/game-speed';
import { Arena } from './arena'; import { Arena } from './arena';
import { GameData } from './game-data'; import { GameData } from './system/game-data';
import StarterSelectUiHandler from './ui/starter-select-ui-handler'; import StarterSelectUiHandler from './ui/starter-select-ui-handler';
import { TextStyle, addTextObject } from './text'; import { TextStyle, addTextObject } from './ui/text';
import { Moves } from './move'; import { Moves } from './data/move';
import { getDefaultModifierTypeForTier } from './modifier-type'; import { getDefaultModifierTypeForTier } from './modifier/modifier-type';
const enableAuto = true; const enableAuto = true;
export const startingLevel = 5; export const startingLevel = 5;
@ -598,7 +598,7 @@ export default class BattleScene extends Phaser.Scene {
if ((modifier as PersistentModifier).add(this.modifiers, !!virtual)) { if ((modifier as PersistentModifier).add(this.modifiers, !!virtual)) {
if (!virtual && !this.sound.get(soundName)) if (!virtual && !this.sound.get(soundName))
this.sound.play(soundName); this.sound.play(soundName);
} if (!virtual) { } else if (!virtual) {
const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier); const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier);
this.addModifier(defaultModifierType.newModifier()).then(() => resolve()); this.addModifier(defaultModifierType.newModifier()).then(() => resolve());
this.unshiftPhase(new MessagePhase(this, `The stack for this item is full.\n You will receive ${defaultModifierType.name} instead.`, null, true)); this.unshiftPhase(new MessagePhase(this, `The stack for this item is full.\n You will receive ${defaultModifierType.name} instead.`, null, true));
@ -617,9 +617,12 @@ export default class BattleScene extends Phaser.Scene {
const args: any[] = [ pokemon ]; const args: any[] = [ pokemon ];
if (modifier instanceof PokemonHpRestoreModifier) { if (modifier instanceof PokemonHpRestoreModifier) {
const hpRestoreMultiplier = new Utils.IntegerHolder(1); if (!(modifier as PokemonHpRestoreModifier).fainted) {
this.applyModifiers(HealingBoosterModifier, hpRestoreMultiplier); const hpRestoreMultiplier = new Utils.IntegerHolder(1);
args.push(hpRestoreMultiplier.value); this.applyModifiers(HealingBoosterModifier, hpRestoreMultiplier);
args.push(hpRestoreMultiplier.value);
} else
args.push(1);
} }
if (modifier.shouldApply(args)) if (modifier.shouldApply(args))
@ -704,4 +707,16 @@ export default class BattleScene extends Phaser.Scene {
console.log('Applied', modifier.type.name); console.log('Applied', modifier.type.name);
} }
} }
applyModifier(modifierType: { new(...args: any[]): Modifier }, ...args: any[]): PersistentModifier {
const modifiers = this.modifiers.filter(m => m instanceof modifierType && m.shouldApply(args));
for (let modifier of modifiers) {
if (modifier.apply(args)) {
console.log('Applied', modifier.type.name);
return modifier;
}
}
return null;
}
} }

View File

@ -1,8 +1,8 @@
//import { battleAnimRawData } from "./battle-anim-raw-data"; //import { battleAnimRawData } from "./battle-anim-raw-data";
import BattleScene from "./battle-scene"; import BattleScene from "../battle-scene";
import { ChargeAttr, Moves, allMoves } from "./move"; import { ChargeAttr, Moves, allMoves } from "./move";
import Pokemon from "./pokemon"; import Pokemon from "../pokemon";
import * as Utils from "./utils"; import * as Utils from "../utils";
//import fs from 'vite-plugin-fs/browser'; //import fs from 'vite-plugin-fs/browser';
export enum AnimFrameTarget { export enum AnimFrameTarget {
@ -41,8 +41,9 @@ export enum ChargeAnim {
} }
export enum CommonAnim { export enum CommonAnim {
HEALTH_UP = 2000, USE_ITEM = 2000,
POISON, HEALTH_UP,
POISON = 2010,
TOXIC, TOXIC,
PARALYSIS, PARALYSIS,
SLEEP, SLEEP,
@ -79,7 +80,7 @@ export enum CommonAnim {
PSYCHIC_TERRAIN PSYCHIC_TERRAIN
} }
export class Anim { export class AnimConfig {
public id: integer; public id: integer;
public graphic: string; public graphic: string;
public frames: AnimFrame[][]; public frames: AnimFrame[][];
@ -226,7 +227,7 @@ class AnimTimedSoundEvent extends AnimTimedEvent {
public pitch: number; public pitch: number;
constructor(frameIndex: integer, resourceName: string, source?: any) { constructor(frameIndex: integer, resourceName: string, source?: any) {
super(frameIndex, resourceName + (resourceName && resourceName.indexOf('.') === -1 ? '.ogg' : '')); super(frameIndex, resourceName + (resourceName && resourceName.indexOf('.') === -1 ? resourceName.startsWith('PRSFX-') ? '.wav' : '.ogg' : ''));
if (source) { if (source) {
this.volume = source.volume; this.volume = source.volume;
@ -349,9 +350,9 @@ class AnimTimedAddBgEvent extends AnimTimedBgEvent {
} }
} }
export const moveAnims = new Map<Moves, Anim | [Anim, Anim]>(); export const moveAnims = new Map<Moves, AnimConfig | [AnimConfig, AnimConfig]>();
export const chargeAnims = new Map<ChargeAnim, Anim | [Anim, Anim]>(); export const chargeAnims = new Map<ChargeAnim, AnimConfig | [AnimConfig, AnimConfig]>();
export const commonAnims = new Map<CommonAnim, Anim>(); export const commonAnims = new Map<CommonAnim, AnimConfig>();
export function initCommonAnims(): Promise<void> { export function initCommonAnims(): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
@ -362,7 +363,7 @@ export function initCommonAnims(): Promise<void> {
const commonAnimId = commonAnimIds[ca]; const commonAnimId = commonAnimIds[ca];
commonAnimFetches.push(fetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/\_/g, '-')}.json`) commonAnimFetches.push(fetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/\_/g, '-')}.json`)
.then(response => response.json()) .then(response => response.json())
.then(cas => commonAnims.set(commonAnimId, new Anim(cas)))); .then(cas => commonAnims.set(commonAnimId, new AnimConfig(cas))));
} }
Promise.allSettled(commonAnimFetches).then(() => resolve()); Promise.allSettled(commonAnimFetches).then(() => resolve());
}); });
@ -430,22 +431,22 @@ export function initMoveChargeAnim(chargeAnim: ChargeAnim): Promise<void> {
}); });
} }
function populateMoveAnim(move: Moves, animSource: any) { function populateMoveAnim(move: Moves, animSource: any): void {
const moveAnim = new Anim(animSource); const moveAnim = new AnimConfig(animSource);
if (moveAnims.get(move) === null) { if (moveAnims.get(move) === null) {
moveAnims.set(move, moveAnim); moveAnims.set(move, moveAnim);
return; return;
} }
moveAnims.set(move, [ moveAnims.get(move) as Anim, moveAnim ]); moveAnims.set(move, [ moveAnims.get(move) as AnimConfig, moveAnim ]);
} }
function populateMoveChargeAnim(chargeAnim: ChargeAnim, animSource: any) { function populateMoveChargeAnim(chargeAnim: ChargeAnim, animSource: any) {
const moveChargeAnim = new Anim(animSource); const moveChargeAnim = new AnimConfig(animSource);
if (chargeAnims.get(chargeAnim) === null) { if (chargeAnims.get(chargeAnim) === null) {
chargeAnims.set(chargeAnim, moveChargeAnim); chargeAnims.set(chargeAnim, moveChargeAnim);
return; return;
} }
chargeAnims.set(chargeAnim, [ chargeAnims.get(chargeAnim) as Anim, moveChargeAnim ]); chargeAnims.set(chargeAnim, [ chargeAnims.get(chargeAnim) as AnimConfig, moveChargeAnim ]);
} }
export function loadCommonAnimAssets(scene: BattleScene, startLoad?: boolean): Promise<void> { export function loadCommonAnimAssets(scene: BattleScene, startLoad?: boolean): Promise<void> {
@ -456,12 +457,12 @@ export function loadCommonAnimAssets(scene: BattleScene, startLoad?: boolean): P
export function loadMoveAnimAssets(scene: BattleScene, moveIds: Moves[], startLoad?: boolean): Promise<void> { export function loadMoveAnimAssets(scene: BattleScene, moveIds: Moves[], startLoad?: boolean): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
const moveAnimations = moveIds.map(m => moveAnims.get(m)).flat(); const moveAnimations = moveIds.map(m => moveAnims.get(m) as AnimConfig).flat();
for (let moveId of moveIds) { for (let moveId of moveIds) {
const chargeAttr = allMoves[moveId - 1].getAttrs(ChargeAttr) as ChargeAttr[]; const chargeAttr = allMoves[moveId - 1].getAttrs(ChargeAttr) as ChargeAttr[];
if (chargeAttr.length) { if (chargeAttr.length) {
const moveChargeAnims = chargeAnims.get(chargeAttr[0].chargeAnim); const moveChargeAnims = chargeAnims.get(chargeAttr[0].chargeAnim);
moveAnimations.push(moveChargeAnims instanceof Anim ? moveChargeAnims : moveChargeAnims[0]); moveAnimations.push(moveChargeAnims instanceof AnimConfig ? moveChargeAnims : moveChargeAnims[0]);
if (Array.isArray(moveChargeAnims)) if (Array.isArray(moveChargeAnims))
moveAnimations.push(moveChargeAnims[1]); moveAnimations.push(moveChargeAnims[1]);
} }
@ -470,7 +471,7 @@ export function loadMoveAnimAssets(scene: BattleScene, moveIds: Moves[], startLo
}); });
} }
function loadAnimAssets(scene: BattleScene, anims: Anim[], startLoad?: boolean): Promise<void> { function loadAnimAssets(scene: BattleScene, anims: AnimConfig[], startLoad?: boolean): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
const backgrounds = new Set<string>(); const backgrounds = new Set<string>();
const sounds = new Set<string>(); const sounds = new Set<string>();
@ -515,7 +516,7 @@ export abstract class BattleAnim {
this.sprites = []; this.sprites = [];
} }
abstract getAnim(): Anim; abstract getAnim(): AnimConfig;
abstract isOppAnim(): boolean; abstract isOppAnim(): boolean;
@ -738,7 +739,7 @@ export class CommonBattleAnim extends BattleAnim {
this.commonAnim = commonAnim; this.commonAnim = commonAnim;
} }
getAnim(): Anim { getAnim(): AnimConfig {
return commonAnims.get(this.commonAnim); return commonAnims.get(this.commonAnim);
} }
@ -760,10 +761,10 @@ export class MoveAnim extends BattleAnim {
this.move = move; this.move = move;
} }
getAnim(): Anim { getAnim(): AnimConfig {
return moveAnims.get(this.move) instanceof Anim return moveAnims.get(this.move) instanceof AnimConfig
? moveAnims.get(this.move) as Anim ? moveAnims.get(this.move) as AnimConfig
: moveAnims.get(this.move)[this.user.isPlayer() ? 0 : 1] as Anim; : moveAnims.get(this.move)[this.user.isPlayer() ? 0 : 1] as AnimConfig;
} }
isOppAnim(): boolean { isOppAnim(): boolean {
@ -800,10 +801,10 @@ export class MoveChargeAnim extends MoveAnim {
this.chargeAnim = chargeAnim; this.chargeAnim = chargeAnim;
} }
getAnim(): Anim { getAnim(): AnimConfig {
return chargeAnims.get(this.chargeAnim) instanceof Anim return chargeAnims.get(this.chargeAnim) instanceof AnimConfig
? chargeAnims.get(this.chargeAnim) as Anim ? chargeAnims.get(this.chargeAnim) as AnimConfig
: chargeAnims.get(this.chargeAnim)[this.user.isPlayer() ? 0 : 1] as Anim; : chargeAnims.get(this.chargeAnim)[this.user.isPlayer() ? 0 : 1] as AnimConfig;
} }
} }
@ -840,14 +841,15 @@ export function populateAnims() {
const animName = fields[1].slice(nameIndex, fields[1].indexOf('\n', nameIndex)); const animName = fields[1].slice(nameIndex, fields[1].indexOf('\n', nameIndex));
if (!moveNameToId.hasOwnProperty(animName) && !commonAnimId && !chargeAnimId) if (!moveNameToId.hasOwnProperty(animName) && !commonAnimId && !chargeAnimId)
continue; continue;
let anim = new Anim(); let anim = commonAnimId || chargeAnimId ? new AnimConfig() : new AnimConfig();
anim.id = commonAnimId || chargeAnimId || moveNameToId[animName]; if (anim instanceof AnimConfig)
(anim as AnimConfig).id = moveNameToId[animName];
if (commonAnimId) if (commonAnimId)
commonAnims.set(commonAnimId, anim); commonAnims.set(commonAnimId, anim);
else if (chargeAnimId) else if (chargeAnimId)
chargeAnims.set(chargeAnimId, !isOppMove ? anim : [ chargeAnims.get(chargeAnimId) as Anim, anim ]); chargeAnims.set(chargeAnimId, !isOppMove ? anim : [ chargeAnims.get(chargeAnimId) as AnimConfig, anim ]);
else else
moveAnims.set(moveNameToId[animName], !isOppMove ? anim : [ moveAnims.get(moveNameToId[animName]) as Anim, anim ]); moveAnims.set(moveNameToId[animName], !isOppMove ? anim as AnimConfig : [ moveAnims.get(moveNameToId[animName]) as AnimConfig, anim as AnimConfig ]);
for (let f = 0; f < fields.length; f++) { for (let f = 0; f < fields.length; f++) {
const field = fields[f]; const field = fields[f];
const fieldName = field.slice(0, field.indexOf(':')); const fieldName = field.slice(0, field.indexOf(':'));
@ -940,6 +942,8 @@ export function populateAnims() {
} }
const animReplacer = (k, v) => { const animReplacer = (k, v) => {
if (k === 'id' && !v)
return undefined;
if (v instanceof Map) if (v instanceof Map)
return Object.fromEntries(v); return Object.fromEntries(v);
if (v instanceof AnimTimedEvent) if (v instanceof AnimTimedEvent)
@ -950,21 +954,21 @@ export function populateAnims() {
/*for (let ma of moveAnims.keys()) { /*for (let ma of moveAnims.keys()) {
const data = moveAnims.get(ma); const data = moveAnims.get(ma);
(async () => { (async () => {
await fs.writeFile(`./public/battle-anims/${Moves[ma].toLowerCase().replace(/\_/g, '-')}.json`, JSON.stringify(data, animReplacer, ' ')); await fs.writeFile(`../public/battle-anims/${Moves[ma].toLowerCase().replace(/\_/g, '-')}.json`, JSON.stringify(data, animReplacer, ' '));
})(); })();
} }
for (let ca of chargeAnims.keys()) { for (let ca of chargeAnims.keys()) {
const data = chargeAnims.get(ca); const data = chargeAnims.get(ca);
(async () => { (async () => {
await fs.writeFile(`./public/battle-anims/${chargeAnimNames[chargeAnimIds.indexOf(ca)].replace(/\_/g, '-')}.json`, JSON.stringify(data, animReplacer, ' ')); await fs.writeFile(`../public/battle-anims/${chargeAnimNames[chargeAnimIds.indexOf(ca)].replace(/\_/g, '-')}.json`, JSON.stringify(data, animReplacer, ' '));
})(); })();
} }
for (let cma of commonAnims.keys()) { for (let cma of commonAnims.keys()) {
const data = commonAnims.get(cma); const data = commonAnims.get(cma);
(async () => { (async () => {
await fs.writeFile(`./public/battle-anims/common-${commonAnimNames[commonAnimIds.indexOf(cma)].replace(/\_/g, '-')}.json`, JSON.stringify(data, animReplacer, ' ')); await fs.writeFile(`../public/battle-anims/common-${commonAnimNames[commonAnimIds.indexOf(cma)].replace(/\_/g, '-')}.json`, JSON.stringify(data, animReplacer, ' '));
})(); })();
}*/ }*/
} }

View File

@ -1,10 +1,10 @@
import { CommonAnim, CommonBattleAnim } from "./battle-anims"; import { CommonAnim, CommonBattleAnim } from "./battle-anims";
import { CommonAnimPhase, DamagePhase, MessagePhase, MovePhase, ObtainStatusEffectPhase, PokemonHealPhase } from "./battle-phases"; import { CommonAnimPhase, DamagePhase, MessagePhase, MovePhase, ObtainStatusEffectPhase, PokemonHealPhase } from "../battle-phases";
import { getPokemonMessage } from "./messages"; import { getPokemonMessage } from "../messages";
import Pokemon from "./pokemon"; import Pokemon from "../pokemon";
import { Stat } from "./pokemon-stat"; import { Stat } from "./pokemon-stat";
import { StatusEffect } from "./status-effect"; import { StatusEffect } from "./status-effect";
import * as Utils from "./utils"; import * as Utils from "../utils";
export enum BattleTagType { export enum BattleTagType {
NONE, NONE,
@ -101,7 +101,7 @@ export class ConfusedTag extends PseudoStatusTag {
} }
lapse(pokemon: Pokemon, lapseType: BattleTagLapseType): boolean { lapse(pokemon: Pokemon, lapseType: BattleTagLapseType): boolean {
const ret = super.lapse(pokemon, lapseType); const ret = lapseType !== BattleTagLapseType.CUSTOM && super.lapse(pokemon, lapseType);
if (ret) { if (ret) {
pokemon.scene.unshiftPhase(new MessagePhase(pokemon.scene, getPokemonMessage(pokemon, ' is\nconfused!'))); pokemon.scene.unshiftPhase(new MessagePhase(pokemon.scene, getPokemonMessage(pokemon, ' is\nconfused!')));

60
src/data/berry.ts Normal file
View File

@ -0,0 +1,60 @@
import { MessagePhase, PokemonHealPhase } from "../battle-phases";
import { getPokemonMessage } from "../messages";
import Pokemon from "../pokemon";
import { BattleTagType } from "./battle-tag";
import { getStatusEffectHealText } from "./status-effect";
export enum BerryType {
SITRUS,
LUM
}
export function getBerryName(berryType: BerryType) {
switch (berryType) {
case BerryType.SITRUS:
return 'SITRUS BERRY';
case BerryType.LUM:
return 'LUM BERRY';
}
}
export function getBerryEffectDescription(berryType: BerryType) {
switch (berryType) {
case BerryType.SITRUS:
return 'Restores 25% HP if HP is below 50%';
case BerryType.LUM:
return 'Cures any non-volatile status condition and confusion';
}
}
export type BerryPredicate = (pokemon: Pokemon) => boolean;
export function getBerryPredicate(berryType: BerryType): BerryPredicate {
switch (berryType) {
case BerryType.SITRUS:
return (pokemon: Pokemon) => pokemon.getHpRatio() < 0.5;
case BerryType.LUM:
return (pokemon: Pokemon) => !!pokemon.status || !!pokemon.getTag(BattleTagType.CONFUSED);
}
}
export type BerryEffectFunc = (pokemon: Pokemon) => void;
export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
switch (berryType) {
case BerryType.SITRUS:
return (pokemon: Pokemon) => {
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, true, Math.floor(pokemon.getMaxHp() / 4), getPokemonMessage(pokemon, `'s ${getBerryName(berryType)}\nrestored its HP!`), true));
};
case BerryType.LUM:
return (pokemon: Pokemon) => {
if (pokemon.status) {
pokemon.scene.unshiftPhase(new MessagePhase(pokemon.scene,
getPokemonMessage(pokemon, getStatusEffectHealText(pokemon.status.effect))));
pokemon.resetStatus();
pokemon.updateInfo();
} else if (pokemon.getTag(BattleTagType.CONFUSED))
pokemon.lapseTag(BattleTagType.CONFUSED);
};
}
}

View File

@ -1,7 +1,7 @@
import { pokemonEvolutions, SpeciesEvolution } from "./pokemon-evolutions"; import { pokemonEvolutions, SpeciesEvolution } from "./pokemon-evolutions";
import { Species } from "./species"; import { Species } from "./species";
import { Type } from './type'; import { Type } from './type';
import * as Utils from './utils'; import * as Utils from '../utils';
import beautify from 'json-beautify'; import beautify from 'json-beautify';

View File

@ -1,12 +1,12 @@
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims"; import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
import { DamagePhase, EnemyMovePhase, MessagePhase, ObtainStatusEffectPhase, PlayerMovePhase, PokemonHealPhase, StatChangePhase } from "./battle-phases"; import { DamagePhase, EnemyMovePhase, MessagePhase, ObtainStatusEffectPhase, PlayerMovePhase, PokemonHealPhase, StatChangePhase } from "../battle-phases";
import { BattleStat } from "./battle-stat"; import { BattleStat } from "./battle-stat";
import { BattleTagType } from "./battle-tag"; import { BattleTagType } from "./battle-tag";
import { getPokemonMessage } from "./messages"; import { getPokemonMessage } from "../messages";
import Pokemon, { EnemyPokemon, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "./pokemon"; import Pokemon, { EnemyPokemon, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../pokemon";
import { StatusEffect, getStatusEffectDescriptor } from "./status-effect"; import { StatusEffect, getStatusEffectDescriptor } from "./status-effect";
import { Type } from "./type"; import { Type } from "./type";
import * as Utils from "./utils"; import * as Utils from "../utils";
import { WeatherType } from "./weather"; import { WeatherType } from "./weather";
export enum MoveCategory { export enum MoveCategory {

View File

@ -1,5 +1,5 @@
import BattleScene from "./battle-scene"; import BattleScene from "../battle-scene";
import { toPokemonUpperCase } from "./utils"; import { toPokemonUpperCase } from "../utils";
export enum PokeballType { export enum PokeballType {
POKEBALL, POKEBALL,

View File

@ -1,13 +1,13 @@
import { Gender } from "./gender"; import { Gender } from "./gender";
import { AttackTypeBoosterModifier } from "./modifier"; import { AttackTypeBoosterModifier } from "../modifier/modifier";
import { AttackTypeBoosterModifierType } from "./modifier-type"; import { AttackTypeBoosterModifierType } from "../modifier/modifier-type";
import { Moves } from "./move"; import { Moves } from "./move";
import { PokeballType } from "./pokeball"; import { PokeballType } from "./pokeball";
import Pokemon from "./pokemon"; import Pokemon from "../pokemon";
import { Stat } from "./pokemon-stat"; import { Stat } from "./pokemon-stat";
import { Species } from "./species"; import { Species } from "./species";
import { Type } from "./type"; import { Type } from "./type";
import * as Utils from "./utils"; import * as Utils from "../utils";
export enum SpeciesWildEvolutionDelay { export enum SpeciesWildEvolutionDelay {
NONE, NONE,

View File

@ -1,11 +1,10 @@
import { Abilities } from './abilities'; import { Abilities } from './ability';
import BattleScene from './battle-scene'; import BattleScene from '../battle-scene';
import { GrowthRate } from './exp'; import { GrowthRate } from './exp';
import { EnemyPokemon } from './pokemon';
import { pokemonEvolutions } from './pokemon-evolutions'; import { pokemonEvolutions } from './pokemon-evolutions';
import { Species } from './species'; import { Species } from './species';
import { Type } from './type'; import { Type } from './type';
import * as Utils from './utils'; import * as Utils from '../utils';
export function getPokemonSpecies(species: Species): PokemonSpecies { export function getPokemonSpecies(species: Species): PokemonSpecies {
if (species >= Species.XERNEAS) if (species >= Species.XERNEAS)

View File

@ -1,4 +1,4 @@
import { toPokemonUpperCase } from "./utils"; import { toPokemonUpperCase } from "../utils";
export enum Stat { export enum Stat {
HP = 0, HP = 0,

View File

@ -1,4 +1,4 @@
import * as Utils from "./utils"; import * as Utils from "../utils";
export enum StatusEffect { export enum StatusEffect {
NONE, NONE,

View File

@ -0,0 +1,36 @@
import { BattleStat, getBattleStatName } from "./battle-stat";
export enum TempBattleStat {
ATK,
DEF,
SPATK,
SPDEF,
SPD,
ACC,
CRIT
}
export function getTempBattleStatName(tempBattleStat: TempBattleStat) {
if (tempBattleStat === TempBattleStat.CRIT)
return 'critical-hit ratio';
return getBattleStatName(tempBattleStat as integer as BattleStat);
}
export function getTempBattleStatBoosterItemName(tempBattleStat: TempBattleStat) {
switch (tempBattleStat) {
case TempBattleStat.ATK:
return 'X Attack';
case TempBattleStat.DEF:
return 'X Defense';
case TempBattleStat.SPATK:
return 'X Sp. Atk';
case TempBattleStat.SPDEF:
return 'X Sp. Def';
case TempBattleStat.SPD:
return 'X Speed';
case TempBattleStat.ACC:
return 'X Accuracy';
case TempBattleStat.CRIT:
return 'Dire Hit';
}
}

View File

@ -1,9 +1,9 @@
import { Biome } from "./biome"; import { Biome } from "./biome";
import { getPokemonMessage } from "./messages"; import { getPokemonMessage } from "../messages";
import Pokemon from "./pokemon"; import Pokemon from "../pokemon";
import { Type } from "./type"; import { Type } from "./type";
import Move, { AttackMove } from "./move"; import Move, { AttackMove } from "./move";
import * as Utils from "./utils"; import * as Utils from "../utils";
export enum WeatherType { export enum WeatherType {
NONE, NONE,

View File

@ -1,7 +1,7 @@
import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import { BattlePhase } from "./battle-phase"; import { BattlePhase } from "./battle-phase";
import BattleScene from "./battle-scene"; import BattleScene from "./battle-scene";
import { SpeciesEvolution } from "./pokemon-evolutions"; import { SpeciesEvolution } from "./data/pokemon-evolutions";
import EvolutionSceneHandler from "./ui/evolution-scene-handler"; import EvolutionSceneHandler from "./ui/evolution-scene-handler";
import * as Utils from "./utils"; import * as Utils from "./utils";
import { Mode } from "./ui/ui"; import { Mode } from "./ui/ui";

View File

@ -1,14 +1,16 @@
import { BattleStat, getBattleStatName } from './battle-stat'; import { BattleStat, getBattleStatName } from '../data/battle-stat';
import * as Modifiers from './modifier'; import * as Modifiers from './modifier';
import { AttackMove, Moves, allMoves } from './move'; import { AttackMove, Moves, allMoves } from '../data/move';
import { PokeballType, getPokeballName } from './pokeball'; import { PokeballType, getPokeballName } from '../data/pokeball';
import { PlayerPokemon, PokemonMove } from './pokemon'; import { PlayerPokemon, PokemonMove } from '../pokemon';
import { EvolutionItem, pokemonEvolutions } from './pokemon-evolutions'; import { EvolutionItem, pokemonEvolutions } from '../data/pokemon-evolutions';
import { Stat, getStatName } from './pokemon-stat'; import { Stat, getStatName } from '../data/pokemon-stat';
import { tmSpecies } from './tms'; import { tmSpecies } from '../data/tms';
import { Type } from './type'; import { Type } from '../data/type';
import PartyUiHandler, { PokemonMoveSelectFilter, PokemonSelectFilter } from './ui/party-ui-handler'; import PartyUiHandler, { PokemonMoveSelectFilter, PokemonSelectFilter } from '../ui/party-ui-handler';
import * as Utils from './utils'; import * as Utils from '../utils';
import { TempBattleStat, getTempBattleStatBoosterItemName, getTempBattleStatName } from '../data/temp-battle-stat';
import { BerryType, getBerryEffectDescription, getBerryName } from '../data/berry';
type Modifier = Modifiers.Modifier; type Modifier = Modifiers.Modifier;
@ -59,13 +61,19 @@ class AddPokeballModifierType extends ModifierType {
export class PokemonModifierType extends ModifierType { export class PokemonModifierType extends ModifierType {
public selectFilter: PokemonSelectFilter; public selectFilter: PokemonSelectFilter;
constructor(name: string, description: string, newModifierFunc: NewModifierFunc, selectFilter?: PokemonSelectFilter, iconImage?: string, group?: string) { constructor(name: string, description: string, newModifierFunc: NewModifierFunc, selectFilter?: PokemonSelectFilter, iconImage?: string, group?: string, soundName?: string) {
super(name, description, newModifierFunc, iconImage, group); super(name, description, newModifierFunc, iconImage, group, soundName);
this.selectFilter = selectFilter; this.selectFilter = selectFilter;
} }
} }
export class PokemonHeldItemModifierType extends PokemonModifierType {
constructor(name: string, description: string, newModifierFunc: NewModifierFunc, selectFilter?: PokemonSelectFilter, iconImage?: string, group?: string, soundName?: string) {
super(name, description, newModifierFunc, selectFilter, iconImage, group, soundName);
}
}
export class PokemonHpRestoreModifierType extends PokemonModifierType { export class PokemonHpRestoreModifierType extends PokemonModifierType {
protected restorePoints: integer; protected restorePoints: integer;
protected percent: boolean; protected percent: boolean;
@ -157,41 +165,6 @@ export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType {
} }
} }
export enum TempBattleStat {
ATK,
DEF,
SPATK,
SPDEF,
SPD,
ACC,
CRIT
}
function getTempBattleStatName(tempBattleStat: TempBattleStat) {
if (tempBattleStat === TempBattleStat.CRIT)
return 'critical-hit ratio';
return getBattleStatName(tempBattleStat as integer as BattleStat);
}
function getTempBattleStatBoosterItemName(tempBattleStat: TempBattleStat) {
switch (tempBattleStat) {
case TempBattleStat.ATK:
return 'X Attack';
case TempBattleStat.DEF:
return 'X Defense';
case TempBattleStat.SPATK:
return 'X Sp. Atk';
case TempBattleStat.SPDEF:
return 'X Sp. Def';
case TempBattleStat.SPD:
return 'X Speed';
case TempBattleStat.ACC:
return 'X Accuracy';
case TempBattleStat.CRIT:
return 'Dire Hit';
}
}
export class TempBattleStatBoosterModifierType extends ModifierType { export class TempBattleStatBoosterModifierType extends ModifierType {
public tempBattleStat: TempBattleStat; public tempBattleStat: TempBattleStat;
@ -246,7 +219,7 @@ function getAttackTypeBoosterItemName(type: Type) {
} }
} }
export class AttackTypeBoosterModifierType extends PokemonModifierType { export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType {
public moveType: Type; public moveType: Type;
public boostPercent: integer; public boostPercent: integer;
@ -284,7 +257,7 @@ function getBaseStatBoosterItemName(stat: Stat) {
} }
} }
export class PokemonBaseStatBoosterModifierType extends PokemonModifierType { export class PokemonBaseStatBoosterModifierType extends PokemonHeldItemModifierType {
private stat: Stat; private stat: Stat;
constructor(name: string, stat: Stat, _iconImage?: string) { constructor(name: string, stat: Stat, _iconImage?: string) {
@ -312,7 +285,7 @@ export class ExpBoosterModifierType extends ModifierType {
} }
} }
export class PokemonExpBoosterModifierType extends PokemonModifierType { export class PokemonExpBoosterModifierType extends PokemonHeldItemModifierType {
constructor(name: string, boostPercent: integer, iconImage?: string) { constructor(name: string, boostPercent: integer, iconImage?: string) {
super(name, `Increases the holder's gain of EXP. Points by ${boostPercent}%`, (_type, args) => new Modifiers.PokemonExpBoosterModifier(this, (args[0] as PlayerPokemon).id, boostPercent), super(name, `Increases the holder's gain of EXP. Points by ${boostPercent}%`, (_type, args) => new Modifiers.PokemonExpBoosterModifier(this, (args[0] as PlayerPokemon).id, boostPercent),
(_pokemon: PlayerPokemon) => null, iconImage); (_pokemon: PlayerPokemon) => null, iconImage);
@ -486,7 +459,14 @@ const modifierPool = {
new WeightedModifierType(new ModifierTypeGenerator((party: PlayerPokemon[]) => { new WeightedModifierType(new ModifierTypeGenerator((party: PlayerPokemon[]) => {
const randTempBattleStat = Utils.randInt(7) as TempBattleStat; const randTempBattleStat = Utils.randInt(7) as TempBattleStat;
return new TempBattleStatBoosterModifierType(randTempBattleStat); return new TempBattleStatBoosterModifierType(randTempBattleStat);
}), 4) }), 4),
new WeightedModifierType(new ModifierTypeGenerator((party: PlayerPokemon[]) => {
const berryTypes = Utils.getEnumValues(BerryType);
const randBerryType = berryTypes[Utils.randInt(berryTypes.length)];
return new PokemonHeldItemModifierType(getBerryName(randBerryType), getBerryEffectDescription(randBerryType),
(type, args) => new Modifiers.BerryModifier(type, (args[0] as PlayerPokemon).id, randBerryType),
() => null, null, 'berry');
}), 2)
].map(m => { m.setTier(ModifierTier.COMMON); return m; }), ].map(m => { m.setTier(ModifierTier.COMMON); return m; }),
[ModifierTier.GREAT]: [ [ModifierTier.GREAT]: [
new WeightedModifierType(new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'), 12), new WeightedModifierType(new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'), 12),
@ -524,6 +504,8 @@ const modifierPool = {
new WeightedModifierType(new ModifierTypeGenerator((party: PlayerPokemon[]) => { new WeightedModifierType(new ModifierTypeGenerator((party: PlayerPokemon[]) => {
const partyMemberCompatibleTms = party.map(p => p.compatibleTms); const partyMemberCompatibleTms = party.map(p => p.compatibleTms);
const uniqueCompatibleTms = partyMemberCompatibleTms.flat().filter((tm, i, array) => array.indexOf(tm) === i); const uniqueCompatibleTms = partyMemberCompatibleTms.flat().filter((tm, i, array) => array.indexOf(tm) === i);
if (!uniqueCompatibleTms.length)
return null;
const randTmIndex = Utils.randInt(uniqueCompatibleTms.length); const randTmIndex = Utils.randInt(uniqueCompatibleTms.length);
return new TmModifierType(uniqueCompatibleTms[randTmIndex]); return new TmModifierType(uniqueCompatibleTms[randTmIndex]);
}), 4), }), 4),
@ -535,14 +517,16 @@ const modifierPool = {
].map(m => { m.setTier(ModifierTier.GREAT); return m; }), ].map(m => { m.setTier(ModifierTier.GREAT); return m; }),
[ModifierTier.ULTRA]: [ [ModifierTier.ULTRA]: [
new WeightedModifierType(new AddPokeballModifierType(PokeballType.ULTRA_BALL, 5, 'ub'), 8), new WeightedModifierType(new AddPokeballModifierType(PokeballType.ULTRA_BALL, 5, 'ub'), 8),
new WeightedModifierType(new EvolutionItemModifierTypeGenerator(), 5), new WeightedModifierType(new EvolutionItemModifierTypeGenerator(), 12),
new WeightedModifierType(new AttackTypeBoosterModifierTypeGenerator(), 3), new WeightedModifierType(new AttackTypeBoosterModifierTypeGenerator(), 5),
new ModifierType('OVAL CHARM', 'For every X (no. of party members) items in a POKéMON\'s held item stack, give one to each other party member', new ModifierType('OVAL CHARM', 'For every X (no. of party members) items in a POKéMON\'s held item stack, give one to each other party member',
(type, _args) => new Modifiers.PartyShareModifier(type), 'oval_charm'), (type, _args) => new Modifiers.PartyShareModifier(type), 'oval_charm'),
new ModifierType('HEALING CHARM', 'Doubles the effectiveness of HP restoring moves and items (excludes revives)', (type, _args) => new Modifiers.HealingBoosterModifier(type, 2), 'healing_charm'), new ModifierType('HEALING CHARM', 'Doubles the effectiveness of HP restoring moves and items (excludes revives)', (type, _args) => new Modifiers.HealingBoosterModifier(type, 2), 'healing_charm'),
new WeightedModifierType(new PokemonModifierType('SHELL BELL', 'Heals 1/8 of a POKéMON\'s dealt damage', (type, args) => new Modifiers.HitHealModifier(type, (args[0] as PlayerPokemon).id)), 2), new WeightedModifierType(new PokemonHeldItemModifierType('SHELL BELL', 'Heals 1/8 of a POKéMON\'s dealt damage', (type, args) => new Modifiers.HitHealModifier(type, (args[0] as PlayerPokemon).id)), 2),
new WeightedModifierType(new ExpBoosterModifierType('EXP CHARM', 25), 4), new WeightedModifierType(new ExpBoosterModifierType('EXP CHARM', 25), 4),
new WeightedModifierType(new PokemonExpBoosterModifierType('LUCKY EGG', 50), 3), new WeightedModifierType(new PokemonExpBoosterModifierType('LUCKY EGG', 50), 3),
new WeightedModifierType(new ModifierType('BERRY POUCH', 'Adds a 25% chance that a used berry will not be consumed',
(type, _args) => new Modifiers.PreserveBerryModifier(type)), 3),
new WeightedModifierType(new ModifierType('EXP. BALANCE', 'All EXP. Points received from battles is split among the lower leveled party members', (type, _args) => new Modifiers.ExpBalanceModifier(type), 'exp_balance'), 1) new WeightedModifierType(new ModifierType('EXP. BALANCE', 'All EXP. Points received from battles is split among the lower leveled party members', (type, _args) => new Modifiers.ExpBalanceModifier(type), 'exp_balance'), 1)
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }), ].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.MASTER]: [ [ModifierTier.MASTER]: [

View File

@ -1,16 +1,19 @@
import * as ModifierTypes from './modifier-type'; import * as ModifierTypes from './modifier-type';
import { LearnMovePhase, LevelUpPhase, PokemonHealPhase } from "./battle-phases"; import { CommonAnimPhase, LearnMovePhase, LevelUpPhase, PokemonHealPhase } from "../battle-phases";
import BattleScene from "./battle-scene"; import BattleScene from "../battle-scene";
import { getLevelTotalExp } from "./exp"; import { getLevelTotalExp } from "../data/exp";
import { PokeballType } from "./pokeball"; import { PokeballType } from "../data/pokeball";
import Pokemon, { PlayerPokemon } from "./pokemon"; import Pokemon, { PlayerPokemon } from "../pokemon";
import { Stat } from "./pokemon-stat"; import { Stat } from "../data/pokemon-stat";
import { addTextObject, TextStyle } from "./text"; import { addTextObject, TextStyle } from "../ui/text";
import { Type } from './type'; import { Type } from '../data/type';
import { EvolutionPhase } from './evolution-phase'; import { EvolutionPhase } from '../evolution-phase';
import { pokemonEvolutions } from './pokemon-evolutions'; import { pokemonEvolutions } from '../data/pokemon-evolutions';
import { getPokemonMessage } from './messages'; import { getPokemonMessage } from '../messages';
import * as Utils from "./utils"; import * as Utils from "../utils";
import { TempBattleStat } from '../data/temp-battle-stat';
import { BerryType, getBerryEffectFunc, getBerryPredicate } from '../data/berry';
import { CommonAnim } from '../data/battle-anims';
type ModifierType = ModifierTypes.ModifierType; type ModifierType = ModifierTypes.ModifierType;
export type ModifierPredicate = (modifier: Modifier) => boolean; export type ModifierPredicate = (modifier: Modifier) => boolean;
@ -185,10 +188,10 @@ export class AddPokeballModifier extends ConsumableModifier {
} }
export class TempBattleStatBoosterModifier extends PersistentModifier { export class TempBattleStatBoosterModifier extends PersistentModifier {
private tempBattleStat: ModifierTypes.TempBattleStat; private tempBattleStat: TempBattleStat;
private battlesLeft: integer; private battlesLeft: integer;
constructor(type: ModifierTypes.TempBattleStatBoosterModifierType, tempBattleStat: ModifierTypes.TempBattleStat) { constructor(type: ModifierTypes.TempBattleStatBoosterModifierType, tempBattleStat: TempBattleStat) {
super(type); super(type);
this.tempBattleStat = tempBattleStat; this.tempBattleStat = tempBattleStat;
@ -200,7 +203,7 @@ export class TempBattleStatBoosterModifier extends PersistentModifier {
} }
apply(args: any[]): boolean { apply(args: any[]): boolean {
const tempBattleStat = args[0] as ModifierTypes.TempBattleStat; const tempBattleStat = args[0] as TempBattleStat;
if (tempBattleStat === this.tempBattleStat) { if (tempBattleStat === this.tempBattleStat) {
const statLevel = args[1] as Utils.IntegerHolder; const statLevel = args[1] as Utils.IntegerHolder;
@ -353,15 +356,79 @@ export class HitHealModifier extends PokemonHeldItemModifier {
if (pokemon.turnData.damageDealt && pokemon.getHpRatio() < 1) { if (pokemon.turnData.damageDealt && pokemon.getHpRatio() < 1) {
const scene = pokemon.scene; const scene = pokemon.scene;
const hpRestoreMultiplier = new Utils.IntegerHolder(1); scene.unshiftPhase(new PokemonHealPhase(scene, true, Math.max(Math.floor(pokemon.turnData.damageDealt / 8) * this.stackCount, 1), getPokemonMessage(pokemon, `'s ${this.type.name}\nrestored its HP a little!`), true));
scene.applyModifiers(HealingBoosterModifier, hpRestoreMultiplier);
scene.unshiftPhase(new PokemonHealPhase(scene, true, Math.max(Math.floor(pokemon.turnData.damageDealt / 8) * this.stackCount * hpRestoreMultiplier.value, 1), getPokemonMessage(pokemon, `'s ${this.type.name}\nrestored its HP a little!`), true));
} }
return true; return true;
} }
} }
export class BerryModifier extends PokemonHeldItemModifier {
public berryType: BerryType;
public consumed: boolean;
constructor(type: ModifierType, pokemonId: integer, berryType: BerryType) {
super(type, pokemonId);
this.berryType = berryType;
this.consumed = false;
}
match(modifier: Modifier) {
return modifier instanceof BerryModifier && (modifier as BerryModifier).berryType === this.berryType;
}
clone() {
return new BerryModifier(this.type, this.pokemonId, this.berryType);
}
shouldApply(args: any[]): boolean {
return !this.consumed && super.shouldApply(args) && getBerryPredicate(this.berryType)(args[0] as Pokemon);
}
apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon;
const preserve = new Utils.BooleanHolder(false);
pokemon.scene.applyModifiers(PreserveBerryModifier, preserve);
getBerryEffectFunc(this.berryType)(pokemon);
if (!preserve.value)
this.consumed = true;
return true;
}
}
export class PreserveBerryModifier extends PersistentModifier {
constructor(type: ModifierType) {
super(type);
}
match(modifier: Modifier) {
return modifier instanceof PreserveBerryModifier;
}
clone() {
return new PreserveBerryModifier(this.type);
}
shouldApply(args: any[]): boolean {
return super.shouldApply(args) && args[0] instanceof Utils.BooleanHolder;
}
apply(args: any[]): boolean {
if (!(args[0] as Utils.BooleanHolder).value)
(args[0] as Utils.BooleanHolder).value = this.getStackCount() === this.getMaxStackCount() || Utils.randInt(this.getMaxStackCount()) < this.getStackCount();
return true;
}
getMaxStackCount(): number {
return 4;
}
}
export abstract class ConsumablePokemonModifier extends ConsumableModifier { export abstract class ConsumablePokemonModifier extends ConsumableModifier {
public pokemonId: integer; public pokemonId: integer;
@ -383,7 +450,7 @@ export abstract class ConsumablePokemonModifier extends ConsumableModifier {
export class PokemonHpRestoreModifier extends ConsumablePokemonModifier { export class PokemonHpRestoreModifier extends ConsumablePokemonModifier {
private restorePoints: integer; private restorePoints: integer;
private percent: boolean; private percent: boolean;
private fainted: boolean; public fainted: boolean;
constructor(type: ModifierType, pokemonId: integer, restorePoints: integer, percent: boolean, fainted?: boolean) { constructor(type: ModifierType, pokemonId: integer, restorePoints: integer, percent: boolean, fainted?: boolean) {
super(type, pokemonId); super(type, pokemonId);

View File

@ -1,26 +1,26 @@
import Phaser from 'phaser'; import Phaser from 'phaser';
import BattleScene from './battle-scene'; import BattleScene from './battle-scene';
import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from './battle-info'; import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from './ui/battle-info';
import Move, { StatChangeAttr, HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariablePowerAttr, Moves, allMoves, MoveCategory } from "./move"; import Move, { StatChangeAttr, HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariablePowerAttr, Moves, allMoves, MoveCategory } from "./data/move";
import { pokemonLevelMoves } from './pokemon-level-moves'; import { pokemonLevelMoves } from './data/pokemon-level-moves';
import { default as PokemonSpecies, PokemonSpeciesForm, getPokemonSpecies } from './pokemon-species'; import { default as PokemonSpecies, PokemonSpeciesForm, getPokemonSpecies } from './data/pokemon-species';
import * as Utils from './utils'; import * as Utils from './utils';
import { Type, getTypeDamageMultiplier } from './type'; import { Type, getTypeDamageMultiplier } from './data/type';
import { getLevelTotalExp } from './exp'; import { getLevelTotalExp } from './data/exp';
import { Stat } from './pokemon-stat'; import { Stat } from './data/pokemon-stat';
import { AttackTypeBoosterModifier, PokemonBaseStatModifier as PokemonBaseStatBoosterModifier, ShinyRateBoosterModifier, TempBattleStatBoosterModifier } from './modifier'; import { AttackTypeBoosterModifier, PokemonBaseStatModifier, ShinyRateBoosterModifier, TempBattleStatBoosterModifier } from './modifier/modifier';
import { PokeballType } from './pokeball'; import { PokeballType } from './data/pokeball';
import { Gender } from './gender'; import { Gender } from './data/gender';
import { initMoveAnim, loadMoveAnimAssets } from './battle-anims'; import { initMoveAnim, loadMoveAnimAssets } from './data/battle-anims';
import { Status, StatusEffect } from './status-effect'; import { Status, StatusEffect } from './data/status-effect';
import { tmSpecies } from './tms'; import { tmSpecies } from './data/tms';
import { pokemonEvolutions, pokemonPrevolutions, SpeciesEvolution, SpeciesEvolutionCondition } from './pokemon-evolutions'; import { pokemonEvolutions, pokemonPrevolutions, SpeciesEvolution, SpeciesEvolutionCondition } from './data/pokemon-evolutions';
import { DamagePhase, FaintPhase, MessagePhase } from './battle-phases'; import { DamagePhase, FaintPhase, MessagePhase } from './battle-phases';
import { BattleStat } from './battle-stat'; import { BattleStat } from './data/battle-stat';
import { BattleTag, BattleTagLapseType, BattleTagType, getBattleTag } from './battle-tag'; import { BattleTag, BattleTagLapseType, BattleTagType, getBattleTag } from './data/battle-tag';
import { Species } from './species'; import { Species } from './data/species';
import { WeatherType } from './weather'; import { WeatherType } from './data/weather';
import { TempBattleStat } from './modifier-type'; import { TempBattleStat } from './data/temp-battle-stat';
export default abstract class Pokemon extends Phaser.GameObjects.Container { export default abstract class Pokemon extends Phaser.GameObjects.Container {
public id: integer; public id: integer;
@ -280,7 +280,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (!this.stats) if (!this.stats)
this.stats = [ 0, 0, 0, 0, 0, 0 ]; this.stats = [ 0, 0, 0, 0, 0, 0 ];
const baseStats = this.getSpeciesForm().baseStats.slice(0); const baseStats = this.getSpeciesForm().baseStats.slice(0);
this.scene.applyModifiers(PokemonBaseStatBoosterModifier, this, baseStats); this.scene.applyModifiers(PokemonBaseStatModifier, this, baseStats);
const stats = Utils.getEnumValues(Stat); const stats = Utils.getEnumValues(Stat);
for (let s of stats) { for (let s of stats) {
const isHp = s === Stat.HP; const isHp = s === Stat.HP;

View File

@ -1,17 +1,17 @@
import { SelectModifierPhase } from "./battle-phases"; import { SelectModifierPhase } from "../battle-phases";
import BattleScene, { Button } from "./battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { ModifierTier, ModifierType, ModifierTypeOption, PokemonBaseStatBoosterModifierType, PokemonHpRestoreModifierType, PokemonReviveModifierType } from "./modifier-type"; import { ModifierTier, ModifierType, ModifierTypeOption, PokemonBaseStatBoosterModifierType, PokemonHpRestoreModifierType, PokemonReviveModifierType } from "../modifier/modifier-type";
import Pokemon, { AiType, EnemyPokemon, PlayerPokemon, PokemonMove } from "./pokemon"; import Pokemon, { AiType, EnemyPokemon, PlayerPokemon, PokemonMove } from "../pokemon";
import { Species } from "./species"; import { Species } from "../data/species";
import { getTypeDamageMultiplier } from "./type"; import { getTypeDamageMultiplier } from "../data/type";
import BattleMessageUiHandler from "./ui/battle-message-ui-handler"; import BattleMessageUiHandler from "../ui/battle-message-ui-handler";
import CommandUiHandler from "./ui/command-ui-handler"; import CommandUiHandler from "../ui/command-ui-handler";
import FightUiHandler from "./ui/fight-ui-handler"; import FightUiHandler from "../ui/fight-ui-handler";
import MessageUiHandler from "./ui/message-ui-handler"; import MessageUiHandler from "../ui/message-ui-handler";
import ModifierSelectUiHandler from "./ui/modifier-select-ui-handler"; import ModifierSelectUiHandler from "../ui/modifier-select-ui-handler";
import PartyUiHandler, { PartyUiMode } from "./ui/party-ui-handler"; import PartyUiHandler, { PartyUiMode } from "../ui/party-ui-handler";
import ConfirmUiHandler from "./ui/confirm-ui-handler"; import ConfirmUiHandler from "../ui/confirm-ui-handler";
import { Mode } from "./ui/ui"; import { Mode } from "../ui/ui";
export function initAutoPlay() { export function initAutoPlay() {
const thisArg = this as BattleScene; const thisArg = this as BattleScene;

View File

@ -1,10 +1,10 @@
import BattleScene from "./battle-scene"; import BattleScene from "../battle-scene";
import { Gender } from "./gender"; import { Gender } from "../data/gender";
import Pokemon from "./pokemon"; import Pokemon from "../pokemon";
import { pokemonPrevolutions } from "./pokemon-evolutions"; import { pokemonPrevolutions } from "../data/pokemon-evolutions";
import PokemonSpecies, { allSpecies } from "./pokemon-species"; import PokemonSpecies, { allSpecies } from "../data/pokemon-species";
import { Species } from "./species"; import { Species } from "../data/species";
import * as Utils from "./utils"; import * as Utils from "../utils";
interface SaveData { interface SaveData {
trainerId: integer; trainerId: integer;

View File

@ -1,5 +1,5 @@
import BattleScene from "./battle-scene"; import BattleScene from "../battle-scene";
import * as Utils from "./utils"; import * as Utils from "../utils";
export function initGameSpeed() { export function initGameSpeed() {
const thisArg = this as BattleScene; const thisArg = this as BattleScene;

View File

@ -1,7 +1,7 @@
import { CommandPhase } from "../battle-phases"; import { CommandPhase } from "../battle-phases";
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { getPokeballName, PokeballType } from "../pokeball"; import { getPokeballName, PokeballType } from "../data/pokeball";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import { Command } from "./command-ui-handler"; import { Command } from "./command-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./uiHandler"; import UiHandler from "./uiHandler";

View File

@ -1,10 +1,10 @@
import { default as Pokemon } from './pokemon'; import { default as Pokemon } from '../pokemon';
import { getLevelTotalExp, getLevelRelExp } from './exp'; import { getLevelTotalExp, getLevelRelExp } from '../data/exp';
import * as Utils from './utils'; import * as Utils from '../utils';
import { addTextObject, TextStyle } from './text'; import { addTextObject, TextStyle } from './text';
import { getGenderSymbol, getGenderColor } from './gender'; import { getGenderSymbol, getGenderColor } from '../data/gender';
import { StatusEffect } from './status-effect'; import { StatusEffect } from '../data/status-effect';
import BattleScene from './battle-scene'; import BattleScene from '../battle-scene';
export default class BattleInfo extends Phaser.GameObjects.Container { export default class BattleInfo extends Phaser.GameObjects.Container {
private player: boolean; private player: boolean;

View File

@ -1,9 +1,9 @@
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import UI, { Mode } from "./ui"; import UI, { Mode } from "./ui";
import * as Utils from "../utils"; import * as Utils from "../utils";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { getStatName, Stat } from "../pokemon-stat"; import { getStatName, Stat } from "../data/pokemon-stat";
export default class BattleMessageUiHandler extends MessageUiHandler { export default class BattleMessageUiHandler extends MessageUiHandler {
private levelUpStatsContainer: Phaser.GameObjects.Container; private levelUpStatsContainer: Phaser.GameObjects.Container;

View File

@ -1,6 +1,6 @@
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { Biome, biomeLinks, getBiomeName } from "../biome"; import { Biome, biomeLinks, getBiomeName } from "../data/biome";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./uiHandler"; import UiHandler from "./uiHandler";

View File

@ -1,6 +1,6 @@
import { CommandPhase } from "../battle-phases"; import { CommandPhase } from "../battle-phases";
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import { toPokemonUpperCase } from "../utils"; import { toPokemonUpperCase } from "../utils";
import { PartyUiMode } from "./party-ui-handler"; import { PartyUiMode } from "./party-ui-handler";
import UI, { Mode } from "./ui"; import UI, { Mode } from "./ui";

View File

@ -1,5 +1,5 @@
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./uiHandler"; import UiHandler from "./uiHandler";

View File

@ -1,6 +1,6 @@
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import { Type } from "../type"; import { Type } from "../data/type";
import { Command } from "./command-ui-handler"; import { Command } from "./command-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import UiHandler from "./uiHandler"; import UiHandler from "./uiHandler";

View File

@ -1,3 +0,0 @@
import BattleScene from "../battle-scene";
import { Modifier } from "../modifier";

View File

@ -1,7 +1,7 @@
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { ModifierTier, ModifierType, ModifierTypeOption } from "../modifier-type"; import { ModifierTier, ModifierType, ModifierTypeOption } from "../modifier/modifier-type";
import { getPokeballAtlasKey, PokeballType } from "../pokeball"; import { getPokeballAtlasKey, PokeballType } from "../data/pokeball";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import AwaitableUiHandler from "./awaitable-ui-handler"; import AwaitableUiHandler from "./awaitable-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";

View File

@ -1,7 +1,7 @@
import { CommandPhase, SummonMissingPhase } from "../battle-phases"; import { CommandPhase, SummonMissingPhase } from "../battle-phases";
import BattleScene, { Button } from "../battle-scene"; import BattleScene, { Button } from "../battle-scene";
import { PlayerPokemon, PokemonMove } from "../pokemon"; import { PlayerPokemon, PokemonMove } from "../pokemon";
import { addTextObject, TextStyle } from "../text"; import { addTextObject, TextStyle } from "./text";
import { Command } from "./command-ui-handler"; import { Command } from "./command-ui-handler";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";

Some files were not shown because too many files have changed in this diff Show More