Merge remote-tracking branch 'origin/main' into ui-move-effectiveness-color

This commit is contained in:
Paul 2024-04-26 23:43:01 +02:00
commit cf384927db
8 changed files with 66 additions and 24 deletions

View File

@ -75,6 +75,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public friendship: integer; public friendship: integer;
public metLevel: integer; public metLevel: integer;
public metBiome: Biome | -1; public metBiome: Biome | -1;
public luck: integer;
public pauseEvolutions: boolean; public pauseEvolutions: boolean;
public pokerus: boolean; public pokerus: boolean;
@ -142,6 +143,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.status = dataSource.status; this.status = dataSource.status;
this.friendship = dataSource.friendship !== undefined ? dataSource.friendship : this.species.baseFriendship; this.friendship = dataSource.friendship !== undefined ? dataSource.friendship : this.species.baseFriendship;
this.metLevel = dataSource.metLevel || 5; this.metLevel = dataSource.metLevel || 5;
this.luck = dataSource.luck;
this.metBiome = dataSource.metBiome; this.metBiome = dataSource.metBiome;
this.pauseEvolutions = dataSource.pauseEvolutions; this.pauseEvolutions = dataSource.pauseEvolutions;
this.pokerus = !!dataSource.pokerus; this.pokerus = !!dataSource.pokerus;
@ -189,6 +191,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.generateFusionSpecies(); this.generateFusionSpecies();
} }
} }
this.luck = this.isShiny() ? this.variant + this.fusionVariant : 0;
} }
this.generateName(); this.generateName();

View File

@ -772,7 +772,7 @@ export const pokemon: SimpleTranslationEntries = {
"sandygast": "Sandygast", "sandygast": "Sandygast",
"palossand": "Palossand", "palossand": "Palossand",
"pyukumuku": "Pyukumuku", "pyukumuku": "Pyukumuku",
"type_null": "Type: Null", "type_null": "Código Cero",
"silvally": "Silvally", "silvally": "Silvally",
"minior": "Minior", "minior": "Minior",
"komala": "Komala", "komala": "Komala",
@ -984,18 +984,18 @@ export const pokemon: SimpleTranslationEntries = {
"farigiraf": "Farigiraf", "farigiraf": "Farigiraf",
"dudunsparce": "Dudunsparce", "dudunsparce": "Dudunsparce",
"kingambit": "Kingambit", "kingambit": "Kingambit",
"great_tusk": "Great Tusk", "great_tusk": "Colmilargo",
"scream_tail": "Scream Tail", "scream_tail": "Colagrito",
"brute_bonnet": "Brute Bonnet", "brute_bonnet": "Furioseta",
"flutter_mane": "Flutter Mane", "flutter_mane": "Melenaleteo",
"slither_wing": "Slither Wing", "slither_wing": "Reptalada",
"sandy_shocks": "Sandy Shocks", "sandy_shocks": "Pelarena",
"iron_treads": "Iron Treads", "iron_treads": "Ferrodada",
"iron_bundle": "Iron Bundle", "iron_bundle": "Ferrosaco",
"iron_hands": "Iron Hands", "iron_hands": "Ferropalmas",
"iron_jugulis": "Iron Jugulis", "iron_jugulis": "Ferrocuello",
"iron_moth": "Iron Moth", "iron_moth": "Ferropolilla",
"iron_thorns": "Iron Thorns", "iron_thorns": "Ferropúas",
"frigibax": "Frigibax", "frigibax": "Frigibax",
"arctibax": "Arctibax", "arctibax": "Arctibax",
"baxcalibur": "Baxcalibur", "baxcalibur": "Baxcalibur",
@ -1005,12 +1005,12 @@ export const pokemon: SimpleTranslationEntries = {
"chien_pao": "Chien-Pao", "chien_pao": "Chien-Pao",
"ting_lu": "Ting-Lu", "ting_lu": "Ting-Lu",
"chi_yu": "Chi-Yu", "chi_yu": "Chi-Yu",
"roaring_moon": "Roaring Moon", "roaring_moon": "Bramaluna",
"iron_valiant": "Iron Valiant", "iron_valiant": "Ferropaladín",
"koraidon": "Koraidon", "koraidon": "Koraidon",
"miraidon": "Miraidon", "miraidon": "Miraidon",
"walking_wake": "Walking Wake", "walking_wake": "Ondulagua",
"iron_leaves": "Iron Leaves", "iron_leaves": "Ferroverdor",
"dipplin": "Dipplin", "dipplin": "Dipplin",
"poltchageist": "Poltchageist", "poltchageist": "Poltchageist",
"sinistcha": "Sinistcha", "sinistcha": "Sinistcha",
@ -1020,10 +1020,10 @@ export const pokemon: SimpleTranslationEntries = {
"ogerpon": "Ogerpon", "ogerpon": "Ogerpon",
"archaludon": "Archaludon", "archaludon": "Archaludon",
"hydrapple": "Hydrapple", "hydrapple": "Hydrapple",
"gouging_fire": "Gouging Fire", "gouging_fire": "Flamariete",
"raging_bolt": "Raging Bolt", "raging_bolt": "Electrofuria",
"iron_boulder": "Iron Boulder", "iron_boulder": "Ferromole",
"iron_crown": "Iron Crown", "iron_crown": "Ferrotesta",
"terapagos": "Terapagos", "terapagos": "Terapagos",
"pecharunt": "Pecharunt", "pecharunt": "Pecharunt",
"alola_rattata": "Rattata", "alola_rattata": "Rattata",

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() || !p.isShiny() ? 0 : !p.isFusion() || !p.shiny || !p.fusionShiny ? p.variant + 1 : (p.variant + 1) + (p.fusionVariant + 1)) return Phaser.Math.Clamp(party.map(p => p.isFainted() ? 0 : p.luck)
.reduce((total: integer, value: integer) => total += value, 0), 0, 14); .reduce((total: integer, value: integer) => total += value, 0), 0, 14);
} }

