Add auto mode and various changes

pull/1/head
Flashfyre 2023-03-29 00:31:25 -04:00
parent 2f17903d30
commit a739a1666f
14 changed files with 806 additions and 502 deletions

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "ES2019",
"moduleResolution": "node", "moduleResolution": "node",
"checkJs": true, "checkJs": true,
"esModuleInterop": true "esModuleInterop": true

268
src/auto-play.ts Normal file
View File

@ -0,0 +1,268 @@
import { SelectModifierPhase } from "./battle-phase";
import BattleScene from "./battle-scene";
import { ModifierTier, ModifierType, PokemonBaseStatBoosterModifierType, PokemonHpRestoreModifierType, PokemonReviveModifierType } from "./modifier";
import Pokemon, { AiType, EnemyPokemon, PlayerPokemon, PokemonMove } from "./pokemon";
import { Species } from "./species";
import { getTypeDamageMultiplier } from "./type";
import BattleMessageUiHandler from "./ui/battle-message-ui-handler";
import CommandUiHandler from "./ui/command-ui-handler";
import FightUiHandler from "./ui/fight-ui-handler";
import MessageUiHandler from "./ui/message-ui-handler";
import ModifierSelectUiHandler from "./ui/modifier-select-ui-handler";
import PartyUiHandler from "./ui/party-ui-handler";
import SwitchCheckUiHandler from "./ui/switch-check-ui-handler";
import { Mode } from "./ui/ui";
export function initAutoPlay(speed: number) {
const thisArg = this as BattleScene;
const originalDelayedCall = this.time.delayedCall;
this.time.delayedCall = function (delay: number, callback: Function, args?: any[], callbackScope?: any) {
delay /= speed;
originalDelayedCall.apply(this, [ delay, callback, args, callbackScope ]);
};
const originalAddEvent = this.time.addEvent;
this.time.addEvent = function (config: Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig) {
if (config.delay)
config.delay = Math.ceil(config.delay / speed);
if (config.startAt)
config.startAt = Math.ceil(config.startAt / speed);
return originalAddEvent.apply(this, [ config ]);
};
const originalTweensAdd = this.tweens.add;
this.tweens.add = function (config: Phaser.Types.Tweens.TweenBuilderConfig | object) {
if (config.duration)
config.duration = Math.ceil(config.duration / speed);
if (config.delay)
config.delay = Math.ceil(config.delay / speed);
return originalTweensAdd.apply(this, [ config ]);
};
const originalAddCounter = this.tweens.addCounter;
this.tweens.addCounter = function (config: Phaser.Types.Tweens.NumberTweenBuilderConfig) {
if (config.duration)
config.duration = Math.ceil(config.duration / speed);
if (config.delay)
config.delay = Math.ceil(config.delay / speed);
return originalAddCounter.apply(this, [ config ]);
};
const keyCodes = Phaser.Input.Keyboard.KeyCodes;
PlayerPokemon.prototype.getNextMove = EnemyPokemon.prototype.getNextMove;
const playerPokemon = this.getParty()[0] as PlayerPokemon;
const messageUiHandler = this.ui.handlers[Mode.MESSAGE] as BattleMessageUiHandler;
const commandUiHandler = this.ui.handlers[Mode.COMMAND] as CommandUiHandler;
const fightUiHandler = this.ui.handlers[Mode.FIGHT] as FightUiHandler;
const partyUiHandler = this.ui.handlers[Mode.PARTY] as PartyUiHandler;
const switchCheckUiHandler = this.ui.handlers[Mode.SWITCH_CHECK] as SwitchCheckUiHandler;
const modifierSelectUiHandler = this.ui.handlers[Mode.MODIFIER_SELECT] as ModifierSelectUiHandler;
const getBestPartyMemberIndex = () => {
const enemyPokemon = thisArg.getEnemyPokemon();
const party = thisArg.getParty();
let bestPartyMemberIndex = -1;
let bestPartyMemberEffectiveness = 0.5;
for (let p = 0; p < party.length; p++) {
const pokemon = party[p];
if ((pokemon.hp / pokemon.getMaxHp()) <= 0.4)
continue;
const effectiveness = getMaxMoveEffectiveness(pokemon, enemyPokemon) / getMaxMoveEffectiveness(enemyPokemon, pokemon);
if (effectiveness > bestPartyMemberEffectiveness) {
bestPartyMemberIndex = p;
bestPartyMemberEffectiveness = effectiveness;
}
console.log(p, Species[pokemon.species.speciesId], '->', Species[enemyPokemon.species.speciesId], effectiveness);
}
if (bestPartyMemberIndex === -1) {
let highestHpValue = 0;
for (let p = 0; p < party.length; p++) {
const pokemon = party[p];
if (pokemon.hp > highestHpValue) {
highestHpValue = pokemon.hp;
bestPartyMemberIndex = p;
}
}
}
return bestPartyMemberIndex;
};
const getMaxMoveEffectiveness = (attacker: Pokemon, defender: Pokemon) => {
let maxEffectiveness = 0.5;
for (let m of attacker.moveset) {
const moveType = m.getMove().type;
let effectiveness = getTypeDamageMultiplier(moveType, defender.species.type1);
if (defender.species.type2 > -1)
effectiveness *= getTypeDamageMultiplier(moveType, defender.species.type2);
if (effectiveness > maxEffectiveness)
maxEffectiveness = effectiveness;
}
return maxEffectiveness;
};
let nextPartyMemberIndex = -1;
const originalMessageUiHandlerShowText = MessageUiHandler.prototype.showText;
MessageUiHandler.prototype.showText = function (text: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean) {
delay = 0;
callbackDelay = 0;
originalMessageUiHandlerShowText.apply(this, [ text, delay, callback, callbackDelay, prompt ]);
};
const originalMessageUiHandlerShowPrompt = MessageUiHandler.prototype.showPrompt;
MessageUiHandler.prototype.showPrompt = function (callback: Function, callbackDelay: integer) {
callbackDelay = 0;
originalMessageUiHandlerShowPrompt.apply(this, [ callback, callbackDelay ]);
thisArg.time.delayedCall(20, () => this.processInput(keyCodes.Z));
};
const originalMessageUiHandlerPromptLevelUpStats = messageUiHandler.promptLevelUpStats;
messageUiHandler.promptLevelUpStats = function (prevStats: integer[], showTotals: boolean, callback?: Function) {
originalMessageUiHandlerPromptLevelUpStats.apply(this, [ prevStats, showTotals, callback ]);
this.processInput(keyCodes.Z);
};
const originalCommandUiHandlerShow = commandUiHandler.show;
commandUiHandler.show = function (args: any[]) {
originalCommandUiHandlerShow.apply(this, [ args ]);
const bestPartyMemberIndex = getBestPartyMemberIndex();
if (bestPartyMemberIndex) {
console.log(bestPartyMemberIndex, thisArg.getParty())
console.log('Switching to ', Species[thisArg.getParty()[bestPartyMemberIndex].species.speciesId]);
nextPartyMemberIndex = bestPartyMemberIndex;
commandUiHandler.setCursor(2);
this.processInput(keyCodes.Z);
} else {
commandUiHandler.setCursor(0);
this.processInput(keyCodes.Z);
}
};
const originalFightUiHandlerShow = fightUiHandler.show;
fightUiHandler.show = function (args: any[]) {
originalFightUiHandlerShow.apply(this, [ args ]);
if (!playerPokemon.aiType)
playerPokemon.aiType = AiType.SMART;
thisArg.time.delayedCall(20, () => {
const nextMove = playerPokemon.getNextMove() as PokemonMove;
fightUiHandler.setCursor(playerPokemon.moveset.indexOf(nextMove));
this.processInput(keyCodes.Z);
});
};
const originalPartyUiHandlerShow = partyUiHandler.show;
partyUiHandler.show = function (args: any[]) {
originalPartyUiHandlerShow.apply(this, [ args ]);
thisArg.time.delayedCall(20, () => {
if (nextPartyMemberIndex === -1)
nextPartyMemberIndex = getBestPartyMemberIndex();
partyUiHandler.setCursor(nextPartyMemberIndex);
nextPartyMemberIndex = -1;
this.processInput(keyCodes.Z);
});
};
const originalSwitchCheckUiHandlerShow = switchCheckUiHandler.show;
switchCheckUiHandler.show = function (args: any[]) {
originalSwitchCheckUiHandlerShow.apply(this, [ args ]);
const bestPartyMemberIndex = getBestPartyMemberIndex();
thisArg.time.delayedCall(20, () => {
if (bestPartyMemberIndex)
nextPartyMemberIndex = bestPartyMemberIndex;
switchCheckUiHandler.setCursor(bestPartyMemberIndex ? 1 : 0);
this.processInput(keyCodes.Z);
});
}
const tryGetBestModifier = (modifierTypes: Array<ModifierType>, predicate: Function) => {
for (let mt = 0; mt < modifierTypes.length; mt++) {
const modifierType = modifierTypes[mt];
if (predicate(modifierType)) {
return mt;
}
}
return -1;
};
const originalModifierSelectUiHandlerShow = modifierSelectUiHandler.show;
modifierSelectUiHandler.show = function (args: any[]) {
if (modifierSelectUiHandler.active)
return;
originalModifierSelectUiHandlerShow.apply(this, [ args ]);
const party = thisArg.getParty();
const modifierTypes = modifierSelectUiHandler.options.map(o => o.modifierType);
const faintedPartyMemberIndex = party.findIndex(p => !p.hp);
const lowHpPartyMemberIndex = party.findIndex(p => (p.hp / p.getMaxHp()) <= 0.5);
const criticalHpPartyMemberIndex = party.findIndex(p => (p.hp / p.getMaxHp()) <= 0.25);
let optionIndex = tryGetBestModifier(modifierTypes, (modifierType: ModifierType) => {
if (modifierType instanceof PokemonHpRestoreModifierType) {
if (modifierType instanceof PokemonReviveModifierType) {
if (faintedPartyMemberIndex > -1) {
nextPartyMemberIndex = faintedPartyMemberIndex;
return true;
}
} else if (criticalHpPartyMemberIndex > -1){
nextPartyMemberIndex = faintedPartyMemberIndex;
return true;
}
}
});
if (optionIndex === -1) {
optionIndex = tryGetBestModifier(modifierTypes, (modifierType: ModifierType) => {
if (modifierType.tier >= ModifierTier.ULTRA) {
nextPartyMemberIndex = 0;
return true;
}
});
}
if (optionIndex === -1) {
optionIndex = tryGetBestModifier(modifierTypes, (modifierType: ModifierType) => {
if (modifierType instanceof PokemonBaseStatBoosterModifierType) {
nextPartyMemberIndex = 0;
return true;
}
});
}
if (optionIndex === -1) {
optionIndex = tryGetBestModifier(modifierTypes, (modifierType: ModifierType) => {
if (lowHpPartyMemberIndex && modifierType instanceof PokemonHpRestoreModifierType && !(ModifierType instanceof PokemonReviveModifierType)) {
nextPartyMemberIndex = lowHpPartyMemberIndex;
return true;
}
});
}
if (optionIndex === -1)
optionIndex = 0;
const trySelectModifier = () => {
modifierSelectUiHandler.setCursor(optionIndex);
thisArg.time.delayedCall(20, () => {
modifierSelectUiHandler.processInput(keyCodes.Z);
thisArg.time.delayedCall(100, () => {
console.log(modifierTypes[optionIndex]?.name);
if (thisArg.getCurrentPhase() instanceof SelectModifierPhase) {
if (optionIndex < modifierSelectUiHandler.options.length - 1) {
optionIndex++;
trySelectModifier();
} else
modifierSelectUiHandler.processInput(keyCodes.X);
}
});
});
};
thisArg.time.delayedCall(4000, () => trySelectModifier());
}
}

