mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-17 22:02:18 +02:00
hp added, moves added
This commit is contained in:
parent
f5a0652875
commit
f8f5b4057b
@ -196,7 +196,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
initSpecies();
|
initSpecies();
|
||||||
initMoves();
|
initMoves();
|
||||||
initAbilities();
|
initAbilities();
|
||||||
|
|
||||||
this.phaseQueue = [];
|
this.phaseQueue = [];
|
||||||
this.phaseQueuePrepend = [];
|
this.phaseQueuePrepend = [];
|
||||||
this.phaseQueuePrependSpliceIndex = -1;
|
this.phaseQueuePrependSpliceIndex = -1;
|
||||||
@ -542,17 +542,17 @@ export default class BattleScene extends SceneBase {
|
|||||||
const species = getPokemonSpecies(parseInt(s));
|
const species = getPokemonSpecies(parseInt(s));
|
||||||
loadPokemonAssets.push(species.loadAssets(this, false, 0, false));
|
loadPokemonAssets.push(species.loadAssets(this, false, 0, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(loadPokemonAssets).then(() => {
|
Promise.all(loadPokemonAssets).then(() => {
|
||||||
const starterCandyColors = {};
|
const starterCandyColors = {};
|
||||||
const rgbaToHexFunc = (r, g, b) => [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
|
const rgbaToHexFunc = (r, g, b) => [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
|
||||||
|
|
||||||
for (let s of Object.keys(speciesStarters)) {
|
for (let s of Object.keys(speciesStarters)) {
|
||||||
const species = getPokemonSpecies(parseInt(s));
|
const species = getPokemonSpecies(parseInt(s));
|
||||||
|
|
||||||
starterCandyColors[species.speciesId] = species.generateCandyColors(this).map(c => rgbaToHexFunc(c[0], c[1], c[2]));
|
starterCandyColors[species.speciesId] = species.generateCandyColors(this).map(c => rgbaToHexFunc(c[0], c[1], c[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(JSON.stringify(starterCandyColors));
|
console.log(JSON.stringify(starterCandyColors));
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
@ -649,7 +649,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
addPokemonIcon(pokemon: Pokemon, x: number, y: number, originX: number = 0.5, originY: number = 0.5, ignoreOverride: boolean = false): Phaser.GameObjects.Container {
|
addPokemonIcon(pokemon: Pokemon, x: number, y: number, originX: number = 0.5, originY: number = 0.5, ignoreOverride: boolean = false): Phaser.GameObjects.Container {
|
||||||
const container = this.add.container(x, y);
|
const container = this.add.container(x, y);
|
||||||
|
|
||||||
const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(ignoreOverride));
|
const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(ignoreOverride));
|
||||||
icon.setFrame(pokemon.getIconId(true));
|
icon.setFrame(pokemon.getIconId(true));
|
||||||
// Temporary fix to show pokemon's default icon if variant icon doesn't exist
|
// Temporary fix to show pokemon's default icon if variant icon doesn't exist
|
||||||
@ -675,7 +675,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
const originalFrame = icon.frame;
|
const originalFrame = icon.frame;
|
||||||
|
|
||||||
const iconHeight = (icon.frame.cutHeight <= fusionIcon.frame.cutHeight ? Math.ceil : Math.floor)((icon.frame.cutHeight + fusionIcon.frame.cutHeight) / 4);
|
const iconHeight = (icon.frame.cutHeight <= fusionIcon.frame.cutHeight ? Math.ceil : Math.floor)((icon.frame.cutHeight + fusionIcon.frame.cutHeight) / 4);
|
||||||
|
|
||||||
// Inefficient, but for some reason didn't work with only the unique properties as part of the name
|
// Inefficient, but for some reason didn't work with only the unique properties as part of the name
|
||||||
const iconFrameId = `${icon.frame.name}f${fusionIcon.frame.name}`;
|
const iconFrameId = `${icon.frame.name}f${fusionIcon.frame.name}`;
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.gameData = new GameData(this);
|
this.gameData = new GameData(this);
|
||||||
|
|
||||||
this.gameMode = gameModes[GameModes.CLASSIC];
|
this.gameMode = gameModes[GameModes.CLASSIC];
|
||||||
|
|
||||||
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
|
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
|
||||||
console.log('Seed:', this.seed);
|
console.log('Seed:', this.seed);
|
||||||
|
|
||||||
@ -760,7 +760,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.party = [];
|
this.party = [];
|
||||||
for (let p of this.getEnemyParty())
|
for (let p of this.getEnemyParty())
|
||||||
p.destroy();
|
p.destroy();
|
||||||
|
|
||||||
this.currentBattle = null;
|
this.currentBattle = null;
|
||||||
|
|
||||||
this.waveCountText.setText(startingWave.toString());
|
this.waveCountText.setText(startingWave.toString());
|
||||||
@ -789,7 +789,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.trainer.setTexture(`trainer_${this.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}_back`);
|
this.trainer.setTexture(`trainer_${this.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}_back`);
|
||||||
this.trainer.setPosition(406, 186);
|
this.trainer.setPosition(406, 186);
|
||||||
this.trainer.setVisible(true);
|
this.trainer.setVisible(true);
|
||||||
|
|
||||||
this.updateGameInfo();
|
this.updateGameInfo();
|
||||||
|
|
||||||
if (reloadI18n) {
|
if (reloadI18n) {
|
||||||
@ -835,7 +835,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.resetSeed(newWaveIndex);
|
this.resetSeed(newWaveIndex);
|
||||||
|
|
||||||
const playerField = this.getPlayerField();
|
const playerField = this.getPlayerField();
|
||||||
|
|
||||||
if (this.gameMode.hasFixedBattles && fixedBattles.hasOwnProperty(newWaveIndex) && trainerData === undefined) {
|
if (this.gameMode.hasFixedBattles && fixedBattles.hasOwnProperty(newWaveIndex) && trainerData === undefined) {
|
||||||
battleConfig = fixedBattles[newWaveIndex];
|
battleConfig = fixedBattles[newWaveIndex];
|
||||||
newDouble = battleConfig.double;
|
newDouble = battleConfig.double;
|
||||||
@ -946,7 +946,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.pushPhase(new LevelCapPhase(this));
|
this.pushPhase(new LevelCapPhase(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.currentBattle;
|
return this.currentBattle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1108,7 +1108,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
party.forEach((pokemon, p) => {
|
party.forEach((pokemon, p) => {
|
||||||
if (!pokemon.pokerus || infectedIndexes.indexOf(p) > -1)
|
if (!pokemon.pokerus || infectedIndexes.indexOf(p) > -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.executeWithSeedOffset(() => {
|
this.executeWithSeedOffset(() => {
|
||||||
if (p)
|
if (p)
|
||||||
spread(p, -1);
|
spread(p, -1);
|
||||||
@ -1553,7 +1553,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.currentPhase = this.phaseQueue.shift();
|
this.currentPhase = this.phaseQueue.shift();
|
||||||
this.currentPhase.start();
|
this.currentPhase.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
overridePhase(phase: Phase): boolean {
|
overridePhase(phase: Phase): boolean {
|
||||||
if (this.standbyPhase)
|
if (this.standbyPhase)
|
||||||
return false;
|
return false;
|
||||||
@ -1646,7 +1646,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.queueMessage(`The stack for this item is full.\n You will receive ${defaultModifierType.name} instead.`, null, true);
|
this.queueMessage(`The stack for this item is full.\n You will receive ${defaultModifierType.name} instead.`, null, true);
|
||||||
return this.addModifier(defaultModifierType.newModifier(), ignoreUpdate, playSound, false, instant).then(success => resolve(success));
|
return this.addModifier(defaultModifierType.newModifier(), ignoreUpdate, playSound, false, instant).then(success => resolve(success));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let rm of modifiersToRemove)
|
for (let rm of modifiersToRemove)
|
||||||
this.removeModifier(rm);
|
this.removeModifier(rm);
|
||||||
|
|
||||||
@ -1670,7 +1670,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
args.push(1);
|
args.push(1);
|
||||||
} else if (modifier instanceof FusePokemonModifier)
|
} else if (modifier instanceof FusePokemonModifier)
|
||||||
args.push(this.getPokemonById(modifier.fusePokemonId) as PlayerPokemon);
|
args.push(this.getPokemonById(modifier.fusePokemonId) as PlayerPokemon);
|
||||||
|
|
||||||
if (modifier.shouldApply(args)) {
|
if (modifier.shouldApply(args)) {
|
||||||
const result = modifier.apply(args);
|
const result = modifier.apply(args);
|
||||||
if (result instanceof Promise)
|
if (result instanceof Promise)
|
||||||
@ -1679,7 +1679,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
success ||= result;
|
success ||= result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.allSettled([this.party.map(p => p.updateInfo(instant)), ...modifierPromises]).then(() => resolve(success));
|
return Promise.allSettled([this.party.map(p => p.updateInfo(instant)), ...modifierPromises]).then(() => resolve(success));
|
||||||
} else {
|
} else {
|
||||||
const args = [ this ];
|
const args = [ this ];
|
||||||
@ -1996,7 +1996,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGameInfo(): void {
|
updateGameInfo(): void {
|
||||||
const gameInfo = {
|
const gameInfo = {
|
||||||
playTime: this.sessionPlayTime ? this.sessionPlayTime : 0,
|
playTime: this.sessionPlayTime ? this.sessionPlayTime : 0,
|
||||||
@ -2005,12 +2005,49 @@ export default class BattleScene extends SceneBase {
|
|||||||
biome: this.currentBattle ? getBiomeName(this.arena.biomeType) : '',
|
biome: this.currentBattle ? getBiomeName(this.arena.biomeType) : '',
|
||||||
weather: this.arena?.weather || {},
|
weather: this.arena?.weather || {},
|
||||||
wave: this.currentBattle?.waveIndex || 0,
|
wave: this.currentBattle?.waveIndex || 0,
|
||||||
party: this.party ? this.party.map(p => {
|
party: this.party ? this.party.map(p => {
|
||||||
return { name: p.name, level: p.level, speciesId: p.species.speciesId, fusionId: p.fusionSpecies?.speciesId || -1, active: p.active, gender: p.gender, fieldPosition: p.fieldPosition, speciesVariant: p.variant, fusionVariant: p.fusionVariant, hp: Math.ceil((p.hp/p.stats[0])*100)};
|
return {
|
||||||
}) : [],
|
name: p.name,
|
||||||
enemyParty: this.getEnemyParty() ? this.getEnemyParty().map(p => {
|
level: p.level,
|
||||||
return { name: p.name, level: p.level, speciesId: p.species.speciesId, fusionId: p.fusionSpecies?.speciesId || -1, active: p.active, gender: p.gender, fieldPosition: p.fieldPosition, speciesVariant: p.variant, fusionVariant: p.fusionVariant, hp: Math.ceil((p.hp/p.stats[0])*100)};
|
speciesId: p.species.speciesId,
|
||||||
}) : [],
|
fusionId: p.fusionSpecies?.speciesId || -1,
|
||||||
|
active: p.active,
|
||||||
|
gender: p.gender,
|
||||||
|
fieldPosition: p.fieldPosition,
|
||||||
|
speciesVariant: p.variant,
|
||||||
|
fusionVariant: p.fusionVariant,
|
||||||
|
ability: p.abilityIndex,
|
||||||
|
hp: {
|
||||||
|
current: p.hp,
|
||||||
|
max: p.getMaxHp(),
|
||||||
|
percent: (p.getHpRatio(false))*100
|
||||||
|
},
|
||||||
|
moveset: p.moveset.map(m => {
|
||||||
|
return {
|
||||||
|
moveId: m.moveId,
|
||||||
|
ppUsed: m.ppUsed,
|
||||||
|
ppUp: m.ppUp,
|
||||||
|
ppBase: m.getMove().pp
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}) : [],
|
||||||
|
enemyParty: this.getEnemyParty() ? this.getEnemyParty().map(p => {
|
||||||
|
return {
|
||||||
|
name: p.name,
|
||||||
|
level: p.level,
|
||||||
|
speciesId: p.species.speciesId,
|
||||||
|
fusionId: p.fusionSpecies?.speciesId || -1,
|
||||||
|
active: p.active,
|
||||||
|
gender: p.gender,
|
||||||
|
fieldPosition: p.fieldPosition,
|
||||||
|
speciesVariant: p.variant,
|
||||||
|
fusionVariant: p.fusionVariant,
|
||||||
|
hp: {
|
||||||
|
percent: (p.getHpRatio(false))*100
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}) : [],
|
||||||
|
|
||||||
};
|
};
|
||||||
(window as any).gameInfo = gameInfo;
|
(window as any).gameInfo = gameInfo;
|
||||||
|
Loading…
Reference in New Issue
Block a user