Add fusion luck as a separate field
parent
bf2a83993c
commit
6b9542511f
|
@ -85,6 +85,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
public fusionShiny: boolean;
|
||||
public fusionVariant: Variant;
|
||||
public fusionGender: Gender;
|
||||
public fusionLuck: integer;
|
||||
|
||||
private summonDataPrimer: PokemonSummonData;
|
||||
|
||||
|
@ -153,6 +154,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.fusionShiny = dataSource.fusionShiny;
|
||||
this.fusionVariant = dataSource.fusionVariant || 0;
|
||||
this.fusionGender = dataSource.fusionGender;
|
||||
this.fusionLuck = dataSource.fusionLuck;
|
||||
} else {
|
||||
this.id = Utils.randSeedInt(4294967296);
|
||||
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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
getLuck(): integer {
|
||||
return this.luck + this.fusionLuck;
|
||||
}
|
||||
|
||||
isFusion(): boolean {
|
||||
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.fusionLuck = this.luck;
|
||||
|
||||
this.generateName();
|
||||
}
|
||||
|
@ -1062,6 +1069,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.fusionAbilityIndex = 0;
|
||||
this.fusionShiny = false;
|
||||
this.fusionGender = 0;
|
||||
this.fusionLuck = 0;
|
||||
|
||||
this.generateName();
|
||||
this.calculateStats();
|
||||
|
@ -2418,6 +2426,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
newPokemon.fusionShiny = this.fusionShiny;
|
||||
newPokemon.fusionVariant = this.fusionVariant;
|
||||
newPokemon.fusionGender = this.fusionGender;
|
||||
newPokemon.fusionLuck = this.fusionLuck;
|
||||
this.scene.getParty().push(newPokemon);
|
||||
newPokemon.evolve(newEvolution);
|
||||
const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
|
@ -2477,6 +2486,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
this.fusionShiny = pokemon.shiny;
|
||||
this.fusionVariant = pokemon.fusionVariant;
|
||||
this.fusionGender = pokemon.gender;
|
||||
this.fusionLuck = pokemon.luck;
|
||||
|
||||
this.scene.validateAchv(achvs.SPLICE);
|
||||
this.scene.gameData.gameStats.pokemonFused++;
|
||||
|
|
|
@ -1518,7 +1518,7 @@ export class ModifierTypeOption {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ export default class PokemonData {
|
|||
public fusionShiny: boolean;
|
||||
public fusionVariant: Variant;
|
||||
public fusionGender: Gender;
|
||||
public fusionLuck: integer;
|
||||
|
||||
public boss: boolean;
|
||||
|
||||
|
@ -76,7 +77,7 @@ export default class PokemonData {
|
|||
this.friendship = source.friendship !== undefined ? source.friendship : getPokemonSpecies(this.species).baseFriendship;
|
||||
this.metLevel = source.metLevel || 5;
|
||||
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)
|
||||
this.pauseEvolutions = !!source.pauseEvolutions;
|
||||
this.pokerus = !!source.pokerus;
|
||||
|
@ -87,6 +88,7 @@ export default class PokemonData {
|
|||
this.fusionShiny = source.fusionShiny;
|
||||
this.fusionVariant = source.fusionVariant;
|
||||
this.fusionGender = source.fusionGender;
|
||||
this.fusionLuck = source.fusionLuck !== undefined ? source.fusionLuck : (source.fusionShiny ? source.fusionVariant + 1 : 0);
|
||||
|
||||
if (!forHistory)
|
||||
this.boss = (source instanceof EnemyPokemon && !!source.bossSegments) || (!this.player && !!source.boss);
|
||||
|
|
|
@ -604,14 +604,14 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
if (this.pokemon.isTerastallized())
|
||||
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);
|
||||
luckLabelText.setOrigin(0, 0);
|
||||
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.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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue