From bb1d76c7362893292f401acb71888e31983efc8d Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Sun, 12 May 2024 07:19:28 +0100 Subject: [PATCH] Added documentation for Power Split and Guard Split + linting --- pokerogue_forks/pokerogue | 1 + src/data/move.ts | 32 ++++++++++++++++++++++++++++---- src/data/pokemon-level-moves.ts | 7 ++++++- src/data/terrain.ts | 8 ++++++++ src/field/pokemon.ts | 6 ++---- src/modifier/modifier-type.ts | 2 +- 6 files changed, 46 insertions(+), 10 deletions(-) create mode 160000 pokerogue_forks/pokerogue diff --git a/pokerogue_forks/pokerogue b/pokerogue_forks/pokerogue new file mode 160000 index 00000000000..6d5e2b2c486 --- /dev/null +++ b/pokerogue_forks/pokerogue @@ -0,0 +1 @@ +Subproject commit 6d5e2b2c486abc63b451daf2d2f9812bbe5003b8 diff --git a/src/data/move.ts b/src/data/move.ts index 02e80cf1bac..b9162c2130a 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1842,7 +1842,19 @@ export class HpSplitAttr extends MoveEffectAttr { } } +/** + * Attribute used for moves which split the user and the target's offensive raw stats. + * This attribute is used for the move Power Split. +*/ export class PowerSplitAttr extends MoveEffectAttr { + /** + * Applying Power Split to the user and the target. + * @param {Pokemon} user The pokemon using the move. + * @param {Pokemon} target The targeted pokemon of the move. + * @param {Move} move The move used. + * @param {any} args N/A + * @returns {boolean} True if power split is applied successfully. + */ apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) : Promise { return new Promise(resolve => { @@ -1868,7 +1880,19 @@ export class PowerSplitAttr extends MoveEffectAttr { } } +/** + * Attribute used for moves which split the user and the target's defensive raw stats. + * This attribute is used for the move Guard Split. +*/ export class GuardSplitAttr extends MoveEffectAttr { + /** + * Applying Guard Split to the user and the target. + * @param {Pokemon} user The pokemon using the move. + * @param {Pokemon} target The targeted pokemon of the move. + * @param {Move} move The move used. + * @param {any} args N/A + * @returns {boolean} True if power split is applied successfully. + */ apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { return new Promise(resolve => { if (!super.apply(user, target, move, args)) @@ -1877,15 +1901,15 @@ export class GuardSplitAttr extends MoveEffectAttr { const infoUpdates = []; const defenseValue = Math.floor((target.getStat(Stat.DEF) + user.getStat(Stat.DEF)) / 2); - user.changeStat(Stat.DEF, defenseValue); + user.changeSummonStat(Stat.DEF, defenseValue); infoUpdates.push(user.updateInfo()); - target.changeStat(Stat.DEF, defenseValue); + target.changeSummonStat(Stat.DEF, defenseValue); infoUpdates.push(target.updateInfo()); const specialDefenseValue = Math.floor((target.getStat(Stat.SPDEF) + user.getStat(Stat.SPDEF)) / 2); - user.changeStat(Stat.SPDEF, specialDefenseValue); + user.changeSummonStat(Stat.SPDEF, specialDefenseValue); infoUpdates.push(user.updateInfo()); - target.changeStat(Stat.SPDEF, specialDefenseValue); + target.changeSummonStat(Stat.SPDEF, specialDefenseValue); infoUpdates.push(target.updateInfo()); diff --git a/src/data/pokemon-level-moves.ts b/src/data/pokemon-level-moves.ts index 2823170b13d..1ec45ccc0bd 100644 --- a/src/data/pokemon-level-moves.ts +++ b/src/data/pokemon-level-moves.ts @@ -73,8 +73,11 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 1, Moves.SCRATCH ], [ 1, Moves.GROWL ], [ 4, Moves.EMBER ], - [ 8, Moves.SMOKESCREEN ], + [ 6, Moves.POWER_SPLIT ], + [ 7, Moves.GUARD_SPLIT ], [ 12, Moves.DRAGON_BREATH ], + [ 15, Moves.TRIPLE_KICK], + [ 16, Moves.TRIPLE_AXEL], [ 17, Moves.FIRE_FANG ], [ 20, Moves.SLASH ], [ 24, Moves.FLAMETHROWER ], @@ -89,6 +92,7 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 1, Moves.EMBER ], [ 1, Moves.SMOKESCREEN ], [ 12, Moves.DRAGON_BREATH ], + [ 17, Moves.LIFE_DEW], [ 19, Moves.FIRE_FANG ], [ 24, Moves.SLASH ], [ 30, Moves.FLAMETHROWER ], @@ -15487,6 +15491,7 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 1, Moves.BABY_DOLL_EYES ], [ 5, Moves.ECHOED_VOICE ], [ 8, Moves.HELPING_HAND ], + [ 10, Moves.PROTECT], [ 11, Moves.SUPER_FANG ], [ 14, Moves.DOUBLE_HIT ], [ 18, Moves.BULLET_SEED ], diff --git a/src/data/terrain.ts b/src/data/terrain.ts index c0328d98d6c..fad055ad076 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -5,6 +5,7 @@ import * as Utils from "../utils"; import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability"; import { ProtectAttr } from "./move"; import { BattlerIndex } from "#app/battle.js"; +import { Abilities } from "./enums/abilities"; export enum TerrainType { NONE, @@ -52,6 +53,13 @@ export class Terrain { isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move): boolean { switch (this.terrainType) { case TerrainType.PSYCHIC: + var enemies = user.getOpponents().filter(o => targets.includes(o.getBattlerIndex())); + if (enemies.length > 0 && + enemies.some(e => e.species.isOfType(Type.FLYING))|| + enemies.some(e => e.species.getAbility(0) === Abilities.LEVITATE || e.species.getAbility(1) === Abilities.LEVITATE || e.species.getAbility(2) === Abilities.LEVITATE)) + { + return false; + } if (!move.getAttrs(ProtectAttr).length) { const priority = new Utils.IntegerHolder(move.priority); applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index de7ddb181f0..99ef623609c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -545,8 +545,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } getStat(stat: Stat): integer { - if (!this.summonData) - { + if (!this.summonData) { return this.stats[stat]; } @@ -1708,8 +1707,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return healAmount; } - changeSummonStat(stat: Stat, value: integer) : void - { + changeSummonStat(stat: Stat, value: integer) : void { this.summonData.stats[stat] = value; } diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 2457a705bce..385fb1d2253 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -973,7 +973,7 @@ interface ModifierPool { const modifierPool: ModifierPool = { [ModifierTier.COMMON]: [ new WeightedModifierType(modifierTypes.POKEBALL, 6), - new WeightedModifierType(modifierTypes.RARE_CANDY, 2), + new WeightedModifierType(modifierTypes.RARE_CANDY, 9999), new WeightedModifierType(modifierTypes.POTION, (party: Pokemon[]) => { const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 10 || p.getHpRatio() <= 0.875).length, 3); return thresholdPartyMemberCount * 3;