mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-15 21:02:18 +02:00
Added documentation for Power Split and Guard Split + linting
This commit is contained in:
parent
58524d40eb
commit
bb1d76c736
1
pokerogue_forks/pokerogue
Submodule
1
pokerogue_forks/pokerogue
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 6d5e2b2c486abc63b451daf2d2f9812bbe5003b8
|
@ -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 {
|
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<boolean> {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) : Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
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 {
|
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<boolean> {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (!super.apply(user, target, move, args))
|
if (!super.apply(user, target, move, args))
|
||||||
@ -1877,15 +1901,15 @@ export class GuardSplitAttr extends MoveEffectAttr {
|
|||||||
const infoUpdates = [];
|
const infoUpdates = [];
|
||||||
|
|
||||||
const defenseValue = Math.floor((target.getStat(Stat.DEF) + user.getStat(Stat.DEF)) / 2);
|
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());
|
infoUpdates.push(user.updateInfo());
|
||||||
target.changeStat(Stat.DEF, defenseValue);
|
target.changeSummonStat(Stat.DEF, defenseValue);
|
||||||
infoUpdates.push(target.updateInfo());
|
infoUpdates.push(target.updateInfo());
|
||||||
|
|
||||||
const specialDefenseValue = Math.floor((target.getStat(Stat.SPDEF) + user.getStat(Stat.SPDEF)) / 2);
|
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());
|
infoUpdates.push(user.updateInfo());
|
||||||
target.changeStat(Stat.SPDEF, specialDefenseValue);
|
target.changeSummonStat(Stat.SPDEF, specialDefenseValue);
|
||||||
infoUpdates.push(target.updateInfo());
|
infoUpdates.push(target.updateInfo());
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,8 +73,11 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
|
|||||||
[ 1, Moves.SCRATCH ],
|
[ 1, Moves.SCRATCH ],
|
||||||
[ 1, Moves.GROWL ],
|
[ 1, Moves.GROWL ],
|
||||||
[ 4, Moves.EMBER ],
|
[ 4, Moves.EMBER ],
|
||||||
[ 8, Moves.SMOKESCREEN ],
|
[ 6, Moves.POWER_SPLIT ],
|
||||||
|
[ 7, Moves.GUARD_SPLIT ],
|
||||||
[ 12, Moves.DRAGON_BREATH ],
|
[ 12, Moves.DRAGON_BREATH ],
|
||||||
|
[ 15, Moves.TRIPLE_KICK],
|
||||||
|
[ 16, Moves.TRIPLE_AXEL],
|
||||||
[ 17, Moves.FIRE_FANG ],
|
[ 17, Moves.FIRE_FANG ],
|
||||||
[ 20, Moves.SLASH ],
|
[ 20, Moves.SLASH ],
|
||||||
[ 24, Moves.FLAMETHROWER ],
|
[ 24, Moves.FLAMETHROWER ],
|
||||||
@ -89,6 +92,7 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
|
|||||||
[ 1, Moves.EMBER ],
|
[ 1, Moves.EMBER ],
|
||||||
[ 1, Moves.SMOKESCREEN ],
|
[ 1, Moves.SMOKESCREEN ],
|
||||||
[ 12, Moves.DRAGON_BREATH ],
|
[ 12, Moves.DRAGON_BREATH ],
|
||||||
|
[ 17, Moves.LIFE_DEW],
|
||||||
[ 19, Moves.FIRE_FANG ],
|
[ 19, Moves.FIRE_FANG ],
|
||||||
[ 24, Moves.SLASH ],
|
[ 24, Moves.SLASH ],
|
||||||
[ 30, Moves.FLAMETHROWER ],
|
[ 30, Moves.FLAMETHROWER ],
|
||||||
@ -15487,6 +15491,7 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
|
|||||||
[ 1, Moves.BABY_DOLL_EYES ],
|
[ 1, Moves.BABY_DOLL_EYES ],
|
||||||
[ 5, Moves.ECHOED_VOICE ],
|
[ 5, Moves.ECHOED_VOICE ],
|
||||||
[ 8, Moves.HELPING_HAND ],
|
[ 8, Moves.HELPING_HAND ],
|
||||||
|
[ 10, Moves.PROTECT],
|
||||||
[ 11, Moves.SUPER_FANG ],
|
[ 11, Moves.SUPER_FANG ],
|
||||||
[ 14, Moves.DOUBLE_HIT ],
|
[ 14, Moves.DOUBLE_HIT ],
|
||||||
[ 18, Moves.BULLET_SEED ],
|
[ 18, Moves.BULLET_SEED ],
|
||||||
|
@ -5,6 +5,7 @@ import * as Utils from "../utils";
|
|||||||
import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability";
|
import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability";
|
||||||
import { ProtectAttr } from "./move";
|
import { ProtectAttr } from "./move";
|
||||||
import { BattlerIndex } from "#app/battle.js";
|
import { BattlerIndex } from "#app/battle.js";
|
||||||
|
import { Abilities } from "./enums/abilities";
|
||||||
|
|
||||||
export enum TerrainType {
|
export enum TerrainType {
|
||||||
NONE,
|
NONE,
|
||||||
@ -52,6 +53,13 @@ export class Terrain {
|
|||||||
isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move): boolean {
|
isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move): boolean {
|
||||||
switch (this.terrainType) {
|
switch (this.terrainType) {
|
||||||
case TerrainType.PSYCHIC:
|
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) {
|
if (!move.getAttrs(ProtectAttr).length) {
|
||||||
const priority = new Utils.IntegerHolder(move.priority);
|
const priority = new Utils.IntegerHolder(move.priority);
|
||||||
applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority);
|
applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority);
|
||||||
|
@ -545,8 +545,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getStat(stat: Stat): integer {
|
getStat(stat: Stat): integer {
|
||||||
if (!this.summonData)
|
if (!this.summonData) {
|
||||||
{
|
|
||||||
return this.stats[stat];
|
return this.stats[stat];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1708,8 +1707,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return healAmount;
|
return healAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeSummonStat(stat: Stat, value: integer) : void
|
changeSummonStat(stat: Stat, value: integer) : void {
|
||||||
{
|
|
||||||
this.summonData.stats[stat] = value;
|
this.summonData.stats[stat] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ interface ModifierPool {
|
|||||||
const modifierPool: ModifierPool = {
|
const modifierPool: ModifierPool = {
|
||||||
[ModifierTier.COMMON]: [
|
[ModifierTier.COMMON]: [
|
||||||
new WeightedModifierType(modifierTypes.POKEBALL, 6),
|
new WeightedModifierType(modifierTypes.POKEBALL, 6),
|
||||||
new WeightedModifierType(modifierTypes.RARE_CANDY, 2),
|
new WeightedModifierType(modifierTypes.RARE_CANDY, 9999),
|
||||||
new WeightedModifierType(modifierTypes.POTION, (party: Pokemon[]) => {
|
new WeightedModifierType(modifierTypes.POTION, (party: Pokemon[]) => {
|
||||||
const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 10 || p.getHpRatio() <= 0.875).length, 3);
|
const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 10 || p.getHpRatio() <= 0.875).length, 3);
|
||||||
return thresholdPartyMemberCount * 3;
|
return thresholdPartyMemberCount * 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user