View File

@ -497,6 +497,7 @@ export class SelectStarterPhase extends Phase {
starterPokemon.tryPopulateMoveset(starter.moveset); starterPokemon.tryPopulateMoveset(starter.moveset);
if (starter.passive) if (starter.passive)
starterPokemon.passive = true; starterPokemon.passive = true;
starterPokemon.luck = this.scene.gameData.getDexAttrLuck(this.scene.gameData.dexData[starter.species.speciesId].caughtAttr);
if (starter.pokerus) if (starter.pokerus)
starterPokemon.pokerus = true; starterPokemon.pokerus = true;
if (this.scene.gameMode.isSplicedOnly) if (this.scene.gameMode.isSplicedOnly)

View File

@ -1189,6 +1189,10 @@ export class GameData {
return Math.pow(2, this.getSpeciesDefaultNature(species)); return Math.pow(2, this.getSpeciesDefaultNature(species));
} }
getDexAttrLuck(dexAttr: bigint): integer {
return dexAttr & DexAttr.SHINY ? dexAttr & DexAttr.VARIANT_3 ? 3 : dexAttr & DexAttr.VARIANT_2 ? 2 : 1 : 0;
}
getNaturesForAttr(natureAttr: integer): Nature[] { getNaturesForAttr(natureAttr: integer): Nature[] {
let ret: Nature[] = []; let ret: Nature[] = [];
for (let n = 0; n < 25; n++) { for (let n = 0; n < 25; n++) {

View File

@ -36,6 +36,7 @@ export default class PokemonData {
public friendship: integer; public friendship: integer;
public metLevel: integer; public metLevel: integer;
public metBiome: Biome | -1; public metBiome: Biome | -1;
public luck: integer;
public pauseEvolutions: boolean; public pauseEvolutions: boolean;
public pokerus: boolean; public pokerus: boolean;
@ -75,6 +76,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);
if (!forHistory) if (!forHistory)
this.pauseEvolutions = !!source.pauseEvolutions; this.pauseEvolutions = !!source.pauseEvolutions;
this.pokerus = !!source.pokerus; this.pokerus = !!source.pokerus;

View File

@ -97,6 +97,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
private pokemonGrowthRateText: Phaser.GameObjects.Text; private pokemonGrowthRateText: Phaser.GameObjects.Text;
private type1Icon: Phaser.GameObjects.Sprite; private type1Icon: Phaser.GameObjects.Sprite;
private type2Icon: Phaser.GameObjects.Sprite; private type2Icon: Phaser.GameObjects.Sprite;
private pokemonLuckLabelText: Phaser.GameObjects.Text;
private pokemonLuckText: Phaser.GameObjects.Text;
private pokemonGenderText: Phaser.GameObjects.Text; private pokemonGenderText: Phaser.GameObjects.Text;
private pokemonUncaughtText: Phaser.GameObjects.Text; private pokemonUncaughtText: Phaser.GameObjects.Text;
private pokemonAbilityLabelText: Phaser.GameObjects.Text; private pokemonAbilityLabelText: Phaser.GameObjects.Text;
@ -418,6 +420,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.type2Icon.setOrigin(0, 0); this.type2Icon.setOrigin(0, 0);
this.starterSelectContainer.add(this.type2Icon); this.starterSelectContainer.add(this.type2Icon);
this.pokemonLuckLabelText = addTextObject(this.scene, 8, 89, 'Luck:', TextStyle.WINDOW_ALT, { fontSize: '56px' });
this.pokemonLuckLabelText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonLuckLabelText);
this.pokemonLuckText = addTextObject(this.scene, 8 + this.pokemonLuckLabelText.displayWidth + 2, 89, '0', TextStyle.WINDOW, { fontSize: '56px' });
this.pokemonLuckText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonLuckText);
this.pokemonCandyIcon = this.scene.add.sprite(1, 12, 'items', 'candy'); this.pokemonCandyIcon = this.scene.add.sprite(1, 12, 'items', 'candy');
this.pokemonCandyIcon.setScale(0.5); this.pokemonCandyIcon.setScale(0.5);
this.pokemonCandyIcon.setOrigin(0, 0); this.pokemonCandyIcon.setOrigin(0, 0);
@ -1249,6 +1259,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
if (this.speciesStarterDexEntry?.caughtAttr) { if (this.speciesStarterDexEntry?.caughtAttr) {
const colorScheme = starterColors[species.speciesId]; const colorScheme = starterColors[species.speciesId];
const luck = this.scene.gameData.getDexAttrLuck(this.speciesStarterDexEntry.caughtAttr);
this.pokemonLuckText.setVisible(!!luck);
this.pokemonLuckText.setText(luck.toString());
this.pokemonLuckText.setTint(getVariantTint(Math.min(luck - 1, 2) as Variant));
this.pokemonLuckLabelText.setVisible(this.pokemonLuckText.visible);
this.pokemonGrowthRateText.setText(Utils.toReadableString(GrowthRate[species.growthRate])); this.pokemonGrowthRateText.setText(Utils.toReadableString(GrowthRate[species.growthRate]));
this.pokemonGrowthRateText.setColor(getGrowthRateColor(species.growthRate)); this.pokemonGrowthRateText.setColor(getGrowthRateColor(species.growthRate));
this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true)); this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true));
@ -1310,6 +1326,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonGrowthRateLabelText.setVisible(false); this.pokemonGrowthRateLabelText.setVisible(false);
this.type1Icon.setVisible(false); this.type1Icon.setVisible(false);
this.type2Icon.setVisible(false); this.type2Icon.setVisible(false);
this.pokemonLuckLabelText.setVisible(false);
this.pokemonLuckText.setVisible(false);
this.pokemonUncaughtText.setVisible(true); this.pokemonUncaughtText.setVisible(true);
this.pokemonAbilityLabelText.setVisible(false); this.pokemonAbilityLabelText.setVisible(false);
this.pokemonPassiveLabelText.setVisible(false); this.pokemonPassiveLabelText.setVisible(false);
@ -1334,6 +1352,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonGrowthRateLabelText.setVisible(false); this.pokemonGrowthRateLabelText.setVisible(false);
this.type1Icon.setVisible(false); this.type1Icon.setVisible(false);
this.type2Icon.setVisible(false); this.type2Icon.setVisible(false);
this.pokemonLuckLabelText.setVisible(false);
this.pokemonLuckText.setVisible(false);
this.pokemonUncaughtText.setVisible(!!species); this.pokemonUncaughtText.setVisible(!!species);
this.pokemonAbilityLabelText.setVisible(false); this.pokemonAbilityLabelText.setVisible(false);
this.pokemonPassiveLabelText.setVisible(false); this.pokemonPassiveLabelText.setVisible(false);

View File

@ -16,7 +16,7 @@ import { getBiomeName } from "../data/biomes";
import { Nature, getNatureStatMultiplier } from "../data/nature"; import { Nature, getNatureStatMultiplier } from "../data/nature";
import { loggedInUser } from "../account"; import { loggedInUser } from "../account";
import { PlayerGender } from "../system/game-data"; import { PlayerGender } from "../system/game-data";
import { getVariantTint } from "#app/data/variant"; import { Variant, getVariantTint } from "#app/data/variant";
enum Page { enum Page {
PROFILE, PROFILE,
@ -604,6 +604,17 @@ 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) {
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);
luckText.setOrigin(0, 0);
luckText.setTint(getVariantTint((Math.min(this.pokemon.luck - 1, 2)) as Variant));
profileContainer.add(luckText);
}
const ability = this.pokemon.getAbility(true); const ability = this.pokemon.getAbility(true);
const abilityNameText = addTextObject(this.scene, 7, 66, ability.name, TextStyle.SUMMARY_ALT); const abilityNameText = addTextObject(this.scene, 7, 66, ability.name, TextStyle.SUMMARY_ALT);