Merge branch 'pagefaultgames:main' into splash-messages-literals

pull/600/head
Alessandro Bruzzese 2024-05-08 09:24:11 +02:00 committed by GitHub
commit b3cc3feb76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 2570 additions and 126 deletions

View File

@ -0,0 +1,55 @@
import re
filenames = [['src/data/enums/moves.ts', 'move'], ['src/data/enums/abilities.ts', 'ability'], ['src/data/enums/species.ts', 'Pokémon']]
commentBlockStart = re.compile('\/\*[^\*].*') # Regex for the start of a comment block
commentBlockEnd = re.compile('.*,\*\/') # Regex for the end of a comment block
commentExp = re.compile('(?:\/\*\*.*\*\/)') # Regex for a url comment that already existed in the file
enumExp = re.compile('.*,') # Regex for a regular enum line
numberExp = re.compile(' +\= +\d+,')
replaceList = ['ALOLA', 'ETERNAL', 'GALAR', 'HISUI', 'PALDEA', 'BLOODMOON']
for args in filenames:
output = ''
skip = False # True when we should completely stop adding url comments for any reason
blockComment = False # True when currently reading a comment block
file = open(args[0], 'r')
line = file.readline()
while line:
if(skip): # Appends the next line in the file and moves on if we already hit the end of the enum
output += line
line = file.readline()
continue
skip = line.find('};') != -1 # True if we reached the end of an enum definition
# Determines when a comment block has started and we should stop adding url comments
if (commentBlockStart.findall(line)):
blockComment = True
if(not commentExp.findall(line)):
urlInsert = numberExp.sub('', line).strip().rstrip('\n').rstrip(',').title() # Clean up the enum line to only the enum
for replace in replaceList:
urlInsert = urlInsert.replace(replace.title() + '_', '')
if (not blockComment and enumExp.findall(line)):
output += ' /**{@link https://bulbapedia.bulbagarden.net/wiki/' + urlInsert + '_(' + args[1] + ') | Source} */\n'
output += line # Add the line to output since it isn't an existing url comment
# Determines if we're at the end of a comment block and can resume adding url comments
if (blockComment):
blockComment = not commentBlockEnd.findall(line)
line = file.readline()
file.close()
file = open(args[0], 'w', encoding='utf-8')
file.write(output,)
file.close

View File

