Add fusion luck as a separate field

battle-stats
Flashfyre 2024-04-26 18:27:00 -04:00
parent bf2a83993c
commit 6b9542511f
4 changed files with 18 additions and 6 deletions

View File

@ -85,6 +85,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public fusionShiny: boolean; public fusionShiny: boolean;
public fusionVariant: Variant; public fusionVariant: Variant;
public fusionGender: Gender; public fusionGender: Gender;
public fusionLuck: integer;
private summonDataPrimer: PokemonSummonData; private summonDataPrimer: PokemonSummonData;
@ -153,6 +154,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.fusionShiny = dataSource.fusionShiny; this.fusionShiny = dataSource.fusionShiny;
this.fusionVariant = dataSource.fusionVariant || 0; this.fusionVariant = dataSource.fusionVariant || 0;
this.fusionGender = dataSource.fusionGender; this.fusionGender = dataSource.fusionGender;
this.fusionLuck = dataSource.fusionLuck;
} else { } else {
this.id = Utils.randSeedInt(4294967296); this.id = Utils.randSeedInt(4294967296);
this.ivs = ivs || Utils.getIvsFromId(this.id); this.ivs = ivs || Utils.getIvsFromId(this.id);
@ -192,7 +194,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
this.luck = this.isShiny() ? this.variant + this.fusionVariant : 0; this.luck = (this.shiny ? (this.variant + 1) : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
} }
this.generateName(); this.generateName();
@ -690,6 +692,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return !this.isFusion() ? this.variant : Math.max(this.variant, this.fusionVariant) as Variant; return !this.isFusion() ? this.variant : Math.max(this.variant, this.fusionVariant) as Variant;
} }
getLuck(): integer {
return this.luck + this.fusionLuck;
}
isFusion(): boolean { isFusion(): boolean {
return !!this.fusionSpecies; return !!this.fusionSpecies;
} }
@ -1052,6 +1058,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
this.fusionFormIndex = this.scene.getSpeciesFormIndex(this.fusionSpecies, this.fusionGender, this.getNature(), true); this.fusionFormIndex = this.scene.getSpeciesFormIndex(this.fusionSpecies, this.fusionGender, this.getNature(), true);
this.fusionLuck = this.luck;
this.generateName(); this.generateName();
} }
@ -1062,6 +1069,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.fusionAbilityIndex = 0; this.fusionAbilityIndex = 0;
this.fusionShiny = false; this.fusionShiny = false;
this.fusionGender = 0; this.fusionGender = 0;
this.fusionLuck = 0;
this.generateName(); this.generateName();
this.calculateStats(); this.calculateStats();
@ -2418,6 +2426,7 @@ export class PlayerPokemon extends Pokemon {
newPokemon.fusionShiny = this.fusionShiny; newPokemon.fusionShiny = this.fusionShiny;
newPokemon.fusionVariant = this.fusionVariant; newPokemon.fusionVariant = this.fusionVariant;
newPokemon.fusionGender = this.fusionGender; newPokemon.fusionGender = this.fusionGender;
newPokemon.fusionLuck = this.fusionLuck;
this.scene.getParty().push(newPokemon); this.scene.getParty().push(newPokemon);
newPokemon.evolve(newEvolution); newPokemon.evolve(newEvolution);
const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
@ -2477,6 +2486,7 @@ export class PlayerPokemon extends Pokemon {
this.fusionShiny = pokemon.shiny; this.fusionShiny = pokemon.shiny;
this.fusionVariant = pokemon.fusionVariant; this.fusionVariant = pokemon.fusionVariant;
this.fusionGender = pokemon.gender; this.fusionGender = pokemon.gender;
this.fusionLuck = pokemon.luck;
this.scene.validateAchv(achvs.SPLICE); this.scene.validateAchv(achvs.SPLICE);
this.scene.gameData.gameStats.pokemonFused++; this.scene.gameData.gameStats.pokemonFused++;

View File

@ -1518,7 +1518,7 @@ export class ModifierTypeOption {
} }
export function getPartyLuckValue(party: Pokemon[]): integer { export function getPartyLuckValue(party: Pokemon[]): integer {
return Phaser.Math.Clamp(party.map(p => p.isFainted() ? 0 : p.luck) return Phaser.Math.Clamp(party.map(p => p.isFainted() ? 0 : p.getLuck())
.reduce((total: integer, value: integer) => total += value, 0), 0, 14); .reduce((total: integer, value: integer) => total += value, 0), 0, 14);
} }

View File

@ -46,6 +46,7 @@ export default class PokemonData {
public fusionShiny: boolean; public fusionShiny: boolean;
public fusionVariant: Variant; public fusionVariant: Variant;
public fusionGender: Gender; public fusionGender: Gender;
public fusionLuck: integer;
public boss: boolean; public boss: boolean;
@ -76,7 +77,7 @@ export default class PokemonData {
this.friendship = source.friendship !== undefined ? source.friendship : getPokemonSpecies(this.species).baseFriendship; this.friendship = source.friendship !== undefined ? source.friendship : getPokemonSpecies(this.species).baseFriendship;
this.metLevel = source.metLevel || 5; this.metLevel = source.metLevel || 5;
this.metBiome = source.metBiome !== undefined ? source.metBiome : -1; this.metBiome = source.metBiome !== undefined ? source.metBiome : -1;
this.luck = source.luck !== undefined ? source.luck : (source.shiny ? (source.variant + 1) : 0) + (source.fusionShiny ? source.fusionVariant + 1 : 0); this.luck = source.luck !== undefined ? source.luck : (source.shiny ? (source.variant + 1) : 0);
if (!forHistory) if (!forHistory)
this.pauseEvolutions = !!source.pauseEvolutions; this.pauseEvolutions = !!source.pauseEvolutions;
this.pokerus = !!source.pokerus; this.pokerus = !!source.pokerus;
@ -87,6 +88,7 @@ export default class PokemonData {
this.fusionShiny = source.fusionShiny; this.fusionShiny = source.fusionShiny;
this.fusionVariant = source.fusionVariant; this.fusionVariant = source.fusionVariant;
this.fusionGender = source.fusionGender; this.fusionGender = source.fusionGender;
this.fusionLuck = source.fusionLuck !== undefined ? source.fusionLuck : (source.fusionShiny ? source.fusionVariant + 1 : 0);
if (!forHistory) if (!forHistory)
this.boss = (source instanceof EnemyPokemon && !!source.bossSegments) || (!this.player && !!source.boss); this.boss = (source instanceof EnemyPokemon && !!source.bossSegments) || (!this.player && !!source.boss);

View File

@ -604,14 +604,14 @@ export default class SummaryUiHandler extends UiHandler {
if (this.pokemon.isTerastallized()) if (this.pokemon.isTerastallized())
profileContainer.add(getTypeIcon(types.length, this.pokemon.getTeraType(), true)); profileContainer.add(getTypeIcon(types.length, this.pokemon.getTeraType(), true));
if (this.pokemon.luck) { if (this.pokemon.getLuck()) {
const luckLabelText = addTextObject(this.scene, 141, 28, 'Luck:', TextStyle.SUMMARY_ALT); const luckLabelText = addTextObject(this.scene, 141, 28, 'Luck:', TextStyle.SUMMARY_ALT);
luckLabelText.setOrigin(0, 0); luckLabelText.setOrigin(0, 0);
profileContainer.add(luckLabelText); profileContainer.add(luckLabelText);
const luckText = addTextObject(this.scene, 141 + luckLabelText.displayWidth + 2, 28, this.pokemon.luck.toString(), TextStyle.SUMMARY); const luckText = addTextObject(this.scene, 141 + luckLabelText.displayWidth + 2, 28, this.pokemon.getLuck().toString(), TextStyle.SUMMARY);
luckText.setOrigin(0, 0); luckText.setOrigin(0, 0);
luckText.setTint(getVariantTint((Math.min(this.pokemon.luck - 1, 2)) as Variant)); luckText.setTint(getVariantTint((Math.min(this.pokemon.getLuck() - 1, 2)) as Variant));
profileContainer.add(luckText); profileContainer.add(luckText);
} }