Merge branch 'pagefaultgames:main' into main

pull/726/merge^2
Lugiad 2024-05-14 22:20:04 +02:00 committed by GitHub
commit 7e6efa7092
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 427 additions and 74 deletions

View File

@ -44,7 +44,8 @@ Check out our [Trello Board](https://trello.com/b/z10B703R/pokerogue-board) to s
- Arata Iiyoshi - Arata Iiyoshi
- Atsuhiro Ishizuna - Atsuhiro Ishizuna
- Pokémon Black/White 2 - Pokémon Black/White 2
- Firel (Additional biome themes) - Firel (Custom Metropolis and Laboratory biome music)
- Lmz (Custom Jungle biome music)
- edifette (Title screen music) - edifette (Title screen music)
### 🎵 Sound Effects ### 🎵 Sound Effects

View File

@ -2,6 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" />
<title>PokéRogue</title> <title>PokéRogue</title>
<meta name="description" content="A Pokémon fangame heavily inspired by the roguelite genre. Battle endlessly while gathering stacking items, exploring many different biomes, and reaching Pokémon stats you never thought possible." /> <meta name="description" content="A Pokémon fangame heavily inspired by the roguelite genre. Battle endlessly while gathering stacking items, exploring many different biomes, and reaching Pokémon stats you never thought possible." />
<meta name="theme-color" content="#da3838" /> <meta name="theme-color" content="#da3838" />
@ -12,7 +13,6 @@
<link rel="apple-touch-icon" href="./logo512.png" /> <link rel="apple-touch-icon" href="./logo512.png" />
<link rel="shortcut icon" type="image/png" href="./logo512.png" /> <link rel="shortcut icon" type="image/png" href="./logo512.png" />
<link rel="canonical" href="https://pokerogue.net" /> <link rel="canonical" href="https://pokerogue.net" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<style type="text/css"> <style type="text/css">
@font-face { @font-face {

Binary file not shown.

View File

@ -715,7 +715,7 @@ export class PostDefendContactApplyStatusEffectAbAttr extends PostDefendAbAttr {
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && !attacker.status && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance)) { if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && !attacker.status && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance)) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
return attacker.trySetStatus(effect, true); return attacker.trySetStatus(effect, true, pokemon);
} }
return false; return false;
@ -1177,7 +1177,7 @@ export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (pokemon != attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance && !pokemon.status) { if (pokemon != attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance && !pokemon.status) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
return attacker.trySetStatus(effect, true); return attacker.trySetStatus(effect, true, pokemon);
} }
return false; return false;
@ -2648,8 +2648,8 @@ export class NoFusionAbilityAbAttr extends AbAttr {
} }
export class IgnoreTypeImmunityAbAttr extends AbAttr { export class IgnoreTypeImmunityAbAttr extends AbAttr {
defenderType: Type; private defenderType: Type;
allowedMoveTypes: Type[]; private allowedMoveTypes: Type[];
constructor(defenderType: Type, allowedMoveTypes: Type[]) { constructor(defenderType: Type, allowedMoveTypes: Type[]) {
super(true); super(true);
@ -2666,6 +2666,30 @@ export class IgnoreTypeImmunityAbAttr extends AbAttr {
} }
} }
/**
* Ignores the type immunity to Status Effects of the defender if the defender is of a certain type
*/
export class IgnoreTypeStatusEffectImmunityAbAttr extends AbAttr {
private statusEffect: StatusEffect[];
private defenderType: Type[];
constructor(statusEffect: StatusEffect[], defenderType: Type[]) {
super(true);
this.statusEffect = statusEffect;
this.defenderType = defenderType;
}
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (this.statusEffect.includes(args[0] as StatusEffect) && this.defenderType.includes(args[1] as Type)) {
cancelled.value = true;
return true;
}
return false;
}
}
function applyAbAttrsInternal<TAttr extends AbAttr>(attrType: { new(...args: any[]): TAttr }, function applyAbAttrsInternal<TAttr extends AbAttr>(attrType: { new(...args: any[]): TAttr },
pokemon: Pokemon, applyFunc: AbAttrApplyFunc<TAttr>, args: any[], isAsync: boolean = false, showAbilityInstant: boolean = false, quiet: boolean = false, passive: boolean = false): Promise<void> { pokemon: Pokemon, applyFunc: AbAttrApplyFunc<TAttr>, args: any[], isAsync: boolean = false, showAbilityInstant: boolean = false, quiet: boolean = false, passive: boolean = false): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
@ -3489,8 +3513,9 @@ export function initAbilities() {
.attr(UnsuppressableAbilityAbAttr) .attr(UnsuppressableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.partial(), .partial(),
new Ability(Abilities.CORROSION, 7) new Ability(Abilities.CORROSION, 7) // TODO: Test Corrosion against Magic Bounce once it is implemented
.unimplemented(), .attr(IgnoreTypeStatusEffectImmunityAbAttr, [StatusEffect.POISON, StatusEffect.TOXIC], [Type.STEEL, Type.POISON])
.partial(),
new Ability(Abilities.COMATOSE, 7) new Ability(Abilities.COMATOSE, 7)
.attr(UncopiableAbilityAbAttr) .attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr) .attr(UnswappableAbilityAbAttr)

View File

@ -316,7 +316,7 @@ class ToxicSpikesTag extends ArenaTrapTag {
} }
} else if (!pokemon.status) { } else if (!pokemon.status) {
const toxic = this.layers > 1; const toxic = this.layers > 1;
if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true, null, `the ${this.getMoveName()}`)) if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true, null, 0, `the ${this.getMoveName()}`))
return true; return true;
} }
} }