View File

@ -74,23 +74,26 @@ export class NextEncounterPhase extends BattlePhase {
this.scene.getEnemyPokemon().destroy(); this.scene.getEnemyPokemon().destroy();
const newEnemyPokemon = new EnemyPokemon(this.scene, this.scene.randomSpecies(true), this.scene.getLevelForWave()); const newEnemyPokemon = new EnemyPokemon(this.scene, this.scene.randomSpecies(true), this.scene.getLevelForWave());
this.scene.setEnemyPokemon(newEnemyPokemon); newEnemyPokemon.loadAssets().then(() => {
this.scene.field.add(newEnemyPokemon); this.scene.setEnemyPokemon(newEnemyPokemon);
this.scene.field.moveBelow(newEnemyPokemon, this.scene.getPlayerPokemon()); this.scene.field.add(newEnemyPokemon);
newEnemyPokemon.tint(0, 0.5); this.scene.field.moveBelow(newEnemyPokemon, this.scene.getPlayerPokemon());
this.scene.tweens.add({ newEnemyPokemon.tint(0, 0.5);
targets: [ this.scene.arenaEnemy, this.scene.arenaEnemy2, newEnemyPokemon ], this.scene.tweens.add({
x: '+=300', targets: [ this.scene.arenaEnemy, this.scene.arenaEnemy2, newEnemyPokemon ],
duration: 2000, x: '+=300',
onComplete: () => { duration: 2000,
this.scene.arenaEnemy.setX(this.scene.arenaEnemy2.x); onComplete: () => {
this.scene.arenaEnemy2.setX(this.scene.arenaEnemy2.x - 300); this.scene.arenaEnemy.setX(this.scene.arenaEnemy2.x);
newEnemyPokemon.untint(100, 'Sine.easeOut'); this.scene.arenaEnemy2.setX(this.scene.arenaEnemy2.x - 300);
newEnemyPokemon.cry(); newEnemyPokemon.untint(100, 'Sine.easeOut');
newEnemyPokemon.showInfo(); newEnemyPokemon.cry();
this.scene.ui.showText(`A wild ${newEnemyPokemon.name} appeared!`, null, () => this.end(), 1500); newEnemyPokemon.showInfo();
} this.scene.ui.showText(`A wild ${newEnemyPokemon.name} appeared!`, null, () => this.end(), 1500);
}); }
});
});
this.scene.load.start();
} }
end() { end() {
@ -241,7 +244,7 @@ export class CheckSwitchPhase extends BattlePhase {
start() { start() {
super.start(); super.start();
this.scene.ui.showText('Will you switch\nPokémon?', null, () => { this.scene.ui.showText('Will you switch\nPOKéMON?', null, () => {
this.scene.ui.setMode(Mode.SWITCH_CHECK, () => this.end()); this.scene.ui.setMode(Mode.SWITCH_CHECK, () => this.end());
}); });
} }
@ -340,6 +343,8 @@ abstract class MovePhase extends BattlePhase {
this.end(); this.end();
return; return;
} }
if (!this.move)
console.log(this.pokemon.moveset);
this.scene.ui.showText(`${this.pokemon.name} used\n${this.move.getName()}!`, null, () => this.end(), 500); this.scene.ui.showText(`${this.pokemon.name} used\n${this.move.getName()}!`, null, () => this.end(), 500);
if (this.move.getMove().category !== MOVE_CATEGORY.STATUS) if (this.move.getMove().category !== MOVE_CATEGORY.STATUS)
this.scene.unshiftPhase(this.getDamagePhase()); this.scene.unshiftPhase(this.getDamagePhase());

View File

@ -3,13 +3,17 @@ import { ArenaType, Arena } from './arena';
import UI from './ui/ui'; import UI from './ui/ui';
import { BattlePhase, EncounterPhase, SummonPhase, CommandPhase } from './battle-phase'; import { BattlePhase, EncounterPhase, SummonPhase, CommandPhase } from './battle-phase';
import { PlayerPokemon, EnemyPokemon } from './pokemon'; import { PlayerPokemon, EnemyPokemon } from './pokemon';
import PokemonSpecies, { default as Pokemon, allSpecies } from './pokemon-species'; import PokemonSpecies, { allSpecies, getPokemonSpecies } from './pokemon-species';
import * as Utils from './utils'; import * as Utils from './utils';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonModifierType, PokemonModifier } from './modifier'; import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonModifier } from './modifier';
import { Stat } from './pokemon-stat';
import { PokeballType } from './pokeball'; import { PokeballType } from './pokeball';
import { Species } from './species';
import { initAutoPlay } from './auto-play';
export default class BattleScene extends Phaser.Scene { export default class BattleScene extends Phaser.Scene {
private auto: boolean;
private autoSpeed: integer = 10;
private phaseQueue: Array<BattlePhase>; private phaseQueue: Array<BattlePhase>;
private phaseQueuePrepend: Array<BattlePhase>; private phaseQueuePrepend: Array<BattlePhase>;
private currentPhase: BattlePhase; private currentPhase: BattlePhase;
@ -190,7 +194,7 @@ export default class BattleScene extends Phaser.Scene {
new Arena(this, ArenaType.ARENA_PINK, 'elite_4'), new Arena(this, ArenaType.ARENA_PINK, 'elite_4'),
new Arena(this, ArenaType.ARENA_ORANGE, 'elite_5') new Arena(this, ArenaType.ARENA_ORANGE, 'elite_5')
]; ];
const arena = arenas[Utils.randInt(15)]; const arena = arenas[0];//arenas[Utils.randInt(15)];
this.arena = arena; this.arena = arena;
@ -218,17 +222,20 @@ export default class BattleScene extends Phaser.Scene {
this.modifiers = []; this.modifiers = [];
this.modifierBar = new ModifierBar(this); this.modifierBar = new ModifierBar(this);
this.add.existing(this.modifierBar); this.add.existing(this.modifierBar);
uiContainer.add(this.modifierBar); uiContainer.add(this.modifierBar);
this.waveIndex = 1; this.waveIndex = 1;
this.party = []; this.party = [];
let loadPokemonAssets = [];
for (let s = 0; s < 3; s++) { for (let s = 0; s < 3; s++) {
const playerSpecies = this.randomSpecies(); const playerSpecies = getPokemonSpecies(s === 0 ? Species.TORCHIC : s === 1 ? Species.TREECKO : Species.MUDKIP); //this.randomSpecies();
const playerPokemon = new PlayerPokemon(this, playerSpecies, 5); const playerPokemon = new PlayerPokemon(this, playerSpecies, 5);
playerPokemon.setVisible(false); playerPokemon.setVisible(false);
loadPokemonAssets.push(playerPokemon.loadAssets());
this.party.push(playerPokemon); this.party.push(playerPokemon);
} }
@ -236,6 +243,7 @@ export default class BattleScene extends Phaser.Scene {
const enemySpecies = arena.randomSpecies(1); const enemySpecies = arena.randomSpecies(1);
console.log(enemySpecies.name); console.log(enemySpecies.name);
const enemyPokemon = new EnemyPokemon(this, enemySpecies, this.getLevelForWave()); const enemyPokemon = new EnemyPokemon(this, enemySpecies, this.getLevelForWave());
loadPokemonAssets.push(enemyPokemon.loadAssets());
this.add.existing(enemyPokemon); this.add.existing(enemyPokemon);
this.enemyPokemon = enemyPokemon; this.enemyPokemon = enemyPokemon;
@ -274,16 +282,22 @@ export default class BattleScene extends Phaser.Scene {
ui.setup(); ui.setup();
this.phaseQueue.push(new EncounterPhase(this), new SummonPhase(this));
this.shiftPhase();
this.upKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.UP); this.upKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.UP);
this.downKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.DOWN); this.downKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.DOWN);
this.leftKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.LEFT); this.leftKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.LEFT);
this.rightKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.RIGHT); this.rightKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.RIGHT);
this.actionKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Z); this.actionKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Z);
this.cancelKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.X); this.cancelKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.X);
Promise.all(loadPokemonAssets).then(() => {
if (this.auto)
initAutoPlay.apply(this, [ this.autoSpeed ]);
this.phaseQueue.push(new EncounterPhase(this), new SummonPhase(this));
this.shiftPhase();
});
this.load.start();
} }
update() { update() {
@ -313,16 +327,14 @@ export default class BattleScene extends Phaser.Scene {
} }
getLevelForWave() { getLevelForWave() {
if (this.waveIndex === 1) let averageLevel = 1 + this.waveIndex * 0.25;
return 5;
let averageLevel = 5 + this.waveIndex * 0.5;
if (this.waveIndex % 10 === 0) if (this.waveIndex % 10 === 0)
return averageLevel + 5; return Math.floor(averageLevel * 1.25);
const deviation = 10 / this.waveIndex; const deviation = 10 / this.waveIndex;
return averageLevel + Math.round(Utils.randGauss(deviation)); return Math.max(Math.round(averageLevel + Utils.randGauss(deviation)), 1);
} }
checkInput(): boolean { checkInput(): boolean {

View File

@ -334,7 +334,7 @@ export abstract class PokemonModifierType extends ModifierType {
} }
} }
class PokemonHpRestoreModifierType extends PokemonModifierType { export class PokemonHpRestoreModifierType extends PokemonModifierType {
protected restorePercent: integer; protected restorePercent: integer;
constructor(name: string, restorePercent: integer, iconImage?: string) { constructor(name: string, restorePercent: integer, iconImage?: string) {
@ -349,7 +349,7 @@ class PokemonHpRestoreModifierType extends PokemonModifierType {
} }
} }
class PokemonReviveModifierType extends PokemonHpRestoreModifierType { export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
constructor(name: string, restorePercent: integer, iconImage?: string) { constructor(name: string, restorePercent: integer, iconImage?: string) {
super(name, restorePercent, iconImage); super(name, restorePercent, iconImage);
@ -362,7 +362,7 @@ class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
} }
} }
class PokemonBaseStatBoosterModifierType extends PokemonModifierType { export class PokemonBaseStatBoosterModifierType extends PokemonModifierType {
private stat: Stat; private stat: Stat;
constructor(name: string, stat: Stat, _iconImage?: string) { constructor(name: string, stat: Stat, _iconImage?: string) {

View File

@ -219,7 +219,7 @@ export enum Moves {
PROTECT, PROTECT,
MACH_PUNCH, MACH_PUNCH,
SCARY_FACE, SCARY_FACE,
FAINT_ATTACK, FEINT_ATTACK,
SWEET_KISS, SWEET_KISS,
BELLY_DRUM, BELLY_DRUM,
SLUDGE_BOMB, SLUDGE_BOMB,
@ -781,7 +781,7 @@ export const allMoves = [
[ Moves.PROTECT, "Protect", Type.NORMAL, MOVE_CATEGORY.STATUS, -1, -1, 10, "TM07", "Protects the user, but may fail if used consecutively.", -1, 2 ], [ Moves.PROTECT, "Protect", Type.NORMAL, MOVE_CATEGORY.STATUS, -1, -1, 10, "TM07", "Protects the user, but may fail if used consecutively.", -1, 2 ],
[ Moves.MACH_PUNCH, "Mach Punch", Type.FIGHTING, MOVE_CATEGORY.PHYSICAL, 40, 100, 30, "", "User attacks first.", -1, 2 ], [ Moves.MACH_PUNCH, "Mach Punch", Type.FIGHTING, MOVE_CATEGORY.PHYSICAL, 40, 100, 30, "", "User attacks first.", -1, 2 ],
[ Moves.SCARY_FACE, "Scary Face", Type.NORMAL, MOVE_CATEGORY.STATUS, -1, 100, 10, "TM06", "Sharply lowers opponent's Speed.", -1, 2 ], [ Moves.SCARY_FACE, "Scary Face", Type.NORMAL, MOVE_CATEGORY.STATUS, -1, 100, 10, "TM06", "Sharply lowers opponent's Speed.", -1, 2 ],
[ Moves.FAINT_ATTACK, "Faint Attack", Type.DARK, MOVE_CATEGORY.PHYSICAL, 60, 999, 20, "", "Ignores Accuracy and Evasiveness.", -1, 2 ], [ Moves.FEINT_ATTACK, "Feint Attack", Type.DARK, MOVE_CATEGORY.PHYSICAL, 60, 999, 20, "", "Ignores Accuracy and Evasiveness.", -1, 2 ],
[ Moves.SWEET_KISS, "Sweet Kiss", Type.FAIRY, MOVE_CATEGORY.STATUS, -1, 75, 10, "", "Confuses opponent.", -1, 2 ], [ Moves.SWEET_KISS, "Sweet Kiss", Type.FAIRY, MOVE_CATEGORY.STATUS, -1, 75, 10, "", "Confuses opponent.", -1, 2 ],
[ Moves.BELLY_DRUM, "Belly Drum", Type.NORMAL, MOVE_CATEGORY.STATUS, -1, -1, 10, "", "User loses 50% of its max HP, but Attack raises to maximum.", -1, 2 ], [ Moves.BELLY_DRUM, "Belly Drum", Type.NORMAL, MOVE_CATEGORY.STATUS, -1, -1, 10, "", "User loses 50% of its max HP, but Attack raises to maximum.", -1, 2 ],
[ Moves.SLUDGE_BOMB, "Sludge Bomb", Type.POISON, MOVE_CATEGORY.SPECIAL, 90, 100, 10, "TM148", "May poison opponent.", 30, 2 ], [ Moves.SLUDGE_BOMB, "Sludge Bomb", Type.POISON, MOVE_CATEGORY.SPECIAL, 90, 100, 10, "TM148", "May poison opponent.", 30, 2 ],

File diff suppressed because it is too large Load Diff

View File

@ -550,7 +550,7 @@ export const pokemonLevelMoves = {
[ 12, Moves.FIRE_SPIN ], [ 12, Moves.FIRE_SPIN ],
[ 15, Moves.CONFUSE_RAY ], [ 15, Moves.CONFUSE_RAY ],
[ 18, Moves.IMPRISON ], [ 18, Moves.IMPRISON ],
[ 20, Moves.FAINT_ATTACK ], [ 20, Moves.FEINT_ATTACK ],
[ 23, Moves.FLAME_BURST ], [ 23, Moves.FLAME_BURST ],
[ 26, Moves.WILL_O_WISP ], [ 26, Moves.WILL_O_WISP ],
[ 28, Moves.HEX ], [ 28, Moves.HEX ],
@ -775,7 +775,7 @@ export const pokemonLevelMoves = {
[ 9, Moves.FAKE_OUT ], [ 9, Moves.FAKE_OUT ],
[ 14, Moves.FURY_SWIPES ], [ 14, Moves.FURY_SWIPES ],
[ 17, Moves.SCREECH ], [ 17, Moves.SCREECH ],
[ 22, Moves.FAINT_ATTACK ], [ 22, Moves.FEINT_ATTACK ],
[ 25, Moves.TAUNT ], [ 25, Moves.TAUNT ],
[ 30, Moves.PAY_DAY ], [ 30, Moves.PAY_DAY ],
[ 33, Moves.SLASH ], [ 33, Moves.SLASH ],
@ -795,7 +795,7 @@ export const pokemonLevelMoves = {
[ 9, Moves.FAKE_OUT ], [ 9, Moves.FAKE_OUT ],
[ 14, Moves.FURY_SWIPES ], [ 14, Moves.FURY_SWIPES ],
[ 17, Moves.SCREECH ], [ 17, Moves.SCREECH ],
[ 22, Moves.FAINT_ATTACK ], [ 22, Moves.FEINT_ATTACK ],
[ 25, Moves.TAUNT ], [ 25, Moves.TAUNT ],
[ 28, Moves.SWIFT ], [ 28, Moves.SWIFT ],
[ 32, Moves.POWER_GEM ], [ 32, Moves.POWER_GEM ],
@ -2078,7 +2078,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.SMOG ], [ 1, Moves.SMOG ],
[ 5, Moves.EMBER ], [ 5, Moves.EMBER ],
[ 8, Moves.SMOKESCREEN ], [ 8, Moves.SMOKESCREEN ],
[ 12, Moves.FAINT_ATTACK ], [ 12, Moves.FEINT_ATTACK ],
[ 15, Moves.FIRE_SPIN ], [ 15, Moves.FIRE_SPIN ],
[ 19, Moves.CLEAR_SMOG ], [ 19, Moves.CLEAR_SMOG ],
[ 22, Moves.FLAME_BURST ], [ 22, Moves.FLAME_BURST ],
@ -3066,7 +3066,7 @@ export const pokemonLevelMoves = {
[ 12, Moves.ROCK_THROW ], [ 12, Moves.ROCK_THROW ],
[ 15, Moves.MIMIC ], [ 15, Moves.MIMIC ],
[ 15, Moves.SLAM ], [ 15, Moves.SLAM ],
[ 19, Moves.FAINT_ATTACK ], [ 19, Moves.FEINT_ATTACK ],
[ 22, Moves.ROCK_TOMB ], [ 22, Moves.ROCK_TOMB ],
[ 26, Moves.BLOCK ], [ 26, Moves.BLOCK ],
[ 29, Moves.ROCK_SLIDE ], [ 29, Moves.ROCK_SLIDE ],
@ -3277,7 +3277,7 @@ export const pokemonLevelMoves = {
[ 9, Moves.PURSUIT ], [ 9, Moves.PURSUIT ],
[ 13, Moves.QUICK_ATTACK ], [ 13, Moves.QUICK_ATTACK ],
[ 17, Moves.CONFUSE_RAY ], [ 17, Moves.CONFUSE_RAY ],
[ 21, Moves.FAINT_ATTACK ], [ 21, Moves.FEINT_ATTACK ],
[ 25, Moves.ASSURANCE ], [ 25, Moves.ASSURANCE ],
[ 29, Moves.SCREECH ], [ 29, Moves.SCREECH ],
[ 33, Moves.MOONLIGHT ], [ 33, Moves.MOONLIGHT ],
@ -3294,7 +3294,7 @@ export const pokemonLevelMoves = {
[ 21, Moves.NIGHT_SHADE ], [ 21, Moves.NIGHT_SHADE ],
[ 25, Moves.ASSURANCE ], [ 25, Moves.ASSURANCE ],
[ 31, Moves.TAUNT ], [ 31, Moves.TAUNT ],
[ 35, Moves.FAINT_ATTACK ], [ 35, Moves.FEINT_ATTACK ],
[ 41, Moves.MEAN_LOOK ], [ 41, Moves.MEAN_LOOK ],
[ 45, Moves.FOUL_PLAY ], [ 45, Moves.FOUL_PLAY ],
[ 51, Moves.TAILWIND ], [ 51, Moves.TAILWIND ],
@ -3432,7 +3432,7 @@ export const pokemonLevelMoves = {
[ 10, Moves.KNOCK_OFF ], [ 10, Moves.KNOCK_OFF ],
[ 13, Moves.QUICK_ATTACK ], [ 13, Moves.QUICK_ATTACK ],
[ 16, Moves.FURY_CUTTER ], [ 16, Moves.FURY_CUTTER ],
[ 19, Moves.FAINT_ATTACK ], [ 19, Moves.FEINT_ATTACK ],
[ 22, Moves.ACROBATICS ], [ 22, Moves.ACROBATICS ],
[ 27, Moves.SLASH ], [ 27, Moves.SLASH ],
[ 30, Moves.U_TURN ], [ 30, Moves.U_TURN ],
@ -3585,7 +3585,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.TAUNT ], [ 1, Moves.TAUNT ],
[ 1, Moves.SCRATCH ], [ 1, Moves.SCRATCH ],
[ 8, Moves.QUICK_ATTACK ], [ 8, Moves.QUICK_ATTACK ],
[ 10, Moves.FAINT_ATTACK ], [ 10, Moves.FEINT_ATTACK ],
[ 14, Moves.ICY_WIND ], [ 14, Moves.ICY_WIND ],
[ 16, Moves.FURY_SWIPES ], [ 16, Moves.FURY_SWIPES ],
[ 20, Moves.AGILITY ], [ 20, Moves.AGILITY ],
@ -3605,7 +3605,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.LICK ], [ 1, Moves.LICK ],
[ 1, Moves.COVET ], [ 1, Moves.COVET ],
[ 8, Moves.FURY_SWIPES ], [ 8, Moves.FURY_SWIPES ],
[ 15, Moves.FAINT_ATTACK ], [ 15, Moves.FEINT_ATTACK ],
[ 22, Moves.SWEET_SCENT ], [ 22, Moves.SWEET_SCENT ],
[ 29, Moves.SLASH ], [ 29, Moves.SLASH ],
[ 36, Moves.CHARM ], [ 36, Moves.CHARM ],
@ -3621,7 +3621,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.LICK ], [ 1, Moves.LICK ],
[ 1, Moves.COVET ], [ 1, Moves.COVET ],
[ 8, Moves.FURY_SWIPES ], [ 8, Moves.FURY_SWIPES ],
[ 15, Moves.FAINT_ATTACK ], [ 15, Moves.FEINT_ATTACK ],
[ 22, Moves.SWEET_SCENT ], [ 22, Moves.SWEET_SCENT ],
[ 29, Moves.SLASH ], [ 29, Moves.SLASH ],
[ 38, Moves.SCARY_FACE ], [ 38, Moves.SCARY_FACE ],
@ -3810,7 +3810,7 @@ export const pokemonLevelMoves = {
[ 20, Moves.ODOR_SLEUTH ], [ 20, Moves.ODOR_SLEUTH ],
[ 25, Moves.BEAT_UP ], [ 25, Moves.BEAT_UP ],
[ 28, Moves.FIRE_FANG ], [ 28, Moves.FIRE_FANG ],
[ 32, Moves.FAINT_ATTACK ], [ 32, Moves.FEINT_ATTACK ],
[ 37, Moves.EMBARGO ], [ 37, Moves.EMBARGO ],
[ 40, Moves.FOUL_PLAY ], [ 40, Moves.FOUL_PLAY ],
[ 44, Moves.FLAMETHROWER ], [ 44, Moves.FLAMETHROWER ],
@ -3831,7 +3831,7 @@ export const pokemonLevelMoves = {
[ 20, Moves.ODOR_SLEUTH ], [ 20, Moves.ODOR_SLEUTH ],
[ 26, Moves.BEAT_UP ], [ 26, Moves.BEAT_UP ],
[ 30, Moves.FIRE_FANG ], [ 30, Moves.FIRE_FANG ],
[ 35, Moves.FAINT_ATTACK ], [ 35, Moves.FEINT_ATTACK ],
[ 41, Moves.EMBARGO ], [ 41, Moves.EMBARGO ],
[ 45, Moves.FOUL_PLAY ], [ 45, Moves.FOUL_PLAY ],
[ 50, Moves.FLAMETHROWER ], [ 50, Moves.FLAMETHROWER ],
@ -3999,7 +3999,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.SMOG ], [ 1, Moves.SMOG ],
[ 5, Moves.EMBER ], [ 5, Moves.EMBER ],
[ 8, Moves.SMOKESCREEN ], [ 8, Moves.SMOKESCREEN ],
[ 12, Moves.FAINT_ATTACK ], [ 12, Moves.FEINT_ATTACK ],
[ 15, Moves.FIRE_SPIN ], [ 15, Moves.FIRE_SPIN ],
[ 19, Moves.CLEAR_SMOG ], [ 19, Moves.CLEAR_SMOG ],
[ 22, Moves.FLAME_BURST ], [ 22, Moves.FLAME_BURST ],
@ -4509,7 +4509,7 @@ export const pokemonLevelMoves = {
[ 13, Moves.NATURE_POWER ], [ 13, Moves.NATURE_POWER ],
[ 19, Moves.FAKE_OUT ], [ 19, Moves.FAKE_OUT ],
[ 25, Moves.TORMENT ], [ 25, Moves.TORMENT ],
[ 31, Moves.FAINT_ATTACK ], [ 31, Moves.FEINT_ATTACK ],
[ 37, Moves.RAZOR_WIND ], [ 37, Moves.RAZOR_WIND ],
[ 43, Moves.SWAGGER ], [ 43, Moves.SWAGGER ],
[ 49, Moves.EXTRASENSORY ] [ 49, Moves.EXTRASENSORY ]
@ -4518,7 +4518,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.WHIRLWIND ], [ 1, Moves.WHIRLWIND ],
[ 1, Moves.NASTY_PLOT ], [ 1, Moves.NASTY_PLOT ],
[ 1, Moves.RAZOR_LEAF ], [ 1, Moves.RAZOR_LEAF ],
[ 1, Moves.FAINT_ATTACK ], [ 1, Moves.FEINT_ATTACK ],
[ 19, Moves.LEAF_TORNADO ], [ 19, Moves.LEAF_TORNADO ],
[ 49, Moves.LEAF_STORM ] [ 49, Moves.LEAF_STORM ]
], ],
@ -4711,7 +4711,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.SCRATCH ], [ 1, Moves.SCRATCH ],
[ 7, Moves.ENCORE ], [ 7, Moves.ENCORE ],
[ 13, Moves.SLACK_OFF ], [ 13, Moves.SLACK_OFF ],
[ 19, Moves.FAINT_ATTACK ], [ 19, Moves.FEINT_ATTACK ],
[ 25, Moves.AMNESIA ], [ 25, Moves.AMNESIA ],
[ 31, Moves.COVET ], [ 31, Moves.COVET ],
[ 37, Moves.CHIP_AWAY ], [ 37, Moves.CHIP_AWAY ],
@ -4740,7 +4740,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.SCRATCH ], [ 1, Moves.SCRATCH ],
[ 7, Moves.ENCORE ], [ 7, Moves.ENCORE ],
[ 13, Moves.SLACK_OFF ], [ 13, Moves.SLACK_OFF ],
[ 19, Moves.FAINT_ATTACK ], [ 19, Moves.FEINT_ATTACK ],
[ 25, Moves.AMNESIA ], [ 25, Moves.AMNESIA ],
[ 31, Moves.COVET ], [ 31, Moves.COVET ],
[ 36, Moves.SWAGGER ], [ 36, Moves.SWAGGER ],
@ -4934,7 +4934,7 @@ export const pokemonLevelMoves = {
[ 18, Moves.COPYCAT ], [ 18, Moves.COPYCAT ],
[ 22, Moves.ASSIST ], [ 22, Moves.ASSIST ],
[ 25, Moves.CHARM ], [ 25, Moves.CHARM ],
[ 29, Moves.FAINT_ATTACK ], [ 29, Moves.FEINT_ATTACK ],
[ 32, Moves.WAKE_UP_SLAP ], [ 32, Moves.WAKE_UP_SLAP ],
[ 36, Moves.COVET ], [ 36, Moves.COVET ],
[ 39, Moves.HEAL_BELL ], [ 39, Moves.HEAL_BELL ],
@ -4958,7 +4958,7 @@ export const pokemonLevelMoves = {
[ 22, Moves.DETECT ], [ 22, Moves.DETECT ],
[ 25, Moves.SHADOW_SNEAK ], [ 25, Moves.SHADOW_SNEAK ],
[ 29, Moves.KNOCK_OFF ], [ 29, Moves.KNOCK_OFF ],
[ 32, Moves.FAINT_ATTACK ], [ 32, Moves.FEINT_ATTACK ],
[ 36, Moves.PUNISHMENT ], [ 36, Moves.PUNISHMENT ],
[ 39, Moves.SHADOW_CLAW ], [ 39, Moves.SHADOW_CLAW ],
[ 43, Moves.POWER_GEM ], [ 43, Moves.POWER_GEM ],
@ -4974,7 +4974,7 @@ export const pokemonLevelMoves = {
[ 11, Moves.BITE ], [ 11, Moves.BITE ],
[ 16, Moves.SWEET_SCENT ], [ 16, Moves.SWEET_SCENT ],
[ 21, Moves.VISE_GRIP ], [ 21, Moves.VISE_GRIP ],
[ 26, Moves.FAINT_ATTACK ], [ 26, Moves.FEINT_ATTACK ],
[ 31, Moves.BATON_PASS ], [ 31, Moves.BATON_PASS ],
[ 36, Moves.CRUNCH ], [ 36, Moves.CRUNCH ],
[ 41, Moves.IRON_DEFENSE ], [ 41, Moves.IRON_DEFENSE ],
@ -5415,7 +5415,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.TACKLE ], [ 1, Moves.TACKLE ],
[ 5, Moves.UPROAR ], [ 5, Moves.UPROAR ],
[ 10, Moves.COPYCAT ], [ 10, Moves.COPYCAT ],
[ 14, Moves.FAINT_ATTACK ], [ 14, Moves.FEINT_ATTACK ],
[ 19, Moves.PSYBEAM ], [ 19, Moves.PSYBEAM ],
[ 23, Moves.HYPNOSIS ], [ 23, Moves.HYPNOSIS ],
[ 28, Moves.DIZZY_PUNCH ], [ 28, Moves.DIZZY_PUNCH ],
@ -5429,7 +5429,7 @@ export const pokemonLevelMoves = {
[Species.TRAPINCH]: [ [Species.TRAPINCH]: [
[ 1, Moves.BITE ], [ 1, Moves.BITE ],
[ 4, Moves.SAND_ATTACK ], [ 4, Moves.SAND_ATTACK ],
[ 7, Moves.FAINT_ATTACK ], [ 7, Moves.FEINT_ATTACK ],
[ 10, Moves.SAND_TOMB ], [ 10, Moves.SAND_TOMB ],
[ 13, Moves.MUD_SLAP ], [ 13, Moves.MUD_SLAP ],
[ 17, Moves.BIDE ], [ 17, Moves.BIDE ],
@ -5448,10 +5448,10 @@ export const pokemonLevelMoves = {
[Species.VIBRAVA]: [ [Species.VIBRAVA]: [
[ 1, Moves.SAND_ATTACK ], [ 1, Moves.SAND_ATTACK ],
[ 1, Moves.SAND_TOMB ], [ 1, Moves.SAND_TOMB ],
[ 1, Moves.FAINT_ATTACK ], [ 1, Moves.FEINT_ATTACK ],
[ 1, Moves.SONIC_BOOM ], [ 1, Moves.SONIC_BOOM ],
[ 4, Moves.SAND_ATTACK ], [ 4, Moves.SAND_ATTACK ],
[ 7, Moves.FAINT_ATTACK ], [ 7, Moves.FEINT_ATTACK ],
[ 10, Moves.SAND_TOMB ], [ 10, Moves.SAND_TOMB ],
[ 13, Moves.MUD_SLAP ], [ 13, Moves.MUD_SLAP ],
[ 17, Moves.BIDE ], [ 17, Moves.BIDE ],
@ -5467,10 +5467,10 @@ export const pokemonLevelMoves = {
[Species.FLYGON]: [ [Species.FLYGON]: [
[ 1, Moves.SAND_ATTACK ], [ 1, Moves.SAND_ATTACK ],
[ 1, Moves.SAND_TOMB ], [ 1, Moves.SAND_TOMB ],
[ 1, Moves.FAINT_ATTACK ], [ 1, Moves.FEINT_ATTACK ],
[ 1, Moves.SONIC_BOOM ], [ 1, Moves.SONIC_BOOM ],
[ 4, Moves.SAND_ATTACK ], [ 4, Moves.SAND_ATTACK ],
[ 7, Moves.FAINT_ATTACK ], [ 7, Moves.FEINT_ATTACK ],
[ 10, Moves.SAND_TOMB ], [ 10, Moves.SAND_TOMB ],
[ 13, Moves.MUD_SLAP ], [ 13, Moves.MUD_SLAP ],
[ 17, Moves.BIDE ], [ 17, Moves.BIDE ],
@ -5494,7 +5494,7 @@ export const pokemonLevelMoves = {
[ 17, Moves.SAND_ATTACK ], [ 17, Moves.SAND_ATTACK ],
[ 21, Moves.PIN_MISSILE ], [ 21, Moves.PIN_MISSILE ],
[ 25, Moves.INGRAIN ], [ 25, Moves.INGRAIN ],
[ 29, Moves.FAINT_ATTACK ], [ 29, Moves.FEINT_ATTACK ],
[ 33, Moves.SPIKES ], [ 33, Moves.SPIKES ],
[ 37, Moves.SUCKER_PUNCH ], [ 37, Moves.SUCKER_PUNCH ],
[ 41, Moves.PAYBACK ], [ 41, Moves.PAYBACK ],
@ -5515,7 +5515,7 @@ export const pokemonLevelMoves = {
[ 17, Moves.SAND_ATTACK ], [ 17, Moves.SAND_ATTACK ],
[ 21, Moves.PIN_MISSILE ], [ 21, Moves.PIN_MISSILE ],
[ 25, Moves.INGRAIN ], [ 25, Moves.INGRAIN ],
[ 29, Moves.FAINT_ATTACK ], [ 29, Moves.FEINT_ATTACK ],
[ 35, Moves.SPIKES ], [ 35, Moves.SPIKES ],
[ 41, Moves.SUCKER_PUNCH ], [ 41, Moves.SUCKER_PUNCH ],
[ 47, Moves.PAYBACK ], [ 47, Moves.PAYBACK ],
@ -5849,7 +5849,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.ASTONISH ], [ 1, Moves.ASTONISH ],
[ 1, Moves.THIEF ], [ 1, Moves.THIEF ],
[ 4, Moves.BIND ], [ 4, Moves.BIND ],
[ 7, Moves.FAINT_ATTACK ], [ 7, Moves.FEINT_ATTACK ],
[ 10, Moves.FURY_SWIPES ], [ 10, Moves.FURY_SWIPES ],
[ 14, Moves.FEINT ], [ 14, Moves.FEINT ],
[ 18, Moves.PSYBEAM ], [ 18, Moves.PSYBEAM ],
@ -5870,7 +5870,7 @@ export const pokemonLevelMoves = {
[ 13, Moves.WILL_O_WISP ], [ 13, Moves.WILL_O_WISP ],
[ 16, Moves.SHADOW_SNEAK ], [ 16, Moves.SHADOW_SNEAK ],
[ 19, Moves.CURSE ], [ 19, Moves.CURSE ],
[ 22, Moves.FAINT_ATTACK ], [ 22, Moves.FEINT_ATTACK ],
[ 26, Moves.HEX ], [ 26, Moves.HEX ],
[ 30, Moves.SHADOW_BALL ], [ 30, Moves.SHADOW_BALL ],
[ 34, Moves.SUCKER_PUNCH ], [ 34, Moves.SUCKER_PUNCH ],
@ -5890,7 +5890,7 @@ export const pokemonLevelMoves = {
[ 13, Moves.WILL_O_WISP ], [ 13, Moves.WILL_O_WISP ],
[ 16, Moves.SHADOW_SNEAK ], [ 16, Moves.SHADOW_SNEAK ],
[ 19, Moves.CURSE ], [ 19, Moves.CURSE ],
[ 22, Moves.FAINT_ATTACK ], [ 22, Moves.FEINT_ATTACK ],
[ 26, Moves.HEX ], [ 26, Moves.HEX ],
[ 30, Moves.SHADOW_BALL ], [ 30, Moves.SHADOW_BALL ],
[ 34, Moves.SUCKER_PUNCH ], [ 34, Moves.SUCKER_PUNCH ],
@ -7061,7 +7061,7 @@ export const pokemonLevelMoves = {
[ 5, Moves.SCRATCH ], [ 5, Moves.SCRATCH ],
[ 8, Moves.GROWL ], [ 8, Moves.GROWL ],
[ 13, Moves.HYPNOSIS ], [ 13, Moves.HYPNOSIS ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 20, Moves.FURY_SWIPES ], [ 20, Moves.FURY_SWIPES ],
[ 25, Moves.CHARM ], [ 25, Moves.CHARM ],
[ 29, Moves.ASSIST ], [ 29, Moves.ASSIST ],
@ -7078,7 +7078,7 @@ export const pokemonLevelMoves = {
[ 5, Moves.SCRATCH ], [ 5, Moves.SCRATCH ],
[ 8, Moves.GROWL ], [ 8, Moves.GROWL ],
[ 13, Moves.HYPNOSIS ], [ 13, Moves.HYPNOSIS ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 20, Moves.FURY_SWIPES ], [ 20, Moves.FURY_SWIPES ],
[ 25, Moves.CHARM ], [ 25, Moves.CHARM ],
[ 29, Moves.ASSIST ], [ 29, Moves.ASSIST ],
@ -7138,7 +7138,7 @@ export const pokemonLevelMoves = {
[ 11, Moves.CONFUSE_RAY ], [ 11, Moves.CONFUSE_RAY ],
[ 15, Moves.PSYWAVE ], [ 15, Moves.PSYWAVE ],
[ 19, Moves.IRON_DEFENSE ], [ 19, Moves.IRON_DEFENSE ],
[ 21, Moves.FAINT_ATTACK ], [ 21, Moves.FEINT_ATTACK ],
[ 25, Moves.SAFEGUARD ], [ 25, Moves.SAFEGUARD ],
[ 29, Moves.FUTURE_SIGHT ], [ 29, Moves.FUTURE_SIGHT ],
[ 31, Moves.METAL_SOUND ], [ 31, Moves.METAL_SOUND ],
@ -7160,7 +7160,7 @@ export const pokemonLevelMoves = {
[ 11, Moves.CONFUSE_RAY ], [ 11, Moves.CONFUSE_RAY ],
[ 15, Moves.PSYWAVE ], [ 15, Moves.PSYWAVE ],
[ 19, Moves.IRON_DEFENSE ], [ 19, Moves.IRON_DEFENSE ],
[ 21, Moves.FAINT_ATTACK ], [ 21, Moves.FEINT_ATTACK ],
[ 25, Moves.SAFEGUARD ], [ 25, Moves.SAFEGUARD ],
[ 29, Moves.FUTURE_SIGHT ], [ 29, Moves.FUTURE_SIGHT ],
[ 31, Moves.METAL_SOUND ], [ 31, Moves.METAL_SOUND ],
@ -7178,7 +7178,7 @@ export const pokemonLevelMoves = {
[ 8, Moves.LOW_KICK ], [ 8, Moves.LOW_KICK ],
[ 12, Moves.ROCK_THROW ], [ 12, Moves.ROCK_THROW ],
[ 15, Moves.SLAM ], [ 15, Moves.SLAM ],
[ 19, Moves.FAINT_ATTACK ], [ 19, Moves.FEINT_ATTACK ],
[ 22, Moves.ROCK_TOMB ], [ 22, Moves.ROCK_TOMB ],
[ 26, Moves.BLOCK ], [ 26, Moves.BLOCK ],
[ 29, Moves.ROCK_SLIDE ], [ 29, Moves.ROCK_SLIDE ],
@ -7236,7 +7236,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.CURSE ], [ 1, Moves.CURSE ],
[ 1, Moves.SHADOW_SNEAK ], [ 1, Moves.SHADOW_SNEAK ],
[ 1, Moves.PURSUIT ], [ 1, Moves.PURSUIT ],
[ 7, Moves.FAINT_ATTACK ], [ 7, Moves.FEINT_ATTACK ],
[ 13, Moves.HYPNOSIS ], [ 13, Moves.HYPNOSIS ],
[ 19, Moves.DREAM_EATER ], [ 19, Moves.DREAM_EATER ],
[ 25, Moves.OMINOUS_WIND ], [ 25, Moves.OMINOUS_WIND ],
@ -7419,7 +7419,7 @@ export const pokemonLevelMoves = {
[ 8, Moves.POISON_STING ], [ 8, Moves.POISON_STING ],
[ 10, Moves.TAUNT ], [ 10, Moves.TAUNT ],
[ 15, Moves.PURSUIT ], [ 15, Moves.PURSUIT ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 22, Moves.REVENGE ], [ 22, Moves.REVENGE ],
[ 24, Moves.SWAGGER ], [ 24, Moves.SWAGGER ],
[ 29, Moves.MUD_BOMB ], [ 29, Moves.MUD_BOMB ],
@ -7438,7 +7438,7 @@ export const pokemonLevelMoves = {
[ 8, Moves.POISON_STING ], [ 8, Moves.POISON_STING ],
[ 10, Moves.TAUNT ], [ 10, Moves.TAUNT ],
[ 15, Moves.PURSUIT ], [ 15, Moves.PURSUIT ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 22, Moves.REVENGE ], [ 22, Moves.REVENGE ],
[ 24, Moves.SWAGGER ], [ 24, Moves.SWAGGER ],
[ 29, Moves.MUD_BOMB ], [ 29, Moves.MUD_BOMB ],
@ -7456,7 +7456,7 @@ export const pokemonLevelMoves = {
[ 11, Moves.VINE_WHIP ], [ 11, Moves.VINE_WHIP ],
[ 17, Moves.SWEET_SCENT ], [ 17, Moves.SWEET_SCENT ],
[ 21, Moves.INGRAIN ], [ 21, Moves.INGRAIN ],
[ 27, Moves.FAINT_ATTACK ], [ 27, Moves.FEINT_ATTACK ],
[ 31, Moves.LEAF_TORNADO ], [ 31, Moves.LEAF_TORNADO ],
[ 37, Moves.STOCKPILE ], [ 37, Moves.STOCKPILE ],
[ 37, Moves.SWALLOW ], [ 37, Moves.SWALLOW ],
@ -7556,7 +7556,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.ASSURANCE ], [ 1, Moves.ASSURANCE ],
[ 1, Moves.SCRATCH ], [ 1, Moves.SCRATCH ],
[ 8, Moves.QUICK_ATTACK ], [ 8, Moves.QUICK_ATTACK ],
[ 10, Moves.FAINT_ATTACK ], [ 10, Moves.FEINT_ATTACK ],
[ 14, Moves.ICY_WIND ], [ 14, Moves.ICY_WIND ],
[ 16, Moves.FURY_SWIPES ], [ 16, Moves.FURY_SWIPES ],
[ 20, Moves.NASTY_PLOT ], [ 20, Moves.NASTY_PLOT ],
@ -7680,7 +7680,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.SMOG ], [ 1, Moves.SMOG ],
[ 5, Moves.EMBER ], [ 5, Moves.EMBER ],
[ 8, Moves.SMOKESCREEN ], [ 8, Moves.SMOKESCREEN ],
[ 12, Moves.FAINT_ATTACK ], [ 12, Moves.FEINT_ATTACK ],
[ 15, Moves.FIRE_SPIN ], [ 15, Moves.FIRE_SPIN ],
[ 19, Moves.CLEAR_SMOG ], [ 19, Moves.CLEAR_SMOG ],
[ 22, Moves.FLAME_BURST ], [ 22, Moves.FLAME_BURST ],
@ -7765,7 +7765,7 @@ export const pokemonLevelMoves = {
[ 10, Moves.KNOCK_OFF ], [ 10, Moves.KNOCK_OFF ],
[ 13, Moves.QUICK_ATTACK ], [ 13, Moves.QUICK_ATTACK ],
[ 16, Moves.FURY_CUTTER ], [ 16, Moves.FURY_CUTTER ],
[ 19, Moves.FAINT_ATTACK ], [ 19, Moves.FEINT_ATTACK ],
[ 22, Moves.ACROBATICS ], [ 22, Moves.ACROBATICS ],
[ 27, Moves.NIGHT_SLASH ], [ 27, Moves.NIGHT_SLASH ],
[ 30, Moves.U_TURN ], [ 30, Moves.U_TURN ],
@ -8081,7 +8081,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.OMINOUS_WIND ], [ 1, Moves.OMINOUS_WIND ],
[ 11, Moves.QUICK_ATTACK ], [ 11, Moves.QUICK_ATTACK ],
[ 20, Moves.HYPNOSIS ], [ 20, Moves.HYPNOSIS ],
[ 29, Moves.FAINT_ATTACK ], [ 29, Moves.FEINT_ATTACK ],
[ 38, Moves.NIGHTMARE ], [ 38, Moves.NIGHTMARE ],
[ 47, Moves.DOUBLE_TEAM ], [ 47, Moves.DOUBLE_TEAM ],
[ 57, Moves.HAZE ], [ 57, Moves.HAZE ],
@ -9203,7 +9203,7 @@ export const pokemonLevelMoves = {
[ 5, Moves.ROCK_BLAST ], [ 5, Moves.ROCK_BLAST ],
[ 7, Moves.WITHDRAW ], [ 7, Moves.WITHDRAW ],
[ 11, Moves.SAND_ATTACK ], [ 11, Moves.SAND_ATTACK ],
[ 13, Moves.FAINT_ATTACK ], [ 13, Moves.FEINT_ATTACK ],
[ 17, Moves.SMACK_DOWN ], [ 17, Moves.SMACK_DOWN ],
[ 19, Moves.ROCK_POLISH ], [ 19, Moves.ROCK_POLISH ],
[ 23, Moves.BUG_BITE ], [ 23, Moves.BUG_BITE ],
@ -9223,7 +9223,7 @@ export const pokemonLevelMoves = {
[ 5, Moves.ROCK_BLAST ], [ 5, Moves.ROCK_BLAST ],
[ 7, Moves.WITHDRAW ], [ 7, Moves.WITHDRAW ],
[ 11, Moves.SAND_ATTACK ], [ 11, Moves.SAND_ATTACK ],
[ 13, Moves.FAINT_ATTACK ], [ 13, Moves.FEINT_ATTACK ],
[ 17, Moves.SMACK_DOWN ], [ 17, Moves.SMACK_DOWN ],
[ 19, Moves.ROCK_POLISH ], [ 19, Moves.ROCK_POLISH ],
[ 23, Moves.BUG_BITE ], [ 23, Moves.BUG_BITE ],
@ -9239,7 +9239,7 @@ export const pokemonLevelMoves = {
[ 1, Moves.LEER ], [ 1, Moves.LEER ],
[ 1, Moves.LOW_KICK ], [ 1, Moves.LOW_KICK ],
[ 5, Moves.SAND_ATTACK ], [ 5, Moves.SAND_ATTACK ],
[ 9, Moves.FAINT_ATTACK ], [ 9, Moves.FEINT_ATTACK ],
[ 12, Moves.HEADBUTT ], [ 12, Moves.HEADBUTT ],
[ 16, Moves.SWAGGER ], [ 16, Moves.SWAGGER ],
[ 20, Moves.BRICK_BREAK ], [ 20, Moves.BRICK_BREAK ],
@ -9257,9 +9257,9 @@ export const pokemonLevelMoves = {
[ 1, Moves.SAND_ATTACK ], [ 1, Moves.SAND_ATTACK ],
[ 1, Moves.LEER ], [ 1, Moves.LEER ],
[ 1, Moves.LOW_KICK ], [ 1, Moves.LOW_KICK ],
[ 1, Moves.FAINT_ATTACK ], [ 1, Moves.FEINT_ATTACK ],
[ 5, Moves.SAND_ATTACK ], [ 5, Moves.SAND_ATTACK ],
[ 9, Moves.FAINT_ATTACK ], [ 9, Moves.FEINT_ATTACK ],
[ 12, Moves.HEADBUTT ], [ 12, Moves.HEADBUTT ],
[ 16, Moves.SWAGGER ], [ 16, Moves.SWAGGER ],
[ 20, Moves.BRICK_BREAK ], [ 20, Moves.BRICK_BREAK ],
@ -9455,7 +9455,7 @@ export const pokemonLevelMoves = {
[ 5, Moves.PURSUIT ], [ 5, Moves.PURSUIT ],
[ 9, Moves.FAKE_TEARS ], [ 9, Moves.FAKE_TEARS ],
[ 13, Moves.FURY_SWIPES ], [ 13, Moves.FURY_SWIPES ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 21, Moves.SCARY_FACE ], [ 21, Moves.SCARY_FACE ],
[ 25, Moves.TAUNT ], [ 25, Moves.TAUNT ],
[ 29, Moves.FOUL_PLAY ], [ 29, Moves.FOUL_PLAY ],
@ -9476,7 +9476,7 @@ export const pokemonLevelMoves = {
[ 5, Moves.PURSUIT ], [ 5, Moves.PURSUIT ],
[ 9, Moves.HONE_CLAWS ], [ 9, Moves.HONE_CLAWS ],
[ 13, Moves.FURY_SWIPES ], [ 13, Moves.FURY_SWIPES ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 21, Moves.SCARY_FACE ], [ 21, Moves.SCARY_FACE ],
[ 25, Moves.TAUNT ], [ 25, Moves.TAUNT ],
[ 29, Moves.FOUL_PLAY ], [ 29, Moves.FOUL_PLAY ],
@ -9524,7 +9524,7 @@ export const pokemonLevelMoves = {
[ 14, Moves.DOUBLE_SLAP ], [ 14, Moves.DOUBLE_SLAP ],
[ 16, Moves.PSYBEAM ], [ 16, Moves.PSYBEAM ],
[ 19, Moves.EMBARGO ], [ 19, Moves.EMBARGO ],
[ 24, Moves.FAINT_ATTACK ], [ 24, Moves.FEINT_ATTACK ],
[ 25, Moves.PSYSHOCK ], [ 25, Moves.PSYSHOCK ],
[ 28, Moves.FLATTER ], [ 28, Moves.FLATTER ],
[ 31, Moves.FUTURE_SIGHT ], [ 31, Moves.FUTURE_SIGHT ],
@ -9545,7 +9545,7 @@ export const pokemonLevelMoves = {
[ 14, Moves.DOUBLE_SLAP ], [ 14, Moves.DOUBLE_SLAP ],
[ 16, Moves.PSYBEAM ], [ 16, Moves.PSYBEAM ],
[ 19, Moves.EMBARGO ], [ 19, Moves.EMBARGO ],
[ 24, Moves.FAINT_ATTACK ], [ 24, Moves.FEINT_ATTACK ],
[ 25, Moves.PSYSHOCK ], [ 25, Moves.PSYSHOCK ],
[ 28, Moves.FLATTER ], [ 28, Moves.FLATTER ],
[ 31, Moves.FUTURE_SIGHT ], [ 31, Moves.FUTURE_SIGHT ],
@ -9566,7 +9566,7 @@ export const pokemonLevelMoves = {
[ 14, Moves.DOUBLE_SLAP ], [ 14, Moves.DOUBLE_SLAP ],
[ 16, Moves.PSYBEAM ], [ 16, Moves.PSYBEAM ],
[ 19, Moves.EMBARGO ], [ 19, Moves.EMBARGO ],
[ 24, Moves.FAINT_ATTACK ], [ 24, Moves.FEINT_ATTACK ],
[ 25, Moves.PSYSHOCK ], [ 25, Moves.PSYSHOCK ],
[ 28, Moves.FLATTER ], [ 28, Moves.FLATTER ],
[ 31, Moves.FUTURE_SIGHT ], [ 31, Moves.FUTURE_SIGHT ],
@ -9739,7 +9739,7 @@ export const pokemonLevelMoves = {
[ 7, Moves.SAND_ATTACK ], [ 7, Moves.SAND_ATTACK ],
[ 10, Moves.DOUBLE_KICK ], [ 10, Moves.DOUBLE_KICK ],
[ 13, Moves.LEECH_SEED ], [ 13, Moves.LEECH_SEED ],
[ 16, Moves.FAINT_ATTACK ], [ 16, Moves.FEINT_ATTACK ],
[ 20, Moves.TAKE_DOWN ], [ 20, Moves.TAKE_DOWN ],
[ 24, Moves.JUMP_KICK ], [ 24, Moves.JUMP_KICK ],
[ 28, Moves.AROMATHERAPY ], [ 28, Moves.AROMATHERAPY ],
@ -9759,7 +9759,7 @@ export const pokemonLevelMoves = {
[ 7, Moves.SAND_ATTACK ], [ 7, Moves.SAND_ATTACK ],
[ 10, Moves.DOUBLE_KICK ], [ 10, Moves.DOUBLE_KICK ],
[ 13, Moves.LEECH_SEED ], [ 13, Moves.LEECH_SEED ],
[ 16, Moves.FAINT_ATTACK ], [ 16, Moves.FEINT_ATTACK ],
[ 20, Moves.TAKE_DOWN ], [ 20, Moves.TAKE_DOWN ],
[ 24, Moves.JUMP_KICK ], [ 24, Moves.JUMP_KICK ],
[ 28, Moves.AROMATHERAPY ], [ 28, Moves.AROMATHERAPY ],
@ -9831,7 +9831,7 @@ export const pokemonLevelMoves = {
[ 12, Moves.BIDE ], [ 12, Moves.BIDE ],
[ 15, Moves.MEGA_DRAIN ], [ 15, Moves.MEGA_DRAIN ],
[ 18, Moves.INGRAIN ], [ 18, Moves.INGRAIN ],
[ 20, Moves.FAINT_ATTACK ], [ 20, Moves.FEINT_ATTACK ],
[ 24, Moves.SWEET_SCENT ], [ 24, Moves.SWEET_SCENT ],
[ 28, Moves.GIGA_DRAIN ], [ 28, Moves.GIGA_DRAIN ],
[ 32, Moves.TOXIC ], [ 32, Moves.TOXIC ],
@ -9851,7 +9851,7 @@ export const pokemonLevelMoves = {
[ 12, Moves.BIDE ], [ 12, Moves.BIDE ],
[ 15, Moves.MEGA_DRAIN ], [ 15, Moves.MEGA_DRAIN ],
[ 18, Moves.INGRAIN ], [ 18, Moves.INGRAIN ],
[ 20, Moves.FAINT_ATTACK ], [ 20, Moves.FEINT_ATTACK ],
[ 24, Moves.SWEET_SCENT ], [ 24, Moves.SWEET_SCENT ],
[ 28, Moves.GIGA_DRAIN ], [ 28, Moves.GIGA_DRAIN ],
[ 32, Moves.TOXIC ], [ 32, Moves.TOXIC ],
@ -10437,7 +10437,7 @@ export const pokemonLevelMoves = {
[ 6, Moves.LEER ], [ 6, Moves.LEER ],
[ 9, Moves.FURY_CUTTER ], [ 9, Moves.FURY_CUTTER ],
[ 14, Moves.TORMENT ], [ 14, Moves.TORMENT ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 22, Moves.SCARY_FACE ], [ 22, Moves.SCARY_FACE ],
[ 25, Moves.METAL_CLAW ], [ 25, Moves.METAL_CLAW ],
[ 30, Moves.SLASH ], [ 30, Moves.SLASH ],
@ -10459,7 +10459,7 @@ export const pokemonLevelMoves = {
[ 6, Moves.LEER ], [ 6, Moves.LEER ],
[ 9, Moves.FURY_CUTTER ], [ 9, Moves.FURY_CUTTER ],
[ 14, Moves.TORMENT ], [ 14, Moves.TORMENT ],
[ 17, Moves.FAINT_ATTACK ], [ 17, Moves.FEINT_ATTACK ],
[ 22, Moves.SCARY_FACE ], [ 22, Moves.SCARY_FACE ],
[ 25, Moves.METAL_CLAW ], [ 25, Moves.METAL_CLAW ],
[ 30, Moves.SLASH ], [ 30, Moves.SLASH ],
@ -10534,7 +10534,7 @@ export const pokemonLevelMoves = {
[ 10, Moves.PLUCK ], [ 10, Moves.PLUCK ],
[ 14, Moves.NASTY_PLOT ], [ 14, Moves.NASTY_PLOT ],
[ 19, Moves.FLATTER ], [ 19, Moves.FLATTER ],
[ 23, Moves.FAINT_ATTACK ], [ 23, Moves.FEINT_ATTACK ],
[ 28, Moves.PUNISHMENT ], [ 28, Moves.PUNISHMENT ],
[ 32, Moves.DEFOG ], [ 32, Moves.DEFOG ],
[ 37, Moves.TAILWIND ], [ 37, Moves.TAILWIND ],
@ -10554,7 +10554,7 @@ export const pokemonLevelMoves = {
[ 10, Moves.PLUCK ], [ 10, Moves.PLUCK ],
[ 14, Moves.NASTY_PLOT ], [ 14, Moves.NASTY_PLOT ],
[ 19, Moves.FLATTER ], [ 19, Moves.FLATTER ],
[ 23, Moves.FAINT_ATTACK ], [ 23, Moves.FEINT_ATTACK ],
[ 28, Moves.PUNISHMENT ], [ 28, Moves.PUNISHMENT ],
[ 32, Moves.DEFOG ], [ 32, Moves.DEFOG ],
[ 37, Moves.TAILWIND ], [ 37, Moves.TAILWIND ],

View File

@ -1,5 +1,5 @@
import { GrowthRate } from './exp'; import { GrowthRate } from './exp';
import { PokemonSpeciesEvolutionCondition, pokemonEvolutions } from './pokemon-evolutions'; import { pokemonEvolutions } from './pokemon-evolutions';
import { Species } from './species'; import { Species } from './species';
import { Type } from './type'; import { Type } from './type';
import * as Utils from './utils'; import * as Utils from './utils';
@ -69,7 +69,7 @@ export default class PokemonSpecies {
return this.type1 === type || (this.type2 > -1 && this.type2 === type); return this.type1 === type || (this.type2 > -1 && this.type2 === type);
} }
getSpeciesForLevel(level: integer): Species { getSpeciesForLevel(level: integer, allowEvolving?: boolean): Species {
const prevolutionLevels = this.getPrevolutionLevels(); const prevolutionLevels = this.getPrevolutionLevels();
if (prevolutionLevels.length) { if (prevolutionLevels.length) {
@ -80,6 +80,9 @@ export default class PokemonSpecies {
} }
} }
if (!allowEvolving)
return this.speciesId;
const evolutionLevels = this.getEvolutionLevels(); const evolutionLevels = this.getEvolutionLevels();
let speciesIds = []; let speciesIds = [];

View File

@ -114,25 +114,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
tintSprite.setVisible(false); tintSprite.setVisible(false);
(this.scene as BattleScene).loadAtlas(this.getSpriteKey(), 'pokemon', this.getAtlasPath());
this.scene.load.audio(this.species.speciesId.toString(), `audio/cry/${this.species.speciesId}.mp3`);
this.scene.load.once(Phaser.Loader.Events.COMPLETE, () => {
const originalWarn = console.warn;
// Ignore warnings for missing frames, because there will be a lot
console.warn = () => {};
const frameNames = this.scene.anims.generateFrameNames(this.getSpriteKey(), { zeroPad: 4, suffix: ".png", start: 1, end: 256 });
console.warn = originalWarn;
this.scene.anims.create({
key: this.getSpriteKey(),
frames: frameNames,
frameRate: 12,
repeat: -1
});
sprite.play(this.getSpriteKey());
tintSprite.play(this.getSpriteKey());
});
this.scene.load.start()
this.add(sprite); this.add(sprite);
this.add(tintSprite); this.add(tintSprite);
@ -156,35 +137,58 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
abstract isPlayer(): boolean; abstract isPlayer(): boolean;
getAtlasPath() { loadAssets(): Promise<void> {
return new Promise(resolve => {
(this.scene as BattleScene).loadAtlas(this.getSpriteKey(), 'pokemon', this.getAtlasPath());
this.scene.load.audio(this.species.speciesId.toString(), `audio/cry/${this.species.speciesId}.mp3`);
this.scene.load.once(Phaser.Loader.Events.COMPLETE, () => {
const originalWarn = console.warn;
// Ignore warnings for missing frames, because there will be a lot
console.warn = () => {};
const frameNames = this.scene.anims.generateFrameNames(this.getSpriteKey(), { zeroPad: 4, suffix: ".png", start: 1, end: 256 });
console.warn = originalWarn;
this.scene.anims.create({
key: this.getSpriteKey(),
frames: frameNames,
frameRate: 12,
repeat: -1
});
this.getSprite().play(this.getSpriteKey());
this.getTintSprite().play(this.getSpriteKey());
resolve();
});
});
}
getAtlasPath(): string {
return this.getSpriteId().replace(/\_{2}/g, '/'); return this.getSpriteId().replace(/\_{2}/g, '/');
} }
getSpriteId() { getSpriteId(): string {
return `${this.isPlayer() ? 'back__' : ''}${this.shiny ? 'shiny__' : ''}${this.species.genderDiffs && !this.gender ? 'female__' : ''}${this.species.speciesId}`; return `${this.isPlayer() ? 'back__' : ''}${this.shiny ? 'shiny__' : ''}${this.species.genderDiffs && !this.gender ? 'female__' : ''}${this.species.speciesId}`;
} }
getSpriteKey() { getSpriteKey(): string {
return `pkmn__${this.getSpriteId()}`; return `pkmn__${this.getSpriteId()}`;
} }
getIconAtlasKey() { getIconAtlasKey(): string {
return `pokemon_icons_${this.species.generation}`; return `pokemon_icons_${this.species.generation}`;
} }
getIconId() { getIconId(): string {
return `${Utils.padInt(this.species.speciesId, 3)}`; return `${Utils.padInt(this.species.speciesId, 3)}`;
} }
getIconKey() { getIconKey(): string {
return `pkmn_icon__${this.getIconId()}`; return `pkmn_icon__${this.getIconId()}`;
} }
getSprite() { getSprite(): Phaser.GameObjects.Sprite {
return this.getAt(0) as Phaser.GameObjects.Sprite; return this.getAt(0) as Phaser.GameObjects.Sprite;
} }
getTintSprite() { getTintSprite(): Phaser.GameObjects.Sprite {
return this.getAt(1) as Phaser.GameObjects.Sprite; return this.getAt(1) as Phaser.GameObjects.Sprite;
} }
@ -303,7 +307,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
apply(source: Pokemon, battlerMove: PokemonMove, callback?: Function) { apply(source: Pokemon, battlerMove: PokemonMove, callback?: Function) {
const battleScene = this.scene as BattleScene; const battleScene = this.scene as BattleScene;
let result: integer; let result: integer;
let sound: Phaser.Sound.BaseSound;
let success = false; let success = false;
const move = battlerMove.getMove(); const move = battlerMove.getMove();
const moveCategory = move.category; const moveCategory = move.category;
@ -390,7 +393,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.scene.sound.play(this.species.speciesId.toString()); this.scene.sound.play(this.species.speciesId.toString());
} }
faintCry(callback) { faintCry(callback: Function) {
const key = this.species.speciesId.toString(); const key = this.species.speciesId.toString();
let i = 0; let i = 0;
let rate = 0.85; let rate = 0.85;
@ -519,7 +522,7 @@ export class EnemyPokemon extends Pokemon {
constructor(scene: BattleScene, species: PokemonSpecies, level: integer) { constructor(scene: BattleScene, species: PokemonSpecies, level: integer) {
super(scene, -63, 86, species, level); super(scene, -63, 86, species, level);
this.aiType = AiType.SMART; this.aiType = AiType.SMART_RANDOM;
} }
getNextMove(): PokemonMove { getNextMove(): PokemonMove {
@ -530,6 +533,7 @@ export class EnemyPokemon extends Pokemon {
switch (this.aiType) { switch (this.aiType) {
case AiType.RANDOM: case AiType.RANDOM:
return movePool[Utils.randInt(movePool.length)]; return movePool[Utils.randInt(movePool.length)];
case AiType.SMART_RANDOM:
case AiType.SMART: case AiType.SMART:
const target = (this.scene as BattleScene).getPlayerPokemon(); const target = (this.scene as BattleScene).getPlayerPokemon();
const moveScores = movePool.map(() => 0); const moveScores = movePool.map(() => 0);
@ -567,19 +571,23 @@ export class EnemyPokemon extends Pokemon {
moveScores[m] = score; moveScores[m] = score;
} }
} }
console.log(moveScores);
const sortedMovePool = movePool.slice(0); const sortedMovePool = movePool.slice(0);
sortedMovePool.sort((a, b) => { sortedMovePool.sort((a, b) => {
const scoreA = moveScores[movePool.indexOf(a)]; const scoreA = moveScores[movePool.indexOf(a)];
const scoreB = moveScores[movePool.indexOf(b)]; const scoreB = moveScores[movePool.indexOf(b)];
console.log(a, b, scoreA, scoreB)
return scoreA < scoreB ? 1 : scoreA > scoreB ? -1 : 0; return scoreA < scoreB ? 1 : scoreA > scoreB ? -1 : 0;
}); });
let randomBool: integer; let randInt: integer;
let r = 0; let r = 0;
while (r < sortedMovePool.length - 1 && (randomBool = Utils.randInt(2))) if (this.aiType === AiType.SMART_RANDOM) {
r++; while (r < sortedMovePool.length - 1 && (randInt = Utils.randInt(8)) >= 5)
r++;
}
console.log(movePool.map(m => m.getName()), moveScores, r, sortedMovePool.map(m => m.getName())); console.log(movePool.map(m => m.getName()), moveScores, r, sortedMovePool.map(m => m.getName()));
return sortedMovePool[r] return sortedMovePool[r];
} }
} }
return new PokemonMove(Moves.STRUGGLE, 0, 0); return new PokemonMove(Moves.STRUGGLE, 0, 0);
@ -598,8 +606,9 @@ export class EnemyPokemon extends Pokemon {
} }
} }
enum AiType { export enum AiType {
RANDOM, RANDOM,
SMART_RANDOM,
SMART SMART
}; };

View File

@ -26,41 +26,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
}; };
if (prompt) { if (prompt) {
const originalCallback = callback; const originalCallback = callback;
callback = () => { callback = () => this.showPrompt(originalCallback, callbackDelay);
const wrappedTextLines = this.message.runWordWrap(this.message.text).split(/\n/g);
const textLinesCount = wrappedTextLines.length;
const lastTextLine = wrappedTextLines[wrappedTextLines.length - 1];
const lastLineTest = this.scene.add.text(0, 0, lastTextLine, { font: '96px emerald' });
lastLineTest.setScale(this.message.scale);
const lastLineWidth = lastLineTest.displayWidth;
lastLineTest.destroy();
if (prompt) {
if (this.prompt) {
this.prompt.setPosition(lastLineWidth + 2, (textLinesCount - 1) * 18 + 2);
this.prompt.play('prompt');
}
this.pendingPrompt = false;
}
this.awaitingActionInput = true;
this.onActionInput = () => {
if (this.prompt) {
this.prompt.anims.stop();
this.prompt.setVisible(false);
}
if (originalCallback) {
if (callbackDelay) {
this.textCallbackTimer = this.scene.time.delayedCall(callbackDelay, () => {
if (this.textCallbackTimer) {
this.textCallbackTimer.destroy();
this.textCallbackTimer = null;
}
originalCallback();
});
} else
originalCallback();
}
};
};
} }
if (delay) { if (delay) {
this.clearText(); this.clearText();
@ -94,6 +60,40 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
} }
} }
showPrompt(callback: Function, callbackDelay: integer) {
const wrappedTextLines = this.message.runWordWrap(this.message.text).split(/\n/g);
const textLinesCount = wrappedTextLines.length;
const lastTextLine = wrappedTextLines[wrappedTextLines.length - 1];
const lastLineTest = this.scene.add.text(0, 0, lastTextLine, { font: '96px emerald' });
lastLineTest.setScale(this.message.scale);
const lastLineWidth = lastLineTest.displayWidth;
lastLineTest.destroy();
if (this.prompt) {
this.prompt.setPosition(lastLineWidth + 2, (textLinesCount - 1) * 18 + 2);
this.prompt.play('prompt');
}
this.pendingPrompt = false;
this.awaitingActionInput = true;
this.onActionInput = () => {
if (this.prompt) {
this.prompt.anims.stop();
this.prompt.setVisible(false);
}
if (callback) {
if (callbackDelay) {
this.textCallbackTimer = this.scene.time.delayedCall(callbackDelay, () => {
if (this.textCallbackTimer) {
this.textCallbackTimer.destroy();
this.textCallbackTimer = null;
}
callback();
});
} else
callback();
}
};
}
clearText() { clearText() {
this.message.setText(''); this.message.setText('');
this.pendingPrompt = false; this.pendingPrompt = false;

View File

@ -9,7 +9,7 @@ import { Mode } from "./ui";
export default class ModifierSelectUiHandler extends AwaitableUiHandler { export default class ModifierSelectUiHandler extends AwaitableUiHandler {
private overlayBg: Phaser.GameObjects.Rectangle; private overlayBg: Phaser.GameObjects.Rectangle;
private modifierContainer: Phaser.GameObjects.Container; private modifierContainer: Phaser.GameObjects.Container;
private options: ModifierOption[]; public options: ModifierOption[];
private cursorObj: Phaser.GameObjects.Image; private cursorObj: Phaser.GameObjects.Image;
@ -66,8 +66,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
onUpdate: t => { onUpdate: t => {
const value = t.getValue(); const value = t.getValue();
const index = Math.floor(value * types.length); const index = Math.floor(value * types.length);
if (index > i && index <= types.length) if (index > i && index <= types.length) {
this.options[i++].show(Math.floor((1 - value) * 1250) * 0.325); const option = this.options[i++];
option?.show(Math.floor((1 - value) * 1250) * 0.325);
}
} }
}); });
@ -225,6 +227,8 @@ class ModifierOption extends Phaser.GameObjects.Container {
duration: 1250, duration: 1250,
ease: 'Bounce.Out', ease: 'Bounce.Out',
onUpdate: t => { onUpdate: t => {
if (!this.scene)
return;
const value = t.getValue(); const value = t.getValue();
if (!bounce && value > lastValue) { if (!bounce && value > lastValue) {
this.scene.sound.play('pb_bounce_1', { volume: 1 / ++bounceCount }); this.scene.sound.play('pb_bounce_1', { volume: 1 / ++bounceCount });
@ -236,6 +240,9 @@ class ModifierOption extends Phaser.GameObjects.Container {
}); });
this.scene.time.delayedCall(remainingDuration + 2000, () => { this.scene.time.delayedCall(remainingDuration + 2000, () => {
if (!this.scene)
return;
this.pb.setTexture('pb', `${this.getPbAtlasKey()}_open`); this.pb.setTexture('pb', `${this.getPbAtlasKey()}_open`);
this.scene.sound.play('pb_rel'); this.scene.sound.play('pb_rel');

View File

@ -63,7 +63,6 @@ export default class PartyUiHandler extends MessageUiHandler {
this.partyMessageBox = partyMessageBox; this.partyMessageBox = partyMessageBox;
const partyMessageText = addTextObject(this.scene, 8, 10, defaultMessage, TextStyle.WINDOW, { maxLines: 2 }); const partyMessageText = addTextObject(this.scene, 8, 10, defaultMessage, TextStyle.WINDOW, { maxLines: 2 });
partyMessageText.setPositionRelative
partyMessageText.setOrigin(0, 0); partyMessageText.setOrigin(0, 0);
partyMessageBoxContainer.add(partyMessageText); partyMessageBoxContainer.add(partyMessageText);

View File

@ -5,7 +5,7 @@ export default abstract class UiHandler {
protected scene: BattleScene; protected scene: BattleScene;
protected mode: integer; protected mode: integer;
protected cursor: integer = 0; protected cursor: integer = 0;
protected active: boolean = false; public active: boolean = false;
constructor(scene: BattleScene, mode: Mode) { constructor(scene: BattleScene, mode: Mode) {
this.scene = scene; this.scene = scene;