Implement trainer battles and various changes
Implement trainer battles; add dialogue functionality; add random session seed for predictable random results; remove capitalization from text; add full party heal after every 10 wavespull/2/head
|
@ -31,6 +31,7 @@
|
|||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="src/main.ts"></script>
|
||||
<script src="src/debug.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"textures": [
|
||||
{
|
||||
"image": "rival_m.png",
|
||||
"image": "player.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 196,
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"textures": [
|
||||
{
|
||||
"image": "rival_f.png",
|
||||
"image": "rival.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 267,
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 278 B |
|
@ -0,0 +1,104 @@
|
|||
{
|
||||
"textures": [
|
||||
{
|
||||
"image": "pb_tray_ball.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 28,
|
||||
"h": 7
|
||||
},
|
||||
"scale": 1,
|
||||
"frames": [
|
||||
{
|
||||
"filename": "ball",
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"sourceSize": {
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"frame": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "empty",
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"sourceSize": {
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"frame": {
|
||||
"x": 7,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "faint",
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"sourceSize": {
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"frame": {
|
||||
"x": 14,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "status",
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"sourceSize": {
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
},
|
||||
"frame": {
|
||||
"x": 21,
|
||||
"y": 0,
|
||||
"w": 7,
|
||||
"h": 7
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"app": "https://www.codeandweb.com/texturepacker",
|
||||
"version": "3.0",
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:f7a37dfea18d90e97d6fe0b1f2e1f69c:6823410fc296184fa84e87f6ca79158a:097b8eb81a77f8ed73a75d6d94f48dac$"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 902 B After Width: | Height: | Size: 4.7 KiB |
92
src/arena.ts
|
@ -1,6 +1,5 @@
|
|||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
import BattleScene from "./battle-scene";
|
||||
import { Biome, BiomePoolTier, BiomeTierPokemonPools, biomePokemonPools } from "./data/biome";
|
||||
import { Biome, BiomePoolTier, BiomeTierPokemonPools, BiomeTierTrainerPools, biomePokemonPools, biomeTrainerPools } from "./data/biome";
|
||||
import * as Utils from "./utils";
|
||||
import PokemonSpecies, { getPokemonSpecies } from "./data/pokemon-species";
|
||||
import { Species } from "./data/species";
|
||||
|
@ -11,6 +10,7 @@ import { Type } from "./data/type";
|
|||
import Move, { Moves } from "./data/move";
|
||||
import { ArenaTag, ArenaTagType, getArenaTag } from "./data/arena-tag";
|
||||
import { GameMode } from "./game-mode";
|
||||
import { TrainerType } from "./data/trainer-type";
|
||||
|
||||
export class Arena {
|
||||
public scene: BattleScene;
|
||||
|
@ -20,6 +20,7 @@ export class Arena {
|
|||
public bgm: string;
|
||||
|
||||
private pokemonPool: BiomeTierPokemonPools;
|
||||
private trainerPool: BiomeTierTrainerPools;
|
||||
|
||||
constructor(scene: BattleScene, biome: Biome, bgm: string) {
|
||||
this.scene = scene;
|
||||
|
@ -27,12 +28,13 @@ export class Arena {
|
|||
this.tags = [];
|
||||
this.bgm = bgm;
|
||||
this.pokemonPool = biomePokemonPools[biome];
|
||||
this.trainerPool = biomeTrainerPools[biome];
|
||||
}
|
||||
|
||||
randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies {
|
||||
const isBoss = waveIndex % 10 === 0 && !!this.pokemonPool[BiomePoolTier.BOSS].length
|
||||
&& (this.biomeType !== Biome.END || this.scene.gameMode !== GameMode.ENDLESS || waveIndex % 250 === 0);
|
||||
const tierValue = Utils.randInt(!isBoss ? 512 : 64);
|
||||
const tierValue = Utils.randSeedInt(!isBoss ? 512 : 64);
|
||||
let tier = !isBoss
|
||||
? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE
|
||||
: tierValue >= 20 ? BiomePoolTier.BOSS : tierValue >= 6 ? BiomePoolTier.BOSS_RARE : tierValue >= 1 ? BiomePoolTier.BOSS_SUPER_RARE : BiomePoolTier.BOSS_ULTRA_RARE;
|
||||
|
@ -47,7 +49,7 @@ export class Arena {
|
|||
if (!tierPool.length)
|
||||
ret = this.scene.randomSpecies(waveIndex, level);
|
||||
else {
|
||||
const entry = tierPool[Utils.randInt(tierPool.length)];
|
||||
const entry = tierPool[Utils.randSeedInt(tierPool.length)];
|
||||
let species: Species;
|
||||
if (typeof entry === 'number')
|
||||
species = entry as Species;
|
||||
|
@ -58,7 +60,7 @@ export class Arena {
|
|||
if (level >= levelThreshold) {
|
||||
const speciesIds = entry[levelThreshold];
|
||||
if (speciesIds.length > 1)
|
||||
species = speciesIds[Utils.randInt(speciesIds.length)];
|
||||
species = speciesIds[Utils.randSeedInt(speciesIds.length)];
|
||||
else
|
||||
species = speciesIds[0];
|
||||
break;
|
||||
|
@ -99,9 +101,25 @@ export class Arena {
|
|||
return ret;
|
||||
}
|
||||
|
||||
randomTrainerType(waveIndex: integer): TrainerType {
|
||||
const isBoss = waveIndex % 10 === 0 && !!this.trainerPool[BiomePoolTier.BOSS].length
|
||||
&& (this.biomeType !== Biome.END || this.scene.gameMode !== GameMode.ENDLESS || waveIndex % 250 === 0);
|
||||
const tierValue = Utils.randSeedInt(!isBoss ? 512 : 64);
|
||||
let tier = !isBoss
|
||||
? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE
|
||||
: tierValue >= 20 ? BiomePoolTier.BOSS : tierValue >= 6 ? BiomePoolTier.BOSS_RARE : tierValue >= 1 ? BiomePoolTier.BOSS_SUPER_RARE : BiomePoolTier.BOSS_ULTRA_RARE;
|
||||
console.log(BiomePoolTier[tier]);
|
||||
while (tier && !this.trainerPool[tier].length) {
|
||||
console.log(`Downgraded trainer rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`);
|
||||
tier--;
|
||||
}
|
||||
const tierPool = this.trainerPool[tier] || [];
|
||||
return !tierPool.length ? TrainerType.BREEDER : tierPool[Utils.randSeedInt(tierPool.length)];
|
||||
}
|
||||
|
||||
getFormIndex(species: PokemonSpecies) {
|
||||
if (!species.canChangeForm && species.forms?.length)
|
||||
return Utils.randInt(species.forms.length); // TODO: Base on biome
|
||||
return Utils.randSeedInt(species.forms.length); // TODO: Base on biome
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -182,6 +200,45 @@ export class Arena {
|
|||
return this.weather.getAttackTypeMultiplier(attackType);
|
||||
}
|
||||
|
||||
getTrainerChance(): integer {
|
||||
switch (this.biomeType) {
|
||||
case Biome.CITY:
|
||||
case Biome.BEACH:
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return 4;
|
||||
case Biome.PLAINS:
|
||||
case Biome.GRASS:
|
||||
case Biome.LAKE:
|
||||
case Biome.CAVE:
|
||||
return 6;
|
||||
case Biome.TALL_GRASS:
|
||||
case Biome.FOREST:
|
||||
case Biome.SEA:
|
||||
case Biome.SWAMP:
|
||||
case Biome.MOUNTAIN:
|
||||
case Biome.BADLANDS:
|
||||
case Biome.DESERT:
|
||||
case Biome.MEADOW:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.FACTORY:
|
||||
return 8;
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.VOLCANO:
|
||||
case Biome.RUINS:
|
||||
case Biome.WASTELAND:
|
||||
case Biome.JUNGLE:
|
||||
return 12;
|
||||
case Biome.SEABED:
|
||||
case Biome.ABYSS:
|
||||
case Biome.SPACE:
|
||||
return 16;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
isDaytime(): boolean {
|
||||
switch (this.biomeType) {
|
||||
case Biome.TOWN:
|
||||
|
@ -195,6 +252,7 @@ export class Arena {
|
|||
case Biome.DESERT:
|
||||
case Biome.MEADOW:
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -349,12 +407,12 @@ export class ArenaBase extends Phaser.GameObjects.Container {
|
|||
|
||||
this.player = player;
|
||||
|
||||
this.base = scene.add.sprite(0, 0, `plains_a`);
|
||||
this.base = scene.add.sprite(0, 0, 'plains_a');
|
||||
this.base.setOrigin(0, 0);
|
||||
|
||||
this.props = !player ?
|
||||
new Array(3).fill(null).map(() => {
|
||||
const ret = scene.add.sprite(0, 0, `plains_b`);
|
||||
const ret = scene.add.sprite(0, 0, 'plains_b');
|
||||
ret.setOrigin(0, 0);
|
||||
ret.setVisible(false);
|
||||
return ret;
|
||||
|
@ -372,14 +430,16 @@ export class ArenaBase extends Phaser.GameObjects.Container {
|
|||
this.add(this.base);
|
||||
|
||||
if (!this.player) {
|
||||
this.propValue = propValue === undefined
|
||||
? hasProps ? Utils.randInt(8) : 0
|
||||
: propValue;
|
||||
this.props.forEach((prop, p) => {
|
||||
prop.setTexture(`${biomeKey}_b${hasProps ? `_${p + 1}` : ''}`);
|
||||
prop.setVisible(hasProps && !!(this.propValue & (1 << p)));
|
||||
this.add(prop);
|
||||
});
|
||||
(this.scene as BattleScene).executeWithSeedOffset(() => {
|
||||
this.propValue = propValue === undefined
|
||||
? hasProps ? Utils.randSeedInt(8) : 0
|
||||
: propValue;
|
||||
this.props.forEach((prop, p) => {
|
||||
prop.setTexture(`${biomeKey}_b${hasProps ? `_${p + 1}` : ''}`);
|
||||
prop.setVisible(hasProps && !!(this.propValue & (1 << p)));
|
||||
this.add(prop);
|
||||
});
|
||||
}, (this.scene as BattleScene).currentBattle?.waveIndex || 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -80,7 +80,7 @@ export class CheckLoadPhase extends BattlePhase {
|
|||
this.scene.pushPhase(new SummonPhase(this.scene, 0));
|
||||
if (this.scene.currentBattle.double && availablePartyMembers > 1)
|
||||
this.scene.pushPhase(new SummonPhase(this.scene, 1));
|
||||
if (this.scene.currentBattle.waveIndex > 1) {
|
||||
if (this.scene.currentBattle.waveIndex > 1 && this.scene.currentBattle.battleType !== BattleType.TRAINER) {
|
||||
this.scene.pushPhase(new CheckSwitchPhase(this.scene, 0, this.scene.currentBattle.double));
|
||||
if (this.scene.currentBattle.double && availablePartyMembers > 1)
|
||||
this.scene.pushPhase(new CheckSwitchPhase(this.scene, 1, this.scene.currentBattle.double));
|
||||
|
@ -237,11 +237,14 @@ export class EncounterPhase extends BattlePhase {
|
|||
const battle = this.scene.currentBattle;
|
||||
|
||||
battle.enemyLevels.forEach((level, e) => {
|
||||
const enemySpecies = battle.battleType === BattleType.TRAINER
|
||||
? this.scene.currentBattle.trainer.genPartyMemberSpecies(level)
|
||||
: this.scene.randomSpecies(battle.waveIndex, level, null, true);
|
||||
if (!this.loaded)
|
||||
battle.enemyParty[e] = new EnemyPokemon(this.scene, enemySpecies, level);
|
||||
if (!this.loaded) {
|
||||
if (battle.battleType === BattleType.TRAINER)
|
||||
battle.enemyParty[e] = battle.trainer.genPartyMember(e);
|
||||
else {
|
||||
const enemySpecies = this.scene.randomSpecies(battle.waveIndex, level, null, true);
|
||||
battle.enemyParty[e] = new EnemyPokemon(this.scene, enemySpecies, level);
|
||||
}
|
||||
}
|
||||
const enemyPokemon = this.scene.getEnemyParty()[e];
|
||||
if (e < (battle.double ? 2 : 1)) {
|
||||
enemyPokemon.setX(-66 + enemyPokemon.getFieldPositionOffset()[0]);
|
||||
|
@ -255,7 +258,7 @@ export class EncounterPhase extends BattlePhase {
|
|||
});
|
||||
|
||||
if (battle.battleType === BattleType.TRAINER)
|
||||
loadEnemyAssets.push(battle.trainer.loadAssets());
|
||||
loadEnemyAssets.push(battle.trainer.loadAssets().then(() => battle.trainer.initSprite()));
|
||||
|
||||
Promise.all(loadEnemyAssets).then(() => {
|
||||
battle.enemyParty.forEach((enemyPokemon, e) => {
|
||||
|
@ -321,23 +324,45 @@ export class EncounterPhase extends BattlePhase {
|
|||
: `A wild ${enemyField[0].name}\nand ${enemyField[1].name} appeared!`;
|
||||
this.scene.ui.showText(text, null, () => this.end(), 1500);
|
||||
} else if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
this.scene.currentBattle.trainer.untint(100, 'Sine.easeOut');
|
||||
this.scene.currentBattle.trainer.playAnim();
|
||||
const text = `${this.scene.currentBattle.trainer.getName()}\nwould like to battle!`;
|
||||
this.scene.ui.showText(text, null, () => {
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.currentBattle.trainer,
|
||||
x: '+=16',
|
||||
y: '-=16',
|
||||
alpha: 0,
|
||||
ease: 'Sine.easeInOut',
|
||||
duration: 750
|
||||
});
|
||||
this.scene.unshiftPhase(new SummonPhase(this.scene, 0, false));
|
||||
if (this.scene.currentBattle.double)
|
||||
this.scene.unshiftPhase(new SummonPhase(this.scene, 1, false));
|
||||
this.end();
|
||||
}, 1500);
|
||||
const trainer = this.scene.currentBattle.trainer;
|
||||
trainer.untint(100, 'Sine.easeOut');
|
||||
trainer.playAnim();
|
||||
|
||||
const doSummon = () => {
|
||||
this.scene.currentBattle.started = true;
|
||||
this.scene.playBgm(undefined);
|
||||
this.scene.pbTray.showPbTray(this.scene.getParty());
|
||||
this.scene.pbTrayEnemy.showPbTray(this.scene.getEnemyParty());
|
||||
const text = `${this.scene.currentBattle.trainer.getName()}\nwould like to battle!`;
|
||||
this.scene.ui.showText(text, null, () => {
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.currentBattle.trainer,
|
||||
x: '+=16',
|
||||
y: '-=16',
|
||||
alpha: 0,
|
||||
ease: 'Sine.easeInOut',
|
||||
duration: 750
|
||||
});
|
||||
this.scene.unshiftPhase(new SummonPhase(this.scene, 0, false));
|
||||
if (this.scene.currentBattle.double)
|
||||
this.scene.unshiftPhase(new SummonPhase(this.scene, 1, false));
|
||||
this.end();
|
||||
}, 1500, true);
|
||||
};
|
||||
|
||||
if (!trainer.config.encounterMessages.length)
|
||||
doSummon();
|
||||
else {
|
||||
let message: string;
|
||||
this.scene.executeWithSeedOffset(() => message = Phaser.Math.RND.pick(this.scene.currentBattle.trainer.config.encounterMessages), this.scene.currentBattle.waveIndex);
|
||||
const messagePages = message.split(/\$/g).map(m => m.trim());
|
||||
let showMessageAndSummon = () => doSummon();
|
||||
for (let p = messagePages.length - 1; p >= 0; p--) {
|
||||
const originalFunc = showMessageAndSummon;
|
||||
showMessageAndSummon = () => this.scene.ui.showDialogue(messagePages[p], trainer.getName(), null, originalFunc, null, true);
|
||||
}
|
||||
showMessageAndSummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,7 +393,7 @@ export class NextEncounterPhase extends EncounterPhase {
|
|||
|
||||
const enemyField = this.scene.getEnemyField();
|
||||
this.scene.tweens.add({
|
||||
targets: [ this.scene.arenaEnemy, this.scene.arenaNextEnemy, this.scene.currentBattle.trainer, enemyField ].flat(),
|
||||
targets: [ this.scene.arenaEnemy, this.scene.arenaNextEnemy, this.scene.currentBattle.trainer, enemyField, this.scene.lastEnemyTrainer ].flat(),
|
||||
x: '+=300',
|
||||
duration: 2000,
|
||||
onComplete: () => {
|
||||
|
@ -430,6 +455,8 @@ export class SelectBiomePhase extends BattlePhase {
|
|||
const currentBiome = this.scene.arena.biomeType;
|
||||
|
||||
const setNextBiome = (nextBiome: Biome) => {
|
||||
if (this.scene.gameMode === GameMode.CLASSIC)
|
||||
this.scene.unshiftPhase(new PartyHealPhase(this.scene, false));
|
||||
this.scene.unshiftPhase(new SwitchBiomePhase(this.scene, nextBiome));
|
||||
this.end();
|
||||
};
|
||||
|
@ -441,7 +468,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||
setNextBiome(Biome.END);
|
||||
else {
|
||||
const allBiomes = Utils.getEnumValues(Biome);
|
||||
setNextBiome(allBiomes[Utils.randInt(allBiomes.length - 2, 1)]);
|
||||
setNextBiome(allBiomes[Utils.randSeedInt(allBiomes.length - 2, 1)]);
|
||||
}
|
||||
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
||||
const biomes = biomeLinks[currentBiome] as Biome[];
|
||||
|
@ -451,7 +478,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||
setNextBiome(biomes[biomeIndex]);
|
||||
});
|
||||
} else
|
||||
setNextBiome(biomes[Utils.randInt(biomes.length)]);
|
||||
setNextBiome(biomes[Utils.randSeedInt(biomes.length)]);
|
||||
} else
|
||||
setNextBiome(biomeLinks[currentBiome] as Biome);
|
||||
}
|
||||
|
@ -469,6 +496,9 @@ export class SwitchBiomePhase extends BattlePhase {
|
|||
start() {
|
||||
super.start();
|
||||
|
||||
if (this.nextBiome === undefined)
|
||||
return this.end();
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.arenaEnemy,
|
||||
x: '+=300',
|
||||
|
@ -536,7 +566,8 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||
|
||||
if (this.player) {
|
||||
this.scene.ui.showText(`Go! ${this.getPokemon().name}!`);
|
||||
if (this.player)
|
||||
if (this.player)
|
||||
this.scene.pbTray.hide();
|
||||
this.scene.trainer.play('trainer_m_pb');
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.trainer,
|
||||
|
@ -544,8 +575,10 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||
duration: 1000
|
||||
});
|
||||
this.scene.time.delayedCall(750, () => this.summon());
|
||||
} else
|
||||
} else {
|
||||
this.scene.pbTrayEnemy.hide();
|
||||
this.scene.ui.showText(`${this.scene.currentBattle.trainer.getName()} sent out\n${this.getPokemon().name}!`, null, () => this.summon());
|
||||
}
|
||||
}
|
||||
|
||||
summon(): void {
|
||||
|
@ -740,6 +773,25 @@ export class ReturnPhase extends SwitchSummonPhase {
|
|||
}
|
||||
}
|
||||
|
||||
export class ShowTrainerPhase extends BattlePhase {
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene);
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
this.scene.trainer.setTexture('trainer_m');
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.trainer,
|
||||
x: 106,
|
||||
duration: 1000,
|
||||
onComplete: () => this.end()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class ToggleDoublePositionPhase extends BattlePhase {
|
||||
private double: boolean;
|
||||
|
||||
|
@ -796,7 +848,7 @@ export class CheckSwitchPhase extends BattlePhase {
|
|||
return;
|
||||
}
|
||||
|
||||
this.scene.ui.showText(`Will you switch\n${this.useName ? pokemon.name : 'POKéMON'}?`, null, () => {
|
||||
this.scene.ui.showText(`Will you switch\n${this.useName ? pokemon.name : 'Pokémon'}?`, null, () => {
|
||||
this.scene.ui.setMode(Mode.CONFIRM, () => {
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.unshiftPhase(new SwitchPhase(this.scene, this.fieldIndex, false, true));
|
||||
|
@ -931,7 +983,14 @@ export class CommandPhase extends FieldPhase {
|
|||
if (this.scene.arena.biomeType === Biome.END) {
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(`A strange force\nprevents using POKé BALLS.`, null, () => {
|
||||
this.scene.ui.showText(`A strange force\nprevents using Poké Balls.`, null, () => {
|
||||
this.scene.ui.showText(null, 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
}, null, true);
|
||||
} else if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(`You can't catch\nanother trainer's Pokémon!`, null, () => {
|
||||
this.scene.ui.showText(null, 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
}, null, true);
|
||||
|
@ -949,20 +1008,33 @@ export class CommandPhase extends FieldPhase {
|
|||
case Command.POKEMON:
|
||||
case Command.RUN:
|
||||
const isSwitch = command === Command.POKEMON;
|
||||
const trapTag = playerPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag;
|
||||
const trapped = new Utils.BooleanHolder(false);
|
||||
const batonPass = isSwitch && args[0] as boolean;
|
||||
if (!batonPass)
|
||||
enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trapped));
|
||||
if (batonPass || (!trapTag && !trapped.value)) {
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||
: { command: Command.RUN };
|
||||
success = true;
|
||||
} else if (trapTag)
|
||||
this.scene.ui.showText(`${this.scene.getPokemonById(trapTag.sourceId).name}'s ${trapTag.getMoveName()}\nprevents ${isSwitch ? 'switching' : 'fleeing'}!`, null, () => {
|
||||
if (!isSwitch && this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(`You can't run\nfrom a trainer battle!`, null, () => {
|
||||
this.scene.ui.showText(null, 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
}, null, true);
|
||||
} else {
|
||||
const trapTag = playerPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag;
|
||||
const trapped = new Utils.BooleanHolder(false);
|
||||
const batonPass = isSwitch && args[0] as boolean;
|
||||
if (!batonPass)
|
||||
enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trapped));
|
||||
if (batonPass || (!trapTag && !trapped.value)) {
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||
: { command: Command.RUN };
|
||||
success = true;
|
||||
} else if (trapTag) {
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(`${this.scene.getPokemonById(trapTag.sourceId).name}'s ${trapTag.getMoveName()}\nprevents ${isSwitch ? 'switching' : 'fleeing'}!`, null, () => {
|
||||
this.scene.ui.showText(null, 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND);
|
||||
}, null, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1786,6 +1858,12 @@ export class MessagePhase extends BattlePhase {
|
|||
start() {
|
||||
super.start();
|
||||
|
||||
if (this.text.indexOf('$') > -1) {
|
||||
const pageIndex = this.text.indexOf('$');
|
||||
this.scene.unshiftPhase(new MessagePhase(this.scene, this.text.slice(pageIndex + 1), this.callbackDelay, this.prompt, this.promptDelay));
|
||||
this.text = this.text.slice(0, pageIndex).trim();
|
||||
}
|
||||
|
||||
this.scene.ui.showText(this.text, null, () => this.end(), this.callbackDelay || (this.prompt ? 0 : 1500), this.prompt, this.promptDelay);
|
||||
}
|
||||
|
||||
|
@ -1972,6 +2050,8 @@ export class VictoryPhase extends PokemonPhase {
|
|||
|
||||
if (!this.scene.getEnemyParty().filter(p => !p?.isFainted(true)).length) {
|
||||
this.scene.pushPhase(new BattleEndPhase(this.scene));
|
||||
if (this.scene.currentBattle.battleType === BattleType.TRAINER)
|
||||
this.scene.pushPhase(new TrainerVictoryPhase(this.scene));
|
||||
if (this.scene.gameMode === GameMode.ENDLESS || this.scene.currentBattle.waveIndex < this.scene.finalWave) {
|
||||
this.scene.pushPhase(new SelectModifierPhase(this.scene));
|
||||
this.scene.pushPhase(new NewBattlePhase(this.scene));
|
||||
|
@ -1983,6 +2063,41 @@ export class VictoryPhase extends PokemonPhase {
|
|||
}
|
||||
}
|
||||
|
||||
export class TrainerVictoryPhase extends BattlePhase {
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene);
|
||||
}
|
||||
|
||||
start() {
|
||||
this.scene.playBgm('victory');
|
||||
|
||||
this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName()}!`, null, () => {
|
||||
const defeatMessages = this.scene.currentBattle.trainer.config.defeatMessages;
|
||||
let showMessageAndEnd = () => this.end();//this.scene.ui.showText(`You got ₽0\nfor winning!`, null, () => this.end(), null, true);
|
||||
if (defeatMessages.length) {
|
||||
let message: string;
|
||||
this.scene.executeWithSeedOffset(() => message = Phaser.Math.RND.pick(this.scene.currentBattle.trainer.config.defeatMessages), this.scene.currentBattle.waveIndex);
|
||||
const messagePages = message.split(/\$/g).map(m => m.trim());
|
||||
|
||||
for (let p = messagePages.length - 1; p >= 0; p--) {
|
||||
const originalFunc = showMessageAndEnd;
|
||||
showMessageAndEnd = () => this.scene.ui.showDialogue(messagePages[p], this.scene.currentBattle.trainer.getName(), null, originalFunc, null, true);
|
||||
}
|
||||
}
|
||||
showMessageAndEnd();
|
||||
}, null, true);
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this.scene.currentBattle.trainer,
|
||||
x: '-=16',
|
||||
y: '+=16',
|
||||
alpha: 1,
|
||||
ease: 'Sine.easeInOut',
|
||||
duration: 750
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class GameOverPhase extends BattlePhase {
|
||||
private victory: boolean;
|
||||
|
||||
|
@ -2166,7 +2281,7 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
|
|||
pokemon.calculateStats();
|
||||
pokemon.updateInfo();
|
||||
this.scene.playSoundWithoutBgm('level_up_fanfare', 1500);
|
||||
this.scene.ui.showText(`${this.getPokemon().name} grew to\nLV. ${this.level}!`, null, () => this.scene.ui.getMessageHandler().promptLevelUpStats(this.partyMemberIndex, prevStats, false, () => this.end()), null, true);
|
||||
this.scene.ui.showText(`${this.getPokemon().name} grew to\nLv. ${this.level}!`, null, () => this.scene.ui.getMessageHandler().promptLevelUpStats(this.partyMemberIndex, prevStats, false, () => this.end()), null, true);
|
||||
if (this.level <= 100) {
|
||||
const levelMoves = this.getPokemon().getLevelMoves(this.lastLevel + 1);
|
||||
for (let lm of levelMoves)
|
||||
|
@ -2215,7 +2330,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
.then(() => {
|
||||
this.scene.ui.setMode(messageMode).then(() => {
|
||||
this.scene.playSoundWithoutBgm('level_up_fanfare', 1500);
|
||||
this.scene.ui.showText(`${pokemon.name} learned\n${Utils.toPokemonUpperCase(move.name)}!`, null, () => this.end(), messageMode === Mode.EVOLUTION_SCENE ? 1000 : null, true);
|
||||
this.scene.ui.showText(`${pokemon.name} learned\n${move.name}!`, null, () => this.end(), messageMode === Mode.EVOLUTION_SCENE ? 1000 : null, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -2506,7 +2621,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
Promise.all([ pokemon.hideInfo(), this.scene.gameData.setPokemonCaught(pokemon) ]).then(() => {
|
||||
if (this.scene.getParty().length === 6) {
|
||||
const promptRelease = () => {
|
||||
this.scene.ui.showText(`Your party is full.\nRelease a POKéMON to make room for ${pokemon.name}?`, null, () => {
|
||||
this.scene.ui.showText(`Your party is full.\nRelease a Pokémon to make room for ${pokemon.name}?`, null, () => {
|
||||
this.scene.ui.setMode(Mode.CONFIRM, () => {
|
||||
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
|
@ -2591,6 +2706,8 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
start() {
|
||||
super.start();
|
||||
|
||||
this.scene.resetSeed();
|
||||
|
||||
const party = this.scene.getParty();
|
||||
regenerateModifierPoolThresholds(party);
|
||||
const modifierCount = new Utils.IntegerHolder(3);
|
||||
|
@ -2658,6 +2775,40 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
}
|
||||
}
|
||||
|
||||
export class PartyHealPhase extends BattlePhase {
|
||||
private resumeBgm: boolean;
|
||||
|
||||
constructor(scene: BattleScene, resumeBgm: boolean) {
|
||||
super(scene);
|
||||
|
||||
this.resumeBgm = resumeBgm;
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
const bgmPlaying = this.scene.isBgmPlaying();
|
||||
if (bgmPlaying)
|
||||
this.scene.fadeOutBgm(1000, false);
|
||||
this.scene.ui.fadeOut(1000).then(() => {
|
||||
for (let pokemon of this.scene.getParty()) {
|
||||
pokemon.hp = pokemon.getMaxHp();
|
||||
pokemon.resetStatus();
|
||||
for (let move of pokemon.moveset)
|
||||
move.ppUsed = 0;
|
||||
}
|
||||
const healSong = this.scene.sound.add('heal');
|
||||
healSong.play();
|
||||
this.scene.time.delayedCall(healSong.totalDuration * 1000, () => {
|
||||
healSong.destroy();
|
||||
if (this.resumeBgm && bgmPlaying)
|
||||
this.scene.playBgm();
|
||||
this.scene.ui.fadeIn(500).then(() => this.end());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class ShinySparklePhase extends PokemonPhase {
|
||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex) {
|
||||
super(scene, battlerIndex);
|
||||
|
@ -2669,4 +2820,10 @@ export class ShinySparklePhase extends PokemonPhase {
|
|||
this.getPokemon().sparkle();
|
||||
this.scene.time.delayedCall(1000, () => this.end());
|
||||
}
|
||||
}
|
||||
|
||||
export class TestMessagePhase extends MessagePhase {
|
||||
constructor(scene: BattleScene, message: string) {
|
||||
super(scene, message, null, true);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import Phaser from 'phaser';
|
||||
import { Biome } from './data/biome';
|
||||
import UI from './ui/ui';
|
||||
import { EncounterPhase, SummonPhase, NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, CheckLoadPhase, TurnInitPhase, ReturnPhase, ToggleDoublePositionPhase, CheckSwitchPhase, LevelCapPhase } from './battle-phases';
|
||||
import { EncounterPhase, SummonPhase, NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, CheckLoadPhase, TurnInitPhase, ReturnPhase, ToggleDoublePositionPhase, CheckSwitchPhase, LevelCapPhase, TestMessagePhase, ShowTrainerPhase, PartyHealPhase } from './battle-phases';
|
||||
import Pokemon, { PlayerPokemon, EnemyPokemon } from './pokemon';
|
||||
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies } from './data/pokemon-species';
|
||||
import * as Utils from './utils';
|
||||
|
@ -19,7 +19,7 @@ import { Moves, initMoves } from './data/move';
|
|||
import { getDefaultModifierTypeForTier, getEnemyModifierTypesForWave } from './modifier/modifier-type';
|
||||
import AbilityBar from './ui/ability-bar';
|
||||
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, applyAbAttrs, initAbilities } from './data/ability';
|
||||
import Battle, { BattleType } from './battle';
|
||||
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
|
||||
import { GameMode } from './game-mode';
|
||||
import SpritePipeline from './pipelines/sprite';
|
||||
import PartyExpBar from './ui/party-exp-bar';
|
||||
|
@ -28,6 +28,7 @@ import Trainer from './trainer';
|
|||
import TrainerData from './system/trainer-data';
|
||||
import SoundFade from 'phaser3-rex-plugins/plugins/soundfade';
|
||||
import { pokemonPrevolutions } from './data/pokemon-evolutions';
|
||||
import PokeballTray from './ui/pokeball-tray';
|
||||
|
||||
const enableAuto = true;
|
||||
const quickStart = false;
|
||||
|
@ -70,6 +71,8 @@ export default class BattleScene extends Phaser.Scene {
|
|||
private currentPhase: BattlePhase;
|
||||
public field: Phaser.GameObjects.Container;
|
||||
public fieldUI: Phaser.GameObjects.Container;
|
||||
public pbTray: PokeballTray;
|
||||
public pbTrayEnemy: PokeballTray;
|
||||
public abilityBar: AbilityBar;
|
||||
public partyExpBar: PartyExpBar;
|
||||
public arenaBg: Phaser.GameObjects.Sprite;
|
||||
|
@ -81,6 +84,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
public arena: Arena;
|
||||
public gameMode: GameMode;
|
||||
public trainer: Phaser.GameObjects.Sprite;
|
||||
public lastEnemyTrainer: Trainer;
|
||||
public currentBattle: Battle;
|
||||
public pokeballCounts: PokeballCounts;
|
||||
private party: PlayerPokemon[];
|
||||
|
@ -92,6 +96,9 @@ export default class BattleScene extends Phaser.Scene {
|
|||
public uiContainer: Phaser.GameObjects.Container;
|
||||
public ui: UI;
|
||||
|
||||
public seed: string;
|
||||
public waveSeed: string;
|
||||
|
||||
public spritePipeline: SpritePipeline;
|
||||
|
||||
private bgm: Phaser.Sound.BaseSound;
|
||||
|
@ -163,6 +170,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.loadAtlas('prompt', 'ui');
|
||||
this.loadImage('cursor', 'ui');
|
||||
this.loadImage('window', 'ui');
|
||||
this.loadImage('namebox', 'ui');
|
||||
this.loadImage('pbinfo_player', 'ui');
|
||||
this.loadImage('pbinfo_player_mini', 'ui');
|
||||
this.loadImage('pbinfo_enemy_mini', 'ui');
|
||||
|
@ -176,6 +184,10 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.loadImage('party_exp_bar', 'ui');
|
||||
this.loadImage('shiny_star', 'ui', 'shiny.png');
|
||||
|
||||
this.loadImage('pb_tray_overlay_player', 'ui');
|
||||
this.loadImage('pb_tray_overlay_enemy', 'ui');
|
||||
this.loadAtlas('pb_tray_ball', 'ui');
|
||||
|
||||
this.loadImage('party_bg', 'ui');
|
||||
this.loadImage('party_bg_double', 'ui');
|
||||
this.loadAtlas('party_slot_main', 'ui');
|
||||
|
@ -281,7 +293,6 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.loadSe('upgrade');
|
||||
this.loadSe('error');
|
||||
|
||||
this.loadSe('pb');
|
||||
this.loadSe('pb_rel');
|
||||
this.loadSe('pb_throw');
|
||||
this.loadSe('pb_bounce_1');
|
||||
|
@ -290,9 +301,15 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.loadSe('pb_catch');
|
||||
this.loadSe('pb_lock');
|
||||
|
||||
this.loadSe('pb_tray_enter');
|
||||
this.loadSe('pb_tray_ball');
|
||||
this.loadSe('pb_tray_empty');
|
||||
|
||||
this.loadBgm('menu');
|
||||
|
||||
this.loadBgm('level_up_fanfare', 'bw/level_up_fanfare.mp3');
|
||||
this.loadBgm('heal', 'bw/heal.mp3');
|
||||
this.loadBgm('victory', 'bw/victory.mp3');
|
||||
this.loadBgm('evolution', 'bw/evolution.mp3');
|
||||
this.loadBgm('evolution_fanfare', 'bw/evolution_fanfare.mp3');
|
||||
|
||||
|
@ -300,6 +317,9 @@ export default class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
|
||||
create() {
|
||||
this.seed = this.game.config.seed[0];
|
||||
console.log('Seed:', this.seed);
|
||||
|
||||
initGameSpeed.apply(this);
|
||||
|
||||
this.setupControls();
|
||||
|
@ -345,6 +365,15 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.add.existing(this.enemyModifierBar);
|
||||
uiContainer.add(this.enemyModifierBar);
|
||||
|
||||
this.pbTray = new PokeballTray(this, true);
|
||||
this.pbTray.setup();
|
||||
|
||||
this.pbTrayEnemy = new PokeballTray(this, false);
|
||||
this.pbTrayEnemy.setup();
|
||||
|
||||
this.fieldUI.add(this.pbTray);
|
||||
this.fieldUI.add(this.pbTrayEnemy);
|
||||
|
||||
this.abilityBar = new AbilityBar(this);
|
||||
this.abilityBar.setup();
|
||||
this.fieldUI.add(this.abilityBar);
|
||||
|
@ -541,38 +570,65 @@ export default class BattleScene extends Phaser.Scene {
|
|||
let newBattleType: BattleType;
|
||||
let newTrainer: Trainer;
|
||||
|
||||
if (battleType === undefined)
|
||||
newBattleType = BattleType.WILD;
|
||||
else
|
||||
newBattleType = battleType;
|
||||
let battleConfig: FixedBattleConfig = null;
|
||||
|
||||
if (newBattleType === BattleType.TRAINER) {
|
||||
newTrainer = trainerData !== undefined ? trainerData.toTrainer(this) : new Trainer(this, TrainerType.SWIMMER, !!Utils.randInt(2));
|
||||
this.field.add(newTrainer);
|
||||
this.resetSeed(newWaveIndex);
|
||||
|
||||
if (fixedBattles.hasOwnProperty(newWaveIndex)) {
|
||||
battleConfig = fixedBattles[newWaveIndex];
|
||||
newDouble = battleConfig.double;
|
||||
newBattleType = battleConfig.battleType;
|
||||
newTrainer = battleConfig.getTrainer(this);
|
||||
if (newTrainer)
|
||||
this.field.add(newTrainer);
|
||||
} else {
|
||||
if (battleType === undefined) {
|
||||
const trainerChance = this.arena.getTrainerChance();
|
||||
newBattleType = trainerChance && !Utils.randSeedInt(trainerChance) ? BattleType.TRAINER : BattleType.WILD;
|
||||
} else
|
||||
newBattleType = battleType;
|
||||
|
||||
if (newBattleType === BattleType.TRAINER) {
|
||||
newTrainer = trainerData !== undefined ? trainerData.toTrainer(this) : new Trainer(this, this.arena.randomTrainerType(newWaveIndex), !!Utils.randSeedInt(2));
|
||||
this.field.add(newTrainer);
|
||||
}
|
||||
}
|
||||
|
||||
const playerField = this.getPlayerField();
|
||||
|
||||
if (double === undefined && newWaveIndex > 1) {
|
||||
if (newBattleType === BattleType.WILD) {
|
||||
const doubleChance = new Utils.IntegerHolder(newWaveIndex % 10 === 0 ? 32 : 8);
|
||||
this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance);
|
||||
this.getPlayerField().forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, doubleChance));
|
||||
newDouble = !Utils.randInt(doubleChance.value);
|
||||
playerField.forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, doubleChance));
|
||||
newDouble = !Utils.randSeedInt(doubleChance.value);
|
||||
} else if (newBattleType === BattleType.TRAINER)
|
||||
newDouble = newTrainer.config.isDouble;
|
||||
} else
|
||||
} else if (!battleConfig)
|
||||
newDouble = !!double;
|
||||
|
||||
const lastBattle = this.currentBattle;
|
||||
|
||||
const maxExpLevel = this.getMaxExpLevel();
|
||||
|
||||
this.lastEnemyTrainer = lastBattle?.trainer ?? null;
|
||||
|
||||
this.currentBattle = new Battle(newWaveIndex, newBattleType, newTrainer, newDouble);
|
||||
this.currentBattle.incrementTurn(this);
|
||||
|
||||
//this.pushPhase(new TestMessagePhase(this, trainerConfigs[TrainerType.RIVAL].encounterMessages[0]))
|
||||
|
||||
if (!waveIndex) {
|
||||
const isNewBiome = !lastBattle || !(lastBattle.waveIndex % 10);
|
||||
const showTrainer = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
|
||||
const availablePartyMemberCount = this.getParty().filter(p => !p.isFainted()).length;
|
||||
if (lastBattle) {
|
||||
this.getEnemyField().forEach(enemyPokemon => enemyPokemon.destroy());
|
||||
if (this.gameMode === GameMode.CLASSIC && lastBattle.waveIndex % 10)
|
||||
if (showTrainer) {
|
||||
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
||||
this.unshiftPhase(new ShowTrainerPhase(this));
|
||||
}
|
||||
if (this.gameMode === GameMode.CLASSIC && !isNewBiome)
|
||||
this.pushPhase(new NextEncounterPhase(this));
|
||||
else {
|
||||
this.pushPhase(new SelectBiomePhase(this));
|
||||
|
@ -582,6 +638,11 @@ export default class BattleScene extends Phaser.Scene {
|
|||
if (newMaxExpLevel > maxExpLevel)
|
||||
this.pushPhase(new LevelCapPhase(this));
|
||||
}
|
||||
if (showTrainer) {
|
||||
this.pushPhase(new SummonPhase(this, 0));
|
||||
if (this.currentBattle.double && availablePartyMemberCount > 1)
|
||||
this.pushPhase(new SummonPhase(this, 1));
|
||||
}
|
||||
} else {
|
||||
if (!this.quickStart)
|
||||
this.pushPhase(new CheckLoadPhase(this));
|
||||
|
@ -591,8 +652,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
}
|
||||
|
||||
if ((lastBattle?.double || false) !== newDouble) {
|
||||
const availablePartyMemberCount = this.getParty().filter(p => !p.isFainted()).length;
|
||||
if (!showTrainer && (lastBattle?.double || false) !== newDouble) {
|
||||
if (newDouble) {
|
||||
if (availablePartyMemberCount > 1) {
|
||||
this.pushPhase(new ToggleDoublePositionPhase(this, true));
|
||||
|
@ -605,7 +665,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
}
|
||||
|
||||
if (lastBattle) {
|
||||
if (lastBattle && this.currentBattle.battleType !== BattleType.TRAINER) {
|
||||
this.pushPhase(new CheckSwitchPhase(this, 0, newDouble));
|
||||
if (newDouble)
|
||||
this.pushPhase(new CheckSwitchPhase(this, 1, newDouble));
|
||||
|
@ -632,6 +692,20 @@ export default class BattleScene extends Phaser.Scene {
|
|||
return this.arena;
|
||||
}
|
||||
|
||||
resetSeed(waveIndex?: integer): void {
|
||||
this.waveSeed = Utils.shiftCharCodes(this.seed, waveIndex || this.currentBattle.waveIndex);
|
||||
Phaser.Math.RND.sow([ this.waveSeed ]);
|
||||
}
|
||||
|
||||
executeWithSeedOffset(func: Function, offset: integer): void {
|
||||
if (!func)
|
||||
return;
|
||||
const state = Phaser.Math.RND.state();
|
||||
Phaser.Math.RND.sow([ Utils.shiftCharCodes(this.seed, offset) ]);
|
||||
func();
|
||||
Phaser.Math.RND.state(state);
|
||||
}
|
||||
|
||||
updateWaveCountText(): void {
|
||||
const isBoss = !(this.currentBattle.waveIndex % 10);
|
||||
this.waveCountText.setText(this.currentBattle.waveIndex.toString());
|
||||
|
@ -659,7 +733,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
s = getPokemonSpecies(pokemonPrevolutions[s.speciesId]);
|
||||
return s;
|
||||
}))] : allSpecies.slice(0, -1);
|
||||
return getPokemonSpecies(filteredSpecies[Utils.randInt(filteredSpecies.length)].getSpeciesForLevel(level, true));
|
||||
return getPokemonSpecies(filteredSpecies[Utils.randSeedInt(filteredSpecies.length)].getSpeciesForLevel(level, true));
|
||||
}
|
||||
|
||||
checkInput(): boolean {
|
||||
|
@ -721,11 +795,15 @@ export default class BattleScene extends Phaser.Scene {
|
|||
return this.buttonKeys[button].filter(k => k.isDown).length >= 1;
|
||||
}
|
||||
|
||||
isBgmPlaying(): boolean {
|
||||
return this.bgm && this.bgm.isPlaying;
|
||||
}
|
||||
|
||||
playBgm(bgmName?: string, fadeOut?: boolean): void {
|
||||
if (bgmName === undefined)
|
||||
bgmName = this.currentBattle.getBgmOverride() || this.arena.bgm;
|
||||
if (this.bgm && bgmName === this.bgm.key) {
|
||||
if (!this.bgm.isPlaying || this.bgm.pendingRemove) {
|
||||
if (!this.bgm.isPlaying) {
|
||||
this.bgm.play({
|
||||
volume: 1
|
||||
});
|
||||
|
@ -771,7 +849,7 @@ export default class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
|
||||
pauseBgm(): void {
|
||||
if (this.bgm)
|
||||
if (this.bgm && this.bgm.isPlaying)
|
||||
this.bgm.pause();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as Utils from "./utils";
|
|||
import Trainer from "./trainer";
|
||||
import { Species } from "./data/species";
|
||||
import { Moves } from "./data/move";
|
||||
import { TrainerType } from "./data/trainer-type";
|
||||
import { TrainerConfig, TrainerType } from "./data/trainer-type";
|
||||
|
||||
export enum BattleType {
|
||||
WILD,
|
||||
|
@ -38,6 +38,7 @@ export default class Battle {
|
|||
public enemyLevels: integer[];
|
||||
public enemyParty: EnemyPokemon[];
|
||||
public double: boolean;
|
||||
public started: boolean;
|
||||
public turn: integer;
|
||||
public turnCommands: TurnCommands;
|
||||
public turnPokeballCounts: PokeballCounts;
|
||||
|
@ -49,10 +50,13 @@ export default class Battle {
|
|||
this.waveIndex = waveIndex;
|
||||
this.battleType = battleType;
|
||||
this.trainer = trainer;
|
||||
this.enemyLevels = new Array(battleType !== BattleType.TRAINER ? double ? 2 : 1 : trainer.config.genPartySize()).fill(null).map(() => this.getLevelForWave());
|
||||
this.enemyLevels = battleType !== BattleType.TRAINER
|
||||
? new Array(double ? 2 : 1).fill(null).map(() => this.getLevelForWave())
|
||||
: trainer.getPartyLevels(this.waveIndex);
|
||||
this.enemyParty = [];
|
||||
this.double = double;
|
||||
this.turn = 0;
|
||||
this.started = false;
|
||||
}
|
||||
|
||||
private getLevelForWave(): integer {
|
||||
|
@ -89,23 +93,85 @@ export default class Battle {
|
|||
|
||||
getBgmOverride(): string {
|
||||
const battlers = this.enemyParty.slice(0, this.getBattlerCount());
|
||||
if (this.battleType === BattleType.TRAINER) {
|
||||
if (!this.started && this.trainer.config.encounterMessages.length)
|
||||
return `encounter_${this.trainer.getEncounterBgm()}`;
|
||||
return this.trainer.getBattleBgm();
|
||||
}
|
||||
for (let pokemon of battlers) {
|
||||
if (this.battleType === BattleType.TRAINER) {
|
||||
if (this.trainer.config.trainerType === TrainerType.RIVAL)
|
||||
return 'battle_rival';
|
||||
return 'battle_trainer';
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ETERNATUS)
|
||||
return 'battle_final';
|
||||
if (pokemon.species.legendary) {
|
||||
if (pokemon.species.speciesId === Species.RESHIRAM || pokemon.species.speciesId === Species.ZEKROM)
|
||||
return 'battle_legendary_rz';
|
||||
if (pokemon.species.legendary || pokemon.species.pseudoLegendary || pokemon.species.mythical) {
|
||||
if (pokemon.species.speciesId === Species.KYUREM)
|
||||
return 'battle_legendary_z';
|
||||
if (pokemon.species.legendary)
|
||||
return 'battle_legendary_rz';
|
||||
return 'battle_legendary';
|
||||
}
|
||||
}
|
||||
|
||||
if (this.waveIndex <= 3)
|
||||
return 'battle_wild';
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class FixedBattle extends Battle {
|
||||
constructor(scene: BattleScene, waveIndex: integer, config: FixedBattleConfig) {
|
||||
super(waveIndex, config.battleType, config.battleType === BattleType.TRAINER ? config.getTrainer(scene) : null, config.double);
|
||||
if (config.getEnemyParty)
|
||||
this.enemyParty = config.getEnemyParty(scene);
|
||||
}
|
||||
}
|
||||
|
||||
type GetTrainerFunc = (scene: BattleScene) => Trainer;
|
||||
type GetEnemyPartyFunc = (scene: BattleScene) => EnemyPokemon[];
|
||||
|
||||
export class FixedBattleConfig {
|
||||
public battleType: BattleType;
|
||||
public double: boolean;
|
||||
public getTrainer: GetTrainerFunc;
|
||||
public getEnemyParty: GetEnemyPartyFunc;
|
||||
|
||||
setBattleType(battleType: BattleType): FixedBattleConfig {
|
||||
this.battleType = battleType;
|
||||
return this;
|
||||
}
|
||||
|
||||
setDouble(double: boolean): FixedBattleConfig {
|
||||
this.double = double;
|
||||
return this;
|
||||
}
|
||||
|
||||
setGetTrainerFunc(getTrainerFunc: GetTrainerFunc): FixedBattleConfig {
|
||||
this.getTrainer = getTrainerFunc;
|
||||
return this;
|
||||
}
|
||||
|
||||
setGetEnemyPartyFunc(getEnemyPartyFunc: GetEnemyPartyFunc): FixedBattleConfig {
|
||||
this.getEnemyParty = getEnemyPartyFunc;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
interface FixedBattleConfigs {
|
||||
[key: integer]: FixedBattleConfig
|
||||
}
|
||||
|
||||
export const fixedBattles: FixedBattleConfigs = {
|
||||
[4]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.YOUNGSTER, !!Utils.randInt(2))),
|
||||
[5]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL, true)),
|
||||
[25]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_2, true)),
|
||||
[55]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_3, true)),
|
||||
[95]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_4, true)),
|
||||
[145]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_5, true)),
|
||||
[199]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
|
||||
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_6, true))
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
import Pokemon, { HitResult, MoveResult, PokemonMove } from "../pokemon";
|
||||
import Pokemon, { HitResult, PokemonMove } from "../pokemon";
|
||||
import { Type } from "./type";
|
||||
import * as Utils from "../utils";
|
||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
||||
import { DamagePhase, PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../battle-phases";
|
||||
import { getPokemonMessage } from "../messages";
|
||||
import { Weather, WeatherType } from "./weather";
|
||||
import { BattlerTag, BattlerTagType, TrappedTag } from "./battler-tag";
|
||||
import { BattlerTag, BattlerTagType } from "./battler-tag";
|
||||
import { StatusEffect, getStatusEffectDescriptor } from "./status-effect";
|
||||
import { MoveFlags, Moves, RecoilAttr, allMoves } from "./move";
|
||||
import { MoveFlags, Moves, RecoilAttr } from "./move";
|
||||
import { ArenaTagType } from "./arena-tag";
|
||||
|
||||
export class Ability {
|
||||
|
@ -20,7 +20,7 @@ export class Ability {
|
|||
|
||||
constructor(id: Abilities, name: string, description: string, generation: integer) {
|
||||
this.id = id;
|
||||
this.name = name.toUpperCase();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.generation = generation;
|
||||
this.attrs = [];
|
||||
|
@ -265,7 +265,7 @@ export class PostDefendTypeChangeAbAttr extends PostDefendAbAttr {
|
|||
}
|
||||
|
||||
getTriggerMessage(pokemon: Pokemon, ...args: any[]): string {
|
||||
return getPokemonMessage(pokemon, `'s ${pokemon.getAbility().name}\nmade it the ${Type[pokemon.getTypes()[0]]} type!`);
|
||||
return getPokemonMessage(pokemon, `'s ${pokemon.getAbility().name}\nmade it the ${Utils.toReadableString(Type[pokemon.getTypes()[0]])} type!`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1196,142 +1196,142 @@ export function initAbilities() {
|
|||
.attr(SuppressWeatherEffectAbAttr, true),
|
||||
new Ability(Abilities.ARENA_TRAP, "Arena Trap", "Prevents the foe from fleeing.", 3)
|
||||
.attr(ArenaTrapAbAttr),
|
||||
new Ability(Abilities.BATTLE_ARMOR, "Battle Armor", "The POKéMON is protected against critical hits.", 3)
|
||||
new Ability(Abilities.BATTLE_ARMOR, "Battle Armor", "The Pokémon is protected against critical hits.", 3)
|
||||
.attr(BlockCritAbAttr),
|
||||
new Ability(Abilities.BLAZE, "Blaze", "Powers up FIRE-type moves in a pinch.", 3)
|
||||
new Ability(Abilities.BLAZE, "Blaze", "Powers up Fire-type moves in a pinch.", 3)
|
||||
.attr(LowHpMoveTypePowerBoostAbAttr, Type.FIRE),
|
||||
new Ability(Abilities.CHLOROPHYLL, "Chlorophyll", "Boosts the POKéMON's SPEED in sunshine.", 3)
|
||||
new Ability(Abilities.CHLOROPHYLL, "Chlorophyll", "Boosts the Pokémon's Speed in sunshine.", 3)
|
||||
.attr(BattleStatMultiplierAbAttr, BattleStat.SPD, 2)
|
||||
.condition(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN)), // TODO: Show ability bar on weather change and summon
|
||||
new Ability(Abilities.CLEAR_BODY, "Clear Body", "Prevents other POKéMON from lowering its stats.", 3)
|
||||
new Ability(Abilities.CLEAR_BODY, "Clear Body", "Prevents other Pokémon from lowering its stats.", 3)
|
||||
.attr(ProtectStatAbAttr),
|
||||
new Ability(Abilities.CLOUD_NINE, "Cloud Nine", "Eliminates the effects of non-severe weather.", 3)
|
||||
.attr(SuppressWeatherEffectAbAttr),
|
||||
new Ability(Abilities.COLOR_CHANGE, "Color Change", "Changes the POKéMON's type to the foe's move.", 3)
|
||||
new Ability(Abilities.COLOR_CHANGE, "Color Change", "Changes the Pokémon's type to the foe's move.", 3)
|
||||
.attr(PostDefendTypeChangeAbAttr),
|
||||
new Ability(Abilities.COMPOUND_EYES, "Compound Eyes", "The POKéMON's accuracy is boosted.", 3)
|
||||
new Ability(Abilities.COMPOUND_EYES, "Compound Eyes", "The Pokémon's Accuracy is boosted.", 3)
|
||||
.attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 1.3),
|
||||
new Ability(Abilities.CUTE_CHARM, "Cute Charm", "Contact with the POKéMON may cause infatuation.", 3)
|
||||
new Ability(Abilities.CUTE_CHARM, "Cute Charm", "Contact with the Pokémon may cause infatuation.", 3)
|
||||
.attr(PostDefendContactApplyTagChanceAbAttr, 30, BattlerTagType.INFATUATED),
|
||||
new Ability(Abilities.DAMP, "Damp (N)", "Prevents the use of self-destructing moves.", 3),
|
||||
new Ability(Abilities.DRIZZLE, "Drizzle", "The POKéMON makes it rain when it enters a battle.", 3)
|
||||
new Ability(Abilities.DRIZZLE, "Drizzle", "The Pokémon makes it rain when it enters a battle.", 3)
|
||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.RAIN),
|
||||
new Ability(Abilities.DROUGHT, "Drought", "Turns the sunlight harsh when the POKéMON enters a battle.", 3)
|
||||
new Ability(Abilities.DROUGHT, "Drought", "Turns the sunlight harsh when the Pokémon enters a battle.", 3)
|
||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.SUNNY),
|
||||
new Ability(Abilities.EARLY_BIRD, "Early Bird (N)", "The POKéMON awakens quickly from sleep.", 3),
|
||||
new Ability(Abilities.EARLY_BIRD, "Early Bird (N)", "The Pokémon awakens quickly from sleep.", 3),
|
||||
new Ability(Abilities.EFFECT_SPORE, "Effect Spore", "Contact may poison or cause paralysis or sleep.", 3)
|
||||
.attr(PostDefendContactApplyStatusEffectAbAttr, 10, StatusEffect.POISON, StatusEffect.PARALYSIS, StatusEffect.SLEEP),
|
||||
new Ability(Abilities.FLAME_BODY, "Flame Body", "Contact with the POKéMON may burn the attacker.", 3)
|
||||
new Ability(Abilities.FLAME_BODY, "Flame Body", "Contact with the Pokémon may burn the attacker.", 3)
|
||||
.attr(PostDefendContactApplyStatusEffectAbAttr, 30, StatusEffect.BURN),
|
||||
new Ability(Abilities.FLASH_FIRE, "Flash Fire", "It powers up FIRE-type moves if it's hit by one.", 3)
|
||||
new Ability(Abilities.FLASH_FIRE, "Flash Fire", "It powers up Fire-type moves if it's hit by one.", 3)
|
||||
.attr(TypeImmunityAddBattlerTagAbAttr, Type.FIRE, BattlerTagType.FIRE_BOOST, 1, (pokemon: Pokemon) => !pokemon.status || pokemon.status.effect !== StatusEffect.FREEZE),
|
||||
new Ability(Abilities.FORECAST, "Forecast (N)", "Castform transforms with the weather.", 3),
|
||||
new Ability(Abilities.GUTS, "Guts (N)", "Boosts ATTACK if there is a status problem.", 3),
|
||||
new Ability(Abilities.HUGE_POWER, "Huge Power", "Raises the POKéMON's ATTACK stat.", 3)
|
||||
new Ability(Abilities.GUTS, "Guts (N)", "Boosts Attack if there is a status problem.", 3),
|
||||
new Ability(Abilities.HUGE_POWER, "Huge Power", "Raises the Pokémon's Attack stat.", 3)
|
||||
.attr(PostSummonStatChangeAbAttr, BattleStat.ATK, 1, true),
|
||||
new Ability(Abilities.HUSTLE, "Hustle (N)", "Boosts the ATTACK stat, but lowers accuracy.", 3),
|
||||
new Ability(Abilities.HYPER_CUTTER, "Hyper Cutter", "Prevents other POKéMON from lowering ATTACK stat.", 3)
|
||||
new Ability(Abilities.HUSTLE, "Hustle (N)", "Boosts the Attack stat, but lowers Accuracy.", 3),
|
||||
new Ability(Abilities.HYPER_CUTTER, "Hyper Cutter", "Prevents other Pokémon from lowering Attack stat.", 3)
|
||||
.attr(ProtectStatAbAttr, BattleStat.ATK),
|
||||
new Ability(Abilities.ILLUMINATE, "Illuminate", "Raises the likelihood of an encounter being a double battle.", 3)
|
||||
.attr(DoubleBattleChanceAbAttr),
|
||||
new Ability(Abilities.IMMUNITY, "Immunity", "Prevents the POKéMON from getting poisoned.", 3)
|
||||
new Ability(Abilities.IMMUNITY, "Immunity", "Prevents the Pokémon from getting poisoned.", 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.POISON),
|
||||
new Ability(Abilities.INNER_FOCUS, "Inner Focus", "The POKéMON is protected from flinching.", 3)
|
||||
new Ability(Abilities.INNER_FOCUS, "Inner Focus", "The Pokémon is protected from flinching.", 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.FLINCHED),
|
||||
new Ability(Abilities.INSOMNIA, "Insomnia", "Prevents the POKéMON from falling asleep.", 3)
|
||||
new Ability(Abilities.INSOMNIA, "Insomnia", "Prevents the Pokémon from falling asleep.", 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY),
|
||||
new Ability(Abilities.INTIMIDATE, "Intimidate", "Lowers the foe's ATTACK stat.", 3)
|
||||
new Ability(Abilities.INTIMIDATE, "Intimidate", "Lowers the foe's Attack stat.", 3)
|
||||
.attr(PostSummonStatChangeAbAttr, BattleStat.ATK, -1),
|
||||
new Ability(Abilities.KEEN_EYE, "Keen Eye", "Prevents other POKéMON from lowering accuracy.", 3)
|
||||
new Ability(Abilities.KEEN_EYE, "Keen Eye", "Prevents other Pokémon from lowering Accuracy.", 3)
|
||||
.attr(ProtectStatAbAttr, BattleStat.ACC),
|
||||
new Ability(Abilities.LEVITATE, "Levitate", "Gives immunity to GROUND-type moves.", 3)
|
||||
new Ability(Abilities.LEVITATE, "Levitate", "Gives immunity to Ground-type moves.", 3)
|
||||
.attr(TypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(BattlerTagType.IGNORE_FLYING) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY)),
|
||||
new Ability(Abilities.LIGHTNING_ROD, "Lightning Rod", "Draws in all ELECTRIC-type moves to up SP. ATK.", 3)
|
||||
new Ability(Abilities.LIGHTNING_ROD, "Lightning Rod", "Draws in all Electric-type moves to up Sp. Atk.", 3)
|
||||
.attr(TypeImmunityStatChangeAbAttr, Type.ELECTRIC, BattleStat.SPATK, 1),
|
||||
new Ability(Abilities.LIMBER, "Limber", "The POKéMON is protected from paralysis.", 3)
|
||||
new Ability(Abilities.LIMBER, "Limber", "The Pokémon is protected from paralysis.", 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.PARALYSIS),
|
||||
new Ability(Abilities.LIQUID_OOZE, "Liquid Ooze (N)", "Damages attackers using any draining move.", 3),
|
||||
new Ability(Abilities.MAGMA_ARMOR, "Magma Armor", "Prevents the POKéMON from becoming frozen.", 3)
|
||||
new Ability(Abilities.MAGMA_ARMOR, "Magma Armor", "Prevents the Pokémon from becoming frozen.", 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.FREEZE),
|
||||
new Ability(Abilities.MAGNET_PULL, "Magnet Pull", "Prevents STEEL-type POKéMON from escaping.", 3)
|
||||
new Ability(Abilities.MAGNET_PULL, "Magnet Pull", "Prevents Steel-type Pokémon from escaping.", 3)
|
||||
/*.attr(ArenaTrapAbAttr)
|
||||
.condition((pokemon: Pokemon) => pokemon.getOpponent()?.isOfType(Type.STEEL))*/, // TODO: Rework
|
||||
new Ability(Abilities.MARVEL_SCALE, "Marvel Scale (N)", "Ups DEFENSE if there is a status problem.", 3),
|
||||
new Ability(Abilities.MINUS, "Minus (N)", "Ups SP. ATK if another POKéMON has PLUS or MINUS.", 3),
|
||||
new Ability(Abilities.MARVEL_SCALE, "Marvel Scale (N)", "Ups Defense if there is a status problem.", 3),
|
||||
new Ability(Abilities.MINUS, "Minus (N)", "Ups Sp. Atk if another Pokémon has Plus or Minus.", 3),
|
||||
new Ability(Abilities.NATURAL_CURE, "Natural Cure (N)", "All status problems heal when it switches out.", 3),
|
||||
new Ability(Abilities.OBLIVIOUS, "Oblivious", "Prevents it from becoming infatuated.", 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.INFATUATED),
|
||||
new Ability(Abilities.OVERGROW, "Overgrow", "Powers up GRASS-type moves in a pinch.", 3)
|
||||
new Ability(Abilities.OVERGROW, "Overgrow", "Powers up Grass-type moves in a pinch.", 3)
|
||||
.attr(LowHpMoveTypePowerBoostAbAttr, Type.GRASS),
|
||||
new Ability(Abilities.OWN_TEMPO, "Own Tempo", "Prevents the POKéMON from becoming confused.", 3)
|
||||
new Ability(Abilities.OWN_TEMPO, "Own Tempo", "Prevents the Pokémon from becoming confused.", 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.CONFUSED),
|
||||
new Ability(Abilities.PICKUP, "Pickup (N)", "The POKéMON may pick up items.", 3),
|
||||
new Ability(Abilities.PLUS, "Plus (N)", "Ups SP. ATK if another POKéMON has PLUS or MINUS.", 3),
|
||||
new Ability(Abilities.POISON_POINT, "Poison Point", "Contact with the POKéMON may poison the attacker.", 3)
|
||||
new Ability(Abilities.PICKUP, "Pickup (N)", "The Pokémon may pick up items.", 3),
|
||||
new Ability(Abilities.PLUS, "Plus (N)", "Ups Sp. Atk if another Pokémon has PLUS or MINUS.", 3),
|
||||
new Ability(Abilities.POISON_POINT, "Poison Point", "Contact with the Pokémon may poison the attacker.", 3)
|
||||
.attr(PostDefendContactApplyStatusEffectAbAttr, StatusEffect.POISON),
|
||||
new Ability(Abilities.PRESSURE, "Pressure (N)", "The POKéMON raises the foe's PP usage.", 3),
|
||||
new Ability(Abilities.PURE_POWER, "Pure Power", "Raises the POKéMON's ATTACK stat.", 3)
|
||||
new Ability(Abilities.PRESSURE, "Pressure (N)", "The Pokémon raises the foe's PP usage.", 3),
|
||||
new Ability(Abilities.PURE_POWER, "Pure Power", "Raises the Pokémon's Attack stat.", 3)
|
||||
.attr(PostSummonStatChangeAbAttr, BattleStat.ATK, 1, true),
|
||||
new Ability(Abilities.RAIN_DISH, "Rain Dish", "The POKéMON gradually regains HP in rain.", 3)
|
||||
new Ability(Abilities.RAIN_DISH, "Rain Dish", "The Pokémon gradually regains HP in rain.", 3)
|
||||
.attr(PostWeatherLapseHealAbAttr, 1, WeatherType.RAIN, WeatherType.HEAVY_RAIN),
|
||||
new Ability(Abilities.ROCK_HEAD, "Rock Head", "Protects the POKéMON from recoil damage.", 3)
|
||||
new Ability(Abilities.ROCK_HEAD, "Rock Head", "Protects the Pokémon from recoil damage.", 3)
|
||||
.attr(BlockRecoilDamageAttr),
|
||||
new Ability(Abilities.ROUGH_SKIN, "Rough Skin (N)", "Inflicts damage to the attacker on contact.", 3),
|
||||
new Ability(Abilities.RUN_AWAY, "Run Away (N)", "Enables a sure getaway from wild POKéMON.", 3),
|
||||
new Ability(Abilities.SAND_STREAM, "Sand Stream", "The POKéMON summons a sandstorm in battle.", 3)
|
||||
new Ability(Abilities.RUN_AWAY, "Run Away (N)", "Enables a sure getaway from wild Pokémon.", 3),
|
||||
new Ability(Abilities.SAND_STREAM, "Sand Stream", "The Pokémon summons a sandstorm in battle.", 3)
|
||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.SANDSTORM),
|
||||
new Ability(Abilities.SAND_VEIL, "Sand Veil", "Boosts the POKéMON's evasion in a sandstorm.", 3)
|
||||
new Ability(Abilities.SAND_VEIL, "Sand Veil", "Boosts the Pokémon's Evasiveness in a sandstorm.", 3)
|
||||
.attr(BattleStatMultiplierAbAttr, BattleStat.EVA, 1.2)
|
||||
.attr(BlockWeatherDamageAttr, WeatherType.SANDSTORM)
|
||||
.condition(getWeatherCondition(WeatherType.SANDSTORM)),
|
||||
new Ability(Abilities.SERENE_GRACE, "Serene Grace (N)", "Boosts the likelihood of added effects appearing.", 3),
|
||||
new Ability(Abilities.SHADOW_TAG, "Shadow Tag", "Prevents the foe from escaping.", 3)
|
||||
.attr(ArenaTrapAbAttr),
|
||||
new Ability(Abilities.SHED_SKIN, "Shed Skin (N)", "The POKéMON may heal its own status problems.", 3),
|
||||
new Ability(Abilities.SHELL_ARMOR, "Shell Armor", "The POKéMON is protected against critical hits.", 3)
|
||||
new Ability(Abilities.SHED_SKIN, "Shed Skin (N)", "The Pokémon may heal its own status problems.", 3),
|
||||
new Ability(Abilities.SHELL_ARMOR, "Shell Armor", "The Pokémon is protected against critical hits.", 3)
|
||||
.attr(BlockCritAbAttr),
|
||||
new Ability(Abilities.SHIELD_DUST, "Shield Dust (N)", "Blocks the added effects of attacks taken.", 3),
|
||||
new Ability(Abilities.SOUNDPROOF, "Soundproof (N)", "Gives immunity to sound-based moves.", 3),
|
||||
new Ability(Abilities.SPEED_BOOST, "Speed Boost", "Its SPEED stat is gradually boosted.", 3)
|
||||
new Ability(Abilities.SPEED_BOOST, "Speed Boost", "Its Speed stat is gradually boosted.", 3)
|
||||
.attr(PostTurnSpeedBoostAbAttr),
|
||||
new Ability(Abilities.STATIC, "Static", "Contact with the POKéMON may cause paralysis.", 3)
|
||||
new Ability(Abilities.STATIC, "Static", "Contact with the Pokémon may cause paralysis.", 3)
|
||||
.attr(PostDefendContactApplyStatusEffectAbAttr, StatusEffect.PARALYSIS),
|
||||
new Ability(Abilities.STENCH, "Stench (N)", "The stench may cause the target to flinch.", 3),
|
||||
new Ability(Abilities.STICKY_HOLD, "Sticky Hold", "Protects the POKéMON from item theft.", 3)
|
||||
new Ability(Abilities.STICKY_HOLD, "Sticky Hold", "Protects the Pokémon from item theft.", 3)
|
||||
.attr(BlockItemTheftAbAttr),
|
||||
new Ability(Abilities.STURDY, "Sturdy (N)", "It cannot be knocked out with one hit.", 3),
|
||||
new Ability(Abilities.SUCTION_CUPS, "Suction Cups (N)", "Negates all moves that force switching out.", 3),
|
||||
new Ability(Abilities.SWARM, "Swarm", "Powers up BUG-type moves in a pinch.", 3)
|
||||
new Ability(Abilities.SWARM, "Swarm", "Powers up Bug-type moves in a pinch.", 3)
|
||||
.attr(LowHpMoveTypePowerBoostAbAttr, Type.BUG),
|
||||
new Ability(Abilities.SWIFT_SWIM, "Swift Swim", "Boosts the POKéMON's SPEED in rain.", 3)
|
||||
new Ability(Abilities.SWIFT_SWIM, "Swift Swim", "Boosts the Pokémon's Speed in rain.", 3)
|
||||
.attr(BattleStatMultiplierAbAttr, BattleStat.SPD, 2)
|
||||
.condition(getWeatherCondition(WeatherType.RAIN, WeatherType.HEAVY_RAIN)), // TODO: Show ability bar on weather change and summon
|
||||
new Ability(Abilities.SYNCHRONIZE, "Synchronize (N)", "Passes a burn, poison, or paralysis to the foe.", 3),
|
||||
new Ability(Abilities.THICK_FAT, "Thick Fat", "Ups resistance to Fire- and ICE-type moves.", 3)
|
||||
new Ability(Abilities.THICK_FAT, "Thick Fat", "Ups resistance to Fire-type and Ice-type moves.", 3)
|
||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 0.5)
|
||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.ICE, 0.5),
|
||||
new Ability(Abilities.TORRENT, "Torrent", "Powers up WATER-type moves in a pinch.", 3)
|
||||
new Ability(Abilities.TORRENT, "Torrent", "Powers up Water-type moves in a pinch.", 3)
|
||||
.attr(LowHpMoveTypePowerBoostAbAttr, Type.WATER),
|
||||
new Ability(Abilities.TRACE, "Trace (N)", "The POKéMON copies a foe's Ability.", 3),
|
||||
new Ability(Abilities.TRUANT, "Truant", "POKéMON can't attack on consecutive turns.", 3)
|
||||
new Ability(Abilities.TRACE, "Trace (N)", "The Pokémon copies a foe's Ability.", 3),
|
||||
new Ability(Abilities.TRUANT, "Truant", "Pokémon can't attack on consecutive turns.", 3)
|
||||
.attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1),
|
||||
new Ability(Abilities.VITAL_SPIRIT, "Vital Spirit", "Prevents the POKéMON from falling asleep.", 3)
|
||||
new Ability(Abilities.VITAL_SPIRIT, "Vital Spirit", "Prevents the Pokémon from falling asleep.", 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY),
|
||||
new Ability(Abilities.VOLT_ABSORB, "Volt Absorb", "Restores HP if hit by an ELECTRIC-type move.", 3)
|
||||
new Ability(Abilities.VOLT_ABSORB, "Volt Absorb", "Restores HP if hit by an Electric-type move.", 3)
|
||||
.attr(TypeImmunityHealAbAttr, Type.ELECTRIC),
|
||||
new Ability(Abilities.WATER_ABSORB, "Water Absorb", "Restores HP if hit by a WATER-type move.", 3)
|
||||
new Ability(Abilities.WATER_ABSORB, "Water Absorb", "Restores HP if hit by a Water-type move.", 3)
|
||||
.attr(TypeImmunityHealAbAttr, Type.WATER),
|
||||
new Ability(Abilities.WATER_VEIL, "Water Veil", "Prevents the POKéMON from getting a burn.", 3)
|
||||
new Ability(Abilities.WATER_VEIL, "Water Veil", "Prevents the Pokémon from getting a burn.", 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.BURN),
|
||||
new Ability(Abilities.WHITE_SMOKE, "White Smoke", "Prevents other POKéMON from lowering its stats.", 3)
|
||||
new Ability(Abilities.WHITE_SMOKE, "White Smoke", "Prevents other Pokémon from lowering its stats.", 3)
|
||||
.attr(ProtectStatAbAttr),
|
||||
new Ability(Abilities.WONDER_GUARD, "Wonder Guard", "Only super effective moves will hit.", 3)
|
||||
.attr(NonSuperEffectiveImmunityAbAttr),
|
||||
new Ability(Abilities.ADAPTABILITY, "Adaptability (N)", "Powers up moves of the same type.", 4),
|
||||
new Ability(Abilities.AFTERMATH, "Aftermath (N)", "Damages the attacker landing the finishing hit.", 4),
|
||||
new Ability(Abilities.ANGER_POINT, "Anger Point (N)", "Maxes ATTACK after taking a critical hit.", 4),
|
||||
new Ability(Abilities.ANGER_POINT, "Anger Point (N)", "Maxes Attack after taking a critical hit.", 4),
|
||||
new Ability(Abilities.ANTICIPATION, "Anticipation (N)", "Senses a foe's dangerous moves.", 4),
|
||||
new Ability(Abilities.BAD_DREAMS, "Bad Dreams (N)", "Reduces a sleeping foe's HP.", 4),
|
||||
new Ability(Abilities.DOWNLOAD, "Download (N)", "Adjusts power according to a foe's defenses.", 4),
|
||||
|
@ -1341,105 +1341,105 @@ export function initAbilities() {
|
|||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 1.25)
|
||||
.attr(TypeImmunityHealAbAttr, Type.WATER),
|
||||
new Ability(Abilities.FILTER, "Filter (N)", "Reduces damage from super-effective attacks.", 4),
|
||||
new Ability(Abilities.FLOWER_GIFT, "Flower Gift (N)", "Powers up party POKéMON when it is sunny.", 4),
|
||||
new Ability(Abilities.FLOWER_GIFT, "Flower Gift (N)", "Powers up party Pokémon when it is sunny.", 4),
|
||||
new Ability(Abilities.FOREWARN, "Forewarn (N)", "Determines what moves a foe has.", 4),
|
||||
new Ability(Abilities.FRISK, "Frisk (N)", "The POKéMON can check a foe's held item.", 4),
|
||||
new Ability(Abilities.FRISK, "Frisk (N)", "The Pokémon can check a foe's held item.", 4),
|
||||
new Ability(Abilities.GLUTTONY, "Gluttony (N)", "Encourages the early use of a held Berry.", 4),
|
||||
new Ability(Abilities.HEATPROOF, "Heatproof", "Weakens the power of FIRE-type moves.", 4)
|
||||
new Ability(Abilities.HEATPROOF, "Heatproof", "Weakens the power of Fire-type moves.", 4)
|
||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 0.5),
|
||||
new Ability(Abilities.HONEY_GATHER, "Honey Gather (N)", "The POKéMON may gather Honey from somewhere.", 4),
|
||||
new Ability(Abilities.HONEY_GATHER, "Honey Gather (N)", "The Pokémon may gather Honey from somewhere.", 4),
|
||||
new Ability(Abilities.HYDRATION, "Hydration (N)", "Heals status problems if it is raining.", 4),
|
||||
new Ability(Abilities.ICE_BODY, "Ice Body", "The POKéMON gradually regains HP in a hailstorm.", 4)
|
||||
new Ability(Abilities.ICE_BODY, "Ice Body", "The Pokémon gradually regains HP in a hailstorm.", 4)
|
||||
.attr(PostWeatherLapseHealAbAttr, 1, WeatherType.HAIL),
|
||||
new Ability(Abilities.IRON_FIST, "Iron Fist (N)", "Boosts the power of punching moves.", 4),
|
||||
new Ability(Abilities.KLUTZ, "Klutz (N)", "The POKéMON can't use any held items.", 4),
|
||||
new Ability(Abilities.KLUTZ, "Klutz (N)", "The Pokémon can't use any held items.", 4),
|
||||
new Ability(Abilities.LEAF_GUARD, "Leaf Guard", "Prevents problems with status in sunny weather.", 4)
|
||||
.attr(StatusEffectImmunityAbAttr)
|
||||
.condition(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN)),
|
||||
new Ability(Abilities.MAGIC_GUARD, "Magic Guard (N)", "Protects the POKéMON from indirect damage.", 4),
|
||||
new Ability(Abilities.MAGIC_GUARD, "Magic Guard (N)", "Protects the Pokémon from indirect damage.", 4),
|
||||
new Ability(Abilities.MOLD_BREAKER, "Mold Breaker (N)", "Moves can be used regardless of Abilities.", 4),
|
||||
new Ability(Abilities.MOTOR_DRIVE, "Motor Drive", "Raises SPEED if hit by an ELECTRIC-type move.", 4)
|
||||
new Ability(Abilities.MOTOR_DRIVE, "Motor Drive", "Raises Speed if hit by an Electric-type move.", 4)
|
||||
.attr(TypeImmunityStatChangeAbAttr, Type.ELECTRIC, BattleStat.SPD, 1),
|
||||
new Ability(Abilities.MULTITYPE, "Multitype (N)", "Changes type to match the held Plate.", 4),
|
||||
new Ability(Abilities.NO_GUARD, "No Guard (N)", "Ensures attacks by or against the POKéMON land.", 4),
|
||||
new Ability(Abilities.NORMALIZE, "Normalize (N)", "All the POKéMON's moves become the NORMAL type.", 4),
|
||||
new Ability(Abilities.POISON_HEAL, "Poison Heal (N)", "Restores HP if the POKéMON is poisoned.", 4),
|
||||
new Ability(Abilities.QUICK_FEET, "Quick Feet (N)", "Boosts SPEED if there is a status problem.", 4),
|
||||
new Ability(Abilities.NO_GUARD, "No Guard (N)", "Ensures attacks by or against the Pokémon land.", 4),
|
||||
new Ability(Abilities.NORMALIZE, "Normalize (N)", "All the Pokémon's moves become Normal-type.", 4),
|
||||
new Ability(Abilities.POISON_HEAL, "Poison Heal (N)", "Restores HP if the Pokémon is poisoned.", 4),
|
||||
new Ability(Abilities.QUICK_FEET, "Quick Feet (N)", "Boosts Speed if there is a status problem.", 4),
|
||||
new Ability(Abilities.RECKLESS, "Reckless", "Powers up moves that have recoil damage.", 4)
|
||||
.attr(RecoilMovePowerBoostAbAttr),
|
||||
new Ability(Abilities.RIVALRY, "Rivalry (N)", "Deals more damage to a POKéMON of same gender.", 4),
|
||||
new Ability(Abilities.SCRAPPY, "Scrappy (N)", "Enables moves to hit GHOST-type POKéMON.", 4),
|
||||
new Ability(Abilities.RIVALRY, "Rivalry (N)", "Deals more damage to a Pokémon of same gender.", 4),
|
||||
new Ability(Abilities.SCRAPPY, "Scrappy (N)", "Enables moves to hit Ghost-type Pokémon.", 4),
|
||||
new Ability(Abilities.SIMPLE, "Simple (N)", "Doubles all stat changes.", 4),
|
||||
new Ability(Abilities.SKILL_LINK, "Skill Link (N)", "Increases the frequency of multi-strike moves.", 4),
|
||||
new Ability(Abilities.SLOW_START, "Slow Start (N)", "Temporarily halves ATTACK and SPEED.", 4),
|
||||
new Ability(Abilities.SLOW_START, "Slow Start (N)", "Temporarily halves Attack and Speed.", 4),
|
||||
new Ability(Abilities.SNIPER, "Sniper (N)", "Powers up moves if they become critical hits.", 4),
|
||||
new Ability(Abilities.SNOW_CLOAK, "Snow Cloak", "Raises evasion in a hailstorm.", 4)
|
||||
new Ability(Abilities.SNOW_CLOAK, "Snow Cloak", "Raises Evasiveness in a hailstorm.", 4)
|
||||
.attr(BattleStatMultiplierAbAttr, BattleStat.EVA, 1.2)
|
||||
.attr(BlockWeatherDamageAttr, WeatherType.HAIL),
|
||||
new Ability(Abilities.SNOW_WARNING, "Snow Warning", "The POKéMON summons a hailstorm in battle.", 4)
|
||||
new Ability(Abilities.SNOW_WARNING, "Snow Warning", "The Pokémon summons a hailstorm in battle.", 4)
|
||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HAIL),
|
||||
new Ability(Abilities.SOLAR_POWER, "Solar Power (N)", "In sunshine, SP. ATK is boosted but HP decreases.", 4),
|
||||
new Ability(Abilities.SOLAR_POWER, "Solar Power (N)", "In sunshine, Sp. Atk is boosted but HP decreases.", 4),
|
||||
new Ability(Abilities.SOLID_ROCK, "Solid Rock (N)", "Reduces damage from super-effective attacks.", 4),
|
||||
new Ability(Abilities.STALL, "Stall (N)", "The POKéMON moves after all other POKéMON do.", 4),
|
||||
new Ability(Abilities.STEADFAST, "Steadfast (N)", "Raises SPEED each time the POKéMON flinches.", 4),
|
||||
new Ability(Abilities.STORM_DRAIN, "Storm Drain", "Draws in all WATER-type moves to up SP. ATK.", 4)
|
||||
new Ability(Abilities.STALL, "Stall (N)", "The Pokémon moves after all other Pokémon do.", 4),
|
||||
new Ability(Abilities.STEADFAST, "Steadfast (N)", "Raises Speed each time the Pokémon flinches.", 4),
|
||||
new Ability(Abilities.STORM_DRAIN, "Storm Drain", "Draws in all Water-type moves to up Sp. Atk.", 4)
|
||||
.attr(TypeImmunityStatChangeAbAttr, Type.WATER, BattleStat.SPATK, 1),
|
||||
new Ability(Abilities.SUPER_LUCK, "Super Luck (N)", "Heightens the critical-hit ratios of moves.", 4),
|
||||
new Ability(Abilities.TANGLED_FEET, "Tangled Feet (N)", "Raises evasion if the POKéMON is confused.", 4),
|
||||
new Ability(Abilities.TECHNICIAN, "Technician (N)", "Powers up the POKéMON's weaker moves.", 4),
|
||||
new Ability(Abilities.TANGLED_FEET, "Tangled Feet (N)", "Raises Evasiveness if the Pokémon is confused.", 4),
|
||||
new Ability(Abilities.TECHNICIAN, "Technician (N)", "Powers up the Pokémon's weaker moves.", 4),
|
||||
new Ability(Abilities.TINTED_LENS, "Tinted Lens (N)", "Powers up \"not very effective\" moves.", 4),
|
||||
new Ability(Abilities.UNAWARE, "Unaware (N)", "Ignores any stat changes in the POKéMON.", 4),
|
||||
new Ability(Abilities.UNBURDEN, "Unburden (N)", "Raises SPEED if a held item is used.", 4),
|
||||
new Ability(Abilities.ANALYTIC, "Analytic (N)", "Boosts move power when the POKéMON moves last.", 5),
|
||||
new Ability(Abilities.BIG_PECKS, "Big Pecks", "Protects the POKéMON from DEFENSE-lowering attacks.", 5)
|
||||
new Ability(Abilities.UNAWARE, "Unaware (N)", "Ignores any stat changes in the Pokémon.", 4),
|
||||
new Ability(Abilities.UNBURDEN, "Unburden (N)", "Raises Speed if a held item is used.", 4),
|
||||
new Ability(Abilities.ANALYTIC, "Analytic (N)", "Boosts move power when the Pokémon moves last.", 5),
|
||||
new Ability(Abilities.BIG_PECKS, "Big Pecks", "Protects the Pokémon from Defense-lowering attacks.", 5)
|
||||
.attr(ProtectStatAbAttr, BattleStat.DEF),
|
||||
new Ability(Abilities.CONTRARY, "Contrary (N)", "Makes stat changes have an opposite effect.", 5),
|
||||
new Ability(Abilities.CURSED_BODY, "Cursed Body (N)", "May disable a move used on the POKéMON.", 5),
|
||||
new Ability(Abilities.CURSED_BODY, "Cursed Body (N)", "May disable a move used on the Pokémon.", 5),
|
||||
new Ability(Abilities.DEFEATIST, "Defeatist (N)", "Lowers stats when HP drops below half.", 5),
|
||||
new Ability(Abilities.DEFIANT, "Defiant (N)", "Sharply raises ATTACK when the POKéMON's stats are lowered.", 5),
|
||||
new Ability(Abilities.DEFIANT, "Defiant (N)", "Sharply raises Attack when the Pokémon's stats are lowered.", 5),
|
||||
new Ability(Abilities.FLARE_BOOST, "Flare Boost (N)", "Powers up special attacks when burned.", 5),
|
||||
new Ability(Abilities.FRIEND_GUARD, "Friend Guard (N)", "Reduces damage done to allies.", 5),
|
||||
new Ability(Abilities.HARVEST, "Harvest (N)", "May create another Berry after one is used.", 5),
|
||||
new Ability(Abilities.HEALER, "Healer (N)", "May heal an ally's status conditions.", 5),
|
||||
new Ability(Abilities.HEAVY_METAL, "Heavy Metal (N)", "Doubles the POKéMON's weight.", 5),
|
||||
new Ability(Abilities.ILLUSION, "Illusion (N)", "Enters battle disguised as the last POKéMON in the party.", 5),
|
||||
new Ability(Abilities.IMPOSTER, "Imposter (N)", "It transforms itself into the POKéMON it is facing.", 5),
|
||||
new Ability(Abilities.HEAVY_METAL, "Heavy Metal (N)", "Doubles the Pokémon's weight.", 5),
|
||||
new Ability(Abilities.ILLUSION, "Illusion (N)", "Enters battle disguised as the last Pokémon in the party.", 5),
|
||||
new Ability(Abilities.IMPOSTER, "Imposter (N)", "It transforms itself into the Pokémon it is facing.", 5),
|
||||
new Ability(Abilities.INFILTRATOR, "Infiltrator (N)", "Passes through the foe's barrier and strikes.", 5),
|
||||
new Ability(Abilities.IRON_BARBS, "Iron Barbs (N)", "Inflicts damage to the POKéMON on contact.", 5),
|
||||
new Ability(Abilities.JUSTIFIED, "Justified (N)", "Raises ATTACK when hit by a DARK-type move.", 5),
|
||||
new Ability(Abilities.LIGHT_METAL, "Light Metal (N)", "Halves the POKéMON's weight.", 5),
|
||||
new Ability(Abilities.IRON_BARBS, "Iron Barbs (N)", "Inflicts damage to the Pokémon on contact.", 5),
|
||||
new Ability(Abilities.JUSTIFIED, "Justified (N)", "Raises Attack when hit by a Dark-type move.", 5),
|
||||
new Ability(Abilities.LIGHT_METAL, "Light Metal (N)", "Halves the Pokémon's weight.", 5),
|
||||
new Ability(Abilities.MAGIC_BOUNCE, "Magic Bounce (N)", "Reflects status- changing moves.", 5),
|
||||
new Ability(Abilities.MOODY, "Moody (N)", "Raises one stat and lowers another.", 5),
|
||||
new Ability(Abilities.MOXIE, "Moxie (N)", "Boosts ATTACK after knocking out any POKéMON.", 5),
|
||||
new Ability(Abilities.MOXIE, "Moxie (N)", "Boosts Attack after knocking out any Pokémon.", 5),
|
||||
new Ability(Abilities.MULTISCALE, "Multiscale (N)", "Reduces damage when HP is full.", 5),
|
||||
new Ability(Abilities.MUMMY, "Mummy (N)", "Contact with this POKéMON spreads this Ability.", 5),
|
||||
new Ability(Abilities.OVERCOAT, "Overcoat", "Protects the POKéMON from weather damage.", 5)
|
||||
new Ability(Abilities.MUMMY, "Mummy (N)", "Contact with this Pokémon spreads this Ability.", 5),
|
||||
new Ability(Abilities.OVERCOAT, "Overcoat", "Protects the Pokémon from weather damage.", 5)
|
||||
.attr(BlockWeatherDamageAttr),
|
||||
new Ability(Abilities.PICKPOCKET, "Pickpocket (N)", "Once per battle, steals an item when hit by another POKéMON.", 5),
|
||||
new Ability(Abilities.POISON_TOUCH, "Poison Touch", "May poison targets when a POKéMON makes contact.", 5)
|
||||
new Ability(Abilities.PICKPOCKET, "Pickpocket (N)", "Once per battle, steals an item when hit by another Pokémon.", 5),
|
||||
new Ability(Abilities.POISON_TOUCH, "Poison Touch", "May poison targets when a Pokémon makes contact.", 5)
|
||||
.attr(PostDefendContactApplyStatusEffectAbAttr, 30, StatusEffect.POISON),
|
||||
new Ability(Abilities.PRANKSTER, "Prankster (N)", "Gives priority to a status move.", 5),
|
||||
new Ability(Abilities.RATTLED, "Rattled (N)", "BUG, GHOST or DARK type moves scare it and boost its SPEED.", 5),
|
||||
new Ability(Abilities.RATTLED, "Rattled (N)", "BUG, GHOST or DARK type moves scare it and boost its Speed.", 5),
|
||||
new Ability(Abilities.REGENERATOR, "Regenerator (N)", "Restores a little HP when withdrawn from battle.", 5),
|
||||
new Ability(Abilities.SAND_FORCE, "Sand Force (N)", "Boosts certain moves' power in a sandstorm.", 5),
|
||||
new Ability(Abilities.SAND_RUSH, "Sand Rush (N)", "Boosts the POKéMON's SPEED in a sandstorm.", 5),
|
||||
new Ability(Abilities.SAP_SIPPER, "Sap Sipper", "Boosts ATTACK when hit by a GRASS-type move.", 5)
|
||||
new Ability(Abilities.SAND_RUSH, "Sand Rush (N)", "Boosts the Pokémon's Speed in a sandstorm.", 5),
|
||||
new Ability(Abilities.SAP_SIPPER, "Sap Sipper", "Boosts Attack when hit by a Grass-type move.", 5)
|
||||
.attr(TypeImmunityStatChangeAbAttr, Type.GRASS, BattleStat.ATK, 1),
|
||||
new Ability(Abilities.SHEER_FORCE, "Sheer Force (N)", "Removes added effects to increase move damage.", 5),
|
||||
new Ability(Abilities.TELEPATHY, "Telepathy (N)", "Anticipates an ally's ATTACK and dodges it.", 5),
|
||||
new Ability(Abilities.TELEPATHY, "Telepathy (N)", "Anticipates an ally's Attack and dodges it.", 5),
|
||||
new Ability(Abilities.TERAVOLT, "Teravolt (N)", "Moves can be used regardless of Abilities.", 5),
|
||||
new Ability(Abilities.TOXIC_BOOST, "Toxic Boost (N)", "Powers up physical attacks when poisoned.", 5),
|
||||
new Ability(Abilities.TURBOBLAZE, "Turboblaze (N)", "Moves can be used regardless of Abilities.", 5),
|
||||
new Ability(Abilities.UNNERVE, "Unnerve (N)", "Makes the foe nervous and unable to eat Berries.", 5),
|
||||
new Ability(Abilities.VICTORY_STAR, "Victory Star (N)", "Boosts the accuracy of its allies and itself.", 5),
|
||||
new Ability(Abilities.WEAK_ARMOR, "Weak Armor (N)", "Physical attacks lower DEFENSE and raise SPEED.", 5),
|
||||
new Ability(Abilities.VICTORY_STAR, "Victory Star (N)", "Boosts the Accuracy of its allies and itself.", 5),
|
||||
new Ability(Abilities.WEAK_ARMOR, "Weak Armor (N)", "Physical attacks lower Defense and raise Speed.", 5),
|
||||
new Ability(Abilities.WONDER_SKIN, "Wonder Skin (N)", "Makes status-changing moves more likely to miss.", 5),
|
||||
new Ability(Abilities.ZEN_MODE, "Zen Mode (N)", "Changes form when HP drops below half.", 5),
|
||||
new Ability(Abilities.COMPETITIVE, "Competitive (N)", "Sharply raises SP. ATK when the POKéMON's stats are lowered.", 6),
|
||||
new Ability(Abilities.DARK_AURA, "Dark Aura (N)", "Raises power of DARK type moves for all POKéMON in battle.", 6),
|
||||
new Ability(Abilities.FAIRY_AURA, "Fairy Aura (N)", "Raises power of FAIRY type moves for all POKéMON in battle.", 6),
|
||||
new Ability(Abilities.PROTEAN, "Protean (N)", "Changes the POKéMON's type to its last used move.", 6),
|
||||
new Ability(Abilities.SLUSH_RUSH, "Slush Rush (N)", "Boosts the POKéMON's SPEED stat in a hailstorm.", 7),
|
||||
new Ability(Abilities.NEUTRALIZING_GAS, "Neutralizing Gas (N)", "Neutralizes abilities of all POKéMON in battle.", 8)
|
||||
new Ability(Abilities.COMPETITIVE, "Competitive (N)", "Sharply raises Sp. Atk when the Pokémon's stats are lowered.", 6),
|
||||
new Ability(Abilities.DARK_AURA, "Dark Aura (N)", "Raises power of DARK type moves for all Pokémon in battle.", 6),
|
||||
new Ability(Abilities.FAIRY_AURA, "Fairy Aura (N)", "Raises power of FAIRY type moves for all Pokémon in battle.", 6),
|
||||
new Ability(Abilities.PROTEAN, "Protean (N)", "Changes the Pokémon's type to its last used move.", 6),
|
||||
new Ability(Abilities.SLUSH_RUSH, "Slush Rush (N)", "Boosts the Pokémon's Speed stat in a hailstorm.", 7),
|
||||
new Ability(Abilities.NEUTRALIZING_GAS, "Neutralizing Gas (N)", "Neutralizes abilities of all Pokémon in battle.", 8)
|
||||
);
|
||||
}
|
|
@ -12,19 +12,19 @@ export enum BattleStat {
|
|||
export function getBattleStatName(stat: BattleStat) {
|
||||
switch (stat) {
|
||||
case BattleStat.ATK:
|
||||
return 'ATTACK';
|
||||
return 'Attack';
|
||||
case BattleStat.DEF:
|
||||
return 'DEFENSE';
|
||||
return 'Defense';
|
||||
case BattleStat.SPATK:
|
||||
return 'SP. ATK';
|
||||
return 'Sp. Atk';
|
||||
case BattleStat.SPDEF:
|
||||
return 'SP. DEF';
|
||||
return 'Sp. Def';
|
||||
case BattleStat.SPD:
|
||||
return 'SPEED';
|
||||
return 'Speed';
|
||||
case BattleStat.ACC:
|
||||
return 'accuracy';
|
||||
return 'Accuracy';
|
||||
case BattleStat.EVA:
|
||||
return 'evasiveness';
|
||||
return 'Evasiveness';
|
||||
default:
|
||||
return '???';
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { PokemonHealPhase, StatChangePhase } from "../battle-phases";
|
||||
import { getPokemonMessage } from "../messages";
|
||||
import Pokemon, { HitResult, MoveResult } from "../pokemon";
|
||||
import Pokemon, { HitResult } from "../pokemon";
|
||||
import { getBattleStatName } from "./battle-stat";
|
||||
import { BattleStat } from "./battle-stat";
|
||||
import { BattlerTagType } from "./battler-tag";
|
||||
import { getStatusEffectHealText } from "./status-effect";
|
||||
import * as Utils from "../utils";
|
||||
|
||||
export enum BerryType {
|
||||
SITRUS,
|
||||
|
@ -20,7 +21,7 @@ export enum BerryType {
|
|||
}
|
||||
|
||||
export function getBerryName(berryType: BerryType) {
|
||||
return `${BerryType[berryType]} BERRY`;
|
||||
return `${Utils.toReadableString(BerryType[berryType])} Berry`;
|
||||
}
|
||||
|
||||
export function getBerryEffectDescription(berryType: BerryType) {
|
||||
|
|
|
@ -41,17 +41,17 @@ export enum Biome {
|
|||
export function getBiomeName(biome: Biome) {
|
||||
switch (biome) {
|
||||
case Biome.GRASS:
|
||||
return 'GRASSY FIELD';
|
||||
return 'Grassy Field';
|
||||
case Biome.RUINS:
|
||||
return 'ANCIENT RUINS';
|
||||
return 'Ancient Ruins';
|
||||
case Biome.ABYSS:
|
||||
return 'THE ABYSS';
|
||||
return 'The Abyss';
|
||||
case Biome.SPACE:
|
||||
return 'STRATOSPHERE';
|
||||
return 'Stratosphere';
|
||||
case Biome.END:
|
||||
return 'FINAL DESTINATION';
|
||||
return 'Final Destination';
|
||||
default:
|
||||
return Biome[biome].replace(/\_/g, ' ');
|
||||
return Utils.toReadableString(Biome[biome]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ export default class Move {
|
|||
|
||||
constructor(id: Moves, name: string, type: Type, category: MoveCategory, defaultMoveTarget: MoveTarget, power: integer, accuracy: integer, pp: integer, tm: integer, effect: string, chance: integer, priority: integer, generation: integer) {
|
||||
this.id = id;
|
||||
this.name = name.toUpperCase();
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.category = category;
|
||||
this.moveTarget = defaultMoveTarget;
|
||||
|
@ -1926,7 +1926,7 @@ export class CopyBiomeTypeAttr extends MoveEffectAttr {
|
|||
|
||||
user.summonData.types = [ biomeType ];
|
||||
|
||||
user.scene.queueMessage(getPokemonMessage(user, ` transformed\ninto the ${Type[biomeType].toUpperCase()} type!`));
|
||||
user.scene.queueMessage(getPokemonMessage(user, ` transformed\ninto the ${Utils.toReadableString(Type[biomeType])} type!`));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2237,7 +2237,7 @@ export function initMoves() {
|
|||
new SelfStatusMove(Moves.SWORDS_DANCE, "Swords Dance", Type.NORMAL, -1, 20, 88, "Sharply raises user's Attack.", -1, 0, 1)
|
||||
.attr(StatChangeAttr, BattleStat.ATK, 2, true),
|
||||
new AttackMove(Moves.CUT, "Cut", Type.NORMAL, MoveCategory.PHYSICAL, 50, 95, 30, -1, "", -1, 0, 1),
|
||||
new AttackMove(Moves.GUST, "Gust", Type.FLYING, MoveCategory.SPECIAL, 40, 100, 35, -1, "Hits Pokémon using FLY/BOUNCE/SKY DROP with double power.", -1, 0, 1)
|
||||
new AttackMove(Moves.GUST, "Gust", Type.FLYING, MoveCategory.SPECIAL, 40, 100, 35, -1, "Hits Pokémon using Fly/Bounce/Sky Drop with double power.", -1, 0, 1)
|
||||
.attr(HitsTagAttr, BattlerTagType.FLYING, true)
|
||||
.target(MoveTarget.OTHER),
|
||||
new AttackMove(Moves.WING_ATTACK, "Wing Attack", Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 35, -1, "", -1, 0, 1)
|
||||
|
@ -2649,7 +2649,7 @@ export function initMoves() {
|
|||
.target(MoveTarget.ENEMY_SIDE),
|
||||
new AttackMove(Moves.ZAP_CANNON, "Zap Cannon", Type.ELECTRIC, MoveCategory.SPECIAL, 120, 50, 5, -1, "Paralyzes opponent.", 100, 0, 2)
|
||||
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
|
||||
new StatusMove(Moves.FORESIGHT, "Foresight (N)", Type.NORMAL, -1, 40, -1, "Resets opponent's Evasiveness, and allows Normal- and Fighting-type attacks to hit Ghosts.", -1, 0, 2), // TODO
|
||||
new StatusMove(Moves.FORESIGHT, "Foresight (N)", Type.NORMAL, -1, 40, -1, "Resets opponent's Evasiveness, and allows Normal-type and Fighting-type attacks to hit Ghosts.", -1, 0, 2), // TODO
|
||||
new StatusMove(Moves.DESTINY_BOND, "Destiny Bond (N)", Type.GHOST, -1, 5, -1, "If the user faints, the opponent also faints.", -1, 0, 2)
|
||||
.ignoresProtect(),
|
||||
new StatusMove(Moves.PERISH_SONG, "Perish Song (N)", Type.NORMAL, -1, 5, -1, "Any Pokémon in play when this attack is used faints in 3 turns.", -1, 0, 2)
|
||||
|
@ -2744,7 +2744,7 @@ export function initMoves() {
|
|||
new AttackMove(Moves.HIDDEN_POWER, "Hidden Power (N)", Type.NORMAL, MoveCategory.SPECIAL, 60, 100, 15, -1, "Type and power depends on user's IVs.", -1, 0, 2),
|
||||
new AttackMove(Moves.CROSS_CHOP, "Cross Chop", Type.FIGHTING, MoveCategory.PHYSICAL, 100, 80, 5, -1, "High critical hit ratio.", -1, 0, 2)
|
||||
.attr(HighCritAttr),
|
||||
new AttackMove(Moves.TWISTER, "Twister", Type.DRAGON, MoveCategory.SPECIAL, 40, 100, 20, -1, "May cause flinching. Hits Pokémon using FLY/BOUNCE with double power.", 20, 0, 2)
|
||||
new AttackMove(Moves.TWISTER, "Twister", Type.DRAGON, MoveCategory.SPECIAL, 40, 100, 20, -1, "May cause flinching. Hits Pokémon using Fly/Bounce/Sky Drop with double power.", 20, 0, 2)
|
||||
.attr(HitsTagAttr, BattlerTagType.FLYING, true)
|
||||
.attr(FlinchAttr)
|
||||
.target(MoveTarget.ALL_NEAR_ENEMIES), // TODO
|
||||
|
@ -2989,7 +2989,7 @@ export function initMoves() {
|
|||
new SelfStatusMove(Moves.ROOST, "Roost", Type.FLYING, -1, 5, -1, "User recovers half of its max HP and loses the FLYING type temporarily.", -1, 0, 4)
|
||||
.attr(HealAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.IGNORE_FLYING, true, 1),
|
||||
new SelfStatusMove(Moves.GRAVITY, "Gravity", Type.PSYCHIC, -1, 5, -1, "Prevents moves like FLY and BOUNCE and the Ability LEVITATE for 5 turns.", -1, 0, 4)
|
||||
new SelfStatusMove(Moves.GRAVITY, "Gravity", Type.PSYCHIC, -1, 5, -1, "Prevents moves like Fly and Bounce and the Ability Levitate for 5 turns.", -1, 0, 4)
|
||||
.attr(AddArenaTagAttr, ArenaTagType.GRAVITY, 5)
|
||||
.target(MoveTarget.BOTH_SIDES),
|
||||
new StatusMove(Moves.MIRACLE_EYE, "Miracle Eye (N)", Type.PSYCHIC, -1, 40, -1, "Resets opponent's Evasiveness, removes DARK's PSYCHIC immunity.", -1, 0, 4),
|
||||
|
@ -3005,7 +3005,7 @@ export function initMoves() {
|
|||
.attr(MovePowerMultiplierAttr, (user: Pokemon, target: Pokemon, move: Move) => target.getHpRatio() < 0.5 ? 2 : 1),
|
||||
new AttackMove(Moves.NATURAL_GIFT, "Natural Gift (N)", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 15, -1, "Power and type depend on the user's held berry.", -1, 0, 4)
|
||||
.makesContact(false),
|
||||
new AttackMove(Moves.FEINT, "Feint", Type.NORMAL, MoveCategory.PHYSICAL, 30, 100, 10, -1, "Only hits if opponent uses PROTECT or DETECT in the same turn.", -1, 2, 4)
|
||||
new AttackMove(Moves.FEINT, "Feint", Type.NORMAL, MoveCategory.PHYSICAL, 30, 100, 10, -1, "Only hits if opponent uses Protect or Detect in the same turn.", -1, 2, 4)
|
||||
.condition((user: Pokemon, target: Pokemon, move: Move) => !!target.getTag(BattlerTagType.PROTECTED))
|
||||
.makesContact(false)
|
||||
.ignoresProtect(),
|
||||
|
@ -3050,7 +3050,7 @@ export function initMoves() {
|
|||
new AttackMove(Moves.PUNISHMENT, "Punishment (N)", Type.DARK, MoveCategory.PHYSICAL, -1, 100, 5, -1, "Power increases when opponent's stats have been raised.", -1, 0, 4),
|
||||
new AttackMove(Moves.LAST_RESORT, "Last Resort", Type.NORMAL, MoveCategory.PHYSICAL, 140, 100, 5, -1, "Can only be used after all other moves are used.", -1, 0, 4)
|
||||
.condition((user: Pokemon, target: Pokemon, move: Move) => !user.getMoveset().filter(m => m.moveId !== move.id && m.getPpRatio() > 0).length),
|
||||
new StatusMove(Moves.WORRY_SEED, "Worry Seed (N)", Type.GRASS, 100, 10, -1, "Changes the opponent's Ability to INSOMNIA.", -1, 0, 4),
|
||||
new StatusMove(Moves.WORRY_SEED, "Worry Seed (N)", Type.GRASS, 100, 10, -1, "Changes the opponent's Ability to Insomnia.", -1, 0, 4),
|
||||
new AttackMove(Moves.SUCKER_PUNCH, "Sucker Punch (N)", Type.DARK, MoveCategory.PHYSICAL, 70, 100, 5, -1, "User attacks first, but only works if opponent is readying an attack.", -1, 0, 4),
|
||||
new StatusMove(Moves.TOXIC_SPIKES, "Toxic Spikes", Type.POISON, -1, 20, 91, "Poisons opponents when they switch into battle.", -1, 0, 4)
|
||||
.attr(AddArenaTrapTagAttr, ArenaTagType.TOXIC_SPIKES)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import BattleScene from "../battle-scene";
|
||||
import { toPokemonUpperCase } from "../utils";
|
||||
|
||||
export enum PokeballType {
|
||||
POKEBALL,
|
||||
|
@ -43,7 +42,7 @@ export function getPokeballName(type: PokeballType): string {
|
|||
ret = 'Luxury Ball';
|
||||
break;
|
||||
}
|
||||
return toPokemonUpperCase(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function getPokeballCatchMultiplier(type: PokeballType): number {
|
||||
|
|
|
@ -902,7 +902,7 @@ export function initSpecies() {
|
|||
new PokemonForm("Origin Forme", "origin", Type.GHOST, Type.DRAGON, 6.9, 650, Abilities.LEVITATE, Abilities.NONE, Abilities.NONE, 680, 150, 120, 100, 120, 100, 90, 3, 0, 306, GrowthRate.SLOW, "Undiscovered", null, null, 120, false)
|
||||
),
|
||||
new PokemonSpecies(Species.CRESSELIA, "Cresselia", 4, true, false, false, "Lunar Pokémon", Type.PSYCHIC, null, 1.5, 85.6, Abilities.LEVITATE, Abilities.NONE, Abilities.NONE, 600, 120, 70, 120, 75, 130, 85, 3, 100, 270, GrowthRate.SLOW, "Undiscovered", null, 0, 120, false),
|
||||
new PokemonSpecies(Species.PHIONE, "Phione", 4, false, false, true, "Sea Drifter Pokémon", Type.WATER, null, 0.4, 3.1, Abilities.HYDRATION, Abilities.NONE, Abilities.NONE, 480, 80, 80, 80, 80, 80, 80, 30, 70, 216, GrowthRate.SLOW, "Fairy", "Water 1", null, 40, false),
|
||||
new PokemonSpecies(Species.PHIONE, "Phione", 4, false, false, false, "Sea Drifter Pokémon", Type.WATER, null, 0.4, 3.1, Abilities.HYDRATION, Abilities.NONE, Abilities.NONE, 480, 80, 80, 80, 80, 80, 80, 30, 70, 216, GrowthRate.SLOW, "Fairy", "Water 1", null, 40, false),
|
||||
new PokemonSpecies(Species.MANAPHY, "Manaphy", 4, false, false, true, "Seafaring Pokémon", Type.WATER, null, 0.3, 1.4, Abilities.HYDRATION, Abilities.NONE, Abilities.NONE, 600, 100, 100, 100, 100, 100, 100, 3, 70, 270, GrowthRate.SLOW, "Fairy", "Water 1", null, 10, false),
|
||||
new PokemonSpecies(Species.DARKRAI, "Darkrai", 4, false, false, true, "Pitch-Black Pokémon", Type.DARK, null, 1.5, 50.5, Abilities.BAD_DREAMS, Abilities.NONE, Abilities.NONE, 600, 70, 90, 90, 135, 90, 125, 3, 0, 270, GrowthRate.SLOW, "Undiscovered", null, null, 120, false),
|
||||
new PokemonSpecies(Species.SHAYMIN, "Shaymin", 4, false, false, true, "Gratitude Pokémon", Type.GRASS, null, 0.2, 2.1, Abilities.NATURAL_CURE, Abilities.NONE, Abilities.NONE, 600, 100, 100, 100, 100, 100, 100, 45, 100, 270, GrowthRate.MEDIUM_SLOW, "Undiscovered", null, null, 120, false, true,
|
||||
|
@ -1117,5 +1117,12 @@ export function initSpecies() {
|
|||
return s;
|
||||
}))].map(s => s.name));
|
||||
}
|
||||
|
||||
const speciesFilter = (species: PokemonSpecies) => !species.legendary && !species.pseudoLegendary && !species.mythical && species.baseTotal >= 540;
|
||||
console.log(!speciesFilter ? 'all' : [...new Set(allSpecies.slice(0, -1).filter(speciesFilter).map(s => {
|
||||
while (pokemonPrevolutions.hasOwnProperty(s.speciesId))
|
||||
s = getPokemonSpecies(pokemonPrevolutions[s.speciesId]);
|
||||
return s;
|
||||
}))].map(s => s.name));
|
||||
}, 1000);
|
||||
}*/
|
|
@ -1,5 +1,3 @@
|
|||
import { toPokemonUpperCase } from "../utils";
|
||||
|
||||
export enum Stat {
|
||||
HP = 0,
|
||||
ATK,
|
||||
|
@ -31,5 +29,5 @@ export function getStatName(stat: Stat) {
|
|||
ret = 'Speed';
|
||||
break;
|
||||
}
|
||||
return toPokemonUpperCase(ret);
|
||||
return ret;
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
import BattleScene from "../battle-scene";
|
||||
import { EnemyPokemon } from "../pokemon";
|
||||
import * as Utils from "../utils";
|
||||
import { Moves } from "./move";
|
||||
import { pokemonEvolutions, pokemonPrevolutions } from "./pokemon-evolutions";
|
||||
import { pokemonLevelMoves } from "./pokemon-level-moves";
|
||||
import { PokemonSpeciesFilter } from "./pokemon-species";
|
||||
import PokemonSpecies, { PokemonSpeciesFilter, getPokemonSpecies } from "./pokemon-species";
|
||||
import { Species } from "./species";
|
||||
import { tmSpecies } from "./tms";
|
||||
import { Type } from "./type";
|
||||
|
@ -56,14 +58,13 @@ export enum TrainerType {
|
|||
WAITER,
|
||||
WORKER,
|
||||
YOUNGSTER,
|
||||
CYNTHIA,
|
||||
RIVAL,
|
||||
CYNTHIA
|
||||
}
|
||||
|
||||
export enum TrainerPartyType {
|
||||
DEFAULT,
|
||||
BALANCED,
|
||||
REPEATED
|
||||
RIVAL_2,
|
||||
RIVAL_3,
|
||||
RIVAL_4,
|
||||
RIVAL_5,
|
||||
RIVAL_6
|
||||
}
|
||||
|
||||
export enum TrainerPoolTier {
|
||||
|
@ -78,38 +79,185 @@ export interface TrainerTierPools {
|
|||
[key: integer]: Species[]
|
||||
}
|
||||
|
||||
export enum TrainerPartyMemberStrength {
|
||||
WEAKER,
|
||||
WEAK,
|
||||
AVERAGE,
|
||||
STRONG,
|
||||
STRONGER
|
||||
}
|
||||
|
||||
export class TrainerPartyTemplate {
|
||||
public size: integer;
|
||||
public strength: TrainerPartyMemberStrength;
|
||||
public sameSpecies: boolean;
|
||||
public balanced: boolean;
|
||||
|
||||
constructor(size: integer, strength: TrainerPartyMemberStrength, sameSpecies?: boolean, balanced?: boolean) {
|
||||
this.size = size;
|
||||
this.strength = strength;
|
||||
this.sameSpecies = !!sameSpecies;
|
||||
this.balanced = !!balanced;
|
||||
}
|
||||
|
||||
getStrength(index: integer): TrainerPartyMemberStrength {
|
||||
return this.strength;
|
||||
}
|
||||
|
||||
isSameSpecies(index: integer): boolean {
|
||||
return this.sameSpecies;
|
||||
}
|
||||
|
||||
isBalanced(index: integer): boolean {
|
||||
return this.balanced;
|
||||
}
|
||||
}
|
||||
|
||||
export class TrainerPartyCompoundTemplate extends TrainerPartyTemplate {
|
||||
public templates: TrainerPartyTemplate[];
|
||||
|
||||
constructor(...templates: TrainerPartyTemplate[]) {
|
||||
super(templates.reduce((total: integer, template: TrainerPartyTemplate) => {
|
||||
total += template.size;
|
||||
return total;
|
||||
}, 0), TrainerPartyMemberStrength.AVERAGE);
|
||||
this.templates = templates;
|
||||
}
|
||||
|
||||
getStrength(index: integer): TrainerPartyMemberStrength {
|
||||
let t = 0;
|
||||
for (let template of this.templates) {
|
||||
if (t + template.size > index)
|
||||
return template.getStrength(index - t);
|
||||
t += template.size;
|
||||
}
|
||||
|
||||
return super.getStrength(index);
|
||||
}
|
||||
|
||||
isSameSpecies(index: integer): boolean {
|
||||
let t = 0;
|
||||
for (let template of this.templates) {
|
||||
if (t + template.size > index)
|
||||
return template.isSameSpecies(index - t);
|
||||
t += template.size;
|
||||
}
|
||||
|
||||
return super.isSameSpecies(index);
|
||||
}
|
||||
|
||||
isBalanced(index: integer): boolean {
|
||||
let t = 0;
|
||||
for (let template of this.templates) {
|
||||
if (t + template.size > index)
|
||||
return template.isBalanced(index - t);
|
||||
t += template.size;
|
||||
}
|
||||
|
||||
return super.isBalanced(index);
|
||||
}
|
||||
}
|
||||
|
||||
export const trainerPartyTemplates = {
|
||||
ONE_AVG: new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE),
|
||||
ONE_STRONG: new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG),
|
||||
ONE_STRONGER: new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONGER),
|
||||
TWO_WEAKER: new TrainerPartyTemplate(2, TrainerPartyMemberStrength.WEAKER),
|
||||
TWO_WEAK: new TrainerPartyTemplate(2, TrainerPartyMemberStrength.WEAK),
|
||||
TWO_WEAK_SAME_ONE_AVG: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(2, TrainerPartyMemberStrength.WEAK, true), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE)),
|
||||
TWO_WEAK_SAME_TWO_WEAK_SAME: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(2, TrainerPartyMemberStrength.WEAK, true), new TrainerPartyTemplate(2, TrainerPartyMemberStrength.WEAK, true)),
|
||||
TWO_AVG: new TrainerPartyTemplate(2, TrainerPartyMemberStrength.AVERAGE),
|
||||
TWO_AVG_SAME_ONE_AVG: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(2, TrainerPartyMemberStrength.AVERAGE, true), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE)),
|
||||
TWO_AVG_SAME_ONE_STRONG: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(2, TrainerPartyMemberStrength.AVERAGE, true), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG)),
|
||||
TWO_AVG_SAME_TWO_AVG_SAME: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(2, TrainerPartyMemberStrength.AVERAGE, true), new TrainerPartyTemplate(2, TrainerPartyMemberStrength.AVERAGE, true)),
|
||||
THREE_WEAK: new TrainerPartyTemplate(3, TrainerPartyMemberStrength.WEAK),
|
||||
THREE_WEAK_SAME: new TrainerPartyTemplate(3, TrainerPartyMemberStrength.WEAK, true),
|
||||
THREE_AVG: new TrainerPartyTemplate(3, TrainerPartyMemberStrength.AVERAGE),
|
||||
THREE_AVG_SAME: new TrainerPartyTemplate(3, TrainerPartyMemberStrength.AVERAGE, true),
|
||||
FOUR_WEAKER: new TrainerPartyTemplate(4, TrainerPartyMemberStrength.WEAKER),
|
||||
FOUR_WEAKER_SAME: new TrainerPartyTemplate(4, TrainerPartyMemberStrength.WEAKER, true),
|
||||
FOUR_WEAK: new TrainerPartyTemplate(4, TrainerPartyMemberStrength.WEAK),
|
||||
FOUR_WEAK_SAME: new TrainerPartyTemplate(4, TrainerPartyMemberStrength.WEAK),
|
||||
FIVE_WEAK: new TrainerPartyTemplate(5, TrainerPartyMemberStrength.WEAK, true),
|
||||
SIX_WEAK_SAME: new TrainerPartyTemplate(6, TrainerPartyMemberStrength.WEAKER, true),
|
||||
SIX_WEAKER: new TrainerPartyTemplate(6, TrainerPartyMemberStrength.WEAKER),
|
||||
SIX_WEAKER_SAME: new TrainerPartyTemplate(6, TrainerPartyMemberStrength.WEAKER, true),
|
||||
SIX_WEAK_BALANCED: new TrainerPartyTemplate(6, TrainerPartyMemberStrength.WEAK, false, true),
|
||||
|
||||
RIVAL: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE)),
|
||||
RIVAL_2: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE)),
|
||||
RIVAL_3: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE, false, true)),
|
||||
RIVAL_4: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE), new TrainerPartyTemplate(3, TrainerPartyMemberStrength.AVERAGE, false, true)),
|
||||
RIVAL_5: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE), new TrainerPartyTemplate(3, TrainerPartyMemberStrength.AVERAGE, false, true), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG)),
|
||||
RIVAL_6: new TrainerPartyCompoundTemplate(new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONG), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.AVERAGE), new TrainerPartyTemplate(3, TrainerPartyMemberStrength.AVERAGE, false, true), new TrainerPartyTemplate(1, TrainerPartyMemberStrength.STRONGER))
|
||||
};
|
||||
|
||||
type PartyMemberFunc = (scene: BattleScene, level: integer) => EnemyPokemon;
|
||||
|
||||
export interface PartyMemberFuncs {
|
||||
[key: integer]: PartyMemberFunc
|
||||
}
|
||||
|
||||
export class TrainerConfig {
|
||||
public trainerType: TrainerType;
|
||||
public name: string;
|
||||
public nameFemale: string;
|
||||
public hasGenders: boolean = false;
|
||||
public isDouble: boolean = false;
|
||||
public partyType: TrainerPartyType = TrainerPartyType.DEFAULT;
|
||||
public staticParty: boolean = false;
|
||||
public battleBgm: string;
|
||||
public encounterBgm: string;
|
||||
public femaleEncounterBgm: string;
|
||||
public partyTemplates: TrainerPartyTemplate[];
|
||||
public partyMemberFuncs: PartyMemberFuncs = {};
|
||||
public speciesPools: TrainerTierPools;
|
||||
public speciesFilter: PokemonSpeciesFilter;
|
||||
|
||||
public encounterMessages: string[] = [];
|
||||
public victoryMessages: string[] = [];
|
||||
public defeatMessages: string[] = [];
|
||||
|
||||
public femaleEncounterMessages: string[];
|
||||
public femaleVictoryMessages: string[];
|
||||
public femaleDefeatMessages: string[];
|
||||
|
||||
constructor(trainerType: TrainerType, allowLegendaries?: boolean) {
|
||||
this.trainerType = trainerType;
|
||||
this.name = Utils.toPokemonUpperCase(TrainerType[this.trainerType].toString().replace(/\_/g, ' '));
|
||||
this.name = Utils.toReadableString(TrainerType[this.getDerivedType()]);
|
||||
this.battleBgm = 'battle_trainer';
|
||||
this.encounterBgm = this.name.toLowerCase();
|
||||
this.partyTemplates = [ trainerPartyTemplates.TWO_AVG ];
|
||||
this.speciesFilter = species => allowLegendaries || (!species.legendary && !species.pseudoLegendary && !species.mythical);
|
||||
}
|
||||
|
||||
public getKey(female?: boolean): string {
|
||||
let ret = TrainerType[this.trainerType].toString().toLowerCase();
|
||||
getKey(female?: boolean): string {
|
||||
let ret = TrainerType[this.getDerivedType()].toString().toLowerCase();
|
||||
if (this.hasGenders)
|
||||
ret += `_${female ? 'f' : 'm'}`;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public setName(name: string): TrainerConfig {
|
||||
setName(name: string): TrainerConfig {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public setHasGenders(nameFemale?: string, femaleEncounterBgm?: TrainerType | string): TrainerConfig {
|
||||
getDerivedType(): TrainerType {
|
||||
let trainerType = this.trainerType;
|
||||
switch (trainerType) {
|
||||
case TrainerType.RIVAL_2:
|
||||
case TrainerType.RIVAL_3:
|
||||
case TrainerType.RIVAL_4:
|
||||
case TrainerType.RIVAL_5:
|
||||
case TrainerType.RIVAL_6:
|
||||
trainerType = TrainerType.RIVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return trainerType;
|
||||
}
|
||||
|
||||
setHasGenders(nameFemale?: string, femaleEncounterBgm?: TrainerType | string): TrainerConfig {
|
||||
this.hasGenders = true;
|
||||
this.nameFemale = nameFemale;
|
||||
if (femaleEncounterBgm)
|
||||
|
@ -117,33 +265,66 @@ export class TrainerConfig {
|
|||
return this;
|
||||
}
|
||||
|
||||
public setDouble(): TrainerConfig {
|
||||
setDouble(): TrainerConfig {
|
||||
this.isDouble = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public setEncounterBgm(encounterBgm: TrainerType | string): TrainerConfig {
|
||||
setStaticParty(): TrainerConfig {
|
||||
this.staticParty = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
setBattleBgm(battleBgm: string): TrainerConfig {
|
||||
this.battleBgm = battleBgm;
|
||||
return this;
|
||||
}
|
||||
|
||||
setEncounterBgm(encounterBgm: TrainerType | string): TrainerConfig {
|
||||
this.encounterBgm = typeof encounterBgm === 'number' ? TrainerType[encounterBgm].toString().replace(/\_/g, ' ').toLowerCase() : encounterBgm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public setPartyType(partyType: TrainerPartyType): TrainerConfig {
|
||||
this.partyType = partyType;
|
||||
setPartyTemplates(...partyTemplates: TrainerPartyTemplate[]): TrainerConfig {
|
||||
this.partyTemplates = partyTemplates;
|
||||
return this;
|
||||
}
|
||||
|
||||
public setSpeciesPools(speciesPools: TrainerTierPools | Species[]): TrainerConfig {
|
||||
this.speciesPools = (Array.isArray(speciesPools) ? speciesPools : { [TrainerPoolTier.COMMON]: speciesPools }) as unknown as TrainerTierPools;
|
||||
setPartyMemberFunc(slotIndex: integer, partyMemberFunc: PartyMemberFunc): TrainerConfig {
|
||||
this.partyMemberFuncs[slotIndex] = partyMemberFunc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public setSpeciesFilter(speciesFilter: PokemonSpeciesFilter, allowLegendaries?: boolean): TrainerConfig {
|
||||
setSpeciesPools(speciesPools: TrainerTierPools | Species[]): TrainerConfig {
|
||||
this.speciesPools = (Array.isArray(speciesPools) ? { [TrainerPoolTier.COMMON]: speciesPools } : speciesPools) as unknown as TrainerTierPools;
|
||||
return this;
|
||||
}
|
||||
|
||||
setSpeciesFilter(speciesFilter: PokemonSpeciesFilter, allowLegendaries?: boolean): TrainerConfig {
|
||||
const baseFilter = this.speciesFilter;
|
||||
this.speciesFilter = allowLegendaries ? speciesFilter : species => speciesFilter(species) && baseFilter(species);
|
||||
return this;
|
||||
}
|
||||
|
||||
public getName(female?: boolean): string {
|
||||
setEncounterMessages(messages: string[], femaleMessages?: string[]): TrainerConfig {
|
||||
this.encounterMessages = messages;
|
||||
this.femaleEncounterMessages = femaleMessages;
|
||||
return this;
|
||||
}
|
||||
|
||||
setVictoryMessages(messages: string[], femaleMessages?: string[]): TrainerConfig {
|
||||
this.victoryMessages = messages;
|
||||
this.femaleVictoryMessages = femaleMessages;
|
||||
return this;
|
||||
}
|
||||
|
||||
setDefeatMessages(messages: string[], femaleMessages?: string[]): TrainerConfig {
|
||||
this.defeatMessages = messages;
|
||||
this.femaleDefeatMessages = femaleMessages;
|
||||
return this;
|
||||
}
|
||||
|
||||
getName(female?: boolean): string {
|
||||
let ret = this.name;
|
||||
|
||||
if (this.hasGenders) {
|
||||
|
@ -157,11 +338,6 @@ export class TrainerConfig {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public genPartySize(): integer {
|
||||
// TODO
|
||||
return this.isDouble ? 2 : 1;
|
||||
}
|
||||
|
||||
loadAssets(scene: BattleScene, female: boolean): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
const trainerKey = this.getKey(female);
|
||||
|
@ -170,7 +346,7 @@ export class TrainerConfig {
|
|||
const originalWarn = console.warn;
|
||||
// Ignore warnings for missing frames, because there will be a lot
|
||||
console.warn = () => {};
|
||||
const frameNames = scene.anims.generateFrameNames(trainerKey, { zeroPad: 4, suffix: ".png", start: 1, end:24 });
|
||||
const frameNames = scene.anims.generateFrameNames(trainerKey, { zeroPad: 4, suffix: ".png", start: 1, end: 24 });
|
||||
console.warn = originalWarn;
|
||||
scene.anims.create({
|
||||
key: trainerKey,
|
||||
|
@ -192,30 +368,54 @@ interface TrainerConfigs {
|
|||
[key: integer]: TrainerConfig
|
||||
}
|
||||
|
||||
function getRandomPartyMemberFunc(species: Species[], postProcess?: (enemyPokemon: EnemyPokemon) => void): PartyMemberFunc {
|
||||
return (scene: BattleScene, level: integer) => {
|
||||
const ret = new EnemyPokemon(scene, getPokemonSpecies(Phaser.Math.RND.pick(species)), level);
|
||||
if (postProcess)
|
||||
postProcess(ret);
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
function getSpeciesFilterRandomPartyMemberFunc(speciesFilter: PokemonSpeciesFilter, allowLegendaries?: boolean, postProcess?: (EnemyPokemon: EnemyPokemon) => void): PartyMemberFunc {
|
||||
const originalSpeciesFilter = speciesFilter;
|
||||
speciesFilter = (species: PokemonSpecies) => allowLegendaries || (!species.legendary && !species.pseudoLegendary && !species.mythical) && originalSpeciesFilter(species);
|
||||
return (scene: BattleScene, level: integer) => {
|
||||
const ret = new EnemyPokemon(scene, scene.randomSpecies(scene.currentBattle.waveIndex, level, speciesFilter), level);
|
||||
if (postProcess)
|
||||
postProcess(ret);
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
export const trainerConfigs: TrainerConfigs = {
|
||||
[TrainerType.ACE_TRAINER]: new TrainerConfig(++t).setHasGenders().setPartyType(TrainerPartyType.BALANCED),
|
||||
[TrainerType.ARTIST]: new TrainerConfig(++t).setEncounterBgm(TrainerType.RICH).setSpeciesPools([ Species.SMEARGLE ]),
|
||||
[TrainerType.ACE_TRAINER]: new TrainerConfig(++t).setHasGenders().setPartyTemplates(trainerPartyTemplates.SIX_WEAK_BALANCED),
|
||||
[TrainerType.ARTIST]: new TrainerConfig(++t).setEncounterBgm(TrainerType.RICH).setPartyTemplates(trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.THREE_AVG).setSpeciesPools([ Species.SMEARGLE ]),
|
||||
[TrainerType.BACKERS]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.CYCLIST).setDouble(),
|
||||
[TrainerType.BACKPACKER]: new TrainerConfig(++t).setHasGenders().setSpeciesFilter(s => s.isOfType(Type.FLYING) || s.isOfType(Type.ROCK)),
|
||||
[TrainerType.BAKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.GRASS) || s.isOfType(Type.FIRE)),
|
||||
[TrainerType.BEAUTY]: new TrainerConfig(++t).setEncounterBgm(TrainerType.PARASOL_LADY),
|
||||
[TrainerType.BIKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.POISON)),
|
||||
[TrainerType.BLACK_BELT]: new TrainerConfig(++t).setHasGenders('Battle Girl', TrainerType.PSYCHIC).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.FIGHTING)),
|
||||
[TrainerType.BREEDER]: new TrainerConfig(++t).setHasGenders().setDouble().setEncounterBgm(TrainerType.POKEFAN),
|
||||
[TrainerType.BREEDER]: new TrainerConfig(++t).setHasGenders().setDouble().setEncounterBgm(TrainerType.POKEFAN).setPartyTemplates(trainerPartyTemplates.SIX_WEAKER),
|
||||
[TrainerType.CLERK]: new TrainerConfig(++t).setHasGenders(),
|
||||
[TrainerType.CYCLIST]: new TrainerConfig(++t).setHasGenders().setSpeciesFilter(s => !!pokemonLevelMoves[s.speciesId].find(plm => plm[1] === Moves.QUICK_ATTACK)),
|
||||
[TrainerType.DANCER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST),
|
||||
[TrainerType.DEPOT_AGENT]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK),
|
||||
[TrainerType.DOCTOR]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK),
|
||||
[TrainerType.FISHERMAN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER).setSpeciesPools({
|
||||
[TrainerPoolTier.COMMON]: [ Species.TENTACOOL, Species.MAGIKARP, Species.GOLDEEN, Species.STARYU, Species.REMORAID ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.POLIWAG, Species.SHELLDER, Species.KRABBY, Species.HORSEA, Species.CARVANHA, Species.BARBOACH, Species.CORPHISH, Species.FINNEON, Species.TYMPOLE, Species.BASCULIN, Species.FRILLISH ],
|
||||
[TrainerPoolTier.RARE]: [ Species.CHINCHOU, Species.CORSOLA, Species.WAILMER, Species.CLAMPERL, Species.LUVDISC, Species.MANTYKE, Species.ALOMOMOLA ],
|
||||
[TrainerPoolTier.SUPER_RARE]: [ Species.LAPRAS, Species.FEEBAS, Species.RELICANTH ]
|
||||
}),
|
||||
[TrainerType.FISHERMAN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER)
|
||||
.setPartyTemplates(trainerPartyTemplates.TWO_WEAK_SAME_ONE_AVG, trainerPartyTemplates.ONE_AVG, trainerPartyTemplates.THREE_WEAK_SAME, trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.SIX_WEAKER)
|
||||
.setSpeciesPools({
|
||||
[TrainerPoolTier.COMMON]: [ Species.TENTACOOL, Species.MAGIKARP, Species.GOLDEEN, Species.STARYU, Species.REMORAID ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.POLIWAG, Species.SHELLDER, Species.KRABBY, Species.HORSEA, Species.CARVANHA, Species.BARBOACH, Species.CORPHISH, Species.FINNEON, Species.TYMPOLE, Species.BASCULIN, Species.FRILLISH ],
|
||||
[TrainerPoolTier.RARE]: [ Species.CHINCHOU, Species.CORSOLA, Species.WAILMER, Species.CLAMPERL, Species.LUVDISC, Species.MANTYKE, Species.ALOMOMOLA ],
|
||||
[TrainerPoolTier.SUPER_RARE]: [ Species.LAPRAS, Species.FEEBAS, Species.RELICANTH ]
|
||||
}
|
||||
),
|
||||
[TrainerType.GUITARIST]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.ELECTRIC)),
|
||||
[TrainerType.HARLEQUIN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.PSYCHIC).setSpeciesFilter(s => tmSpecies[Moves.TRICK_ROOM].indexOf(s.speciesId) > -1),
|
||||
[TrainerType.HIKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER).setSpeciesFilter(s => s.isOfType(Type.GROUND) || s.isOfType(Type.ROCK)),
|
||||
[TrainerType.HIKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER).setSpeciesFilter(s => s.isOfType(Type.GROUND) || s.isOfType(Type.ROCK))
|
||||
.setPartyTemplates(trainerPartyTemplates.TWO_AVG_SAME_ONE_AVG, trainerPartyTemplates.TWO_AVG_SAME_ONE_STRONG, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.FOUR_WEAK, trainerPartyTemplates.ONE_STRONG),
|
||||
[TrainerType.HOOLIGANS]: new TrainerConfig(++t).setDouble().setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.POISON) || s.isOfType(Type.DARK)),
|
||||
[TrainerType.HOOPSTER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST),
|
||||
[TrainerType.INFIELDER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CYCLIST),
|
||||
|
@ -228,7 +428,8 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
[TrainerType.OFFICER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesPools([ Species.VULPIX, Species.GROWLITHE, Species.SNUBBULL, Species.HOUNDOUR, Species.POOCHYENA, Species.ELECTRIKE, Species.LILLIPUP ]),
|
||||
[TrainerType.PARASOL_LADY]: new TrainerConfig(++t).setSpeciesFilter(s => s.isOfType(Type.WATER)),
|
||||
[TrainerType.PILOT]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => tmSpecies[Moves.FLY].indexOf(s.speciesId) > -1),
|
||||
[TrainerType.POKEFAN]: new TrainerConfig(++t).setHasGenders(),
|
||||
[TrainerType.POKEFAN]: new TrainerConfig(++t).setHasGenders()
|
||||
.setPartyTemplates(trainerPartyTemplates.SIX_WEAKER, trainerPartyTemplates.FOUR_WEAK, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.FOUR_WEAK_SAME, trainerPartyTemplates.FIVE_WEAK, trainerPartyTemplates.SIX_WEAKER_SAME),
|
||||
[TrainerType.PRESCHOOLER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders(undefined, 'lass'),
|
||||
[TrainerType.PSYCHIC]: new TrainerConfig(++t).setHasGenders(),
|
||||
[TrainerType.RANGER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.BACKPACKER).setHasGenders(),
|
||||
|
@ -250,7 +451,81 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
[TrainerType.VETERAN]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.RICH),
|
||||
[TrainerType.WAITER]: new TrainerConfig(++t).setHasGenders().setEncounterBgm(TrainerType.CLERK),
|
||||
[TrainerType.WORKER]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.ROCK) || s.isOfType(Type.STEEL)),
|
||||
[TrainerType.YOUNGSTER]: new TrainerConfig(++t).setHasGenders('Lass', 'lass').setEncounterBgm(TrainerType.YOUNGSTER),
|
||||
[TrainerType.RIVAL]: new TrainerConfig(++t).setHasGenders(),
|
||||
[TrainerType.YOUNGSTER]: new TrainerConfig(++t).setHasGenders('Lass', 'lass').setPartyTemplates(trainerPartyTemplates.TWO_WEAKER).setEncounterBgm(TrainerType.YOUNGSTER).setEncounterMessages([
|
||||
`Hey, wanna battle?`,
|
||||
`Are you a new trainer too?`,
|
||||
`Hey, I haven't seen you before. Let's battle!`
|
||||
], [
|
||||
`Let's have a battle, shall we?`,
|
||||
`You look like a new trainer. Let's have a battle!`,
|
||||
`I don't recognize you. How about a battle?`
|
||||
]).setVictoryMessages([
|
||||
`Wow! You're strong!`,
|
||||
`I didn't stand a chance, huh.`,
|
||||
`I'll find you again when I'm older and beat you!`
|
||||
], [
|
||||
`That was impressive! I've got a lot to learn.`,
|
||||
`I didn't think you'd beat me that bad…`,
|
||||
`I hope we get to have a rematch some day.`
|
||||
]),
|
||||
[TrainerType.CYNTHIA]: new TrainerConfig(++t),
|
||||
[TrainerType.RIVAL]: new TrainerConfig(++t).setStaticParty().setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL).setEncounterMessages([
|
||||
`There you are! I've been looking everywhere for you!\nDid you forget to say goodbye to your best friend?
|
||||
$So you're finally pursuing your dream, huh?\nI knew you'd do it one day…
|
||||
$Anyway, I'll forgive you for forgetting me, but on one condition. You have to battle me!
|
||||
$You'd better give it your best! Wouldn't want your adventure to be over before it started, right?`
|
||||
]).setDefeatMessages([
|
||||
`You already have three Pokémon?!\nThat's not fair at all!
|
||||
$Just kidding! I lost fair and square, and now I know you'll do fine out there.
|
||||
$Do your best like always! I believe in you!`
|
||||
]).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.CHIKORITA, Species.CYNDAQUIL, Species.TOTODILE, Species.TREECKO, Species.TORCHIC, Species.MUDKIP, Species.TURTWIG, Species.CHIMCHAR, Species.PIPLUP, Species.SNIVY, Species.TEPIG, Species.OSHAWOTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEY, Species.HOOTHOOT, Species.TAILLOW, Species.STARLY, Species.PIDOVE ])),
|
||||
[TrainerType.RIVAL_2]: new TrainerConfig(++t).setStaticParty().setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_2).setEncounterMessages([
|
||||
`Oh, fancy meeting you here. Looks like you're still undefeated. Right on!
|
||||
$I know what you're thinking, and no, I wasn't following you. I just happened to be in the area.
|
||||
$I'm happy for you but I just want to let you know that it's OK to lose sometimes.
|
||||
$We learn from our mistakes, often more than we would if we kept succeeding.
|
||||
$In any case, I've been training hard for our rematch, so you'd better give it your all!`
|
||||
]).setDefeatMessages([
|
||||
`I… wasn't supposed to lose that time…`
|
||||
]).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.IVYSAUR, Species.CHARMELEON, Species.WARTORTLE, Species.BAYLEEF, Species.QUILAVA, Species.CROCONAW, Species.GROVYLE, Species.COMBUSKEN, Species.MARSHTOMP, Species.GROTLE, Species.MONFERNO, Species.PRINPLUP, Species.SERVINE, Species.PIGNITE, Species.DEWOTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOTTO, Species.HOOTHOOT, Species.TAILLOW, Species.STARAVIA, Species.TRANQUILL ]))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)),
|
||||
[TrainerType.RIVAL_3]: new TrainerConfig(++t).setStaticParty().setBattleBgm('battle_rival').setPartyTemplates(trainerPartyTemplates.RIVAL_3).setEncounterMessages([
|
||||
`Long time no see! Still haven't lost, huh.\nYou're starting to get on my nerves. Just kidding!
|
||||
$But really, I think it's about time you came home.\nYour family and friends miss you, you know.
|
||||
$I know your dream means a lot to you, but the reality is you're going to lose sooner or later.
|
||||
$And when you do, I'll be there for you like always.\nNow, let me show you how strong I've become!`
|
||||
]).setDefeatMessages([
|
||||
`After all that… it wasn't enough…?`
|
||||
]).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540),
|
||||
[TrainerType.RIVAL_4]: new TrainerConfig(++t).setStaticParty().setBattleBgm('battle_rival_2').setPartyTemplates(trainerPartyTemplates.RIVAL_4).setEncounterMessages([
|
||||
`It's me! You didn't forget about me again did you?
|
||||
$You made it really far! I'm proud of you.\nBut it looks like it's the end of your journey.
|
||||
$You've awoken something in me I never knew was there.\nIt seems like all I do now is train.
|
||||
$I hardly even eat or sleep now, I just train my Pokémon all day, getting stronger every time.
|
||||
$And now, I've finally reached peak performance.\nI don't think anyone could beat me now.
|
||||
$And you know what? It's all because of you.\nI don't know whether to thank you or hate you.
|
||||
$Prepare yourself.`
|
||||
]).setDefeatMessages([
|
||||
`What…@d{64} what are you?`
|
||||
]).setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540),
|
||||
[TrainerType.RIVAL_5]: new TrainerConfig(++t).setStaticParty().setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_5).setEncounterMessages([ `…` ]).setDefeatMessages([ '…' ])
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540)
|
||||
.setPartyMemberFunc(5, getRandomPartyMemberFunc([ Species.RAYQUAZA ])),
|
||||
[TrainerType.RIVAL_6]: new TrainerConfig(++t).setStaticParty().setBattleBgm('battle_rival_3').setPartyTemplates(trainerPartyTemplates.RIVAL_6)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT ]))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT ]))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540)
|
||||
.setPartyMemberFunc(5, getRandomPartyMemberFunc([ Species.RAYQUAZA ])),
|
||||
}
|
|
@ -316,7 +316,7 @@ export function getRandomWeatherType(biome: Biome): WeatherType {
|
|||
let totalWeight = 0;
|
||||
weatherPool.forEach(w => totalWeight += w.weight);
|
||||
|
||||
const rand = Utils.randInt(totalWeight);
|
||||
const rand = Utils.randSeedInt(totalWeight);
|
||||
let w = 0;
|
||||
for (let weather of weatherPool) {
|
||||
w += weather.weight;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
function getSession() {
|
||||
const sessionStr = localStorage.getItem('sessionData');
|
||||
if (!sessionStr)
|
||||
return null;
|
||||
return JSON.parse(atob(sessionStr));
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
import Phaser from 'phaser';
|
||||
import BattleScene from './battle-scene';
|
||||
import SpritePipeline from './pipelines/sprite';
|
||||
import * as Utils from './utils';
|
||||
|
||||
const config: Phaser.Types.Core.GameConfig = {
|
||||
type: Phaser.WEBGL,
|
||||
parent: 'app',
|
||||
seed: [ Utils.randomString(16) ],
|
||||
scale: {
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
|
|
|
@ -39,7 +39,7 @@ export class ModifierType {
|
|||
constructor(name: string, description: string, newModifierFunc: NewModifierFunc, iconImage?: string, group?: string, soundName?: string) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.iconImage = iconImage || name?.replace(/[ \-]/g, '_')?.replace(/'/g, '')?.toLowerCase();
|
||||
this.iconImage = iconImage || name?.replace(/[ \-]/g, '_')?.replace(/['\.]/g, '')?.toLowerCase();
|
||||
this.group = group || '';
|
||||
this.soundName = soundName || 'restore';
|
||||
this.newModifierFunc = newModifierFunc;
|
||||
|
@ -111,7 +111,7 @@ export class PokemonHpRestoreModifierType extends PokemonModifierType {
|
|||
protected restorePercent: integer;
|
||||
|
||||
constructor(name: string, restorePoints: integer, restorePercent: integer, newModifierFunc?: NewModifierFunc, selectFilter?: PokemonSelectFilter, iconImage?: string, group?: string) {
|
||||
super(name, restorePoints ? `Restore ${restorePoints} HP or ${restorePercent}% HP for one POKéMON, whichever is higher` : `Restore ${restorePercent}% HP for one POKéMON`,
|
||||
super(name, restorePoints ? `Restore ${restorePoints} HP or ${restorePercent}% HP for one Pokémon, whichever is higher` : `Restore ${restorePercent}% HP for one Pokémon`,
|
||||
newModifierFunc || ((_type, args) => new Modifiers.PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints, this.restorePercent, false)),
|
||||
selectFilter || ((pokemon: PlayerPokemon) => {
|
||||
if (!pokemon.hp || pokemon.hp >= pokemon.getMaxHp())
|
||||
|
@ -126,14 +126,14 @@ export class PokemonHpRestoreModifierType extends PokemonModifierType {
|
|||
|
||||
export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
|
||||
constructor(name: string, restorePercent: integer, iconImage?: string) {
|
||||
super(name, 0, 100, (_type, args) => new Modifiers.PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, 0, this.restorePercent, true),
|
||||
super(name, 0, restorePercent, (_type, args) => new Modifiers.PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, 0, this.restorePercent, true),
|
||||
((pokemon: PlayerPokemon) => {
|
||||
if (!pokemon.isFainted())
|
||||
return PartyUiHandler.NoEffectMessage;
|
||||
return null;
|
||||
}), iconImage, 'revive');
|
||||
|
||||
this.description = `Revive one POKéMON and restore ${restorePercent}% HP`;
|
||||
this.description = `Revive one Pokémon and restore ${restorePercent}% HP`;
|
||||
this.selectFilter = (pokemon: PlayerPokemon) => {
|
||||
if (pokemon.hp)
|
||||
return PartyUiHandler.NoEffectMessage;
|
||||
|
@ -144,7 +144,7 @@ export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
|
|||
|
||||
export class PokemonStatusHealModifierType extends PokemonModifierType {
|
||||
constructor(name: string) {
|
||||
super(name, `Heal any status ailment for one POKéMON`,
|
||||
super(name, `Heal any status ailment for one Pokémon`,
|
||||
((_type, args) => new Modifiers.PokemonStatusHealModifier(this, (args[0] as PlayerPokemon).id)),
|
||||
((pokemon: PlayerPokemon) => {
|
||||
if (!pokemon.hp || !pokemon.status)
|
||||
|
@ -169,7 +169,7 @@ export class PokemonPpRestoreModifierType extends PokemonMoveModifierType {
|
|||
protected restorePoints: integer;
|
||||
|
||||
constructor(name: string, restorePoints: integer, iconImage?: string) {
|
||||
super(name, `Restore ${restorePoints > -1 ? restorePoints : 'all'} PP for one POKéMON move`, (_type, args) => new Modifiers.PokemonPpRestoreModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.restorePoints),
|
||||
super(name, `Restore ${restorePoints > -1 ? restorePoints : 'all'} PP for one Pokémon move`, (_type, args) => new Modifiers.PokemonPpRestoreModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.restorePoints),
|
||||
(_pokemon: PlayerPokemon) => {
|
||||
return null;
|
||||
}, (pokemonMove: PokemonMove) => {
|
||||
|
@ -186,7 +186,7 @@ export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType {
|
|||
protected restorePoints: integer;
|
||||
|
||||
constructor(name: string, restorePoints: integer, iconImage?: string) {
|
||||
super(name, `Restore ${restorePoints > -1 ? restorePoints : 'all'} PP for all of one POKéMON's moves`, (_type, args) => new Modifiers.PokemonAllMovePpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints),
|
||||
super(name, `Restore ${restorePoints > -1 ? restorePoints : 'all'} PP for all of one Pokémon's moves`, (_type, args) => new Modifiers.PokemonAllMovePpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints),
|
||||
(pokemon: PlayerPokemon) => {
|
||||
if (!pokemon.getMoveset().filter(m => m.ppUsed).length)
|
||||
return PartyUiHandler.NoEffectMessage;
|
||||
|
@ -212,7 +212,7 @@ export class TempBattleStatBoosterModifierType extends ModifierType implements G
|
|||
public tempBattleStat: TempBattleStat;
|
||||
|
||||
constructor(tempBattleStat: TempBattleStat) {
|
||||
super(Utils.toPokemonUpperCase(getTempBattleStatBoosterItemName(tempBattleStat)),
|
||||
super(getTempBattleStatBoosterItemName(tempBattleStat),
|
||||
`Increases the ${getTempBattleStatName(tempBattleStat)} of all party members by 1 stage for 5 battles`,
|
||||
(_type, _args) => new Modifiers.TempBattleStatBoosterModifier(this, this.tempBattleStat),
|
||||
getTempBattleStatBoosterItemName(tempBattleStat).replace(/\./g, '').replace(/[ ]/g, '_').toLowerCase());
|
||||
|
@ -287,7 +287,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
|
|||
public boostPercent: integer;
|
||||
|
||||
constructor(moveType: Type, boostPercent: integer) {
|
||||
super(Utils.toPokemonUpperCase(getAttackTypeBoosterItemName(moveType)), `Inceases the power of a POKéMON's ${Type[moveType]}-type moves by 20%`,
|
||||
super(getAttackTypeBoosterItemName(moveType), `Inceases the power of a Pokémon's ${Utils.toReadableString(Type[moveType])}-type moves by 20%`,
|
||||
(_type, args) => new Modifiers.AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent),
|
||||
`${getAttackTypeBoosterItemName(moveType).replace(/[ \-]/g, '_').toLowerCase()}`);
|
||||
|
||||
|
@ -302,7 +302,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
|
|||
|
||||
export class PokemonLevelIncrementModifierType extends PokemonModifierType {
|
||||
constructor(name: string, iconImage?: string) {
|
||||
super(name, `Increase a POKéMON\'s level by 1`, (_type, args) => new Modifiers.PokemonLevelIncrementModifier(this, (args[0] as PlayerPokemon).id),
|
||||
super(name, `Increase a Pokémon\'s level by 1`, (_type, args) => new Modifiers.PokemonLevelIncrementModifier(this, (args[0] as PlayerPokemon).id),
|
||||
(_pokemon: PlayerPokemon) => null, iconImage);
|
||||
}
|
||||
}
|
||||
|
@ -316,17 +316,17 @@ export class AllPokemonLevelIncrementModifierType extends ModifierType {
|
|||
function getBaseStatBoosterItemName(stat: Stat) {
|
||||
switch (stat) {
|
||||
case Stat.HP:
|
||||
return 'HP-UP';
|
||||
return 'Hp-Up';
|
||||
case Stat.ATK:
|
||||
return 'PROTEIN';
|
||||
return 'Protein';
|
||||
case Stat.DEF:
|
||||
return 'IRON';
|
||||
return 'Iron';
|
||||
case Stat.SPATK:
|
||||
return 'CALCIUM';
|
||||
return 'Calcium';
|
||||
case Stat.SPDEF:
|
||||
return 'ZINC';
|
||||
return 'Zinc';
|
||||
case Stat.SPD:
|
||||
return 'CARBOS';
|
||||
return 'Carbos';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,13 +346,13 @@ export class PokemonBaseStatBoosterModifierType extends PokemonHeldItemModifierT
|
|||
|
||||
class AllPokemonFullHpRestoreModifierType extends ModifierType {
|
||||
constructor(name: string, description?: string, newModifierFunc?: NewModifierFunc, iconImage?: string) {
|
||||
super(name, description || `Restore 100% HP for all POKéMON`, newModifierFunc || ((_type, _args) => new Modifiers.PokemonHpRestoreModifier(this, -1, 0, 100)), iconImage);
|
||||
super(name, description || `Restore 100% HP for all Pokémon`, newModifierFunc || ((_type, _args) => new Modifiers.PokemonHpRestoreModifier(this, -1, 0, 100)), iconImage);
|
||||
}
|
||||
}
|
||||
|
||||
class AllPokemonFullReviveModifierType extends AllPokemonFullHpRestoreModifierType {
|
||||
constructor(name: string, iconImage?: string) {
|
||||
super(name, `Revives all fainted POKéMON, restoring 100% HP`, (_type, _args) => new Modifiers.PokemonHpRestoreModifier(this, -1, 0, 100, true), iconImage);
|
||||
super(name, `Revives all fainted Pokémon, restoring 100% HP`, (_type, _args) => new Modifiers.PokemonHpRestoreModifier(this, -1, 0, 100, true), iconImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ export class TmModifierType extends PokemonModifierType {
|
|||
public moveId: Moves;
|
||||
|
||||
constructor(moveId: Moves) {
|
||||
super(`TM${Utils.padInt(Object.keys(tmSpecies).indexOf(moveId.toString()) + 1, 3)} - ${allMoves[moveId].name}`, `Teach ${allMoves[moveId].name} to a POKéMON`, (_type, args) => new Modifiers.TmModifier(this, (args[0] as PlayerPokemon).id),
|
||||
super(`TM${Utils.padInt(Object.keys(tmSpecies).indexOf(moveId.toString()) + 1, 3)} - ${allMoves[moveId].name}`, `Teach ${allMoves[moveId].name} to a Pokémon`, (_type, args) => new Modifiers.TmModifier(this, (args[0] as PlayerPokemon).id),
|
||||
(pokemon: PlayerPokemon) => {
|
||||
if (pokemon.compatibleTms.indexOf(moveId) === -1 || pokemon.getMoveset().filter(m => m?.moveId === moveId).length)
|
||||
return PartyUiHandler.NoEffectMessage;
|
||||
|
@ -415,7 +415,7 @@ export class EvolutionItemModifierType extends PokemonModifierType implements Ge
|
|||
public evolutionItem: EvolutionItem;
|
||||
|
||||
constructor(evolutionItem: EvolutionItem) {
|
||||
super(getEvolutionItemName(evolutionItem), `Causes certain POKéMON to evolve`, (_type, args) => new Modifiers.EvolutionItemModifier(this, (args[0] as PlayerPokemon).id),
|
||||
super(getEvolutionItemName(evolutionItem), `Causes certain Pokémon to evolve`, (_type, args) => new Modifiers.EvolutionItemModifier(this, (args[0] as PlayerPokemon).id),
|
||||
(pokemon: PlayerPokemon) => {
|
||||
if (pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) && pokemonEvolutions[pokemon.species.speciesId].filter(e => e.item === this.evolutionItem
|
||||
&& (!e.condition || e.condition.predicate(pokemon))).length)
|
||||
|
@ -457,7 +457,7 @@ class AttackTypeBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
|||
|
||||
let type: Type;
|
||||
|
||||
const randInt = Utils.randInt(totalWeight);
|
||||
const randInt = Utils.randSeedInt(totalWeight);
|
||||
let weight = 0;
|
||||
|
||||
for (let t of attackMoveTypeWeights.keys()) {
|
||||
|
@ -481,7 +481,7 @@ class TmModifierTypeGenerator extends ModifierTypeGenerator {
|
|||
const tierUniqueCompatibleTms = partyMemberCompatibleTms.flat().filter(tm => tmPoolTiers[tm] === tier).filter((tm, i, array) => array.indexOf(tm) === i);
|
||||
if (!tierUniqueCompatibleTms.length)
|
||||
return null;
|
||||
const randTmIndex = Utils.randInt(tierUniqueCompatibleTms.length);
|
||||
const randTmIndex = Utils.randSeedInt(tierUniqueCompatibleTms.length);
|
||||
return new TmModifierType(tierUniqueCompatibleTms[randTmIndex]);
|
||||
});
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ class EvolutionItemModifierTypeGenerator extends ModifierTypeGenerator {
|
|||
if (!evolutionItemPool.length)
|
||||
return null;
|
||||
|
||||
return new EvolutionItemModifierType(evolutionItemPool[Utils.randInt(evolutionItemPool.length)]);
|
||||
return new EvolutionItemModifierType(evolutionItemPool[Utils.randSeedInt(evolutionItemPool.length)]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -542,42 +542,42 @@ const modifierTypes = {
|
|||
ULTRA_BALL: () => new AddPokeballModifierType(PokeballType.ULTRA_BALL, 5, 'ub'),
|
||||
MASTER_BALL: () => new AddPokeballModifierType(PokeballType.MASTER_BALL, 1, 'mb'),
|
||||
|
||||
RARE_CANDY: () => new PokemonLevelIncrementModifierType('RARE CANDY'),
|
||||
RARER_CANDY: () => new AllPokemonLevelIncrementModifierType('RARER CANDY'),
|
||||
RARE_CANDY: () => new PokemonLevelIncrementModifierType('Rare Candy'),
|
||||
RARER_CANDY: () => new AllPokemonLevelIncrementModifierType('Rarer Candy'),
|
||||
|
||||
EVOLUTION_ITEM: () => new EvolutionItemModifierTypeGenerator(),
|
||||
|
||||
MAP: () => new ModifierType('MAP', 'Allows you to choose your destination at a crossroads', (type, _args) => new Modifiers.MapModifier(type)),
|
||||
MAP: () => new ModifierType('Map', 'Allows you to choose your destination at a crossroads', (type, _args) => new Modifiers.MapModifier(type)),
|
||||
|
||||
POTION: () => new PokemonHpRestoreModifierType('POTION', 20, 10),
|
||||
SUPER_POTION: () => new PokemonHpRestoreModifierType('SUPER POTION', 50, 25),
|
||||
HYPER_POTION: () => new PokemonHpRestoreModifierType('HYPER POTION', 200, 50),
|
||||
MAX_POTION: () => new PokemonHpRestoreModifierType('MAX POTION', 100, 100),
|
||||
POTION: () => new PokemonHpRestoreModifierType('Potion', 20, 10),
|
||||
SUPER_POTION: () => new PokemonHpRestoreModifierType('Super Potion', 50, 25),
|
||||
HYPER_POTION: () => new PokemonHpRestoreModifierType('Hyper Potion', 200, 50),
|
||||
MAX_POTION: () => new PokemonHpRestoreModifierType('Max Potion', 100, 100),
|
||||
|
||||
REVIVE: () => new PokemonReviveModifierType('REVIVE', 50),
|
||||
MAX_REVIVE: () => new PokemonReviveModifierType('MAX REVIVE', 100),
|
||||
REVIVE: () => new PokemonReviveModifierType('Revive', 50),
|
||||
MAX_REVIVE: () => new PokemonReviveModifierType('Max Revive', 100),
|
||||
|
||||
FULL_HEAL: () => new PokemonStatusHealModifierType('FULL HEAL'),
|
||||
FULL_HEAL: () => new PokemonStatusHealModifierType('Full Heal'),
|
||||
|
||||
SACRED_ASH: () => new AllPokemonFullReviveModifierType('SACRED ASH'),
|
||||
SACRED_ASH: () => new AllPokemonFullReviveModifierType('Sacred Ash'),
|
||||
|
||||
REVIVER_SEED: () => new PokemonHeldItemModifierType('REVIVER SEED', 'Revives the holder for 1/2 HP upon fainting',
|
||||
REVIVER_SEED: () => new PokemonHeldItemModifierType('Reviver Seed', 'Revives the holder for 1/2 HP upon fainting',
|
||||
(type, args) => new Modifiers.PokemonInstantReviveModifier(type, (args[0] as Pokemon).id)),
|
||||
|
||||
ETHER: () => new PokemonPpRestoreModifierType('ETHER', 10),
|
||||
MAX_ETHER: () => new PokemonPpRestoreModifierType('MAX ETHER', -1),
|
||||
ETHER: () => new PokemonPpRestoreModifierType('Ether', 10),
|
||||
MAX_ETHER: () => new PokemonPpRestoreModifierType('Max Ether', -1),
|
||||
|
||||
ELIXIR: () => new PokemonAllMovePpRestoreModifierType('ELIXIR', 10),
|
||||
MAX_ELIXIR: () => new PokemonAllMovePpRestoreModifierType('MAX ELIXIR', -1),
|
||||
ELIXIR: () => new PokemonAllMovePpRestoreModifierType('Elixir', 10),
|
||||
MAX_ELIXIR: () => new PokemonAllMovePpRestoreModifierType('Max Elixir', -1),
|
||||
|
||||
LURE: () => new DoubleBattleChanceBoosterModifierType('LURE', 5),
|
||||
SUPER_LURE: () => new DoubleBattleChanceBoosterModifierType('SUPER LURE', 10),
|
||||
MAX_LURE: () => new DoubleBattleChanceBoosterModifierType('MAX LURE', 25),
|
||||
LURE: () => new DoubleBattleChanceBoosterModifierType('Lure', 5),
|
||||
SUPER_LURE: () => new DoubleBattleChanceBoosterModifierType('Super Lure', 10),
|
||||
MAX_LURE: () => new DoubleBattleChanceBoosterModifierType('Max Lure', 25),
|
||||
|
||||
TEMP_STAT_BOOSTER: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => {
|
||||
if (pregenArgs)
|
||||
return new TempBattleStatBoosterModifierType(pregenArgs[0] as TempBattleStat);
|
||||
const randTempBattleStat = Utils.randInt(7) as TempBattleStat;
|
||||
const randTempBattleStat = Utils.randSeedInt(7) as TempBattleStat;
|
||||
return new TempBattleStatBoosterModifierType(randTempBattleStat);
|
||||
}),
|
||||
|
||||
|
@ -586,7 +586,7 @@ const modifierTypes = {
|
|||
const stat = pregenArgs[0] as Stat;
|
||||
return new PokemonBaseStatBoosterModifierType(getBaseStatBoosterItemName(stat), stat);
|
||||
}
|
||||
const randStat = Utils.randInt(6) as Stat;
|
||||
const randStat = Utils.randSeedInt(6) as Stat;
|
||||
return new PokemonBaseStatBoosterModifierType(getBaseStatBoosterItemName(randStat), randStat);
|
||||
}),
|
||||
|
||||
|
@ -597,13 +597,13 @@ const modifierTypes = {
|
|||
return new BerryModifierType(pregenArgs[0] as BerryType);
|
||||
const berryTypes = Utils.getEnumValues(BerryType);
|
||||
let randBerryType: BerryType;
|
||||
let rand = Utils.randInt(10);
|
||||
let rand = Utils.randSeedInt(10);
|
||||
if (rand < 2)
|
||||
randBerryType = BerryType.SITRUS;
|
||||
else if (rand < 4)
|
||||
randBerryType = BerryType.LUM;
|
||||
else
|
||||
randBerryType = berryTypes[Utils.randInt(berryTypes.length - 2) + 2];
|
||||
randBerryType = berryTypes[Utils.randSeedInt(berryTypes.length - 2) + 2];
|
||||
return new BerryModifierType(randBerryType);
|
||||
}),
|
||||
|
||||
|
@ -611,48 +611,48 @@ const modifierTypes = {
|
|||
TM_GREAT: () => new TmModifierTypeGenerator(ModifierTier.GREAT),
|
||||
TM_ULTRA: () => new TmModifierTypeGenerator(ModifierTier.ULTRA),
|
||||
|
||||
EXP_SHARE: () => new ModifierType('EXP. SHARE', 'All POKéMON in your party gain an additional 10% of a battle\'s EXP. Points',
|
||||
(type, _args) => new Modifiers.ExpShareModifier(type), 'exp_share'),
|
||||
EXP_BALANCE: () => new ModifierType('EXP. BALANCE', 'All EXP. Points received from battles are split between the lower leveled party members',
|
||||
(type, _args) => new Modifiers.ExpBalanceModifier(type), 'exp_balance'),
|
||||
EXP_SHARE: () => new ModifierType('EXP. Share', 'All Pokémon in your party gain an additional 10% of a battle\'s EXP. Points',
|
||||
(type, _args) => new Modifiers.ExpShareModifier(type)),
|
||||
EXP_BALANCE: () => new ModifierType('EXP. Balance', 'All EXP. Points received from battles are split between the lower leveled party members',
|
||||
(type, _args) => new Modifiers.ExpBalanceModifier(type)),
|
||||
|
||||
OVAL_CHARM: () => new ModifierType('OVAL CHARM', 'When multiple POKéMON participate in a battle, each gets an extra 10% of the total EXP',
|
||||
(type, _args) => new Modifiers.MultipleParticipantExpBonusModifier(type), 'oval_charm'),
|
||||
OVAL_CHARM: () => new ModifierType('Oval Charm', 'When multiple Pokémon participate in a battle, each gets an extra 10% of the total EXP',
|
||||
(type, _args) => new Modifiers.MultipleParticipantExpBonusModifier(type)),
|
||||
|
||||
EXP_CHARM: () => new ExpBoosterModifierType('EXP CHARM', 25),
|
||||
GOLDEN_EXP_CHARM: () => new ExpBoosterModifierType('GOLDEN EXP CHARM', 50),
|
||||
EXP_CHARM: () => new ExpBoosterModifierType('EXP. Charm', 25),
|
||||
GOLDEN_EXP_CHARM: () => new ExpBoosterModifierType('Golden EXP. Charm', 50),
|
||||
|
||||
LUCKY_EGG: () => new PokemonExpBoosterModifierType('LUCKY EGG', 50),
|
||||
GOLDEN_EGG: () => new PokemonExpBoosterModifierType('GOLDEN EGG', 200),
|
||||
LUCKY_EGG: () => new PokemonExpBoosterModifierType('Lucky Egg', 50),
|
||||
GOLDEN_EGG: () => new PokemonExpBoosterModifierType('Golden Egg', 200),
|
||||
|
||||
GRIP_CLAW: () => new ContactHeldItemTransferChanceModifierType('GRIP CLAW', 10),
|
||||
GRIP_CLAW: () => new ContactHeldItemTransferChanceModifierType('Grip Claw', 10),
|
||||
|
||||
HEALING_CHARM: () => new ModifierType('HEALING CHARM', 'Increases the effectiveness of HP restoring moves and items by 100% (excludes revives)',
|
||||
HEALING_CHARM: () => new ModifierType('Healing Charm', 'Increases the effectiveness of HP restoring moves and items by 100% (excludes revives)',
|
||||
(type, _args) => new Modifiers.HealingBoosterModifier(type, 2), 'healing_charm'),
|
||||
CANDY_JAR: () => new ModifierType('CANDY JAR', 'Increases the number of levels added by RARE CANDY items by 1', (type, _args) => new Modifiers.LevelIncrementBoosterModifier(type)),
|
||||
CANDY_JAR: () => new ModifierType('Candy Jar', 'Increases the number of levels added by RARE CANDY items by 1', (type, _args) => new Modifiers.LevelIncrementBoosterModifier(type)),
|
||||
|
||||
BERRY_POUCH: () => new ModifierType('BERRY POUCH', 'Adds a 25% chance that a used berry will not be consumed',
|
||||
BERRY_POUCH: () => new ModifierType('Berry Pouch', 'Adds a 25% chance that a used berry will not be consumed',
|
||||
(type, _args) => new Modifiers.PreserveBerryModifier(type)),
|
||||
|
||||
FOCUS_BAND: () => new PokemonHeldItemModifierType('FOCUS BAND', 'Adds a 10% chance to survive with 1 HP after being damaged enough to faint',
|
||||
FOCUS_BAND: () => new PokemonHeldItemModifierType('Focus Band', 'Adds a 10% chance to survive with 1 HP after being damaged enough to faint',
|
||||
(type, args) => new Modifiers.SurviveDamageModifier(type, (args[0] as Pokemon).id)),
|
||||
|
||||
KINGS_ROCK: () => new PokemonHeldItemModifierType('KING\'S ROCK', 'Adds a 10% chance an attack move will cause the opponent to flinch',
|
||||
KINGS_ROCK: () => new PokemonHeldItemModifierType('King\'s Rock', 'Adds a 10% chance an attack move will cause the opponent to flinch',
|
||||
(type, args) => new Modifiers.FlinchChanceModifier(type, (args[0] as Pokemon).id)),
|
||||
|
||||
LEFTOVERS: () => new PokemonHeldItemModifierType('LEFTOVERS', 'Heals 1/16 of a POKéMON\'s maximum HP every turn',
|
||||
LEFTOVERS: () => new PokemonHeldItemModifierType('Leftovers', 'Heals 1/16 of a Pokémon\'s maximum HP every turn',
|
||||
(type, args) => new Modifiers.TurnHealModifier(type, (args[0] as Pokemon).id)),
|
||||
SHELL_BELL: () => new PokemonHeldItemModifierType('SHELL BELL', 'Heals 1/8 of a POKéMON\'s dealt damage',
|
||||
SHELL_BELL: () => new PokemonHeldItemModifierType('Shell Bell', 'Heals 1/8 of a Pokémon\'s dealt damage',
|
||||
(type, args) => new Modifiers.HitHealModifier(type, (args[0] as Pokemon).id)),
|
||||
|
||||
BATON: () => new PokemonHeldItemModifierType('BATON', 'Allows passing along effects when switching POKéMON, which also bypasses traps',
|
||||
BATON: () => new PokemonHeldItemModifierType('Baton', 'Allows passing along effects when switching Pokémon, which also bypasses traps',
|
||||
(type, args) => new Modifiers.SwitchEffectTransferModifier(type, (args[0] as Pokemon).id), 'stick'),
|
||||
|
||||
SHINY_CHARM: () => new ModifierType('SHINY CHARM', 'Dramatically increases the chance of a wild POKéMON being shiny', (type, _args) => new Modifiers.ShinyRateBoosterModifier(type)),
|
||||
SHINY_CHARM: () => new ModifierType('Shiny Charm', 'Dramatically increases the chance of a wild Pokémon being shiny', (type, _args) => new Modifiers.ShinyRateBoosterModifier(type)),
|
||||
|
||||
MINI_BLACK_HOLE: () => new TurnHeldItemTransferModifierType('MINI BLACK HOLE'),
|
||||
MINI_BLACK_HOLE: () => new TurnHeldItemTransferModifierType('Mini Black Hole'),
|
||||
|
||||
GOLDEN_POKEBALL: () => new ModifierType(`GOLDEN ${getPokeballName(PokeballType.POKEBALL)}`, 'Adds 1 extra item option at the end of every battle',
|
||||
GOLDEN_POKEBALL: () => new ModifierType(`Golden ${getPokeballName(PokeballType.POKEBALL)}`, 'Adds 1 extra item option at the end of every battle',
|
||||
(type, _args) => new Modifiers.ExtraModifierModifier(type), 'pb_gold', null, 'pb_bounce_1'),
|
||||
};
|
||||
|
||||
|
@ -846,11 +846,11 @@ function getNewModifierTypeOption(party: Pokemon[], player?: boolean, tier?: Mod
|
|||
if (player === undefined)
|
||||
player = true;
|
||||
if (tier === undefined) {
|
||||
const tierValue = Utils.randInt(256);
|
||||
const tierValue = Utils.randSeedInt(256);
|
||||
if (player && tierValue) {
|
||||
const partyShinyCount = party.filter(p => p.shiny).length;
|
||||
const upgradeOdds = Math.floor(32 / Math.max((partyShinyCount * 2), 1));
|
||||
upgrade = !Utils.randInt(upgradeOdds);
|
||||
upgrade = !Utils.randSeedInt(upgradeOdds);
|
||||
} else
|
||||
upgrade = false;
|
||||
tier = (tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER) + (upgrade ? 1 : 0);
|
||||
|
@ -858,7 +858,7 @@ function getNewModifierTypeOption(party: Pokemon[], player?: boolean, tier?: Mod
|
|||
|
||||
const thresholds = Object.keys((player ? modifierPoolThresholds : enemyModifierPoolThresholds)[tier]);
|
||||
const totalWeight = parseInt(thresholds[thresholds.length - 1]);
|
||||
const value = Utils.randInt(totalWeight);
|
||||
const value = Utils.randSeedInt(totalWeight);
|
||||
let index: integer;
|
||||
for (let t of thresholds) {
|
||||
let threshold = parseInt(t);
|
||||
|
|
|
@ -73,7 +73,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
if (!species.isObtainable() && this.isPlayer())
|
||||
throw `Cannot create a player Pokemon for species '${species.name}'`;
|
||||
|
||||
this.name = Utils.toPokemonUpperCase(species.name);
|
||||
this.name = species.name;
|
||||
this.species = species;
|
||||
this.battleInfo = this.isPlayer()
|
||||
? new PlayerBattleInfo(scene)
|
||||
|
@ -709,6 +709,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
if (isCritical)
|
||||
this.scene.queueMessage('A critical hit!');
|
||||
this.scene.setPhaseQueueSplice();
|
||||
damage = Math.min(damage, this.hp);
|
||||
this.damage(damage);
|
||||
source.turnData.damageDealt += damage;
|
||||
this.turnData.attacksReceived.unshift({ move: move.id, result: result as DamageResult, damage: damage, sourceId: source.id });
|
||||
|
@ -963,7 +964,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
resetStatus(): void {
|
||||
const lastStatus = this.status.effect;
|
||||
const lastStatus = this.status?.effect;
|
||||
this.status = undefined;
|
||||
if (lastStatus === StatusEffect.SLEEP) {
|
||||
this.setFrameRate(12);
|
||||
|
@ -1122,7 +1123,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
return new Promise(resolve => {
|
||||
this.handleSpecialEvolutions(evolution);
|
||||
this.species = getPokemonSpecies(evolution.speciesId);
|
||||
this.name = this.species.name.toUpperCase();
|
||||
this.name = this.species.name;
|
||||
const abilityCount = this.species.getAbilityCount();
|
||||
if (this.abilityIndex >= abilityCount) // Shouldn't happen
|
||||
this.abilityIndex = abilityCount - 1;
|
||||
|
|
|
@ -24,6 +24,7 @@ interface SystemSaveData {
|
|||
}
|
||||
|
||||
interface SessionSaveData {
|
||||
seed: string;
|
||||
gameMode: GameMode;
|
||||
party: PokemonData[];
|
||||
enemyParty: PokemonData[];
|
||||
|
@ -134,6 +135,7 @@ export class GameData {
|
|||
|
||||
saveSession(scene: BattleScene): boolean {
|
||||
const sessionData = {
|
||||
seed: scene.seed,
|
||||
gameMode: scene.gameMode,
|
||||
party: scene.getParty().map(p => new PokemonData(p)),
|
||||
enemyParty: scene.getEnemyParty().map(p => new PokemonData(p)),
|
||||
|
@ -191,6 +193,9 @@ export class GameData {
|
|||
|
||||
console.debug(sessionData);
|
||||
|
||||
scene.seed = sessionData.seed || this.scene.game.config.seed[0];
|
||||
scene.resetSeed();
|
||||
|
||||
scene.gameMode = sessionData.gameMode || GameMode.CLASSIC;
|
||||
|
||||
const loadPokemonAssets: Promise<void>[] = [];
|
||||
|
@ -213,11 +218,11 @@ export class GameData {
|
|||
if (sessionData.enemyField)
|
||||
sessionData.enemyParty = sessionData.enemyField;
|
||||
|
||||
scene.newArena(sessionData.arena.biome, true);
|
||||
|
||||
const battleType = sessionData.battleType || 0;
|
||||
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfigs[sessionData.trainer.trainerType].isDouble : sessionData.enemyParty.length > 1);
|
||||
|
||||
scene.newArena(sessionData.arena.biome, true);
|
||||
|
||||
sessionData.enemyParty.forEach((enemyData, e) => {
|
||||
const enemyPokemon = enemyData.toPokemon(scene) as EnemyPokemon;
|
||||
battle.enemyParty[e] = enemyPokemon;
|
||||
|
@ -334,7 +339,7 @@ export class GameData {
|
|||
|
||||
if (newCatch && !hasPrevolution) {
|
||||
this.scene.playSoundWithoutBgm('level_up_fanfare', 1500);
|
||||
this.scene.ui.showText(`${species.name.toUpperCase()} has been\nadded as a starter!`, null, () => resolve(), null, true);
|
||||
this.scene.ui.showText(`${species.name} has been\nadded as a starter!`, null, () => resolve(), null, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
import FadeIn from 'phaser3-rex-plugins/plugins/audio/fade/FadeIn';
|
||||
import FadeOut from 'phaser3-rex-plugins/plugins/audio/fade/FadeOut';
|
||||
import BattleScene from "../battle-scene";
|
||||
import * as Utils from "../utils";
|
||||
|
||||
type FadeIn = typeof FadeIn;
|
||||
type FadeOut = typeof FadeOut;
|
||||
|
||||
export function initGameSpeed() {
|
||||
const thisArg = this as BattleScene;
|
||||
|
||||
|
@ -32,4 +38,21 @@ export function initGameSpeed() {
|
|||
config.delay = transformValue(config.delay);
|
||||
return originalAddCounter.apply(this, [ config ]);
|
||||
};
|
||||
|
||||
const originalFadeOut = SoundFade.fadeOut;
|
||||
SoundFade.fadeOut = ((
|
||||
scene: Phaser.Scene,
|
||||
sound: Phaser.Sound.BaseSound,
|
||||
duration: number,
|
||||
destroy?: boolean
|
||||
) => originalFadeOut(scene, sound, thisArg.gameSpeed === 1 ? duration : Math.ceil(duration /= thisArg.gameSpeed), destroy)) as FadeOut;
|
||||
|
||||
const originalFadeIn = SoundFade.fadeIn;
|
||||
SoundFade.fadeIn = ((
|
||||
scene: Phaser.Scene,
|
||||
sound: string | Phaser.Sound.BaseSound,
|
||||
duration: number,
|
||||
endVolume?: number,
|
||||
startVolume?: number
|
||||
) => originalFadeIn(scene, sound, thisArg.gameSpeed === 1 ? duration : Math.ceil(duration /= thisArg.gameSpeed), endVolume, startVolume)) as FadeIn;
|
||||
}
|
|
@ -5,14 +5,16 @@ import Trainer from "../trainer";
|
|||
export default class TrainerData {
|
||||
public trainerType: TrainerType;
|
||||
public female: boolean;
|
||||
public partyTemplateIndex: integer;
|
||||
|
||||
constructor(source: Trainer | any) {
|
||||
const sourceTrainer = source instanceof Trainer ? source as Trainer : null;
|
||||
this.trainerType = sourceTrainer ? sourceTrainer.config.trainerType : source.trainerType;
|
||||
this.female = source.female;
|
||||
this.partyTemplateIndex = source.partyMemberTemplateIndex;
|
||||
}
|
||||
|
||||
toTrainer(scene: BattleScene): Trainer {
|
||||
return new Trainer(scene, this.trainerType, this.female);
|
||||
return new Trainer(scene, this.trainerType, this.female, this.partyTemplateIndex);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,6 @@ export function getUnlockableName(unlockable: Unlockables) {
|
|||
case Unlockables.ENDLESS_MODE:
|
||||
return 'Endless Mode';
|
||||
case Unlockables.MINI_BLACK_HOLE:
|
||||
return 'MINI BLACK HOLE';
|
||||
return 'Mini Black Hole';
|
||||
}
|
||||
}
|
142
src/trainer.ts
|
@ -1,16 +1,21 @@
|
|||
import BattleScene from "./battle-scene";
|
||||
import PokemonSpecies, { getPokemonSpecies } from "./data/pokemon-species";
|
||||
import { TrainerConfig, TrainerPartyType, TrainerType, trainerConfigs } from "./data/trainer-type";
|
||||
import { TrainerConfig, TrainerPartyCompoundTemplate, TrainerPartyMemberStrength, TrainerPartyTemplate, TrainerPoolTier, TrainerType, trainerConfigs, trainerPartyTemplates } from "./data/trainer-type";
|
||||
import { EnemyPokemon } from "./pokemon";
|
||||
import * as Utils from "./utils";
|
||||
|
||||
export default class Trainer extends Phaser.GameObjects.Container {
|
||||
public config: TrainerConfig;
|
||||
public female: boolean;
|
||||
public partyTemplateIndex: integer;
|
||||
|
||||
constructor(scene: BattleScene, trainerType: TrainerType, female?: boolean) {
|
||||
constructor(scene: BattleScene, trainerType: TrainerType, female?: boolean, partyTemplateIndex?: integer) {
|
||||
super(scene, -72, 80);
|
||||
this.config = trainerConfigs[trainerType];
|
||||
this.female = female;
|
||||
this.partyTemplateIndex = Math.min(partyTemplateIndex !== undefined ? partyTemplateIndex : Phaser.Math.RND.weightedPick(this.config.partyTemplates.map((_, i) => i)), this.config.partyTemplates.length - 1);
|
||||
|
||||
console.log(Object.keys(trainerPartyTemplates)[Object.values(trainerPartyTemplates).indexOf(this.getPartyTemplate())]);
|
||||
|
||||
const getSprite = (hasShadow?: boolean) => {
|
||||
const ret = this.scene.add.sprite(0, 0, this.getKey());
|
||||
|
@ -36,16 +41,116 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
return this.config.getName(this.female);
|
||||
}
|
||||
|
||||
genPartyMemberSpecies(level: integer, attempt?: integer): PokemonSpecies {
|
||||
const battle = this.scene.currentBattle;
|
||||
getBattleBgm(): string {
|
||||
return this.config.battleBgm;
|
||||
}
|
||||
|
||||
if (this.config.partyType === TrainerPartyType.REPEATED && battle.enemyParty.length)
|
||||
return getPokemonSpecies(battle.enemyParty[0].species.getSpeciesForLevel(level));
|
||||
const ret = getPokemonSpecies(this.scene.randomSpecies(battle.waveIndex, level, this.config.speciesFilter, true).getSpeciesForLevel(level));
|
||||
if (this.config.partyType === TrainerPartyType.BALANCED) {
|
||||
const partyTypes = this.scene.getEnemyParty().map(p => p.getTypes()).flat();
|
||||
if ((attempt || 0) < 10 && (partyTypes.indexOf(ret.type1) > -1 || (ret.type2 !== null && partyTypes.indexOf(ret.type2) > -1)))
|
||||
return this.genPartyMemberSpecies(level, (attempt || 0) + 1);
|
||||
getEncounterBgm(): string {
|
||||
return !this.female ? this.config.encounterBgm : this.config.femaleEncounterBgm || this.config.encounterBgm;
|
||||
}
|
||||
|
||||
getPartyTemplate(): TrainerPartyTemplate {
|
||||
return this.config.partyTemplates[this.partyTemplateIndex];
|
||||
}
|
||||
|
||||
getPartyLevels(waveIndex: integer): integer[] {
|
||||
const ret = [];
|
||||
const partyTemplate = this.getPartyTemplate();
|
||||
|
||||
let baseLevel = 1 + waveIndex / 2 + Math.pow(waveIndex / 25, 2);
|
||||
|
||||
for (let i = 0; i < partyTemplate.size; i++) {
|
||||
let multiplier = 1;
|
||||
|
||||
const strength = partyTemplate.getStrength(i)
|
||||
|
||||
switch (strength) {
|
||||
case TrainerPartyMemberStrength.WEAKER:
|
||||
multiplier = 0.95;
|
||||
break;
|
||||
case TrainerPartyMemberStrength.WEAK:
|
||||
multiplier = 1.0;
|
||||
break;
|
||||
case TrainerPartyMemberStrength.AVERAGE:
|
||||
multiplier = 1.1;
|
||||
break;
|
||||
case TrainerPartyMemberStrength.STRONG:
|
||||
multiplier = 1.2;
|
||||
break;
|
||||
case TrainerPartyMemberStrength.STRONGER:
|
||||
multiplier = 1.25;
|
||||
break;
|
||||
}
|
||||
|
||||
let level = Math.ceil(baseLevel * multiplier);
|
||||
if (strength < TrainerPartyMemberStrength.STRONG) {
|
||||
const minLevel = Math.ceil(baseLevel * 1.2) - Math.floor(waveIndex / 25);
|
||||
if (level < minLevel)
|
||||
level = minLevel;
|
||||
}
|
||||
|
||||
ret.push(level);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
genPartyMember(index: integer): EnemyPokemon {
|
||||
const battle = this.scene.currentBattle;
|
||||
const level = battle.enemyLevels[index];
|
||||
|
||||
let ret: EnemyPokemon;
|
||||
|
||||
this.scene.executeWithSeedOffset(() => {
|
||||
if (this.config.partyMemberFuncs.hasOwnProperty(index)) {
|
||||
ret = this.config.partyMemberFuncs[index](this.scene, level);
|
||||
return;
|
||||
}
|
||||
|
||||
const template = this.getPartyTemplate();
|
||||
|
||||
let offset = 0;
|
||||
|
||||
if (template instanceof TrainerPartyCompoundTemplate) {
|
||||
for (let innerTemplate of template.templates) {
|
||||
if (offset + innerTemplate.size > index)
|
||||
break;
|
||||
offset += innerTemplate.size;
|
||||
}
|
||||
}
|
||||
|
||||
const species = template.isSameSpecies(index) && index > offset
|
||||
? getPokemonSpecies(battle.enemyParty[offset].species.getSpeciesForLevel(level))
|
||||
: this.genNewPartyMemberSpecies(level);
|
||||
|
||||
ret = new EnemyPokemon(this.scene, species, level);
|
||||
}, this.config.staticParty ? this.config.getDerivedType() + ((index + 1) << 8) : this.scene.currentBattle.waveIndex + (this.config.getDerivedType() << 10) + ((index + 1) << 8));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
genNewPartyMemberSpecies(level: integer, attempt?: integer): PokemonSpecies {
|
||||
const battle = this.scene.currentBattle;
|
||||
const template = this.getPartyTemplate();
|
||||
|
||||
let ret: PokemonSpecies;
|
||||
if (this.config.speciesPools) {
|
||||
const tierValue = Utils.randSeedInt(512);
|
||||
let tier = tierValue >= 156 ? TrainerPoolTier.COMMON : tierValue >= 32 ? TrainerPoolTier.UNCOMMON : tierValue >= 6 ? TrainerPoolTier.RARE : tierValue >= 1 ? TrainerPoolTier.SUPER_RARE : TrainerPoolTier.ULTRA_RARE
|
||||
console.log(TrainerPoolTier[tier]);
|
||||
while (!this.config.speciesPools[tier].length) {
|
||||
console.log(`Downgraded trainer Pokemon rarity tier from ${TrainerPoolTier[tier]} to ${TrainerPoolTier[tier - 1]}`);
|
||||
tier--;
|
||||
}
|
||||
const tierPool = this.config.speciesPools[tier];
|
||||
ret = getPokemonSpecies(getPokemonSpecies(Phaser.Math.RND.pick(tierPool)).getSpeciesForLevel(level));
|
||||
} else
|
||||
ret = getPokemonSpecies(this.scene.randomSpecies(battle.waveIndex, level, this.config.speciesFilter).getSpeciesForLevel(level));
|
||||
|
||||
if (template.isBalanced(battle.enemyParty.length)) {
|
||||
const partyMemberTypes = battle.enemyParty.map(p => p.getTypes()).flat();
|
||||
if ((attempt || 0) < 10 && (partyMemberTypes.indexOf(ret.type1) > -1 || (ret.type2 !== null && partyMemberTypes.indexOf(ret.type2) > -1)))
|
||||
ret = this.genNewPartyMemberSpecies(level, (attempt || 0) + 1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -57,8 +162,11 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
const partyMemberScores = nonFaintedPartyMembers.map(p => {
|
||||
const playerField = this.scene.getPlayerField();
|
||||
let score = 0;
|
||||
for (let playerPokemon of playerField)
|
||||
for (let playerPokemon of playerField) {
|
||||
score += p.getMatchupScore(playerPokemon);
|
||||
if (playerPokemon.species.legendary)
|
||||
score /= 2;
|
||||
}
|
||||
score /= playerField.length;
|
||||
return [ party.indexOf(p), score ];
|
||||
});
|
||||
|
@ -71,16 +179,21 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
});
|
||||
|
||||
const maxScorePartyMemberIndexes = partyMemberScores.filter(pms => pms[1] === sortedPartyMemberScores[0][1]).map(pms => pms[0]);
|
||||
return maxScorePartyMemberIndexes[Utils.randInt(maxScorePartyMemberIndexes.length)];
|
||||
return maxScorePartyMemberIndexes[Utils.randSeedInt(maxScorePartyMemberIndexes.length)];
|
||||
}
|
||||
|
||||
loadAssets(): Promise<void> {
|
||||
return this.config.loadAssets(this.scene, this.female);
|
||||
}
|
||||
|
||||
initSprite(): void {
|
||||
this.getSprite().setTexture(this.getKey());
|
||||
this.getTintSprite().setTexture(this.getKey());
|
||||
}
|
||||
|
||||
playAnim(): void {
|
||||
const trainerAnimConfig = {
|
||||
key: this.scene.currentBattle.trainer.getKey(),
|
||||
key: this.getKey(),
|
||||
repeat: 0
|
||||
};
|
||||
this.getSprite().play(trainerAnimConfig);
|
||||
|
@ -134,7 +247,6 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
export default interface Trainer {
|
||||
scene: BattleScene
|
||||
}
|
|
@ -32,7 +32,7 @@ export default class BallUiHandler extends UiHandler {
|
|||
|
||||
for (let pb = 0; pb < Object.keys(this.scene.pokeballCounts).length; pb++)
|
||||
optionsTextContent += `${getPokeballName(pb)}\n`;
|
||||
optionsTextContent += 'CANCEL';
|
||||
optionsTextContent += 'Cancel';
|
||||
const optionsText = addTextObject(this.scene, 0, 0, optionsTextContent, TextStyle.WINDOW, { align: 'right', maxLines: 6 });
|
||||
optionsText.setOrigin(0, 0);
|
||||
optionsText.setPositionRelative(this.pokeballSelectBg, 42, 9);
|
||||
|
|
|
@ -9,14 +9,16 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
private levelUpStatsContainer: Phaser.GameObjects.Container;
|
||||
private levelUpStatsIncrContent: Phaser.GameObjects.Text;
|
||||
private levelUpStatsValuesContent: Phaser.GameObjects.Text;
|
||||
private nameText: Phaser.GameObjects.Text;
|
||||
|
||||
public bg: Phaser.GameObjects.Image;
|
||||
public nameBoxContainer: Phaser.GameObjects.Container;
|
||||
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene, Mode.MESSAGE);
|
||||
}
|
||||
|
||||
setup() {
|
||||
setup(): void {
|
||||
const ui = this.getUi();
|
||||
|
||||
this.textTimer = null;
|
||||
|
@ -41,6 +43,18 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
|
||||
this.message = message;
|
||||
|
||||
this.nameBoxContainer = this.scene.add.container(0, -16);
|
||||
this.nameBoxContainer.setVisible(false);
|
||||
|
||||
const nameBox = this.scene.add.nineslice(0, 0, 'namebox', null, 72, 16, 8, 8, 5, 5);
|
||||
nameBox.setOrigin(0, 0);
|
||||
|
||||
this.nameText = addTextObject(this.scene, 8, 0, 'Rival', TextStyle.MESSAGE, { maxLines: 1 });
|
||||
|
||||
this.nameBoxContainer.add(nameBox);
|
||||
this.nameBoxContainer.add(this.nameText);
|
||||
messageContainer.add(this.nameBoxContainer);
|
||||
|
||||
const prompt = this.scene.add.sprite(0, 0, 'prompt');
|
||||
prompt.setVisible(false);
|
||||
prompt.setOrigin(0, 0);
|
||||
|
@ -81,14 +95,14 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
this.levelUpStatsValuesContent = levelUpStatsValuesContent;
|
||||
}
|
||||
|
||||
show(args: any[]) {
|
||||
show(args: any[]): void {
|
||||
super.show(args);
|
||||
|
||||
this.bg.setTexture('bg');
|
||||
this.message.setWordWrapWidth(1780);
|
||||
}
|
||||
|
||||
processInput(button: Button) {
|
||||
processInput(button: Button): void {
|
||||
const ui = this.getUi();
|
||||
if (this.awaitingActionInput) {
|
||||
if (button === Button.CANCEL || button === Button.ACTION) {
|
||||
|
@ -102,11 +116,21 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
clear(): void {
|
||||
super.clear();
|
||||
}
|
||||
|
||||
promptLevelUpStats(partyMemberIndex: integer, prevStats: integer[], showTotals: boolean, callback?: Function) {
|
||||
showText(text: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
|
||||
this.hideNameText();
|
||||
super.showText(text, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
}
|
||||
|
||||
showDialogue(text: string, name: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
|
||||
this.showNameText(name);
|
||||
super.showDialogue(text, name, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
}
|
||||
|
||||
promptLevelUpStats(partyMemberIndex: integer, prevStats: integer[], showTotals: boolean, callback?: Function): void {
|
||||
const newStats = (this.scene as BattleScene).getParty()[partyMemberIndex].stats;
|
||||
let levelUpStatsValuesText = '';
|
||||
const stats = Utils.getEnumValues(Stat);
|
||||
|
@ -126,4 +150,13 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
showNameText(name: string): void {
|
||||
this.nameBoxContainer.setVisible(true);
|
||||
this.nameText.setText(name);
|
||||
}
|
||||
|
||||
hideNameText(): void {
|
||||
this.nameBoxContainer.setVisible(false);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import { CommandPhase } from "../battle-phases";
|
||||
import BattleScene, { Button } from "../battle-scene";
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import { toPokemonUpperCase } from "../utils";
|
||||
import PartyUiHandler, { PartyUiMode } from "./party-ui-handler";
|
||||
import UI, { Mode } from "./ui";
|
||||
import UiHandler from "./uiHandler";
|
||||
|
@ -23,7 +22,7 @@ export default class CommandUiHandler extends UiHandler {
|
|||
|
||||
setup() {
|
||||
const ui = this.getUi();
|
||||
const commands = [ 'Fight', 'Ball', 'Pokémon', 'Run' ].map(s => toPokemonUpperCase(s));
|
||||
const commands = [ 'Fight', 'Ball', 'Pokémon', 'Run' ];
|
||||
|
||||
this.commandsContainer = this.scene.add.container(216, -38.7);
|
||||
this.commandsContainer.setVisible(false);
|
||||
|
|
|
@ -18,6 +18,14 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
|
|||
}
|
||||
|
||||
showText(text: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
|
||||
this.showTextInternal(text, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
}
|
||||
|
||||
showDialogue(text: string, name: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer) {
|
||||
this.showTextInternal(text, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
}
|
||||
|
||||
private showTextInternal(text: string, delay: integer, callback: Function, callbackDelay: integer, prompt: boolean, promptDelay: integer) {
|
||||
if (delay === null || delay === undefined)
|
||||
delay = 20;
|
||||
let delayMap = new Map<integer, integer>();
|
||||
|
|
|
@ -188,7 +188,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||
ui.showText(this.options[this.cursor].modifierTypeOption.type.description);
|
||||
} else {
|
||||
this.cursorObj.setPosition((this.scene.game.canvas.width / 6) - 50, -60);
|
||||
ui.showText('Transfer a held item from one POKéMON to another instead of selecting an item');
|
||||
ui.showText('Transfer a held item from one Pokémon to another instead of selecting an item');
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -249,7 +249,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
});
|
||||
});
|
||||
} else
|
||||
this.showText('You can\'t release a POKéMON that\'s in battle!', null, () => this.showText(null, 0), null, true);
|
||||
this.showText('You can\'t release a Pokémon that\'s in battle!', null, () => this.showText(null, 0), null, true);
|
||||
} else if (option === PartyOption.CANCEL)
|
||||
this.processInput(Button.CANCEL);
|
||||
} else if (button === Button.CANCEL) {
|
||||
|
@ -473,7 +473,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
optionName = pokemon.moveset[option - PartyOption.MOVE_1].getName();
|
||||
break;
|
||||
default:
|
||||
optionName = PartyOption[option].replace(/\_/g, ' ');
|
||||
optionName = Utils.toReadableString(PartyOption[option]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -694,13 +694,13 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||
let slotTmText: string;
|
||||
switch (true) {
|
||||
case (this.pokemon.compatibleTms.indexOf(tmMoveId) === -1):
|
||||
slotTmText = 'NOT ABLE';
|
||||
slotTmText = 'Not Able';
|
||||
break;
|
||||
case (this.pokemon.getMoveset().filter(m => m?.moveId === tmMoveId).length > 0):
|
||||
slotTmText = 'LEARNED';
|
||||
slotTmText = 'Learned';
|
||||
break;
|
||||
default:
|
||||
slotTmText = 'ABLE';
|
||||
slotTmText = 'Able';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ class PartyCancelButton extends Phaser.GameObjects.Container {
|
|||
|
||||
this.partyCancelPb = partyCancelPb;
|
||||
|
||||
const partyCancelText = addTextObject(this.scene, -7, -6, 'CANCEL', TextStyle.PARTY);
|
||||
const partyCancelText = addTextObject(this.scene, -7, -6, 'Cancel', TextStyle.PARTY);
|
||||
this.add(partyCancelText);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
import BattleScene from "../battle-scene";
|
||||
import Pokemon from "../pokemon";
|
||||
|
||||
export default class PokeballTray extends Phaser.GameObjects.Container {
|
||||
private player: boolean;
|
||||
|
||||
private bg: Phaser.GameObjects.NineSlice;
|
||||
private balls: Phaser.GameObjects.Sprite[];
|
||||
|
||||
public shown: boolean;
|
||||
|
||||
constructor(scene: BattleScene, player: boolean) {
|
||||
super(scene, player ? (scene.game.canvas.width / 6) : 0, player ? -72 : -144);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
setup(): void {
|
||||
this.bg = this.scene.add.nineslice(0, 0, `pb_tray_overlay_${this.player ? 'player' : 'enemy'}`, null, 104, 4, 48, 8, 0, 0);
|
||||
this.bg.setOrigin(this.player ? 1 : 0, 0);
|
||||
|
||||
this.add(this.bg);
|
||||
|
||||
this.balls = new Array(6).fill(null).map((_, i) => this.scene.add.sprite((this.player ? -83 : 76) + (this.scene.game.canvas.width / 6) * (this.player ? -1 : 1) + 10 * i * (this.player ? 1 : -1), -8, 'pb_tray_ball', 'empty'));
|
||||
|
||||
for (let ball of this.balls) {
|
||||
ball.setOrigin(0, 0);
|
||||
this.add(ball);
|
||||
}
|
||||
|
||||
this.setVisible(false);
|
||||
this.shown = false;
|
||||
}
|
||||
|
||||
showPbTray(party: Pokemon[]): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
if (this.shown)
|
||||
return resolve();
|
||||
|
||||
(this.scene as BattleScene).fieldUI.bringToTop(this);
|
||||
|
||||
this.x += 104 * (this.player ? 1 : -1);
|
||||
|
||||
this.bg.width = 104;
|
||||
this.bg.alpha = 1;
|
||||
|
||||
this.balls.forEach((ball, b) => {
|
||||
ball.x += (this.scene.game.canvas.width / 6 + 104) * (this.player ? 1 : -1);
|
||||
let ballFrame = 'ball';
|
||||
if (b >= party.length)
|
||||
ballFrame = 'empty';
|
||||
else if (!party[b].hp)
|
||||
ballFrame = 'fainted';
|
||||
else if (party[b].status)
|
||||
ballFrame = 'status';
|
||||
ball.setFrame(ballFrame);
|
||||
});
|
||||
|
||||
this.scene.sound.play('pb_tray_enter');
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this,
|
||||
x: `${this.player ? '-' : '+'}=104`,
|
||||
duration: 500,
|
||||
ease: 'Sine.easeIn',
|
||||
onComplete: () => {
|
||||
this.balls.forEach((ball, b) => {
|
||||
this.scene.tweens.add({
|
||||
targets: ball,
|
||||
x: `${this.player ? '-' : '+'}=104`,
|
||||
duration: b * 100,
|
||||
ease: 'Sine.easeIn',
|
||||
onComplete: () => this.scene.sound.play(b < party.length ? 'pb_tray_ball' : 'pb_tray_empty')
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.setVisible(true);
|
||||
this.shown = true;
|
||||
|
||||
this.scene.time.delayedCall(1100, () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
hide(): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
if (!this.shown)
|
||||
return resolve();
|
||||
|
||||
this.balls.forEach((ball, b) => {
|
||||
this.scene.tweens.add({
|
||||
targets: ball,
|
||||
x: `${this.player ? '-' : '+'}=${this.scene.game.canvas.width / 6}`,
|
||||
duration: 250,
|
||||
delay: b * 100,
|
||||
ease: 'Sine.easeIn'
|
||||
});
|
||||
});
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this.bg,
|
||||
width: 144,
|
||||
alpha: 0,
|
||||
duration: 500,
|
||||
ease: 'Sine.easeIn'
|
||||
});
|
||||
|
||||
this.scene.time.delayedCall(850, () => {
|
||||
this.setVisible(false);
|
||||
resolve();
|
||||
});
|
||||
|
||||
this.shown = false;
|
||||
});
|
||||
};
|
||||
}
|
|
@ -94,7 +94,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.pokemonGenderText.setOrigin(0, 0);
|
||||
this.starterSelectContainer.add(this.pokemonGenderText);
|
||||
|
||||
this.pokemonAbilityLabelText = addTextObject(this.scene, 6, 126, 'ABILITY:', TextStyle.SUMMARY, { fontSize: '64px' });
|
||||
this.pokemonAbilityLabelText = addTextObject(this.scene, 6, 126, 'Ability:', TextStyle.SUMMARY, { fontSize: '64px' });
|
||||
this.pokemonAbilityLabelText.setOrigin(0, 0);
|
||||
this.pokemonAbilityLabelText.setVisible(false);
|
||||
this.starterSelectContainer.add(this.pokemonAbilityLabelText);
|
||||
|
@ -276,7 +276,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
this.popStarter();
|
||||
this.clearText();
|
||||
};
|
||||
ui.showText('Begin with these POKéMON?', null, () => {
|
||||
ui.showText('Begin with these Pokémon?', null, () => {
|
||||
ui.setModeWithoutClear(Mode.CONFIRM, () => {
|
||||
const startRun = (gameMode: GameMode) => {
|
||||
this.scene.gameMode = gameMode;
|
||||
|
@ -467,7 +467,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
|
||||
if (species && this.speciesStarterDexEntry) {
|
||||
this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 3));
|
||||
this.pokemonNameText.setText(species.name.toUpperCase());
|
||||
this.pokemonNameText.setText(species.name);
|
||||
this.pokemonAbilityLabelText.setVisible(true);
|
||||
|
||||
this.setSpeciesDetails(species, !!this.speciesStarterDexEntry?.shiny, this.speciesStarterDexEntry?.formIndex, !!this.speciesStarterDexEntry?.female, this.speciesStarterDexEntry?.abilityIndex);
|
||||
|
|
|
@ -109,12 +109,19 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
this.summaryContainer.add(this.genderText);
|
||||
|
||||
this.moveEffectContainer = this.scene.add.container(106, -62);
|
||||
|
||||
this.summaryContainer.add(this.moveEffectContainer);
|
||||
|
||||
const moveEffectBg = this.scene.add.image(0, 0, 'summary_moves_effect');
|
||||
moveEffectBg.setOrigin(0, 0);
|
||||
this.moveEffectContainer.add(moveEffectBg);
|
||||
|
||||
const moveEffectLabels = addTextObject(this.scene, 8, 12, 'Power\nAccuracy\nCategory', TextStyle.SUMMARY);
|
||||
moveEffectLabels.setLineSpacing(9);
|
||||
moveEffectLabels.setOrigin(0, 0);
|
||||
|
||||
this.moveEffectContainer.add(moveEffectLabels);
|
||||
|
||||
this.movePowerText = addTextObject(this.scene, 99, 27, '0', TextStyle.WINDOW);
|
||||
this.movePowerText.setOrigin(1, 1);
|
||||
this.moveEffectContainer.add(this.movePowerText);
|
||||
|
@ -420,7 +427,7 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
const profileContainer = this.scene.add.container(0, -pageBg.height);
|
||||
pageContainer.add(profileContainer);
|
||||
|
||||
const typeLabel = addTextObject(this.scene, 7, 28, 'TYPE/', TextStyle.WINDOW);
|
||||
const typeLabel = addTextObject(this.scene, 7, 28, 'Type/', TextStyle.WINDOW);
|
||||
typeLabel.setOrigin(0, 0);
|
||||
profileContainer.add(typeLabel);
|
||||
|
||||
|
@ -483,11 +490,11 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
const totalLvExp = getLevelTotalExp(this.pokemon.level, this.pokemon.species.growthRate);
|
||||
const expRatio = this.pokemon.level < this.scene.getMaxExpLevel() ? this.pokemon.levelExp / totalLvExp : 0;
|
||||
|
||||
const expLabel = addTextObject(this.scene, 6, 112, 'EXP. POINTS', TextStyle.SUMMARY);
|
||||
const expLabel = addTextObject(this.scene, 6, 112, 'EXP. Points', TextStyle.SUMMARY);
|
||||
expLabel.setOrigin(0, 0);
|
||||
statsContainer.add(expLabel);
|
||||
|
||||
const nextLvExpLabel = addTextObject(this.scene, 6, 128, 'NEXT LV.', TextStyle.SUMMARY);
|
||||
const nextLvExpLabel = addTextObject(this.scene, 6, 128, 'Next Lv.', TextStyle.SUMMARY);
|
||||
nextLvExpLabel.setOrigin(0, 0);
|
||||
statsContainer.add(nextLvExpLabel);
|
||||
|
||||
|
@ -528,7 +535,7 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
extraRowOverlay.setOrigin(0, 1);
|
||||
this.extraMoveRowContainer.add(extraRowOverlay);
|
||||
|
||||
const extraRowText = addTextObject(this.scene, 35, 0, this.summaryUiMode === SummaryUiMode.LEARN_MOVE ? this.newMove.name : 'CANCEL',
|
||||
const extraRowText = addTextObject(this.scene, 35, 0, this.summaryUiMode === SummaryUiMode.LEARN_MOVE ? this.newMove.name : 'Cancel',
|
||||
this.summaryUiMode === SummaryUiMode.LEARN_MOVE ? TextStyle.SUMMARY_RED : TextStyle.SUMMARY);
|
||||
extraRowText.setOrigin(0, 1);
|
||||
this.extraMoveRowContainer.add(extraRowText);
|
||||
|
|
|
@ -26,7 +26,6 @@ export function addTextObject(scene: Phaser.Scene, x: number, y: number, content
|
|||
case TextStyle.SUMMARY:
|
||||
case TextStyle.SUMMARY_RED:
|
||||
case TextStyle.SUMMARY_GOLD:
|
||||
styleOptions.padding = undefined;
|
||||
case TextStyle.WINDOW:
|
||||
case TextStyle.MESSAGE:
|
||||
styleOptions.fontSize = '96px';
|
||||
|
|
|
@ -104,6 +104,14 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
this.getMessageHandler().showText(text, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
}
|
||||
|
||||
showDialogue(text: string, name: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer): void {
|
||||
const handler = this.getHandler();
|
||||
if (handler instanceof MessageUiHandler)
|
||||
(handler as MessageUiHandler).showDialogue(text, name, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
else
|
||||
this.getMessageHandler().showDialogue(text, name, delay, callback, callbackDelay, prompt, promptDelay);
|
||||
}
|
||||
|
||||
clearText(): void {
|
||||
const handler = this.getHandler();
|
||||
if (handler instanceof MessageUiHandler)
|
||||
|
|
39
src/utils.ts
|
@ -1,5 +1,32 @@
|
|||
export function toPokemonUpperCase(input: string): string {
|
||||
return input.replace(/([a-z]+)/g, s => s.toUpperCase());
|
||||
export function toReadableString(str: string): string {
|
||||
return str.replace(/\_/g, ' ').split(' ').map(s => `${s.slice(0, 1)}${s.slice(1).toLowerCase()}`).join(' ');
|
||||
}
|
||||
|
||||
export function randomString(length: integer) {
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let result = '';
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
result += characters[randomIndex];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function shiftCharCodes(str: string, shiftCount: integer) {
|
||||
if (!shiftCount)
|
||||
shiftCount = 0;
|
||||
|
||||
let newStr = '';
|
||||
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
let charCode = str.charCodeAt(i);
|
||||
let newCharCode = charCode + shiftCount;
|
||||
newStr += String.fromCharCode(newCharCode);
|
||||
}
|
||||
|
||||
return newStr;
|
||||
}
|
||||
|
||||
export function clampInt(value: integer, min: integer, max: integer): integer {
|
||||
|
@ -30,6 +57,14 @@ export function randInt(range: integer, min?: integer): integer {
|
|||
return Math.floor(Math.random() * range) + min;
|
||||
}
|
||||
|
||||
export function randSeedInt(range: integer, min?: integer): integer {
|
||||
if (!min)
|
||||
min = 0;
|
||||
if (range === 1)
|
||||
return min;
|
||||
return Phaser.Math.RND.integerInRange(min, (range - 1) + min);
|
||||
}
|
||||
|
||||
export function randIntRange(min: integer, max: integer): integer {
|
||||
return randInt(max - min, min);
|
||||
}
|
||||
|
|