View File

@ -819,7 +819,7 @@ export class ContactPoisonProtectedTag extends ProtectedTag {
const effectPhase = pokemon.scene.getCurrentPhase(); const effectPhase = pokemon.scene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon(); const attacker = effectPhase.getPokemon();
attacker.trySetStatus(StatusEffect.POISON, true); attacker.trySetStatus(StatusEffect.POISON, true, pokemon);
} }
} }

View File

@ -13,14 +13,15 @@ export interface DailyRunConfig {
} }
export function fetchDailyRunSeed(): Promise<string> { export function fetchDailyRunSeed(): Promise<string> {
return new Promise<string>(resolve => { return new Promise<string>((resolve, reject) => {
Utils.apiFetch('daily/seed').then(response => { Utils.apiFetch('daily/seed').then(response => {
if (!response.ok) { if (!response.ok) {
resolve(null); resolve(null);
return; return;
} }
return response.text(); return response.text();
}).then(seed => resolve(seed)); }).then(seed => resolve(seed))
.catch(err => reject(err));
}); });
} }

View File

@ -95,9 +95,16 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
let ret: Species; let ret: Species;
// 86400000 is the number of miliseconds in one day
const timeDate = new Date(timestamp);
const dayDate = new Date(Date.UTC(timeDate.getUTCFullYear(), timeDate.getUTCMonth(), timeDate.getUTCDate()));
const dayTimestamp = timeDate.getTime(); // Timestamp of current week
const offset = Math.floor(Math.floor(dayTimestamp / 86400000) / legendarySpecies.length); // Cycle number
const index = Math.floor(dayTimestamp / 86400000) % legendarySpecies.length // Index within cycle
scene.executeWithSeedOffset(() => { scene.executeWithSeedOffset(() => {
ret = Utils.randSeedItem(legendarySpecies); ret = Phaser.Math.RND.shuffle(legendarySpecies)[index];
}, Utils.getSunday(new Date(timestamp)).getTime(), EGG_SEED.toString()); }, offset, EGG_SEED.toString());
return ret; return ret;
} }

View File

