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

View File

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

View File

@ -1518,7 +1518,7 @@ export class ModifierTypeOption {
}
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);
}

View File

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

View File

@ -1189,6 +1189,10 @@ export class GameData {
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[] {
let ret: Nature[] = [];
for (let n = 0; n < 25; n++) {

View File

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

View File

@ -97,6 +97,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
private pokemonGrowthRateText: Phaser.GameObjects.Text;
private type1Icon: Phaser.GameObjects.Sprite;
private type2Icon: Phaser.GameObjects.Sprite;
private pokemonLuckLabelText: Phaser.GameObjects.Text;
private pokemonLuckText: Phaser.GameObjects.Text;
private pokemonGenderText: Phaser.GameObjects.Text;
private pokemonUncaughtText: Phaser.GameObjects.Text;
private pokemonAbilityLabelText: Phaser.GameObjects.Text;
@ -418,6 +420,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.type2Icon.setOrigin(0, 0);
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.setScale(0.5);
this.pokemonCandyIcon.setOrigin(0, 0);
@ -1249,6 +1259,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
if (this.speciesStarterDexEntry?.caughtAttr) {
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.setColor(getGrowthRateColor(species.growthRate));
this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true));
@ -1310,6 +1326,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonGrowthRateLabelText.setVisible(false);
this.type1Icon.setVisible(false);
this.type2Icon.setVisible(false);
this.pokemonLuckLabelText.setVisible(false);
this.pokemonLuckText.setVisible(false);
this.pokemonUncaughtText.setVisible(true);
this.pokemonAbilityLabelText.setVisible(false);
this.pokemonPassiveLabelText.setVisible(false);
@ -1334,6 +1352,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonGrowthRateLabelText.setVisible(false);
this.type1Icon.setVisible(false);
this.type2Icon.setVisible(false);
this.pokemonLuckLabelText.setVisible(false);
this.pokemonLuckText.setVisible(false);
this.pokemonUncaughtText.setVisible(!!species);
this.pokemonAbilityLabelText.setVisible(false);
this.pokemonPassiveLabelText.setVisible(false);

View File

@ -16,7 +16,7 @@ import { getBiomeName } from "../data/biomes";
import { Nature, getNatureStatMultiplier } from "../data/nature";
import { loggedInUser } from "../account";
import { PlayerGender } from "../system/game-data";
import { getVariantTint } from "#app/data/variant";
import { Variant, getVariantTint } from "#app/data/variant";
enum Page {
PROFILE,
@ -604,6 +604,17 @@ export default class SummaryUiHandler extends UiHandler {
if (this.pokemon.isTerastallized())
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 abilityNameText = addTextObject(this.scene, 7, 66, ability.name, TextStyle.SUMMARY_ALT);