Merge branch 'shaymin' of https://github.com/alexcattani44/pokerogue into shaymin

This commit is contained in:
Alex Cattani 2024-04-16 19:15:24 -04:00
commit eec6a9f0dc
20 changed files with 5273 additions and 1278 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.0.0", "version": "1.0.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pokemon-rogue-battle", "name": "pokemon-rogue-battle",
"version": "1.0.0", "version": "1.0.1",
"dependencies": { "dependencies": {
"@material/material-color-utilities": "^0.2.7", "@material/material-color-utilities": "^0.2.7",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",

View File

@ -1246,7 +1246,6 @@ export default class BattleScene extends SceneBase {
case Mode.SAVE_SLOT: case Mode.SAVE_SLOT:
case Mode.PARTY: case Mode.PARTY:
case Mode.SUMMARY: case Mode.SUMMARY:
case Mode.BIOME_SELECT:
case Mode.STARTER_SELECT: case Mode.STARTER_SELECT:
case Mode.CONFIRM: case Mode.CONFIRM:
case Mode.OPTION_SELECT: case Mode.OPTION_SELECT:
@ -1266,14 +1265,19 @@ export default class BattleScene extends SceneBase {
} else if (this.ui?.getHandler() instanceof StarterSelectUiHandler) { } else if (this.ui?.getHandler() instanceof StarterSelectUiHandler) {
if (this.buttonJustPressed(Button.CYCLE_SHINY)) { if (this.buttonJustPressed(Button.CYCLE_SHINY)) {
inputSuccess = this.ui.processInput(Button.CYCLE_SHINY); inputSuccess = this.ui.processInput(Button.CYCLE_SHINY);
this.setLastProcessedMovementTime(Button.CYCLE_SHINY);
} else if (this.buttonJustPressed(Button.CYCLE_FORM)) { } else if (this.buttonJustPressed(Button.CYCLE_FORM)) {
inputSuccess = this.ui.processInput(Button.CYCLE_FORM); inputSuccess = this.ui.processInput(Button.CYCLE_FORM);
this.setLastProcessedMovementTime(Button.CYCLE_FORM);
} else if (this.buttonJustPressed(Button.CYCLE_GENDER)) { } else if (this.buttonJustPressed(Button.CYCLE_GENDER)) {
inputSuccess = this.ui.processInput(Button.CYCLE_GENDER); inputSuccess = this.ui.processInput(Button.CYCLE_GENDER);
this.setLastProcessedMovementTime(Button.CYCLE_GENDER);
} else if (this.buttonJustPressed(Button.CYCLE_ABILITY)) { } else if (this.buttonJustPressed(Button.CYCLE_ABILITY)) {
inputSuccess = this.ui.processInput(Button.CYCLE_ABILITY); inputSuccess = this.ui.processInput(Button.CYCLE_ABILITY);
this.setLastProcessedMovementTime(Button.CYCLE_ABILITY);
} else if (this.buttonJustPressed(Button.CYCLE_NATURE)) { } else if (this.buttonJustPressed(Button.CYCLE_NATURE)) {
inputSuccess = this.ui.processInput(Button.CYCLE_NATURE); inputSuccess = this.ui.processInput(Button.CYCLE_NATURE);
this.setLastProcessedMovementTime(Button.CYCLE_NATURE);
} else } else
return; return;
} else if (this.buttonJustPressed(Button.SPEED_UP)) { } else if (this.buttonJustPressed(Button.SPEED_UP)) {
@ -1648,8 +1652,9 @@ export default class BattleScene extends SceneBase {
return Math.floor(moneyValue / 10) * 10; return Math.floor(moneyValue / 10) * 10;
} }
addModifier(modifier: Modifier, ignoreUpdate?: boolean, playSound?: boolean, virtual?: boolean, instant?: boolean): Promise<void> { addModifier(modifier: Modifier, ignoreUpdate?: boolean, playSound?: boolean, virtual?: boolean, instant?: boolean): Promise<boolean> {
return new Promise(resolve => { return new Promise(resolve => {
let success = false;
const soundName = modifier.type.soundName; const soundName = modifier.type.soundName;
this.validateAchvs(ModifierAchv, modifier); this.validateAchvs(ModifierAchv, modifier);
const modifiersToRemove: PersistentModifier[] = []; const modifiersToRemove: PersistentModifier[] = [];
@ -1659,20 +1664,20 @@ export default class BattleScene extends SceneBase {
modifiersToRemove.push(...(this.findModifiers(m => m instanceof TerastallizeModifier && m.pokemonId === modifier.pokemonId))); modifiersToRemove.push(...(this.findModifiers(m => m instanceof TerastallizeModifier && m.pokemonId === modifier.pokemonId)));
if ((modifier as PersistentModifier).add(this.modifiers, !!virtual, this)) { if ((modifier as PersistentModifier).add(this.modifiers, !!virtual, this)) {
if (modifier instanceof PokemonFormChangeItemModifier || modifier instanceof TerastallizeModifier) if (modifier instanceof PokemonFormChangeItemModifier || modifier instanceof TerastallizeModifier)
modifier.apply([ this.getPokemonById(modifier.pokemonId), true ]); success = modifier.apply([ this.getPokemonById(modifier.pokemonId), true ]);
if (playSound && !this.sound.get(soundName)) if (playSound && !this.sound.get(soundName))
this.playSound(soundName); this.playSound(soundName);
} else if (!virtual) { } else if (!virtual) {
const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier); const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier);
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(() => resolve()); 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);
if (!ignoreUpdate && !virtual) if (!ignoreUpdate && !virtual)
return this.updateModifiers(true, instant).then(() => resolve()); return this.updateModifiers(true, instant).then(() => resolve(success));
} else if (modifier instanceof ConsumableModifier) { } else if (modifier instanceof ConsumableModifier) {
if (playSound && !this.sound.get(soundName)) if (playSound && !this.sound.get(soundName))
this.playSound(soundName); this.playSound(soundName);
@ -1695,19 +1700,26 @@ export default class BattleScene extends SceneBase {
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)
modifierPromises.push(result); modifierPromises.push(result.then(s => success ||= s));
else
success ||= result;
} }
} }
return Promise.allSettled([this.party.map(p => p.updateInfo(instant)), ...modifierPromises]).then(() => resolve()); return Promise.allSettled([this.party.map(p => p.updateInfo(instant)), ...modifierPromises]).then(() => resolve(success));
} else { } else {
const args = [ this ]; const args = [ this ];
if (modifier.shouldApply(args)) if (modifier.shouldApply(args)) {
modifier.apply(args); const result = modifier.apply(args);
if (result instanceof Promise) {
return result.then(success => resolve(success));
} else
success ||= result;
}
} }
} }
resolve(); resolve(success);
}); });
} }