@ -1156,13 +1156,13 @@ export class StatusEffectAttr extends MoveEffectAttr {
return false; return false;
} }
if (!pokemon.status || (pokemon.status.effect === this.effect && move.chance < 0)) if (!pokemon.status || (pokemon.status.effect === this.effect && move.chance < 0))
return pokemon.trySetStatus(this.effect, true, this.cureTurn); return pokemon.trySetStatus(this.effect, true, user, this.cureTurn);
} }
return false; return false;
} }
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(this.effect, true) ? Math.floor(move.chance * -0.1) : 0; return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(this.effect, true, false, user) ? Math.floor(move.chance * -0.1) : 0;
} }
} }
@ -1181,7 +1181,7 @@ export class MultiStatusEffectAttr extends StatusEffectAttr {
} }
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(this.effect, true) ? Math.floor(move.chance * -0.1) : 0; return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(this.effect, true, false, user) ? Math.floor(move.chance * -0.1) : 0;
} }
} }
@ -1197,7 +1197,7 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
return false; return false;
} }
if (!target.status || (target.status.effect === statusToApply && move.chance < 0)) { if (!target.status || (target.status.effect === statusToApply && move.chance < 0)) {
var statusAfflictResult = target.trySetStatus(statusToApply, true); var statusAfflictResult = target.trySetStatus(statusToApply, true, user);
if (statusAfflictResult) { if (statusAfflictResult) {
user.scene.queueMessage(getPokemonMessage(user, getStatusEffectHealText(user.status.effect))); user.scene.queueMessage(getPokemonMessage(user, getStatusEffectHealText(user.status.effect)));
user.resetStatus(); user.resetStatus();
@ -1210,7 +1210,7 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
} }
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(user.status?.effect, true) ? Math.floor(move.chance * -0.1) : 0; return !(this.selfTarget ? user : target).status && (this.selfTarget ? user : target).canSetStatus(user.status?.effect, true, false, user) ? Math.floor(move.chance * -0.1) : 0;
} }
} }
@ -2676,6 +2676,24 @@ export class WaterSuperEffectTypeMultiplierAttr extends VariableMoveTypeMultipli
} }
} }
export class IceNoEffectTypeAttr extends VariableMoveTypeMultiplierAttr {
/**
* Checks to see if the Target is Ice-Type or not. If so, the move will have no effect.
* @param {Pokemon} user N/A
* @param {Pokemon} target Pokemon that is being checked whether Ice-Type or not.
* @param {Move} move N/A
* @param {any[]} args Sets to false if the target is Ice-Type, so it should do no damage/no effect.
* @returns {boolean} Returns true if move is successful, false if Ice-Type.
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (target.isOfType(Type.ICE)) {
(args[0] as Utils.BooleanHolder).value = false;
return false;
}
return true;
}
}
export class FlyingTypeMultiplierAttr extends VariableMoveTypeMultiplierAttr { export class FlyingTypeMultiplierAttr extends VariableMoveTypeMultiplierAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const multiplier = args[0] as Utils.NumberHolder; const multiplier = args[0] as Utils.NumberHolder;
@ -2695,6 +2713,29 @@ export class OneHitKOAccuracyAttr extends VariableAccuracyAttr {
} }
} }
export class SheerColdAccuracyAttr extends OneHitKOAccuracyAttr {
/**
* Changes the normal One Hit KO Accuracy Attr to implement the Gen VII changes,
* where if the user is Ice-Type, it has more accuracy.
* @param {Pokemon} user Pokemon that is using the move; checks the Pokemon's level.
* @param {Pokemon} target Pokemon that is receiving the move; checks the Pokemon's level.
* @param {Move} move N/A
* @param {any[]} args Uses the accuracy argument, allowing to change it from either 0 if it doesn't pass
* the first if/else, or 30/20 depending on the type of the user Pokemon.
* @returns Returns true if move is successful, false if misses.
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const accuracy = args[0] as Utils.NumberHolder;
if (user.level < target.level) {
accuracy.value = 0;
} else {
const baseAccuracy = user.isOfType(Type.ICE) ? 30 : 20;
accuracy.value = Math.min(Math.max(baseAccuracy + 100 * (1 - target.level / user.level), 0), 100);
}
return true;
}
}
export class MissEffectAttr extends MoveAttr { export class MissEffectAttr extends MoveAttr {
private missEffectFunc: UserMoveConditionFunc; private missEffectFunc: UserMoveConditionFunc;
@ -5095,9 +5136,10 @@ export function initMoves() {
new AttackMove(Moves.SAND_TOMB, Type.GROUND, MoveCategory.PHYSICAL, 35, 85, 15, 100, 0, 3) new AttackMove(Moves.SAND_TOMB, Type.GROUND, MoveCategory.PHYSICAL, 35, 85, 15, 100, 0, 3)
.attr(TrapAttr, BattlerTagType.SAND_TOMB) .attr(TrapAttr, BattlerTagType.SAND_TOMB)
.makesContact(false), .makesContact(false),
new AttackMove(Moves.SHEER_COLD, Type.ICE, MoveCategory.SPECIAL, 200, 30, 5, -1, 0, 3) new AttackMove(Moves.SHEER_COLD, Type.ICE, MoveCategory.SPECIAL, 200, 20, 5, -1, 0, 3)
.attr(IceNoEffectTypeAttr)
.attr(OneHitKOAttr) .attr(OneHitKOAttr)
.attr(OneHitKOAccuracyAttr), .attr(SheerColdAccuracyAttr),
new AttackMove(Moves.MUDDY_WATER, Type.WATER, MoveCategory.SPECIAL, 90, 85, 10, 30, 0, 3) new AttackMove(Moves.MUDDY_WATER, Type.WATER, MoveCategory.SPECIAL, 90, 85, 10, 30, 0, 3)
.attr(StatChangeAttr, BattleStat.ACC, -1) .attr(StatChangeAttr, BattleStat.ACC, -1)
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
@ -5226,7 +5268,7 @@ export function initMoves() {
|| user.status?.effect === StatusEffect.TOXIC || user.status?.effect === StatusEffect.TOXIC
|| user.status?.effect === StatusEffect.PARALYSIS || user.status?.effect === StatusEffect.PARALYSIS
|| user.status?.effect === StatusEffect.SLEEP) || user.status?.effect === StatusEffect.SLEEP)
&& target.canSetStatus(user.status?.effect) && target.canSetStatus(user.status?.effect, false, false, user)
), ),
new AttackMove(Moves.TRUMP_CARD, Type.NORMAL, MoveCategory.SPECIAL, -1, -1, 5, -1, 0, 4) new AttackMove(Moves.TRUMP_CARD, Type.NORMAL, MoveCategory.SPECIAL, -1, -1, 5, -1, 0, 4)
.makesContact() .makesContact()
@ -6221,7 +6263,7 @@ export function initMoves() {
.ignoresVirtual(), .ignoresVirtual(),
/* End Unused */ /* End Unused */
new AttackMove(Moves.ZIPPY_ZAP, Type.ELECTRIC, MoveCategory.PHYSICAL, 80, 100, 10, 100, 2, 7) new AttackMove(Moves.ZIPPY_ZAP, Type.ELECTRIC, MoveCategory.PHYSICAL, 80, 100, 10, 100, 2, 7)
.attr(CritOnlyAttr), .attr(StatChangeAttr, BattleStat.EVA, 1, true),
new AttackMove(Moves.SPLISHY_SPLASH, Type.WATER, MoveCategory.SPECIAL, 90, 100, 15, 30, 0, 7) new AttackMove(Moves.SPLISHY_SPLASH, Type.WATER, MoveCategory.SPECIAL, 90, 100, 15, 30, 0, 7)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS) .attr(StatusEffectAttr, StatusEffect.PARALYSIS)
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
@ -6246,7 +6288,7 @@ export function initMoves() {
new AttackMove(Moves.FREEZY_FROST, Type.ICE, MoveCategory.SPECIAL, 100, 90, 10, -1, 0, 7) new AttackMove(Moves.FREEZY_FROST, Type.ICE, MoveCategory.SPECIAL, 100, 90, 10, -1, 0, 7)
.attr(ResetStatsAttr), .attr(ResetStatsAttr),
new AttackMove(Moves.SPARKLY_SWIRL, Type.FAIRY, MoveCategory.SPECIAL, 120, 85, 5, -1, 0, 7) new AttackMove(Moves.SPARKLY_SWIRL, Type.FAIRY, MoveCategory.SPECIAL, 120, 85, 5, -1, 0, 7)
.partial(), .attr(PartyStatusCureAttr, null, Abilities.NONE),
new AttackMove(Moves.VEEVEE_VOLLEY, Type.NORMAL, MoveCategory.PHYSICAL, -1, -1, 20, -1, 0, 7) new AttackMove(Moves.VEEVEE_VOLLEY, Type.NORMAL, MoveCategory.PHYSICAL, -1, -1, 20, -1, 0, 7)
.attr(FriendshipPowerAttr), .attr(FriendshipPowerAttr),
new AttackMove(Moves.DOUBLE_IRON_BASH, Type.STEEL, MoveCategory.PHYSICAL, 60, 100, 5, 30, 0, 7) new AttackMove(Moves.DOUBLE_IRON_BASH, Type.STEEL, MoveCategory.PHYSICAL, 60, 100, 5, 30, 0, 7)

View File

@ -1385,10 +1385,10 @@ export const pokemonEvolutions: PokemonEvolutions = {
new SpeciesEvolution(Species.HELIOLISK, 1, EvolutionItem.SUN_STONE, null, SpeciesWildEvolutionDelay.LONG) new SpeciesEvolution(Species.HELIOLISK, 1, EvolutionItem.SUN_STONE, null, SpeciesWildEvolutionDelay.LONG)
], ],
[Species.CHARJABUG]: [ [Species.CHARJABUG]: [
new SpeciesEvolution(Species.VIKAVOLT, 1, EvolutionItem.THUNDER_STONE, null) new SpeciesEvolution(Species.VIKAVOLT, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.LONG)
], ],
[Species.CRABRAWLER]: [ [Species.CRABRAWLER]: [
new SpeciesEvolution(Species.CRABOMINABLE, 1, EvolutionItem.ICE_STONE, null) new SpeciesEvolution(Species.CRABOMINABLE, 1, EvolutionItem.ICE_STONE, null, SpeciesWildEvolutionDelay.LONG)
], ],
[Species.ROCKRUFF]: [ [Species.ROCKRUFF]: [
new SpeciesFormEvolution(Species.LYCANROC, '', 'midday', 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DAWN || p.scene.arena.getTimeOfDay() === TimeOfDay.DAY) && (p.formIndex === 0)), null), new SpeciesFormEvolution(Species.LYCANROC, '', 'midday', 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DAWN || p.scene.arena.getTimeOfDay() === TimeOfDay.DAY) && (p.formIndex === 0)), null),

