Trainer updates including names and double battle pairs
Add dynamic trainer pairs; add trainer names with Bulbapedia scraping logic; add Hex Maniac trainer; make namebox stretch to fit name
This commit is contained in:
1 parent
a6d0348383
commit
a76f795cd5
17 files changed
+559
-152
No files matched your search
@@ -26,6 +26,7 @@ import { Tutorial } from "../tutorial";
|
||||
import { Moves } from "../data/enums/moves";
|
||||
import { speciesEggMoves } from "../data/egg-moves";
|
||||
import { allMoves } from "../data/move";
|
||||
import { TrainerVariant } from "../field/trainer";
|
||||
|
||||
const saveKey = 'x0i2O7WRiANTqPmZ'; // Temporary; secure encryption is not yet necessary
|
||||
|
||||
@@ -575,13 +576,14 @@ export class GameData {
|
||||
scene.updateScoreText();
|
||||
|
||||
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);
|
||||
const trainerConfig = trainerConfigs[sessionData.trainer.trainerType];
|
||||
const battle = scene.newBattle(sessionData.waveIndex, battleType, sessionData.trainer, battleType === BattleType.TRAINER ? trainerConfig.doubleOnly || sessionData.trainer.variant === TrainerVariant.DOUBLE : sessionData.enemyParty.length > 1);
|
||||
battle.enemyLevels = sessionData.enemyParty.map(p => p.level);
|
||||
|
||||
scene.newArena(sessionData.arena.biome, true);
|
||||
|
||||
sessionData.enemyParty.forEach((enemyData, e) => {
|
||||
const enemyPokemon = enemyData.toPokemon(scene, battleType) as EnemyPokemon;
|
||||
const enemyPokemon = enemyData.toPokemon(scene, battleType, e) as EnemyPokemon;
|
||||
battle.enemyParty[e] = enemyPokemon;
|
||||
if (battleType === BattleType.WILD)
|
||||
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { getPokemonSpecies } from "../data/pokemon-species";
|
||||
import { Species } from "../data/enums/species";
|
||||
import { Status } from "../data/status-effect";
|
||||
import Pokemon, { EnemyPokemon, PokemonMove, PokemonSummonData } from "../field/pokemon";
|
||||
import { TrainerSlot } from "../data/trainer-config";
|
||||
|
||||
export default class PokemonData {
|
||||
public id: integer;
|
||||
@@ -104,10 +105,10 @@ export default class PokemonData {
|
||||
}
|
||||
}
|
||||
|
||||
toPokemon(scene: BattleScene, battleType?: BattleType): Pokemon {
|
||||
toPokemon(scene: BattleScene, battleType?: BattleType, partyMemberIndex: integer = 0): Pokemon {
|
||||
const species = getPokemonSpecies(this.species);
|
||||
if (this.player)
|
||||
return scene.addPlayerPokemon(species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.ivs, this.nature, this);
|
||||
return scene.addEnemyPokemon(species, this.level, battleType === BattleType.TRAINER, this.boss, this);
|
||||
return scene.addEnemyPokemon(species, this.level, battleType === BattleType.TRAINER ? !(partyMemberIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER : TrainerSlot.NONE, this.boss, this);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,24 @@
|
||||
import BattleScene from "../battle-scene";
|
||||
import { TrainerType } from "../data/enums/trainer-type";
|
||||
import Trainer from "../field/trainer";
|
||||
import Trainer, { TrainerVariant } from "../field/trainer";
|
||||
|
||||
export default class TrainerData {
|
||||
public trainerType: TrainerType;
|
||||
public female: boolean;
|
||||
public variant: TrainerVariant;
|
||||
public partyTemplateIndex: integer;
|
||||
public name: string;
|
||||
public partnerName: string;
|
||||
|
||||
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.variant = source.hasOwnProperty('variant') ? source.variant : source.female ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
|
||||
this.partyTemplateIndex = source.partyMemberTemplateIndex;
|
||||
this.name = source.name;
|
||||
this.partnerName = source.partnerName;
|
||||
}
|
||||
|
||||
toTrainer(scene: BattleScene): Trainer {
|
||||
return new Trainer(scene, this.trainerType, this.female, this.partyTemplateIndex);
|
||||
return new Trainer(scene, this.trainerType, this.variant, this.partyTemplateIndex);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user