pull/748/merge
alpaca 2024-05-14 19:19:52 -07:00 committed by GitHub
commit 5628b79a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 3865 additions and 3781 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

View File

@ -179,6 +179,17 @@ export function getWeatherDamageMessage(weatherType: WeatherType, pokemon: Pokem
return null;
}
export function getWeatherImmunityMessage(weatherType: WeatherType, pokemon: Pokemon): string {
switch (weatherType) {
case WeatherType.SANDSTORM:
return getPokemonMessage(pokemon, ' is not affected by\nsandstorm due to its Safety Goggles!');
case WeatherType.HAIL:
return getPokemonMessage(pokemon, ' is not affected by\nhail due to its Safety Goggles!');
}
return null;
}
export function getWeatherClearMessage(weatherType: WeatherType): string {
switch (weatherType) {
case WeatherType.SUNNY:

View File

@ -21,6 +21,8 @@ import { ModifierTier } from './modifier-tier';
import { Nature, getNatureName, getNatureStatMultiplier } from '#app/data/nature';
import { Localizable } from '#app/plugins/i18n';
import { getModifierTierTextTint } from '#app/ui/text';
import { WeatherDamageImmunityModifier } from './modifier';
import { Abilities } from '#app/data/enums/abilities.js';
const outputModifierData = false;
const useMaxWeightForOutput = false;
@ -922,6 +924,9 @@ export const modifierTypes = {
BERRY_POUCH: () => new ModifierType('Berry Pouch', 'Adds a 25% chance that a used berry will not be consumed',
(type, _args) => new Modifiers.PreserveBerryModifier(type)),
SAFETY_GOGGLES: () => new ModifierType('Safety Goggles', 'Prevents damage from weather and powder',
(type, _args) => new Modifiers.WeatherDamageImmunityModifier(type), "safety_goggles"),
FOCUS_BAND: () => new PokemonHeldItemModifierType('Focus Band', 'Adds a 10% chance to survive with 1 HP after being damaged enough to faint',
(type, args) => new Modifiers.SurviveDamageModifier(type, (args[0] as Pokemon).id)),
@ -1072,6 +1077,15 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.EXP_BALANCE, 4),
new WeightedModifierType(modifierTypes.TERA_ORB, (party: Pokemon[]) => Math.min(Math.max(Math.floor(party[0].scene.currentBattle.waveIndex / 50) * 2, 1), 4), 4),
new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(3 - rerollCount, 0) : 0, 3),
new WeightedModifierType(modifierTypes.SAFETY_GOGGLES, (party: Pokemon[]) => {
const hasRelevantMove: boolean = party.filter(p => p.getMoveset().filter(m => ([Moves.SANDSTORM, Moves.HAIL].includes(m.getMove().id)))).length > 0;
const hasRelevantAbility: boolean = party.filter(p => p.hasAbility(Abilities.SAND_SPIT) || p.hasAbility(Abilities.SAND_STREAM)).length > 0;
if (hasRelevantMove || hasRelevantAbility) {
return 10;
} else {
return 1;
}
}),
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.ROGUE]: [
new WeightedModifierType(modifierTypes.ROGUE_BALL, 24),

View File

@ -928,6 +928,37 @@ export class PreserveBerryModifier extends PersistentModifier {
}
}
export class WeatherDamageImmunityModifier extends PersistentModifier {
constructor(type: ModifierType, stackCount?: integer) {
super(type, stackCount);
}
match(modifier: Modifier) {
return modifier instanceof WeatherDamageImmunityModifier;
}
clone() {
return new WeatherDamageImmunityModifier(this.type, this.stackCount);
}
shouldApply(args: any[]): boolean {
return super.shouldApply(args) && args[0] instanceof Pokemon && args[1] instanceof Utils.BooleanHolder;
}
apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon;
if (pokemon.isPlayer()) {
(args[1] as Utils.BooleanHolder).value = true;
}
return true;
}
getMaxStackCount(scene: BattleScene): integer {
return 1;
}
}
export class PokemonInstantReviveModifier extends PokemonHeldItemModifier {
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
super(type, pokemonId, stackCount);

View File

@ -6,7 +6,7 @@ import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMov
import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler";
import { Stat } from "./data/pokemon-stat";
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, FusePokemonModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems } from "./modifier/modifier";
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, FusePokemonModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems, WeatherDamageImmunityModifier } from "./modifier/modifier";
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
@ -26,7 +26,7 @@ import { BattlerTagType } from "./data/enums/battler-tag-type";
import { getPokemonMessage, getPokemonPrefix } from "./messages";
import { Starter } from "./ui/starter-select-ui-handler";
import { Gender } from "./data/gender";
import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, getWeatherDamageMessage, getWeatherLapseMessage } from "./data/weather";
import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, getWeatherDamageMessage, getWeatherImmunityMessage, getWeatherLapseMessage } from "./data/weather";
import { TempBattleStat } from "./data/temp-battle-stat";
import { ArenaTagSide, ArenaTrapTag, MistTag, TrickRoomTag } from "./data/arena-tag";
import { ArenaTagType } from "./data/enums/arena-tag-type";
@ -2914,10 +2914,17 @@ export class WeatherEffectPhase extends CommonAnimPhase {
if (cancelled.value)
return;
const damage = Math.ceil(pokemon.getMaxHp() / 16);
const goggles = new Utils.BooleanHolder(false);
this.scene.applyModifiers(WeatherDamageImmunityModifier, pokemon.isPlayer(), pokemon, goggles);
this.scene.queueMessage(getWeatherDamageMessage(this.weather.weatherType, pokemon));
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
if (goggles.value) {
this.scene.queueMessage(getWeatherImmunityMessage(this.weather.weatherType, pokemon));
} else {
const damage = Math.ceil(pokemon.getMaxHp() / 16);
this.scene.queueMessage(getWeatherDamageMessage(this.weather.weatherType, pokemon));
pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true);
}
};
this.executeForAll((pokemon: Pokemon) => {