@ -2496,11 +2496,11 @@ export class IgnoreTypeImmunityAbAttr extends AbAttr {
}
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (this.defenderType !== (args[1] as Type)) {
return false;
if (this.defenderType === (args[1] as Type) && this.allowedMoveTypes.includes(args[0] as Type)) {
cancelled.value = true;
return true;
}
return this.allowedMoveTypes.some(type => type === (args[0] as Type));
return false;
}
}
@ -3035,7 +3035,7 @@ export function initAbilities() {
new Ability(Abilities.FRISK, 4)
.attr(FriskAbAttr),
new Ability(Abilities.RECKLESS, 4)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.getAttrs(RecoilAttr).length && move.id !== Moves.STRUGGLE, 1.2),
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.RECKLESS_MOVE), 1.2),
new Ability(Abilities.MULTITYPE, 4)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
@ -3606,7 +3606,8 @@ export function initAbilities() {
.partial(),
new Ability(Abilities.MINDS_EYE, 9)
.attr(IgnoreTypeImmunityAbAttr, Type.GHOST, [Type.NORMAL, Type.FIGHTING])
.ignorable(), // TODO: evasiveness bypass should not be ignored, but accuracy immunity should
.ignorable() // TODO: evasiveness bypass should not be ignored, but accuracy immunity should
.partial(),
new Ability(Abilities.SUPERSWEET_SYRUP, 9)
.attr(PostSummonStatChangeAbAttr, BattleStat.EVA, -1)
.condition(getOncePerBattleCondition(Abilities.SUPERSWEET_SYRUP)),

View File

@ -1639,7 +1639,8 @@ export const trainerTypeDialogue = {
},
[TrainerType.HAU]: {
encounter: [
`I wonder if a Trainer battles differently depending on whether they're from a warm region or a cold region. Let's test it out!`,
`I wonder if a Trainer battles differently depending on whether they're from a warm region or a cold region.
$Let's test it out!`,
],
victory: [
`That was awesome! I think I kinda understand your vibe a little better now!`,

View File

@ -1,313 +1,624 @@
export enum Abilities {
/**{@link https://bulbapedia.bulbagarden.net/wiki/None_(ability) | Source} */
NONE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Stench_(ability) | Source} */
STENCH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Drizzle_(ability) | Source} */
DRIZZLE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Speed_Boost_(ability) | Source} */
SPEED_BOOST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Battle_Armor_(ability) | Source} */
BATTLE_ARMOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sturdy_(ability) | Source} */
STURDY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Damp_(ability) | Source} */
DAMP,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Limber_(ability) | Source} */
LIMBER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sand_Veil_(ability) | Source} */
SAND_VEIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Static_(ability) | Source} */
STATIC,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Volt_Absorb_(ability) | Source} */
VOLT_ABSORB,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Water_Absorb_(ability) | Source} */
WATER_ABSORB,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Oblivious_(ability) | Source} */
OBLIVIOUS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Cloud_Nine_(ability) | Source} */
CLOUD_NINE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Compound_Eyes_(ability) | Source} */
COMPOUND_EYES,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Insomnia_(ability) | Source} */
INSOMNIA,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Color_Change_(ability) | Source} */
COLOR_CHANGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Immunity_(ability) | Source} */
IMMUNITY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Flash_Fire_(ability) | Source} */
FLASH_FIRE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Shield_Dust_(ability) | Source} */
SHIELD_DUST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Own_Tempo_(ability) | Source} */
OWN_TEMPO,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Suction_Cups_(ability) | Source} */
SUCTION_CUPS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Intimidate_(ability) | Source} */
INTIMIDATE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Shadow_Tag_(ability) | Source} */
SHADOW_TAG,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rough_Skin_(ability) | Source} */
ROUGH_SKIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Wonder_Guard_(ability) | Source} */
WONDER_GUARD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Levitate_(ability) | Source} */
LEVITATE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Effect_Spore_(ability) | Source} */
EFFECT_SPORE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Synchronize_(ability) | Source} */
SYNCHRONIZE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Clear_Body_(ability) | Source} */
CLEAR_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Natural_Cure_(ability) | Source} */
NATURAL_CURE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Lightning_Rod_(ability) | Source} */
LIGHTNING_ROD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Serene_Grace_(ability) | Source} */
SERENE_GRACE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Swift_Swim_(ability) | Source} */
SWIFT_SWIM,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Chlorophyll_(ability) | Source} */
CHLOROPHYLL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Illuminate_(ability) | Source} */
ILLUMINATE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Trace_(ability) | Source} */
TRACE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Huge_Power_(ability) | Source} */
HUGE_POWER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Poison_Point_(ability) | Source} */
POISON_POINT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Inner_Focus_(ability) | Source} */
INNER_FOCUS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Magma_Armor_(ability) | Source} */
MAGMA_ARMOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Water_Veil_(ability) | Source} */
WATER_VEIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Magnet_Pull_(ability) | Source} */
MAGNET_PULL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Soundproof_(ability) | Source} */
SOUNDPROOF,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rain_Dish_(ability) | Source} */
RAIN_DISH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sand_Stream_(ability) | Source} */
SAND_STREAM,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Pressure_(ability) | Source} */
PRESSURE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Thick_Fat_(ability) | Source} */
THICK_FAT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Early_Bird_(ability) | Source} */
EARLY_BIRD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Flame_Body_(ability) | Source} */
FLAME_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Run_Away_(ability) | Source} */
RUN_AWAY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Keen_Eye_(ability) | Source} */
KEEN_EYE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Hyper_Cutter_(ability) | Source} */
HYPER_CUTTER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Pickup_(ability) | Source} */
PICKUP,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Truant_(ability) | Source} */
TRUANT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Hustle_(ability) | Source} */
HUSTLE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Cute_Charm_(ability) | Source} */
CUTE_CHARM,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Plus_(ability) | Source} */
PLUS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Minus_(ability) | Source} */
MINUS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Forecast_(ability) | Source} */
FORECAST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sticky_Hold_(ability) | Source} */
STICKY_HOLD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Shed_Skin_(ability) | Source} */
SHED_SKIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Guts_(ability) | Source} */
GUTS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Marvel_Scale_(ability) | Source} */
MARVEL_SCALE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Liquid_Ooze_(ability) | Source} */
LIQUID_OOZE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Overgrow_(ability) | Source} */
OVERGROW,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Blaze_(ability) | Source} */
BLAZE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Torrent_(ability) | Source} */
TORRENT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Swarm_(ability) | Source} */
SWARM,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rock_Head_(ability) | Source} */
ROCK_HEAD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Drought_(ability) | Source} */
DROUGHT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Arena_Trap_(ability) | Source} */
ARENA_TRAP,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Vital_Spirit_(ability) | Source} */
VITAL_SPIRIT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/White_Smoke_(ability) | Source} */
WHITE_SMOKE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Pure_Power_(ability) | Source} */
PURE_POWER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(ability) | Source} */
SHELL_ARMOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Air_Lock_(ability) | Source} */
AIR_LOCK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tangled_Feet_(ability) | Source} */
TANGLED_FEET,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Motor_Drive_(ability) | Source} */
MOTOR_DRIVE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rivalry_(ability) | Source} */
RIVALRY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Steadfast_(ability) | Source} */
STEADFAST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Snow_Cloak_(ability) | Source} */
SNOW_CLOAK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Gluttony_(ability) | Source} */
GLUTTONY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Anger_Point_(ability) | Source} */
ANGER_POINT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Unburden_(ability) | Source} */
UNBURDEN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Heatproof_(ability) | Source} */
HEATPROOF,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Simple_(ability) | Source} */
SIMPLE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Dry_Skin_(ability) | Source} */
DRY_SKIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Download_(ability) | Source} */
DOWNLOAD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Iron_Fist_(ability) | Source} */
IRON_FIST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Poison_Heal_(ability) | Source} */
POISON_HEAL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Adaptability_(ability) | Source} */
ADAPTABILITY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Skill_Link_(ability) | Source} */
SKILL_LINK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Hydration_(ability) | Source} */
HYDRATION,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Solar_Power_(ability) | Source} */
SOLAR_POWER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Quick_Feet_(ability) | Source} */
QUICK_FEET,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Normalize_(ability) | Source} */
NORMALIZE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sniper_(ability) | Source} */
SNIPER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(ability) | Source} */
MAGIC_GUARD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/No_Guard_(ability) | Source} */
NO_GUARD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Stall_(ability) | Source} */
STALL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Technician_(ability) | Source} */
TECHNICIAN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Leaf_Guard_(ability) | Source} */
LEAF_GUARD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Klutz_(ability) | Source} */
KLUTZ,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Mold_Breaker_(ability) | Source} */
MOLD_BREAKER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Super_Luck_(ability) | Source} */
SUPER_LUCK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Aftermath_(ability) | Source} */
AFTERMATH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Anticipation_(ability) | Source} */
ANTICIPATION,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Forewarn_(ability) | Source} */
FOREWARN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Unaware_(ability) | Source} */
UNAWARE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tinted_Lens_(ability) | Source} */
TINTED_LENS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Filter_(ability) | Source} */
FILTER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Slow_Start_(ability) | Source} */
SLOW_START,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Scrappy_(ability) | Source} */
SCRAPPY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Storm_Drain_(ability) | Source} */
STORM_DRAIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Ice_Body_(ability) | Source} */
ICE_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Solid_Rock_(ability) | Source} */
SOLID_ROCK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Snow_Warning_(ability) | Source} */
SNOW_WARNING,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Honey_Gather_(ability) | Source} */
HONEY_GATHER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Frisk_(ability) | Source} */
FRISK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Reckless_(ability) | Source} */
RECKLESS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Multitype_(ability) | Source} */
MULTITYPE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Flower_Gift_(ability) | Source} */
FLOWER_GIFT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Bad_Dreams_(ability) | Source} */
BAD_DREAMS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Pickpocket_(ability) | Source} */
PICKPOCKET,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sheer_Force_(ability) | Source} */
SHEER_FORCE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Contrary_(ability) | Source} */
CONTRARY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Unnerve_(ability) | Source} */
UNNERVE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Defiant_(ability) | Source} */
DEFIANT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Defeatist_(ability) | Source} */
DEFEATIST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Cursed_Body_(ability) | Source} */
CURSED_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Healer_(ability) | Source} */
HEALER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Friend_Guard_(ability) | Source} */
FRIEND_GUARD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Weak_Armor_(ability) | Source} */
WEAK_ARMOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Heavy_Metal_(ability) | Source} */
HEAVY_METAL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Light_Metal_(ability) | Source} */
LIGHT_METAL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Multiscale_(ability) | Source} */
MULTISCALE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Toxic_Boost_(ability) | Source} */
TOXIC_BOOST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Flare_Boost_(ability) | Source} */
FLARE_BOOST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Harvest_(ability) | Source} */
HARVEST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Telepathy_(ability) | Source} */
TELEPATHY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Moody_(ability) | Source} */
MOODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Overcoat_(ability) | Source} */
OVERCOAT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Poison_Touch_(ability) | Source} */
POISON_TOUCH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Regenerator_(ability) | Source} */
REGENERATOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Big_Pecks_(ability) | Source} */
BIG_PECKS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sand_Rush_(ability) | Source} */
SAND_RUSH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Wonder_Skin_(ability) | Source} */
WONDER_SKIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Analytic_(ability) | Source} */
ANALYTIC,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Illusion_(ability) | Source} */
ILLUSION,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Imposter_(ability) | Source} */
IMPOSTER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Infiltrator_(ability) | Source} */
INFILTRATOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Mummy_(ability) | Source} */
MUMMY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Moxie_(ability) | Source} */
MOXIE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Justified_(ability) | Source} */
JUSTIFIED,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rattled_(ability) | Source} */
RATTLED,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Magic_Bounce_(ability) | Source} */
MAGIC_BOUNCE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sap_Sipper_(ability) | Source} */
SAP_SIPPER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Prankster_(ability) | Source} */
PRANKSTER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sand_Force_(ability) | Source} */
SAND_FORCE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Iron_Barbs_(ability) | Source} */
IRON_BARBS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Zen_Mode_(ability) | Source} */
ZEN_MODE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Victory_Star_(ability) | Source} */
VICTORY_STAR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Turboblaze_(ability) | Source} */
TURBOBLAZE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Teravolt_(ability) | Source} */
TERAVOLT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Aroma_Veil_(ability) | Source} */
AROMA_VEIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Flower_Veil_(ability) | Source} */
FLOWER_VEIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Cheek_Pouch_(ability) | Source} */
CHEEK_POUCH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Protean_(ability) | Source} */
PROTEAN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Fur_Coat_(ability) | Source} */
FUR_COAT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Magician_(ability) | Source} */
MAGICIAN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Bulletproof_(ability) | Source} */
BULLETPROOF,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Competitive_(ability) | Source} */
COMPETITIVE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Strong_Jaw_(ability) | Source} */
STRONG_JAW,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Refrigerate_(ability) | Source} */
REFRIGERATE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sweet_Veil_(ability) | Source} */
SWEET_VEIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Stance_Change_(ability) | Source} */
STANCE_CHANGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Gale_Wings_(ability) | Source} */
GALE_WINGS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Mega_Launcher_(ability) | Source} */
MEGA_LAUNCHER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Grass_Pelt_(ability) | Source} */
GRASS_PELT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Symbiosis_(ability) | Source} */
SYMBIOSIS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tough_Claws_(ability) | Source} */
TOUGH_CLAWS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Pixilate_(ability) | Source} */
PIXILATE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Gooey_(ability) | Source} */
GOOEY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Aerilate_(ability) | Source} */
AERILATE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(ability) | Source} */
PARENTAL_BOND,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Dark_Aura_(ability) | Source} */
DARK_AURA,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Fairy_Aura_(ability) | Source} */
FAIRY_AURA,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Aura_Break_(ability) | Source} */
AURA_BREAK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Primordial_Sea_(ability) | Source} */
PRIMORDIAL_SEA,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Desolate_Land_(ability) | Source} */
DESOLATE_LAND,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Delta_Stream_(ability) | Source} */
DELTA_STREAM,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Stamina_(ability) | Source} */
STAMINA,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Wimp_Out_(ability) | Source} */
WIMP_OUT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Emergency_Exit_(ability) | Source} */
EMERGENCY_EXIT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Water_Compaction_(ability) | Source} */
WATER_COMPACTION,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Merciless_(ability) | Source} */
MERCILESS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Shields_Down_(ability) | Source} */
SHIELDS_DOWN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Stakeout_(ability) | Source} */
STAKEOUT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Water_Bubble_(ability) | Source} */
WATER_BUBBLE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Steelworker_(ability) | Source} */
STEELWORKER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Berserk_(ability) | Source} */
BERSERK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Slush_Rush_(ability) | Source} */
SLUSH_RUSH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Long_Reach_(ability) | Source} */
LONG_REACH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Liquid_Voice_(ability) | Source} */
LIQUID_VOICE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Triage_(ability) | Source} */
TRIAGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Galvanize_(ability) | Source} */
GALVANIZE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Surge_Surfer_(ability) | Source} */
SURGE_SURFER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Schooling_(ability) | Source} */
SCHOOLING,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Disguise_(ability) | Source} */
DISGUISE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Battle_Bond_(ability) | Source} */
BATTLE_BOND,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Power_Construct_(ability) | Source} */
POWER_CONSTRUCT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Corrosion_(ability) | Source} */
CORROSION,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Comatose_(ability) | Source} */
COMATOSE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Queenly_Majesty_(ability) | Source} */
QUEENLY_MAJESTY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(ability) | Source} */
INNARDS_OUT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Dancer_(ability) | Source} */
DANCER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Battery_(ability) | Source} */
BATTERY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Fluffy_(ability) | Source} */
FLUFFY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Dazzling_(ability) | Source} */
DAZZLING,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Soul_Heart_(ability) | Source} */
SOUL_HEART,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tangling_Hair_(ability) | Source} */
TANGLING_HAIR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Receiver_(ability) | Source} */
RECEIVER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Power_Of_Alchemy_(ability) | Source} */
POWER_OF_ALCHEMY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Beast_Boost_(ability) | Source} */
BEAST_BOOST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rks_System_(ability) | Source} */
RKS_SYSTEM,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Electric_Surge_(ability) | Source} */
ELECTRIC_SURGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Psychic_Surge_(ability) | Source} */
PSYCHIC_SURGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Misty_Surge_(ability) | Source} */
MISTY_SURGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Grassy_Surge_(ability) | Source} */
GRASSY_SURGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Full_Metal_Body_(ability) | Source} */
FULL_METAL_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Shadow_Shield_(ability) | Source} */
SHADOW_SHIELD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Prism_Armor_(ability) | Source} */
PRISM_ARMOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Neuroforce_(ability) | Source} */
NEUROFORCE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Intrepid_Sword_(ability) | Source} */
INTREPID_SWORD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Dauntless_Shield_(ability) | Source} */
DAUNTLESS_SHIELD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Libero_(ability) | Source} */
LIBERO,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Ball_Fetch_(ability) | Source} */
BALL_FETCH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Cotton_Down_(ability) | Source} */
COTTON_DOWN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Propeller_Tail_(ability) | Source} */
PROPELLER_TAIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Mirror_Armor_(ability) | Source} */
MIRROR_ARMOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Gulp_Missile_(ability) | Source} */
GULP_MISSILE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Stalwart_(ability) | Source} */
STALWART,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Steam_Engine_(ability) | Source} */
STEAM_ENGINE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Punk_Rock_(ability) | Source} */
PUNK_ROCK,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sand_Spit_(ability) | Source} */
SAND_SPIT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Ice_Scales_(ability) | Source} */
ICE_SCALES,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Ripen_(ability) | Source} */
RIPEN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Ice_Face_(ability) | Source} */
ICE_FACE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Power_Spot_(ability) | Source} */
POWER_SPOT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Mimicry_(ability) | Source} */
MIMICRY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Screen_Cleaner_(ability) | Source} */
SCREEN_CLEANER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Steely_Spirit_(ability) | Source} */
STEELY_SPIRIT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Perish_Body_(ability) | Source} */
PERISH_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Wandering_Spirit_(ability) | Source} */
WANDERING_SPIRIT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Gorilla_Tactics_(ability) | Source} */
GORILLA_TACTICS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Neutralizing_Gas_(ability) | Source} */
NEUTRALIZING_GAS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Pastel_Veil_(ability) | Source} */
PASTEL_VEIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Hunger_Switch_(ability) | Source} */
HUNGER_SWITCH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Quick_Draw_(ability) | Source} */
QUICK_DRAW,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Unseen_Fist_(ability) | Source} */
UNSEEN_FIST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Curious_Medicine_(ability) | Source} */
CURIOUS_MEDICINE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Transistor_(ability) | Source} */
TRANSISTOR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Dragons_Maw_(ability) | Source} */
DRAGONS_MAW,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Chilling_Neigh_(ability) | Source} */
CHILLING_NEIGH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Grim_Neigh_(ability) | Source} */
GRIM_NEIGH,
/**{@link https://bulbapedia.bulbagarden.net/wiki/As_One_Glastrier_(ability) | Source} */
AS_ONE_GLASTRIER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/As_One_Spectrier_(ability) | Source} */
AS_ONE_SPECTRIER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Lingering_Aroma_(ability) | Source} */
LINGERING_AROMA,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Seed_Sower_(ability) | Source} */
SEED_SOWER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Thermal_Exchange_(ability) | Source} */
THERMAL_EXCHANGE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Anger_Shell_(ability) | Source} */
ANGER_SHELL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Purifying_Salt_(ability) | Source} */
PURIFYING_SALT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Well_Baked_Body_(ability) | Source} */
WELL_BAKED_BODY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Wind_Rider_(ability) | Source} */
WIND_RIDER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Guard_Dog_(ability) | Source} */
GUARD_DOG,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Rocky_Payload_(ability) | Source} */
ROCKY_PAYLOAD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Wind_Power_(ability) | Source} */
WIND_POWER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Zero_To_Hero_(ability) | Source} */
ZERO_TO_HERO,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Commander_(ability) | Source} */
COMMANDER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Electromorphosis_(ability) | Source} */
ELECTROMORPHOSIS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Protosynthesis_(ability) | Source} */
PROTOSYNTHESIS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Quark_Drive_(ability) | Source} */
QUARK_DRIVE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Good_As_Gold_(ability) | Source} */
GOOD_AS_GOLD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Vessel_Of_Ruin_(ability) | Source} */
VESSEL_OF_RUIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sword_Of_Ruin_(ability) | Source} */
SWORD_OF_RUIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tablets_Of_Ruin_(ability) | Source} */
TABLETS_OF_RUIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Beads_Of_Ruin_(ability) | Source} */
BEADS_OF_RUIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Orichalcum_Pulse_(ability) | Source} */
ORICHALCUM_PULSE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Hadron_Engine_(ability) | Source} */
HADRON_ENGINE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Opportunist_(ability) | Source} */
OPPORTUNIST,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Cud_Chew_(ability) | Source} */
CUD_CHEW,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Sharpness_(ability) | Source} */
SHARPNESS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Supreme_Overlord_(ability) | Source} */
SUPREME_OVERLORD,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Costar_(ability) | Source} */
COSTAR,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Toxic_Debris_(ability) | Source} */
TOXIC_DEBRIS,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Armor_Tail_(ability) | Source} */
ARMOR_TAIL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Earth_Eater_(ability) | Source} */
EARTH_EATER,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Mycelium_Might_(ability) | Source} */
MYCELIUM_MIGHT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Minds_Eye_(ability) | Source} */
MINDS_EYE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Supersweet_Syrup_(ability) | Source} */
SUPERSWEET_SYRUP,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Hospitality_(ability) | Source} */
HOSPITALITY,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Toxic_Chain_(ability) | Source} */
TOXIC_CHAIN,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Embody_Aspect_Teal_(ability) | Source} */
EMBODY_ASPECT_TEAL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Embody_Aspect_Wellspring_(ability) | Source} */
EMBODY_ASPECT_WELLSPRING,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Embody_Aspect_Hearthflame_(ability) | Source} */
EMBODY_ASPECT_HEARTHFLAME,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Embody_Aspect_Cornerstone_(ability) | Source} */
EMBODY_ASPECT_CORNERSTONE,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tera_Shift_(ability) | Source} */
TERA_SHIFT,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Tera_Shell_(ability) | Source} */
TERA_SHELL,
/**{@link https://bulbapedia.bulbagarden.net/wiki/Teraform_Zero_(ability) | Source} */
TERAFORM_ZERO,
POISON_PUPPETEER
/**{@link https://bulbapedia.bulbagarden.net/wiki/Poison_Puppeteer_(ability) | Source} */
POISON_PUPPETEER,
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -54,22 +54,28 @@ export enum MoveTarget {
}
export enum MoveFlags {
MAKES_CONTACT = 1,
IGNORE_PROTECT = 2,
IGNORE_VIRTUAL = 4,
SOUND_BASED = 8,
HIDE_USER = 16,
HIDE_TARGET = 32,
BITING_MOVE = 64,
PULSE_MOVE = 128,
PUNCHING_MOVE = 256,
SLICING_MOVE = 512,
BALLBOMB_MOVE = 1024,
POWDER_MOVE = 2048,
DANCE_MOVE = 4096,
WIND_MOVE = 8192,
TRIAGE_MOVE = 16384,
IGNORE_ABILITIES = 32768
NONE = 0,
MAKES_CONTACT = 1 << 0,
IGNORE_PROTECT = 1 << 1,
IGNORE_VIRTUAL = 1 << 2,
SOUND_BASED = 1 << 3,
HIDE_USER = 1 << 4,
HIDE_TARGET = 1 << 5,
BITING_MOVE = 1 << 6,
PULSE_MOVE = 1 << 7,
PUNCHING_MOVE = 1 << 8,
SLICING_MOVE = 1 << 9,
/**
* Indicates a move should be affected by {@link Abilities.RECKLESS}
* @see {@link Move.recklessMove()}
*/
RECKLESS_MOVE = 1 << 10,
BALLBOMB_MOVE = 1 << 11,
POWDER_MOVE = 1 << 12,
DANCE_MOVE = 1 << 13,
WIND_MOVE = 1 << 14,
TRIAGE_MOVE = 1 << 15,
IGNORE_ABILITIES = 1 << 16,
}
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
@ -269,6 +275,17 @@ export default class Move implements Localizable {
return this;
}
/**
* Sets the {@link MoveFlags.RECKLESS_MOVE} flag for the calling Move
* @see {@link Abilities.RECKLESS}
* @param {boolean} recklessMove The value to set the flag to
* @returns {Move} The {@link Move} that called this function
*/
recklessMove(recklessMove?: boolean): this {
this.setFlag(MoveFlags.RECKLESS_MOVE, recklessMove);
return this;
}
ballBombMove(ballBombMove?: boolean): this {
this.setFlag(MoveFlags.BALLBOMB_MOVE, ballBombMove);
return this;
@ -1544,6 +1561,29 @@ export class StatChangeAttr extends MoveEffectAttr {
}
}
export class PostVictoryStatChangeAttr extends MoveAttr {
private stats: BattleStat[];
private levels: integer;
private condition: MoveConditionFunc;
private showMessage: boolean;
constructor(stats: BattleStat | BattleStat[], levels: integer, selfTarget?: boolean, condition?: MoveConditionFunc, showMessage: boolean = true, firstHitOnly: boolean = false) {
super();
this.stats = typeof(stats) === 'number'
? [ stats as BattleStat ]
: stats as BattleStat[];
this.levels = levels;
this.condition = condition || null;
this.showMessage = showMessage;
}
applyPostVictory(user: Pokemon, target: Pokemon, move: Move): void {
if(this.condition && !this.condition(user, target, move))
return false;
const statChangeAttr = new StatChangeAttr(this.stats, this.levels, this.showMessage);
statChangeAttr.apply(user, target, move);
}
}
export class AcupressureStatChangeAttr extends MoveEffectAttr {
constructor() {
super();
@ -1558,7 +1598,7 @@ export class AcupressureStatChangeAttr extends MoveEffectAttr {
return true;
}
return false;
}
}
}
export class GrowthStatChangeAttr extends StatChangeAttr {
@ -4073,7 +4113,8 @@ export function initMoves() {
new AttackMove(Moves.JUMP_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, 100, 95, 10, -1, 0, 1)
.attr(MissEffectAttr, crashDamageFunc)
.attr(NoEffectAttr, crashDamageFunc)
.condition(failOnGravityCondition),
.condition(failOnGravityCondition)
.recklessMove(),
new AttackMove(Moves.ROLLING_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 85, 15, 30, 0, 1)
.attr(FlinchAttr),
new StatusMove(Moves.SAND_ATTACK, Type.GROUND, 100, 15, -1, 0, 1)
@ -4092,13 +4133,15 @@ export function initMoves() {
new AttackMove(Moves.WRAP, Type.NORMAL, MoveCategory.PHYSICAL, 15, 90, 20, 100, 0, 1)
.attr(TrapAttr, BattlerTagType.WRAP),
new AttackMove(Moves.TAKE_DOWN, Type.NORMAL, MoveCategory.PHYSICAL, 90, 85, 20, -1, 0, 1)
.attr(RecoilAttr),
.attr(RecoilAttr)
.recklessMove(),
new AttackMove(Moves.THRASH, Type.NORMAL, MoveCategory.PHYSICAL, 120, 100, 10, -1, 0, 1)
.attr(FrenzyAttr)
.attr(MissEffectAttr, frenzyMissFunc)
.target(MoveTarget.RANDOM_NEAR_ENEMY),
new AttackMove(Moves.DOUBLE_EDGE, Type.NORMAL, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 1)
.attr(RecoilAttr, false, 0.33),
.attr(RecoilAttr, false, 0.33)
.recklessMove(),
new StatusMove(Moves.TAIL_WHIP, Type.NORMAL, 100, 30, -1, 0, 1)
.attr(StatChangeAttr, BattleStat.DEF, -1)
.target(MoveTarget.ALL_NEAR_ENEMIES),
@ -4170,7 +4213,8 @@ export function initMoves() {
new AttackMove(Moves.PECK, Type.FLYING, MoveCategory.PHYSICAL, 35, 100, 35, -1, 0, 1),
new AttackMove(Moves.DRILL_PECK, Type.FLYING, MoveCategory.PHYSICAL, 80, 100, 20, -1, 0, 1),
new AttackMove(Moves.SUBMISSION, Type.FIGHTING, MoveCategory.PHYSICAL, 80, 80, 20, -1, 0, 1)
.attr(RecoilAttr),
.attr(RecoilAttr)
.recklessMove(),
new AttackMove(Moves.LOW_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, -1, 100, 20, -1, 0, 1)
.attr(WeightPowerAttr)
.condition(failOnMaxCondition),
@ -4358,7 +4402,8 @@ export function initMoves() {
new AttackMove(Moves.HIGH_JUMP_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, 130, 90, 10, -1, 0, 1)
.attr(MissEffectAttr, crashDamageFunc)
.attr(NoEffectAttr, crashDamageFunc)
.condition(failOnGravityCondition),
.condition(failOnGravityCondition)
.recklessMove(),
new StatusMove(Moves.GLARE, Type.NORMAL, 100, 30, -1, 0, 1)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
new AttackMove(Moves.DREAM_EATER, Type.PSYCHIC, MoveCategory.SPECIAL, 100, 100, 15, -1, 0, 1)
@ -4943,7 +4988,8 @@ export function initMoves() {
.attr(StealHeldItemChanceAttr, 0.3),
new AttackMove(Moves.VOLT_TACKLE, Type.ELECTRIC, MoveCategory.PHYSICAL, 120, 100, 15, 10, 0, 3)
.attr(RecoilAttr, false, 0.33)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
.attr(StatusEffectAttr, StatusEffect.PARALYSIS)
.recklessMove(),
new AttackMove(Moves.MAGICAL_LEAF, Type.GRASS, MoveCategory.SPECIAL, 60, -1, 20, -1, 0, 3),
new StatusMove(Moves.WATER_SPORT, Type.WATER, -1, 15, -1, 0, 3)
.attr(AddArenaTagAttr, ArenaTagType.WATER_SPORT, 5)
@ -5086,7 +5132,8 @@ export function initMoves() {
.attr(RecoilAttr, false, 0.33)
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE)
.attr(StatusEffectAttr, StatusEffect.BURN)
.condition(failOnGravityCondition),
.condition(failOnGravityCondition)
.recklessMove(),
new AttackMove(Moves.FORCE_PALM, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 100, 10, 30, 0, 4)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
new AttackMove(Moves.AURA_SPHERE, Type.FIGHTING, MoveCategory.SPECIAL, 80, -1, 20, -1, 0, 4)
@ -5131,7 +5178,8 @@ export function initMoves() {
.attr(StatChangeAttr, BattleStat.SPDEF, -1)
.ballBombMove(),
new AttackMove(Moves.BRAVE_BIRD, Type.FLYING, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 4)
.attr(RecoilAttr, false, 0.33),
.attr(RecoilAttr, false, 0.33)
.recklessMove(),
new AttackMove(Moves.EARTH_POWER, Type.GROUND, MoveCategory.SPECIAL, 90, 100, 10, 10, 0, 4)
.attr(StatChangeAttr, BattleStat.SPDEF, -1),
new StatusMove(Moves.SWITCHEROO, Type.DARK, 100, 10, -1, 0, 4)
@ -5237,7 +5285,8 @@ export function initMoves() {
new AttackMove(Moves.CHARGE_BEAM, Type.ELECTRIC, MoveCategory.SPECIAL, 50, 90, 10, 70, 0, 4)
.attr(StatChangeAttr, BattleStat.SPATK, 1, true),
new AttackMove(Moves.WOOD_HAMMER, Type.GRASS, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 4)
.attr(RecoilAttr, false, 0.33),
.attr(RecoilAttr, false, 0.33)
.recklessMove(),
new AttackMove(Moves.AQUA_JET, Type.WATER, MoveCategory.PHYSICAL, 40, 100, 20, -1, 1, 4),
new AttackMove(Moves.ATTACK_ORDER, Type.BUG, MoveCategory.PHYSICAL, 90, 100, 15, -1, 0, 4)
.attr(HighCritAttr)
@ -5248,7 +5297,8 @@ export function initMoves() {
.attr(HealAttr, 0.5)
.triageMove(),
new AttackMove(Moves.HEAD_SMASH, Type.ROCK, MoveCategory.PHYSICAL, 150, 80, 5, -1, 0, 4)
.attr(RecoilAttr, false, 0.5),
.attr(RecoilAttr, false, 0.5)
.recklessMove(),
new AttackMove(Moves.DOUBLE_HIT, Type.NORMAL, MoveCategory.PHYSICAL, 35, 90, 10, -1, 0, 4)
.attr(MultiHitAttr, MultiHitType._2),
new AttackMove(Moves.ROAR_OF_TIME, Type.DRAGON, MoveCategory.SPECIAL, 150, 90, 5, -1, 0, 4)
@ -5436,7 +5486,8 @@ export function initMoves() {
.attr(StatChangeAttr, BattleStat.SPD, -1)
.target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.WILD_CHARGE, Type.ELECTRIC, MoveCategory.PHYSICAL, 90, 100, 15, -1, 0, 5)
.attr(RecoilAttr),
.attr(RecoilAttr)
.recklessMove(),
new AttackMove(Moves.DRILL_RUN, Type.GROUND, MoveCategory.PHYSICAL, 80, 95, 10, -1, 0, 5)
.attr(HighCritAttr),
new AttackMove(Moves.DUAL_CHOP, Type.DRAGON, MoveCategory.PHYSICAL, 40, 90, 15, -1, 0, 5)
@ -5473,7 +5524,8 @@ export function initMoves() {
.attr(HitsTagAttr, BattlerTagType.FLYING, false)
.windMove(),
new AttackMove(Moves.HEAD_CHARGE, Type.NORMAL, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 5)
.attr(RecoilAttr),
.attr(RecoilAttr)
.recklessMove(),
new AttackMove(Moves.GEAR_GRIND, Type.STEEL, MoveCategory.PHYSICAL, 50, 85, 15, -1, 0, 5)
.attr(MultiHitAttr, MultiHitType._2),
new AttackMove(Moves.SEARING_SHOT, Type.FIRE, MoveCategory.SPECIAL, 100, 100, 5, 30, 0, 5)
@ -5536,7 +5588,7 @@ export function initMoves() {
.attr(AddArenaTrapTagAttr, ArenaTagType.STICKY_WEB)
.target(MoveTarget.ENEMY_SIDE),
new AttackMove(Moves.FELL_STINGER, Type.BUG, MoveCategory.PHYSICAL, 50, 100, 25, -1, 0, 6)
.partial(),
.attr(PostVictoryStatChangeAttr, BattleStat.ATK, 3, true ),
new AttackMove(Moves.PHANTOM_FORCE, Type.GHOST, MoveCategory.PHYSICAL, 90, 100, 10, -1, 0, 6)
.attr(ChargeAttr, ChargeAnim.PHANTOM_FORCE_CHARGING, 'vanished\ninstantly!', BattlerTagType.HIDDEN)
.ignoresProtect()
@ -5687,7 +5739,8 @@ export function initMoves() {
.makesContact(false)
.target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.LIGHT_OF_RUIN, Type.FAIRY, MoveCategory.SPECIAL, 140, 90, 5, -1, 0, 6)
.attr(RecoilAttr, false, 0.5),
.attr(RecoilAttr, false, 0.5)
.recklessMove(),
new AttackMove(Moves.ORIGIN_PULSE, Type.WATER, MoveCategory.SPECIAL, 110, 85, 10, -1, 0, 6)
.pulseMove()
.target(MoveTarget.ALL_NEAR_ENEMIES),
@ -5978,7 +6031,8 @@ export function initMoves() {
.attr(FriendshipPowerAttr),
new AttackMove(Moves.BOUNCY_BUBBLE, Type.WATER, MoveCategory.SPECIAL, 60, 100, 20, -1, 0, 7)
.attr(HitHealAttr, 1.0)
.triageMove(),
.triageMove()
.target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.BUZZY_BUZZ, Type.ELECTRIC, MoveCategory.SPECIAL, 60, 100, 20, 100, 0, 7)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
new AttackMove(Moves.SIZZLY_SLIDE, Type.FIRE, MoveCategory.PHYSICAL, 60, 100, 20, 100, 0, 7)
@ -6267,7 +6321,8 @@ export function initMoves() {
.attr(MissEffectAttr, frenzyMissFunc)
.target(MoveTarget.RANDOM_NEAR_ENEMY),
new AttackMove(Moves.WAVE_CRASH, Type.WATER, MoveCategory.PHYSICAL, 120, 100, 10, -1, 0, 8)
.attr(RecoilAttr, false, 0.33),
.attr(RecoilAttr, false, 0.33)
.recklessMove(),
new AttackMove(Moves.CHLOROBLAST, Type.GRASS, MoveCategory.SPECIAL, 150, 95, 5, -1, 0, 8)
.attr(RecoilAttr, true, 0.5),
new AttackMove(Moves.MOUNTAIN_GALE, Type.ICE, MoveCategory.PHYSICAL, 100, 85, 10, 30, 0, 8)
@ -6431,7 +6486,8 @@ export function initMoves() {
new AttackMove(Moves.AXE_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, 120, 90, 10, 30, 0, 9)
.attr(MissEffectAttr, crashDamageFunc)
.attr(NoEffectAttr, crashDamageFunc)
.attr(ConfuseAttr),
.attr(ConfuseAttr)
.recklessMove(),
new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
.attr(MovePowerMultiplierAttr, (user, target, move) => {
return user.scene.getParty().reduce((acc, pokemonInParty) => acc + (pokemonInParty.status?.effect == StatusEffect.FAINT ? 1 : 0),
@ -6635,7 +6691,8 @@ export function initMoves() {
.attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result == MoveResult.MISS || user.getLastXMoves(2)[1]?.result == MoveResult.FAIL ? 2 : 1),
new AttackMove(Moves.SUPERCELL_SLAM, Type.ELECTRIC, MoveCategory.PHYSICAL, 100, 95, 15, -1, 0, 9)
.attr(MissEffectAttr, crashDamageFunc)
.attr(NoEffectAttr, crashDamageFunc),
.attr(NoEffectAttr, crashDamageFunc)
.recklessMove(),
new AttackMove(Moves.PSYCHIC_NOISE, Type.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, -1, 0, 9)
.soundBased()
.partial(),

View File

@ -4305,12 +4305,12 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[Species.GROVYLE]: [
[ 1, Moves.POUND ],
[ 1, Moves.LEER ],
[ 1, Moves.LEAFAGE ],
[ 1, Moves.QUICK_ATTACK ],
[ 1, Moves.FALSE_SWIPE ],
[ 1, Moves.FURY_CUTTER ],
[ 1, Moves.X_SCISSOR ],
[ 1, Moves.ENERGY_BALL ],
[ 1, Moves.LEAFAGE ],
[ 1, Moves.ENERGY_BALL ],
[ 9, Moves.MEGA_DRAIN ],
[ 12, Moves.DETECT ],
[ 15, Moves.QUICK_GUARD ],
@ -4324,15 +4324,16 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 55, Moves.LEAF_STORM ],
],
[Species.SCEPTILE]: [
[ 0, Moves.DUAL_CHOP ],
[ 0, Moves.LEAF_BLADE ],
[ 1, Moves.POUND ],
[ 1, Moves.LEER ],
[ 1, Moves.LEAFAGE ],
[ 1, Moves.QUICK_ATTACK ],
[ 1, Moves.FALSE_SWIPE ],
[ 1, Moves.FURY_CUTTER ],
[ 1, Moves.X_SCISSOR ],
[ 1, Moves.ENERGY_BALL ],
[ 1, Moves.LEAFAGE ],
[ 1, Moves.ENERGY_BALL ],
[ 1, Moves.SHED_TAIL ],
[ 5, Moves.MEGA_DRAIN ],
[ 12, Moves.DETECT ],
[ 15, Moves.QUICK_GUARD ],
@ -4340,10 +4341,9 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 25, Moves.GIGA_DRAIN ],
[ 30, Moves.SLAM ],
[ 35, Moves.DOUBLE_TEAM ],
[ 42, Moves.LEAF_BLADE ],
[ 49, Moves.SCREECH ],
[ 56, Moves.ENDEAVOR ],
[ 63, Moves.LEAF_STORM ],
[ 42, Moves.SCREECH ],
[ 49, Moves.ENDEAVOR ],
[ 56, Moves.LEAF_STORM ],
],
[Species.TORCHIC]: [
[ 1, Moves.SCRATCH ],
@ -4367,9 +4367,9 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 1, Moves.SCRATCH ],
[ 1, Moves.GROWL ],
[ 1, Moves.EMBER ],
[ 1, Moves.QUICK_ATTACK ],
[ 1, Moves.FLAMETHROWER ],
[ 1, Moves.QUICK_ATTACK ],
[ 1, Moves.FEATHER_DANCE ],
[ 1, Moves.FEATHER_DANCE ],
[ 9, Moves.FLAME_CHARGE ],
[ 12, Moves.DETECT ],
[ 15, Moves.SAND_ATTACK ],
@ -4399,10 +4399,10 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 25, Moves.SLASH ],
[ 30, Moves.BOUNCE ],
[ 35, Moves.FOCUS_ENERGY ],
[ 42, Moves.BLAZE_KICK ],
[ 49, Moves.BULK_UP ],
[ 56, Moves.REVERSAL ],
[ 63, Moves.FLARE_BLITZ ],
[ 42, Moves.BULK_UP ],
[ 49, Moves.REVERSAL ],
[ 56, Moves.FLARE_BLITZ ],
[ 63, Moves.BRAVE_BIRD ],
],
[Species.MUDKIP]: [
[ 1, Moves.TACKLE ],
@ -4426,8 +4426,6 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 1, Moves.TACKLE ],
[ 1, Moves.GROWL ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.SURF ],
[ 1, Moves.EARTHQUAKE ],
[ 1, Moves.ROCK_SMASH ],
[ 9, Moves.ROCK_THROW ],
[ 12, Moves.PROTECT ],
@ -4442,13 +4440,13 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
[ 55, Moves.HYDRO_PUMP ],
],
[Species.SWAMPERT]: [
[ 1, Moves.MUD_SHOT ],
[ 1, Moves.TACKLE ],
[ 1, Moves.GROWL ],
[ 1, Moves.WATER_GUN ],
[ 1, Moves.SURF ],
[ 1, Moves.EARTHQUAKE ],
[ 1, Moves.ROCK_SMASH ],
[ 1, Moves.MUD_SHOT ],
[ 1, Moves.ROCK_SMASH ],
[ 1, Moves.HAMMER_ARM ],
[ 9, Moves.ROCK_THROW ],
[ 12, Moves.PROTECT ],

View File

@ -908,14 +908,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return this.isTerastallized() ? 2 : 1;
const types = this.getTypes(true, true);
const ignorableImmunities = source?.getAbility()?.getAttrs(IgnoreTypeImmunityAbAttr) || [];
const cancelled = new Utils.BooleanHolder(false);
let multiplier = types.map(defType => {
if (source) {
const ignoreImmunity = new Utils.BooleanHolder(false);
applyAbAttrs(IgnoreTypeImmunityAbAttr, source, ignoreImmunity, moveType, defType);
if (ignoreImmunity.value)
return 1;
}
let multiplier = types.map(defType =>
ignorableImmunities.some(attr => attr.apply(source, false, cancelled, [moveType, defType]))
? 1
: getTypeDamageMultiplier(moveType, defType)
).reduce((acc, cur) => acc * cur, 1) as TypeDamageMultiplier;
return getTypeDamageMultiplier(moveType, defType);
}).reduce((acc, cur) => acc * cur, 1) as TypeDamageMultiplier;
// Handle strong winds lowering effectiveness of types super effective against pure flying
if (this.scene.arena.weather?.weatherType === WeatherType.STRONG_WINDS && !this.scene.arena.weather.isEffectSuppressed(this.scene) && multiplier >= 2 && this.isOfType(Type.FLYING) && getTypeDamageMultiplier(moveType, Type.FLYING) === 2)

View File

@ -2,7 +2,7 @@ import BattleScene, { AnySound, bypassLogin, startingWave } from "./battle-scene
import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon";
import * as Utils from './utils';
import { Moves } from "./data/enums/moves";
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, FixedDamageAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr } from "./data/move";
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr } from "./data/move";
import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler";
import { Stat } from "./data/pokemon-stat";
@ -3142,8 +3142,16 @@ export class FaintPhase extends PokemonPhase {
alivePlayField.forEach(p => applyPostKnockOutAbAttrs(PostKnockOutAbAttr, p, pokemon));
if (pokemon.turnData?.attacksReceived?.length) {
const defeatSource = this.scene.getPokemonById(pokemon.turnData.attacksReceived[0].sourceId);
if (defeatSource?.isOnField())
if (defeatSource?.isOnField()) {
applyPostVictoryAbAttrs(PostVictoryAbAttr, defeatSource);
const pvmove = allMoves[pokemon.turnData.attacksReceived[0].move];
const pvattrs = pvmove.getAttrs(PostVictoryStatChangeAttr);
if (pvattrs.length) {
for (let pvattr of pvattrs) {
pvattr.applyPostVictory(defeatSource, defeatSource, pvmove);
}
}
}
}
if (this.player) {

View File

@ -250,58 +250,52 @@ export class GameData {
public saveSystem(): Promise<boolean> {
return new Promise<boolean>(resolve => {
this.scene.ui.savingIcon.show();
updateUserInfo().then(response => {
if (!response[0]) {
this.scene.ui.savingIcon.hide();
return resolve(false);
}
const data: SystemSaveData = {
trainerId: this.trainerId,
secretId: this.secretId,
gender: this.gender,
dexData: this.dexData,
starterData: this.starterData,
gameStats: this.gameStats,
unlocks: this.unlocks,
achvUnlocks: this.achvUnlocks,
voucherUnlocks: this.voucherUnlocks,
voucherCounts: this.voucherCounts,
eggs: this.eggs.map(e => new EggData(e)),
gameVersion: this.scene.game.config.gameVersion,
timestamp: new Date().getTime()
};
const data: SystemSaveData = {
trainerId: this.trainerId,
secretId: this.secretId,
gender: this.gender,
dexData: this.dexData,
starterData: this.starterData,
gameStats: this.gameStats,
unlocks: this.unlocks,
achvUnlocks: this.achvUnlocks,
voucherUnlocks: this.voucherUnlocks,
voucherCounts: this.voucherCounts,
eggs: this.eggs.map(e => new EggData(e)),
gameVersion: this.scene.game.config.gameVersion,
timestamp: new Date().getTime()
};
const maxIntAttrValue = Math.pow(2, 31);
const systemData = JSON.stringify(data, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v);
const maxIntAttrValue = Math.pow(2, 31);
const systemData = JSON.stringify(data, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v);
if (!bypassLogin) {
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData, undefined, true)
.then(response => response.text())
.then(error => {
this.scene.ui.savingIcon.hide();
if (error) {
if (error.startsWith('client version out of date')) {
this.scene.clearPhaseQueue();
this.scene.unshiftPhase(new OutdatedPhase(this.scene));
} else if (error.startsWith('session out of date')) {
this.scene.clearPhaseQueue();
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
}
console.error(error);
return resolve(false);
if (!bypassLogin) {
Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData, undefined, true)
.then(response => response.text())
.then(error => {
this.scene.ui.savingIcon.hide();
if (error) {
if (error.startsWith('client version out of date')) {
this.scene.clearPhaseQueue();
this.scene.unshiftPhase(new OutdatedPhase(this.scene));
} else if (error.startsWith('session out of date')) {
this.scene.clearPhaseQueue();
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
}
resolve(true);
});
} else {
localStorage.setItem('data_bak', localStorage.getItem('data'));
console.error(error);
return resolve(false);
}
resolve(true);
});
} else {
localStorage.setItem('data_bak', localStorage.getItem('data'));
localStorage.setItem('data', btoa(systemData));
localStorage.setItem('data', btoa(systemData));
this.scene.ui.savingIcon.hide();
this.scene.ui.savingIcon.hide();
resolve(true);
}
});
resolve(true);
}
});
}

View File

@ -66,7 +66,7 @@ export class GameStats {
this.legendaryPokemonHatched = source?.legendaryPokemonHatched || 0;
this.mythicalPokemonSeen = source?.mythicalPokemonSeen || 0;
this.mythicalPokemonCaught = source?.mythicalPokemonCaught || 0;
this.mythicalPokemonHatched = source?.mythicalPokemonCaught || 0;
this.mythicalPokemonHatched = source?.mythicalPokemonHatched || 0;
this.shinyPokemonSeen = source?.shinyPokemonSeen || 0;
this.shinyPokemonCaught = source?.shinyPokemonCaught || 0;
this.shinyPokemonHatched = source?.shinyPokemonHatched || 0;

View File

@ -222,7 +222,8 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):
export const sessionIdKey = 'pokerogue_sessionId';
export const isLocal = window.location.hostname === 'localhost';
export const serverUrl = isLocal ? 'http://localhost:8001' : '';
export const apiUrl = isLocal ? serverUrl : 'api';
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net';
export const fallbackApiUrl = isLocal ? serverUrl : 'api';
export function setCookie(cName: string, cValue: string): void {
const expiration = new Date();
@ -243,7 +244,7 @@ export function getCookie(cName: string): string {
return '';
}
export function apiFetch(path: string, authed: boolean = false): Promise<Response> {
export function apiFetch(path: string, authed: boolean = false, fallback: boolean = false): Promise<Response> {
return new Promise((resolve, reject) => {
const request = {};
if (authed) {
@ -251,13 +252,22 @@ export function apiFetch(path: string, authed: boolean = false): Promise<Respons
if (sId)
request['headers'] = { 'Authorization': sId };
}
fetch(`${apiUrl}/${path}`, request)
.then(response => resolve(response))
.catch(err => reject(err));
fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, request)
.then(response => {
if (!response.ok && response.status === 404 && !fallback)
return apiFetch(path, authed, true).then(res => resolve(res));
resolve(response);
})
.catch(err => {
if (fallback)
reject(err);
else
apiFetch(path, authed, true).then(res => resolve(res));
});
});
}
export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false): Promise<Response> {
export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false, fallback: boolean = false): Promise<Response> {
return new Promise((resolve, reject) => {
const headers = {
'Accept': contentType,
@ -268,9 +278,14 @@ export function apiPost(path: string, data?: any, contentType: string = 'applica
if (sId)
headers['Authorization'] = sId;
}
fetch(`${apiUrl}/${path}`, { method: 'POST', headers: headers, body: data })
fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, { method: 'POST', headers: headers, body: data })
.then(response => resolve(response))
.catch(err => reject(err));
.catch(err => {
if (fallback)
reject(err);
else
apiPost(path, data, contentType, authed, true).then(res => resolve(res));
});
});
}