File diff suppressed because it is too large Load Diff

View File

@ -2759,7 +2759,7 @@ export const speciesStarters = {
[Species.GROUDON]: 8, [Species.GROUDON]: 8,
[Species.RAYQUAZA]: 8, [Species.RAYQUAZA]: 8,
[Species.JIRACHI]: 7, [Species.JIRACHI]: 7,
[Species.DEOXYS]: 8, [Species.DEOXYS]: 7,
[Species.TURTWIG]: 3, [Species.TURTWIG]: 3,
[Species.CHIMCHAR]: 3, [Species.CHIMCHAR]: 3,
@ -2813,7 +2813,7 @@ export const speciesStarters = {
[Species.DARKRAI]: 7, [Species.DARKRAI]: 7,
[Species.SHAYMIN]: 7, [Species.SHAYMIN]: 7,
[Species.ARCEUS]: 9, [Species.ARCEUS]: 9,
[Species.VICTINI]: 8, [Species.VICTINI]: 7,
[Species.SNIVY]: 3, [Species.SNIVY]: 3,
[Species.TEPIG]: 3, [Species.TEPIG]: 3,
@ -2895,7 +2895,7 @@ export const speciesStarters = {
[Species.KYUREM]: 8, [Species.KYUREM]: 8,
[Species.KELDEO]: 7, [Species.KELDEO]: 7,
[Species.MELOETTA]: 7, [Species.MELOETTA]: 7,
[Species.GENESECT]: 8, [Species.GENESECT]: 7,
[Species.CHESPIN]: 3, [Species.CHESPIN]: 3,
[Species.FENNEKIN]: 3, [Species.FENNEKIN]: 3,

View File

@ -617,7 +617,7 @@ export class Arena {
case Biome.CONSTRUCTION_SITE: case Biome.CONSTRUCTION_SITE:
return 1.222; return 1.222;
case Biome.JUNGLE: case Biome.JUNGLE:
return 2.477; return 0.000;
case Biome.FAIRY_CAVE: case Biome.FAIRY_CAVE:
return 4.542; return 4.542;
case Biome.TEMPLE: case Biome.TEMPLE:

View File

@ -27,7 +27,7 @@ import { TempBattleStat } from '../data/temp-battle-stat';
import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag'; import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag';
import { ArenaTagType } from "../data/enums/arena-tag-type"; import { ArenaTagType } from "../data/enums/arena-tag-type";
import { Biome } from "../data/enums/biome"; 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, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr } 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, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr } 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 Battle, { BattlerIndex } from '../battle'; import Battle, { BattlerIndex } from '../battle';
@ -1563,7 +1563,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (!result) { if (!result) {
if (!typeMultiplier.value) if (!typeMultiplier.value)
result = HitResult.NO_EFFECT; result = move.id == Moves.SHEER_COLD ? HitResult.IMMUNE : HitResult.NO_EFFECT;
else { else {
const oneHitKo = new Utils.BooleanHolder(false); const oneHitKo = new Utils.BooleanHolder(false);
applyMoveAttrs(OneHitKOAttr, source, this, move, oneHitKo); applyMoveAttrs(OneHitKOAttr, source, this, move, oneHitKo);
@ -1631,6 +1631,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
case HitResult.NO_EFFECT: case HitResult.NO_EFFECT:
this.scene.queueMessage(i18next.t('battle:hitResultNoEffect', { pokemonName: this.name })); this.scene.queueMessage(i18next.t('battle:hitResultNoEffect', { pokemonName: this.name }));
break; break;
case HitResult.IMMUNE:
this.scene.queueMessage(`${this.name} is unaffected!`);
break;
case HitResult.ONE_HIT_KO: case HitResult.ONE_HIT_KO:
this.scene.queueMessage(i18next.t('battle:hitResultOneHitKO')); this.scene.queueMessage(i18next.t('battle:hitResultOneHitKO'));
break; break;
@ -2024,7 +2027,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return this.gender !== Gender.GENDERLESS && pokemon.gender === (this.gender === Gender.MALE ? Gender.FEMALE : Gender.MALE); return this.gender !== Gender.GENDERLESS && pokemon.gender === (this.gender === Gender.MALE ? Gender.FEMALE : Gender.MALE);
} }
canSetStatus(effect: StatusEffect, quiet: boolean = false, overrideStatus: boolean = false): boolean { canSetStatus(effect: StatusEffect, quiet: boolean = false, overrideStatus: boolean = false, sourcePokemon: Pokemon = null): boolean {
if (effect !== StatusEffect.FAINT) { if (effect !== StatusEffect.FAINT) {
if (overrideStatus ? this.status?.effect === effect : this.status) if (overrideStatus ? this.status?.effect === effect : this.status)
return false; return false;
@ -2032,11 +2035,32 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return false; return false;
} }
const types = this.getTypes(true, true);
switch (effect) { switch (effect) {
case StatusEffect.POISON: case StatusEffect.POISON:
case StatusEffect.TOXIC: case StatusEffect.TOXIC:
if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)) // Check if the Pokemon is immune to Poison/Toxic or if the source pokemon is canceling the immunity
return false; let poisonImmunity = types.map(defType => {
// Check if the Pokemon is not immune to Poison/Toxic
if (defType !== Type.POISON && defType !== Type.STEEL)
return false;
// Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity
const cancelImmunity = new Utils.BooleanHolder(false);
if (sourcePokemon) {
applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, sourcePokemon, cancelImmunity, effect, defType);
if (cancelImmunity.value)
return false;
}
return true;
})
if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)) {
if (poisonImmunity.includes(true))
return false;
}
break; break;
case StatusEffect.PARALYSIS: case StatusEffect.PARALYSIS:
if (this.isOfType(Type.ELECTRIC)) if (this.isOfType(Type.ELECTRIC))
@ -2065,12 +2089,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return true; return true;
} }
trySetStatus(effect: StatusEffect, asPhase: boolean = false, cureTurn: integer = 0, sourceText: string = null): boolean { trySetStatus(effect: StatusEffect, asPhase: boolean = false, sourcePokemon: Pokemon = null, cureTurn: integer = 0, sourceText: string = null): boolean {
if (!this.canSetStatus(effect, asPhase)) if (!this.canSetStatus(effect, asPhase, false, sourcePokemon))
return false; return false;
if (asPhase) { if (asPhase) {
this.scene.unshiftPhase(new ObtainStatusEffectPhase(this.scene, this.getBattlerIndex(), effect, cureTurn, sourceText)); this.scene.unshiftPhase(new ObtainStatusEffectPhase(this.scene, this.getBattlerIndex(), effect, cureTurn, sourceText, sourcePokemon));
return true; return true;
} }
@ -3339,7 +3363,8 @@ export enum HitResult {
HEAL, HEAL,
FAIL, FAIL,
MISS, MISS,
OTHER OTHER,
IMMUNE
} }
export type DamageResult = HitResult.EFFECTIVE | HitResult.SUPER_EFFECTIVE | HitResult.NOT_VERY_EFFECTIVE | HitResult.ONE_HIT_KO | HitResult.OTHER; export type DamageResult = HitResult.EFFECTIVE | HitResult.SUPER_EFFECTIVE | HitResult.NOT_VERY_EFFECTIVE | HitResult.ONE_HIT_KO | HitResult.OTHER;

View File

@ -9,11 +9,11 @@ export const battle: SimpleTranslationEntries = {
"trainerComeBack": "{{trainerName}} ruft {{pokemonName}} zurück!", "trainerComeBack": "{{trainerName}} ruft {{pokemonName}} zurück!",
"playerGo": "Los! {{pokemonName}}!", "playerGo": "Los! {{pokemonName}}!",
"trainerGo": "{{trainerName}} sendet {{pokemonName}} raus!", "trainerGo": "{{trainerName}} sendet {{pokemonName}} raus!",
"switchQuestion": "Willst du\n{{pokemonName}} auswechseln?", "switchQuestion": "Möchtest du\n{{pokemonName}} auswechseln?",
"trainerDefeated": `{{trainerName}}\nwurde besiegt!`, "trainerDefeated": `{{trainerName}}\nwurde besiegt!`,
"pokemonCaught": "{{pokemonName}} wurde gefangen!", "pokemonCaught": "{{pokemonName}} wurde gefangen!",
"pokemon": "Pokémon", "pokemon": "Pokémon",
"sendOutPokemon": "Los! {{pokemonName}}!", "sendOutPokemon": "Los, {{pokemonName}}!",
"hitResultCriticalHit": "Ein Volltreffer!", "hitResultCriticalHit": "Ein Volltreffer!",
"hitResultSuperEffective": "Das ist sehr effektiv!", "hitResultSuperEffective": "Das ist sehr effektiv!",
"hitResultNotVeryEffective": "Das ist nicht sehr effektiv…", "hitResultNotVeryEffective": "Das ist nicht sehr effektiv…",
@ -26,28 +26,28 @@ export const battle: SimpleTranslationEntries = {
"learnMove": "{{pokemonName}} erlernt\n{{moveName}}!", "learnMove": "{{pokemonName}} erlernt\n{{moveName}}!",
"learnMovePrompt": "{{pokemonName}} versucht, {{moveName}} zu erlernen.", "learnMovePrompt": "{{pokemonName}} versucht, {{moveName}} zu erlernen.",
"learnMoveLimitReached": "Aber {{pokemonName}} kann nur\nmaximal vier Attacken erlernen.", "learnMoveLimitReached": "Aber {{pokemonName}} kann nur\nmaximal vier Attacken erlernen.",
"learnMoveReplaceQuestion": "Soll eine andere Attacke durch\n{{moveName}} ersetzt werden?", "learnMoveReplaceQuestion": "Soll eine bekannte Attacke durch\n{{moveName}} ersetzt werden?",
"learnMoveStopTeaching": "{{moveName}} nicht\nerlernen?", "learnMoveStopTeaching": "{{moveName}} nicht\nerlernen?",
"learnMoveNotLearned": "{{pokemonName}} hat\n{{moveName}} nicht erlernt.", "learnMoveNotLearned": "{{pokemonName}} hat\n{{moveName}} nicht erlernt.",
"learnMoveForgetQuestion": "Welche Attacke soll vergessen werden?", "learnMoveForgetQuestion": "Welche Attacke soll vergessen werden?",
"learnMoveForgetSuccess": "{{pokemonName}} hat\n{{moveName}} vergessen.", "learnMoveForgetSuccess": "{{pokemonName}} hat\n{{moveName}} vergessen.",
"levelCapUp": "Das Levellimit\nhat sich zu {{levelCap}} erhöht!", "levelCapUp": "Das Levellimit\nhat sich zu {{levelCap}} erhöht!",
"moveNotImplemented": "{{moveName}} ist noch nicht implementiert und kann nicht ausgewählt werden.", "moveNotImplemented": "{{moveName}} ist noch nicht implementiert und kann nicht ausgewählt werden.",
"moveNoPP": "Du hast keine AP für\ndiese Attacke mehr übrig!", "moveNoPP": "Es sind keine AP für\ndiese Attacke mehr übrig!",
"moveDisabled": "{{moveName}} ist deaktiviert!", "moveDisabled": "{{moveName}} ist deaktiviert!",
"noPokeballForce": "Eine unsichtbare Kraft\nverhindert die Nutzung von Pokébällen.", "noPokeballForce": "Eine unsichtbare Kraft\nverhindert die Nutzung von Pokébällen.",
"noPokeballTrainer": "Du kannst das Pokémon\neines anderen Trainers nicht fangen!", "noPokeballTrainer": "Du kannst das Pokémon\neines anderen Trainers nicht fangen!",
"noPokeballMulti": "Du kannst erst einen Pokéball werden,\nwenn nur noch ein Pokémon übrig ist!", "noPokeballMulti": "Du kannst erst einen Pokéball werfen,\nwenn nur noch ein Pokémon übrig ist!",
"noPokeballStrong": "Das Ziel-Pokémon ist zu stark, um gefangen zu werden!\nDu musst es zuerst schwächen!", "noPokeballStrong": "Das Ziel-Pokémon ist zu stark, um gefangen zu werden!\nDu musst es zuerst schwächen!",
"noEscapeForce": "Eine unsichtbare Kraft\nverhindert die Flucht.", "noEscapeForce": "Eine unsichtbare Kraft\nverhindert die Flucht.",
"noEscapeTrainer": "Du kannst nicht\naus einem Trainerkampf fliehen!", "noEscapeTrainer": "Du kannst nicht\naus einem Trainerkampf fliehen!",
"noEscapePokemon": "{{pokemonName}}'s {{moveName}}\nverhindert {{escapeVerb}}!", "noEscapePokemon": "{{pokemonName}}'s {{moveName}}\nverhindert {{escapeVerb}}!",
"runAwaySuccess": "Du bist entkommen!", "runAwaySuccess": "Du bist entkommen!",
"runAwayCannotEscape": 'Du kannst nicht fliehen!', "runAwayCannotEscape": 'Flucht unmöglich!',
"escapeVerbSwitch": "auswechseln", "escapeVerbSwitch": "auswechseln",
"escapeVerbFlee": "flucht", "escapeVerbFlee": "flucht",
"skipItemQuestion": "Bist du sicher, dass du kein Item nehmen willst?", "skipItemQuestion": "Bist du sicher, dass du kein Item nehmen willst?",
"notDisabled": "{{pokemonName}}'s {{moveName}} ist\nnicht mehr deaktiviert!", "notDisabled": "{{pokemonName}}'s {{moveName}} ist\nnicht mehr deaktiviert!",
"eggHatching": "Oh?", "eggHatching": "Oh?",
"ivScannerUseQuestion": "IV-Scanner auf {{pokemonName}} benutzen?" "ivScannerUseQuestion": "IV-Scanner auf {{pokemonName}} benutzen?"
} as const; } as const;

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
"zippyZap": { "zippyZap": {
name: "Britzelturbo", name: "Britzelturbo",
effect: "Ein stürmischer Blitz-Angriff mit hoher Erstschlag- und Volltrefferquote." effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and raises the user's evasiveness."
}, },
"splishySplash": { "splishySplash": {
name: "Plätschersurfer", name: "Plätschersurfer",

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
"zippyZap": { "zippyZap": {
name: "Zippy Zap", name: "Zippy Zap",
effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and results in a critical hit." effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and raises the user's evasiveness."
}, },
"splishySplash": { "splishySplash": {
name: "Splishy Splash", name: "Splishy Splash",

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
zippyZap: { zippyZap: {
name: "Pikaturbo", name: "Pikaturbo",
effect: "Ataque eléctrico a la velocidad del rayo. Este movimiento tiene prioridad alta y propina golpes críticos.", effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and raises the user's evasiveness.",
}, },
splishySplash: { splishySplash: {
name: "Salpikasurf", name: "Salpikasurf",

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
"zippyZap": { "zippyZap": {
name: "Pika-Sprint", name: "Pika-Sprint",
effect: "Une attaque électrique rapide comme léclair qui inflige un coup critique à coup sûr. Frappe en priorité." effect: "Une attaque électrique rapide comme léclair qui auguemente lesquive. Frappe en priorité."
}, },
"splishySplash": { "splishySplash": {
name: "Pika-Splash", name: "Pika-Splash",

View File

@ -1,5 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n"; import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = { export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, 'blockRecoilDamage' : `{{abilityName}} di {{pokemonName}}\nl'ha protetto dal contraccolpo!`,
} as const; } as const;

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
zippyZap: { zippyZap: {
name: "Sprintaboom", name: "Sprintaboom",
effect: "Un attacco elettrico ad altissima velocità. Questa mossa ha priorità alta e infligge sicuramente un brutto colpo.", effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and raises the user's evasiveness.",
}, },
splishySplash: { splishySplash: {
name: "Surfasplash", name: "Surfasplash",

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
zippyZap: { zippyZap: {
name: "Zippy Zap", name: "Zippy Zap",
effect: "O usuário ataca o alvo com rajadas de eletricidade em alta velocidade. Este movimento sempre ataca primeiro e resulta em um golpe crítico." effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and raises the user's evasiveness."
}, },
splishySplash: { splishySplash: {
name: "Splishy Splash", name: "Splishy Splash",

View File

@ -2915,7 +2915,7 @@ export const move: MoveTranslationEntries = {
}, },
"zippyZap": { "zippyZap": {
name: "电电加速", name: "电电加速",
effect: "迅猛无比的电击。必定能够\n先制攻击击中对方的要害", effect: "The user attacks the target with bursts of electricity at high speed. This move always goes first and raises the user's evasiveness.",
}, },
"splishySplash": { "splishySplash": {
name: "滔滔冲浪", name: "滔滔冲浪",

View File

@ -554,10 +554,10 @@ export class EvolutionItemModifierType extends PokemonModifierType implements Ge
super(Utils.toReadableString(EvolutionItem[evolutionItem]), `Causes certain Pokémon to evolve`, (_type, args) => new Modifiers.EvolutionItemModifier(this, (args[0] as PlayerPokemon).id), super(Utils.toReadableString(EvolutionItem[evolutionItem]), `Causes certain Pokémon to evolve`, (_type, args) => new Modifiers.EvolutionItemModifier(this, (args[0] as PlayerPokemon).id),
(pokemon: PlayerPokemon) => { (pokemon: PlayerPokemon) => {
if (pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) && pokemonEvolutions[pokemon.species.speciesId].filter(e => e.item === this.evolutionItem if (pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) && pokemonEvolutions[pokemon.species.speciesId].filter(e => e.item === this.evolutionItem
&& (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.formIndex == 0)) && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFormKey() !== SpeciesFormKey.GIGANTAMAX))
return null; return null;
else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === this.evolutionItem else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === this.evolutionItem
&& (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.fusionFormIndex == 0)) && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX))
return null; return null;
return PartyUiHandler.NoEffectMessage; return PartyUiHandler.NoEffectMessage;

View File

@ -289,7 +289,7 @@ export class TitlePhase extends Phase {
} }
this.scene.sessionSlotId = slotId; this.scene.sessionSlotId = slotId;
fetchDailyRunSeed().then(seed => { const generateDaily = (seed: string) => {
this.scene.gameMode = gameModes[GameModes.DAILY]; this.scene.gameMode = gameModes[GameModes.DAILY];
this.scene.setSeed(seed); this.scene.setSeed(seed);
@ -332,9 +332,18 @@ export class TitlePhase extends Phase {
this.scene.sessionPlayTime = 0; this.scene.sessionPlayTime = 0;
this.end(); this.end();
}); });
}).catch(err => { };
console.error("Failed to load daily run:\n", err);
}); // If Online, calls seed fetch from db to generate daily run. If Offline, generates a daily run based on current date.
if (!Utils.isLocal) {
fetchDailyRunSeed().then(seed => {
generateDaily(seed);
}).catch(err => {
console.error("Failed to load daily run:\n", err);
});
} else {
generateDaily(btoa(new Date().toISOString().substring(0, 10)));
}
}); });
} }
@ -2931,19 +2940,21 @@ export class ObtainStatusEffectPhase extends PokemonPhase {
private statusEffect: StatusEffect; private statusEffect: StatusEffect;
private cureTurn: integer; private cureTurn: integer;
private sourceText: string; private sourceText: string;
private sourcePokemon: Pokemon;
constructor(scene: BattleScene, battlerIndex: BattlerIndex, statusEffect: StatusEffect, cureTurn?: integer, sourceText?: string) { constructor(scene: BattleScene, battlerIndex: BattlerIndex, statusEffect: StatusEffect, cureTurn?: integer, sourceText?: string, sourcePokemon?: Pokemon) {
super(scene, battlerIndex); super(scene, battlerIndex);
this.statusEffect = statusEffect; this.statusEffect = statusEffect;
this.cureTurn = cureTurn; this.cureTurn = cureTurn;
this.sourceText = sourceText; this.sourceText = sourceText;
this.sourcePokemon = sourcePokemon; // For tracking which Pokemon caused the status effect
} }
start() { start() {
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
if (!pokemon.status) { if (!pokemon.status) {
if (pokemon.trySetStatus(this.statusEffect)) { if (pokemon.trySetStatus(this.statusEffect, false, this.sourcePokemon)) {
if (this.cureTurn) if (this.cureTurn)
pokemon.status.cureTurn = this.cureTurn; pokemon.status.cureTurn = this.cureTurn;
pokemon.updateInfo(true); pokemon.updateInfo(true);
@ -3610,10 +3621,20 @@ export class GameOverPhase extends BattlePhase {
}); });
}); });
}; };
/* Added a local check to see if the game is running offline on victory
If Online, execute apiFetch as intended
If Offline, execute offlineNewClear(), a localStorage implementation of newClear daily run checks */
if (this.victory) { if (this.victory) {
Utils.apiFetch(`savedata/newclear?slot=${this.scene.sessionSlotId}`, true) if (!Utils.isLocal) {
Utils.apiFetch(`savedata/newclear?slot=${this.scene.sessionSlotId}`, true)
.then(response => response.json()) .then(response => response.json())
.then(newClear => doGameOver(newClear)); .then(newClear => doGameOver(newClear));
} else {
this.scene.gameData.offlineNewClear(this.scene).then(result => {
doGameOver(result);
});
}
} else } else
doGameOver(false); doGameOver(false);
} }