View File

@ -212,6 +212,8 @@ export default class Battle {
} }
randSeedInt(scene: BattleScene, range: integer, min: integer = 0): integer { randSeedInt(scene: BattleScene, range: integer, min: integer = 0): integer {
if (range <= 1)
return min;
let ret: integer; let ret: integer;
const tempRngCounter = scene.rngCounter; const tempRngCounter = scene.rngCounter;
const tempSeedOverride = scene.rngSeedOverride; const tempSeedOverride = scene.rngSeedOverride;

View File

@ -2222,7 +2222,7 @@ export function initAbilities() {
.attr(UnswappableAbilityAbAttr) .attr(UnswappableAbilityAbAttr)
.ignorable(), .ignorable(),
new Ability(Abilities.LEVITATE, "Levitate", "By floating in the air, the Pokémon receives full immunity to all Ground-type moves.", 3) new Ability(Abilities.LEVITATE, "Levitate", "By floating in the air, the Pokémon receives full immunity to all Ground-type moves.", 3)
.attr(TypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(BattlerTagType.IGNORE_FLYING) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY)) .attr(TypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(BattlerTagType.IGNORE_FLYING) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY) && !pokemon.getTag(BattlerTagType.GROUNDED))
.ignorable(), .ignorable(),
new Ability(Abilities.EFFECT_SPORE, "Effect Spore", "Contact with the Pokémon may inflict poison, sleep, or paralysis on its attacker.", 3) new Ability(Abilities.EFFECT_SPORE, "Effect Spore", "Contact with the Pokémon may inflict poison, sleep, or paralysis on its attacker.", 3)
.attr(PostDefendContactApplyStatusEffectAbAttr, 10, StatusEffect.POISON, StatusEffect.PARALYSIS, StatusEffect.SLEEP), .attr(PostDefendContactApplyStatusEffectAbAttr, 10, StatusEffect.POISON, StatusEffect.PARALYSIS, StatusEffect.SLEEP),

View File

@ -1094,6 +1094,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
return new BattlerTag(BattlerTagType.BYPASS_SLEEP, BattlerTagLapseType.TURN_END, turnCount, sourceMove); return new BattlerTag(BattlerTagType.BYPASS_SLEEP, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
case BattlerTagType.IGNORE_FLYING: case BattlerTagType.IGNORE_FLYING:
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove); return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
case BattlerTagType.GROUNDED:
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount - 1, sourceMove);
case BattlerTagType.SALT_CURED: case BattlerTagType.SALT_CURED:
return new SaltCuredTag(sourceId); return new SaltCuredTag(sourceId);
case BattlerTagType.NONE: case BattlerTagType.NONE:
@ -1101,3 +1103,4 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
} }
} }