View File

@ -759,6 +759,36 @@ export class GameData {
}); });
} }
/* Defines a localStorage item 'daily' to check on clears, offline implementation of savedata/newclear API
If a GameModes clear other than Daily is checked, newClear = true as usual
If a Daily mode is cleared, checks if it was already cleared before, based on seed, and returns true only to new daily clear runs */
offlineNewClear(scene: BattleScene): Promise<boolean> {
return new Promise<boolean>(resolve => {
const sessionData = this.getSessionSaveData(scene);
const seed = sessionData.seed;
let daily: string[] = [];
if (sessionData.gameMode == GameModes.DAILY) {
if (localStorage.hasOwnProperty('daily')) {
daily = JSON.parse(atob(localStorage.getItem('daily')));
if (daily.includes(seed)) {
return resolve(false);
} else {
daily.push(seed);
localStorage.setItem('daily', btoa(JSON.stringify(daily)));
return resolve(true);
}
} else {
daily.push(seed);
localStorage.setItem('daily', btoa(JSON.stringify(daily)));
return resolve(true);
}
} else {
return resolve(true);
}
});
}
tryClearSession(scene: BattleScene, slotId: integer): Promise<[success: boolean, newClear: boolean]> { tryClearSession(scene: BattleScene, slotId: integer): Promise<[success: boolean, newClear: boolean]> {
return new Promise<[boolean, boolean]>(resolve => { return new Promise<[boolean, boolean]>(resolve => {
if (bypassLogin) { if (bypassLogin) {

View File

@ -116,13 +116,6 @@ export function randSeedEasedWeightedItem<T>(items: T[], easingFunction: string
return items[Math.floor(easedValue * items.length)]; return items[Math.floor(easedValue * items.length)];
} }
export function getSunday(date: Date): Date {
const day = date.getUTCDay();
const diff = date.getUTCDate() - day;
const newDate = new Date(date.setUTCDate(diff));
return new Date(Date.UTC(newDate.getUTCFullYear(), newDate.getUTCMonth(), newDate.getUTCDate()));
}
export function getFrameMs(frameCount: integer): integer { export function getFrameMs(frameCount: integer): integer {
return Math.floor((1 / 60) * 1000 * frameCount); return Math.floor((1 / 60) * 1000 * frameCount);
} }
@ -199,7 +192,9 @@ export function formatLargeNumber(count: integer, threshold: integer): string {
return '?'; return '?';
} }
const digits = ((ret.length + 2) % 3) + 1; const digits = ((ret.length + 2) % 3) + 1;
const decimalNumber = parseInt(ret.slice(digits, digits + (3 - digits))); let decimalNumber = ret.slice(digits, digits + 2);
while (decimalNumber.endsWith('0'))
decimalNumber = decimalNumber.slice(0, -1);
return `${ret.slice(0, digits)}${decimalNumber ? `.${decimalNumber}` : ''}${suffix}`; return `${ret.slice(0, digits)}${decimalNumber ? `.${decimalNumber}` : ''}${suffix}`;
} }