View File

@ -44,7 +44,7 @@ export const biomeLinks: BiomeLinks = {
[Biome.SEA]: [ Biome.SEABED, Biome.ICE_CAVE ], [Biome.SEA]: [ Biome.SEABED, Biome.ICE_CAVE ],
[Biome.SWAMP]: [ Biome.GRAVEYARD, Biome.TALL_GRASS ], [Biome.SWAMP]: [ Biome.GRAVEYARD, Biome.TALL_GRASS ],
[Biome.BEACH]: [ Biome.SEA, [ Biome.ISLAND, 4 ] ], [Biome.BEACH]: [ Biome.SEA, [ Biome.ISLAND, 4 ] ],
[Biome.LAKE]: [ Biome.BEACH, Biome.SWAMP ], [Biome.LAKE]: [ Biome.BEACH, Biome.SWAMP, Biome.CONSTRUCTION_SITE ],
[Biome.SEABED]: [ Biome.CAVE, [ Biome.VOLCANO, 4 ] ], [Biome.SEABED]: [ Biome.CAVE, [ Biome.VOLCANO, 4 ] ],
[Biome.MOUNTAIN]: [ Biome.VOLCANO, [ Biome.WASTELAND, 3 ] ], [Biome.MOUNTAIN]: [ Biome.VOLCANO, [ Biome.WASTELAND, 3 ] ],
[Biome.BADLANDS]: [ Biome.DESERT, Biome.MOUNTAIN ], [Biome.BADLANDS]: [ Biome.DESERT, Biome.MOUNTAIN ],
@ -66,9 +66,9 @@ export const biomeLinks: BiomeLinks = {
[Biome.FAIRY_CAVE]: [ Biome.ICE_CAVE, [ Biome.SPACE, 3 ] ], [Biome.FAIRY_CAVE]: [ Biome.ICE_CAVE, [ Biome.SPACE, 3 ] ],
[Biome.TEMPLE]: [ Biome.SWAMP, [ Biome.RUINS, 3 ] ], [Biome.TEMPLE]: [ Biome.SWAMP, [ Biome.RUINS, 3 ] ],
[Biome.METROPOLIS]: Biome.SLUM, [Biome.METROPOLIS]: Biome.SLUM,
[Biome.SNOWY_FOREST]: Biome.LAKE, [Biome.SNOWY_FOREST]: [ Biome.FOREST, Biome.LAKE, Biome.MOUNTAIN ],
[Biome.ISLAND]: Biome.SEA, [Biome.ISLAND]: Biome.SEA,
[Biome.LABORATORY]: Biome.METROPOLIS [Biome.LABORATORY]: Biome.CONSTRUCTION_SITE
}; };
export const biomeDepths: BiomeDepths = {}; export const biomeDepths: BiomeDepths = {};

View File

@ -47,5 +47,6 @@ export enum BattlerTagType {
IGNORE_ACCURACY = "IGNORE_ACCURACY", IGNORE_ACCURACY = "IGNORE_ACCURACY",
BYPASS_SLEEP = "BYPASS_SLEEP", BYPASS_SLEEP = "BYPASS_SLEEP",
IGNORE_FLYING = "IGNORE_FLYING", IGNORE_FLYING = "IGNORE_FLYING",
GROUNDED = "GROUNDED",
SALT_CURED = "SALT_CURED" SALT_CURED = "SALT_CURED"
} }

File diff suppressed because it is too large Load Diff

View File

@ -968,8 +968,8 @@ export const pokemonEvolutions: PokemonEvolutions = {
new SpeciesEvolution(Species.COSMOEM, 43, null, null) new SpeciesEvolution(Species.COSMOEM, 43, null, null)
], ],
[Species.COSMOEM]: [ [Species.COSMOEM]: [
new SpeciesEvolution(Species.SOLGALEO, 53, null, new SpeciesEvolutionCondition(p => p.scene.arena.biomeType !== Biome.SPACE && p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), null), new SpeciesEvolution(Species.SOLGALEO, 53, null, new SpeciesEvolutionCondition(p => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), null),
new SpeciesEvolution(Species.LUNALA, 53, null, new SpeciesEvolutionCondition(p => p.scene.arena.biomeType !== Biome.SPACE && p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), null) new SpeciesEvolution(Species.LUNALA, 53, null, new SpeciesEvolutionCondition(p => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), null)
], ],
[Species.MELTAN]: [ [Species.MELTAN]: [
new SpeciesEvolution(Species.MELMETAL, 48, null, null) new SpeciesEvolution(Species.MELMETAL, 48, null, null)

View File

@ -15,6 +15,7 @@ splashMessages.push(...[
'Now with 33% More Salt!', 'Now with 33% More Salt!',
'Infinite Fusion at Home!', 'Infinite Fusion at Home!',
'Broken Egg Moves!', 'Broken Egg Moves!',
'Magnificent!',
'Mubstitute!', 'Mubstitute!',
'That\'s Crazy!', 'That\'s Crazy!',
'Orance Juice!', 'Orance Juice!',

View File

@ -28,7 +28,7 @@ import { Biome } from "../data/enums/biome";
import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from '../data/ability'; import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from '../data/ability';
import { Abilities } from "#app/data/enums/abilities"; import { Abilities } from "#app/data/enums/abilities";
import PokemonData from '../system/pokemon-data'; import PokemonData from '../system/pokemon-data';
import { BattlerIndex } from '../battle'; import Battle, { BattlerIndex } from '../battle';
import { BattleSpec } from "../enums/battle-spec"; import { BattleSpec } from "../enums/battle-spec";
import { Mode } from '../ui/ui'; import { Mode } from '../ui/ui';
import PartyUiHandler, { PartyOption, PartyUiMode } from '../ui/party-ui-handler'; import PartyUiHandler, { PartyOption, PartyUiMode } from '../ui/party-ui-handler';
@ -536,7 +536,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.getTag(BattlerTagType.SLOW_START)) if (this.getTag(BattlerTagType.SLOW_START))
ret >>= 1; ret >>= 1;
if (this.status && this.status.effect === StatusEffect.PARALYSIS) if (this.status && this.status.effect === StatusEffect.PARALYSIS)
ret >>= 2; ret >>= 1;
break; break;
} }
@ -694,7 +694,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
if (forDefend && (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY))) { if (forDefend && (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY) || this.getTag(BattlerTagType.GROUNDED))) {
const flyingIndex = types.indexOf(Type.FLYING); const flyingIndex = types.indexOf(Type.FLYING);
if (flyingIndex > -1) if (flyingIndex > -1)
types.splice(flyingIndex, 1); types.splice(flyingIndex, 1);
@ -730,7 +730,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId)) while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId))
starterSpeciesId = pokemonPrevolutions[starterSpeciesId]; starterSpeciesId = pokemonPrevolutions[starterSpeciesId];
return allAbilities[starterPassiveAbilities[starterSpeciesId]]; return allAbilities[starterPassiveAbilities[starterSpeciesId]];
} }
hasPassive(): boolean { hasPassive(): boolean {
return this.passive || this.isBoss(); return this.passive || this.isBoss();
@ -1213,7 +1213,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
if (source.getTag(BattlerTagType.CRIT_BOOST)) if (source.getTag(BattlerTagType.CRIT_BOOST))
critLevel.value += 2; critLevel.value += 2;
const critChance = Math.ceil(16 / Math.pow(2, critLevel.value)); const critChance = [24, 8, 2, 1][Math.max(0, Math.min(critLevel.value, 3))];
isCritical = !source.getTag(BattlerTagType.NO_CRIT) && (critChance === 1 || !this.scene.randBattleSeedInt(critChance)); isCritical = !source.getTag(BattlerTagType.NO_CRIT) && (critChance === 1 || !this.scene.randBattleSeedInt(critChance));
if (isCritical) { if (isCritical) {
const blockCrit = new Utils.BooleanHolder(false); const blockCrit = new Utils.BooleanHolder(false);
@ -1299,6 +1299,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
applyMoveAttrs(ModifiedDamageAttr, source, this, move, damage); applyMoveAttrs(ModifiedDamageAttr, source, this, move, damage);
if (power.value === 0) {
damage.value = 0;
}
console.log('damage', damage.value, move.name, power.value, sourceAtk, targetDef); console.log('damage', damage.value, move.name, power.value, sourceAtk, targetDef);
if (damage.value) { if (damage.value) {

View File

@ -6,6 +6,7 @@ import { getBiomeHasProps } from "./field/arena";
import CacheBustedLoaderPlugin from "./plugins/cache-busted-loader-plugin"; import CacheBustedLoaderPlugin from "./plugins/cache-busted-loader-plugin";
import { SceneBase } from "./scene-base"; import { SceneBase } from "./scene-base";
import { WindowVariant, getWindowVariantSuffix } from "./ui/ui-theme"; import { WindowVariant, getWindowVariantSuffix } from "./ui/ui-theme";
import { isMobile } from "./touch-controls";
import * as Utils from "./utils"; import * as Utils from "./utils";
export class LoadingScene extends SceneBase { export class LoadingScene extends SceneBase {
@ -23,7 +24,8 @@ export class LoadingScene extends SceneBase {
this.load['cacheBuster'] = buildIdMatch[1]; this.load['cacheBuster'] = buildIdMatch[1];
} }
this.load.video('intro_dark', 'images/intro_dark.mp4', true); if (!isMobile())
this.load.video('intro_dark', 'images/intro_dark.mp4', true);
this.loadImage('loading_bg', 'arenas'); this.loadImage('loading_bg', 'arenas');
this.loadImage('logo', ''); this.loadImage('logo', '');
@ -252,6 +254,8 @@ export class LoadingScene extends SceneBase {
} }
loadLoadingScreen() { loadLoadingScreen() {
const mobile = isMobile();
const loadingGraphics: any[] = []; const loadingGraphics: any[] = [];
const bg = this.add.image(0, 0, ''); const bg = this.add.image(0, 0, '');
@ -316,7 +320,8 @@ export class LoadingScene extends SceneBase {
loadingGraphics.push(bg, graphics, progressBar, progressBox, logo, percentText, assetText); loadingGraphics.push(bg, graphics, progressBar, progressBox, logo, percentText, assetText);
loadingGraphics.map(g => g.setVisible(false)); if (!mobile)
loadingGraphics.map(g => g.setVisible(false));
const destroyLoadingAssets = () => { const destroyLoadingAssets = () => {
intro.destroy(); intro.destroy();
@ -345,9 +350,13 @@ export class LoadingScene extends SceneBase {
break; break;
case 'loading_bg': case 'loading_bg':
bg.setTexture('loading_bg'); bg.setTexture('loading_bg');
if (mobile)
bg.setVisible(true);
break; break;
case 'logo': case 'logo':
logo.setTexture('logo'); logo.setTexture('logo');
if (mobile)
logo.setVisible(true);
break; break;
} }
}); });

3678
src/locales/en/move.ts Normal file

File diff suppressed because it is too large Load Diff

6
src/locales/fr/move.ts Normal file
View File

@ -0,0 +1,6 @@
export const move = {
"ember": {
name: "Flammèche",
effect: "Flammèche inflige des dégâts et a des chances de brûler le Pokémon adverse."
},
} as const;

View File

@ -1001,9 +1001,11 @@ export class PokemonHpRestoreModifier extends ConsumablePokemonModifier {
if (this.fainted || this.healStatus) if (this.fainted || this.healStatus)
pokemon.resetStatus(); pokemon.resetStatus();
pokemon.hp = Math.min(pokemon.hp + Math.max(Math.ceil(Math.max(Math.floor((this.restorePercent * 0.01) * pokemon.getMaxHp()), restorePoints)), 1), pokemon.getMaxHp()); pokemon.hp = Math.min(pokemon.hp + Math.max(Math.ceil(Math.max(Math.floor((this.restorePercent * 0.01) * pokemon.getMaxHp()), restorePoints)), 1), pokemon.getMaxHp());
return true;
} }
return true; return false;
} }
} }

View File

@ -16,7 +16,7 @@ import EvolutionSceneHandler from "./ui/evolution-scene-handler";
import { EvolutionPhase } from "./evolution-phase"; import { EvolutionPhase } from "./evolution-phase";
import { Phase } from "./phase"; import { Phase } from "./phase";
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat"; import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
import { biomeLinks } from "./data/biomes"; import { biomeLinks, getBiomeName } from "./data/biomes";
import { Biome } from "./data/enums/biome"; import { Biome } from "./data/enums/biome";
import { ModifierTier } from "./modifier/modifier-tier"; import { ModifierTier } from "./modifier/modifier-tier";
import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type"; import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
@ -1034,9 +1034,26 @@ export class SelectBiomePhase extends BattlePhase {
.map(b => !Array.isArray(b) ? b : b[0]); .map(b => !Array.isArray(b) ? b : b[0]);
}, this.scene.currentBattle.waveIndex); }, this.scene.currentBattle.waveIndex);
if (biomes.length > 1 && this.scene.findModifier(m => m instanceof MapModifier)) { if (biomes.length > 1 && this.scene.findModifier(m => m instanceof MapModifier)) {
this.scene.ui.setMode(Mode.BIOME_SELECT, currentBiome, (biomeIndex: integer) => { let biomeChoices: Biome[];
this.scene.ui.setMode(Mode.MESSAGE); this.scene.executeWithSeedOffset(() => {
setNextBiome(biomes[biomeIndex]); biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
? [ biomeLinks[currentBiome] as Biome ]
: biomeLinks[currentBiome] as (Biome | [Biome, integer])[])
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
.map(b => Array.isArray(b) ? b[0] : b);
}, this.scene.currentBattle.waveIndex);
const biomeSelectItems = biomeChoices.map(b => {
return {
label: getBiomeName(b),
handler: () => {
this.scene.ui.setMode(Mode.MESSAGE);
setNextBiome(b);
}
};
});
this.scene.ui.setMode(Mode.OPTION_SELECT, {
options: biomeSelectItems,
delay: 1000
}); });
} else } else
setNextBiome(biomes[Utils.randSeedInt(biomes.length)]); setNextBiome(biomes[Utils.randSeedInt(biomes.length)]);
@ -4162,10 +4179,15 @@ export class SelectModifierPhase extends BattlePhase {
const applyModifier = (modifier: Modifier, playSound: boolean = false) => { const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
const result = this.scene.addModifier(modifier, false, playSound); const result = this.scene.addModifier(modifier, false, playSound);
if (cost) { if (cost) {
this.scene.money -= cost; result.then(success => {
this.scene.updateMoneyText(); if (success) {
this.scene.playSound('buy'); this.scene.money -= cost;
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText(); this.scene.updateMoneyText();
this.scene.playSound('buy');
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
} else
this.scene.ui.playError();
});
} else { } else {
const doEnd = () => { const doEnd = () => {
this.scene.ui.clearText(); this.scene.ui.clearText();
@ -4251,7 +4273,7 @@ export class SelectModifierPhase extends BattlePhase {
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined); return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined);
} }
addModifier(modifier: Modifier): Promise<void> { addModifier(modifier: Modifier): Promise<boolean> {
return this.scene.addModifier(modifier, false, true); return this.scene.addModifier(modifier, false, true);
} }
} }

View File

@ -2,6 +2,9 @@ import i18next from 'i18next';
import { menu as enMenu } from '../locales/en/menu'; import { menu as enMenu } from '../locales/en/menu';
import { menu as itMenu } from '../locales/it/menu'; import { menu as itMenu } from '../locales/it/menu';
import { move as enMove } from '../locales/en/move';
import { move as frMove } from '../locales/fr/move';
const DEFAULT_LANGUAGE_OVERRIDE = ''; const DEFAULT_LANGUAGE_OVERRIDE = '';
/** /**
@ -26,9 +29,13 @@ i18next.init({
resources: { resources: {
en: { en: {
menu: enMenu, menu: enMenu,
move: enMove,
}, },
it: { it: {
menu: itMenu, menu: itMenu,
},
fr: {
move: frMove,
} }
}, },
}); });
@ -38,6 +45,7 @@ declare module 'i18next' {
interface CustomTypeOptions { interface CustomTypeOptions {
resources: { resources: {
menu: typeof enMenu; menu: typeof enMenu;
move: typeof enMove;
}; };
} }
} }

View File

@ -69,6 +69,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.HP_Bar_Speed]: 0, [Setting.HP_Bar_Speed]: 0,
[Setting.Fusion_Palette_Swaps]: 1, [Setting.Fusion_Palette_Swaps]: 1,
[Setting.Player_Gender]: 0, [Setting.Player_Gender]: 0,
[Setting.Gamepad_Support]: 0,
[Setting.Touch_Controls]: 0, [Setting.Touch_Controls]: 0,
[Setting.Vibration]: 0 [Setting.Vibration]: 0
}; };

View File

@ -1,134 +0,0 @@
import BattleScene, { Button } from "../battle-scene";
import { biomeLinks, getBiomeName } from "../data/biomes";
import { Biome } from "../data/enums/biome";
import { addTextObject, TextStyle } from "./text";
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import * as Utils from "../utils";
import { addWindow } from "./ui-theme";
export default class BiomeSelectUiHandler extends UiHandler {
private biomeSelectContainer: Phaser.GameObjects.Container;
private biomeSelectBg: Phaser.GameObjects.NineSlice;
private biomesText: Phaser.GameObjects.Text;
private biomeChoices: Biome[];
private cursorObj: Phaser.GameObjects.Image;
private blockInput: boolean;
private biomeSelectHandler: Function;
constructor(scene: BattleScene) {
super(scene, Mode.BIOME_SELECT);
}
setup() {
const ui = this.getUi();
this.biomeSelectContainer = this.scene.add.container((this.scene.game.canvas.width / 6) - 97, -49);
this.biomeSelectContainer.setVisible(false);
ui.add(this.biomeSelectContainer);
this.biomeSelectBg = addWindow(this.scene, 0, 0, 96, 32);
this.biomeSelectBg.setOrigin(0, 1);
this.biomeSelectContainer.add(this.biomeSelectBg);
this.biomesText = addTextObject(this.scene, 0, 0, '', TextStyle.WINDOW, { maxLines: 3 });
this.biomesText.setLineSpacing(12);
this.biomeSelectContainer.add(this.biomesText);
}
show(args: any[]): boolean {
if (args.length >= 2 && typeof(args[0]) === 'number' && args[1] instanceof Function) {
super.show(args);
this.scene.executeWithSeedOffset(() => {
this.biomeChoices = (!Array.isArray(biomeLinks[args[0]])
? [ biomeLinks[args[0]] as Biome ]
: biomeLinks[args[0]] as (Biome | [Biome, integer])[])
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
.map(b => Array.isArray(b) ? b[0] : b);
}, this.scene.currentBattle.waveIndex);
if (this.biomeChoices.length <= 1)
return;
this.biomeSelectBg.height = (this.biomeChoices.length + 1) * 16;
this.biomesText.setText(this.biomeChoices.map(b => getBiomeName(b)).join('\n'));
this.biomesText.setPositionRelative(this.biomeSelectBg, 16, 9);
this.biomeSelectHandler = args[1] as Function;
this.biomeSelectContainer.setVisible(true);
this.setCursor(0);
this.blockInput = true;
this.biomesText.setAlpha(0.5);
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
this.blockInput = false;
this.biomesText.setAlpha(1);
});
}
return true;
}
processInput(button: Button): boolean {
const ui = this.getUi();
let success = false;
if (button === Button.ACTION || button === Button.CANCEL) {
if (this.blockInput)
return false;
success = true;
const originalBiomeSelectHandler = this.biomeSelectHandler;
this.biomeSelectHandler = null;
originalBiomeSelectHandler(this.cursor);
this.clear();
} else {
switch (button) {
case Button.UP:
if (this.cursor)
success = this.setCursor(this.cursor - 1);
break;
case Button.DOWN:
if (this.cursor < this.biomeChoices.length - 1)
success = this.setCursor(this.cursor + 1);
break;
}
}
if (success)
ui.playSelect();
return success;
}
setCursor(cursor: integer): boolean {
const ret = super.setCursor(cursor);
if (!this.cursorObj) {
this.cursorObj = this.scene.add.image(0, 0, 'cursor');
this.biomeSelectContainer.add(this.cursorObj);
}
this.cursorObj.setPositionRelative(this.biomeSelectBg, 12, 17 + 16 * this.cursor);
return ret;
}
clear() {
super.clear();
this.biomeSelectContainer.setVisible(false);
this.biomeSelectHandler = null;
this.eraseCursor();
}
eraseCursor() {
if (this.cursorObj)
this.cursorObj.destroy();
this.cursorObj = null;
}
}

View File

@ -11,7 +11,6 @@ import BallUiHandler from './ball-ui-handler';
import SummaryUiHandler from './summary-ui-handler'; import SummaryUiHandler from './summary-ui-handler';
import StarterSelectUiHandler from './starter-select-ui-handler'; import StarterSelectUiHandler from './starter-select-ui-handler';
import EvolutionSceneHandler from './evolution-scene-handler'; import EvolutionSceneHandler from './evolution-scene-handler';
import BiomeSelectUiHandler from './biome-select-ui-handler';
import TargetSelectUiHandler from './target-select-ui-handler'; import TargetSelectUiHandler from './target-select-ui-handler';
import SettingsUiHandler from './settings-ui-handler'; import SettingsUiHandler from './settings-ui-handler';
import { TextStyle, addTextObject } from './text'; import { TextStyle, addTextObject } from './text';
@ -47,7 +46,6 @@ export enum Mode {
SAVE_SLOT, SAVE_SLOT,
PARTY, PARTY,
SUMMARY, SUMMARY,
BIOME_SELECT,
STARTER_SELECT, STARTER_SELECT,
EVOLUTION_SCENE, EVOLUTION_SCENE,
EGG_HATCH_SCENE, EGG_HATCH_SCENE,
@ -127,7 +125,6 @@ export default class UI extends Phaser.GameObjects.Container {
new SaveSlotSelectUiHandler(scene), new SaveSlotSelectUiHandler(scene),
new PartyUiHandler(scene), new PartyUiHandler(scene),
new SummaryUiHandler(scene), new SummaryUiHandler(scene),
new BiomeSelectUiHandler(scene),
new StarterSelectUiHandler(scene), new StarterSelectUiHandler(scene),
new EvolutionSceneHandler(scene), new EvolutionSceneHandler(scene),
new EggHatchSceneHandler(scene), new EggHatchSceneHandler(scene),