mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 13:59:27 +02:00
Adjust some documentation for new methods
This commit is contained in:
parent
d74a70a529
commit
55b8429787
@ -93,6 +93,7 @@ import { toCamelCase, toTitleCase } from "#utils/strings";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { applyChallenges } from "#utils/challenge-utils";
|
import { applyChallenges } from "#utils/challenge-utils";
|
||||||
import { ConsecutiveUseRestriction, counterAttackCondition_Both, counterAttackCondition_Physical, counterAttackCondition_Special, failAgainstFinalBossCondition, FailIfInsufficientHpCondition, failIfTargetNotAttackingCondition, failTeleportCondition, FirstMoveCondition, GravityUseRestriction, lastResortCondition, MoveCondition, MoveRestriction, UpperHandCondition } from "#moves/move-condition";
|
import { ConsecutiveUseRestriction, counterAttackCondition_Both, counterAttackCondition_Physical, counterAttackCondition_Special, failAgainstFinalBossCondition, FailIfInsufficientHpCondition, failIfTargetNotAttackingCondition, failTeleportCondition, FirstMoveCondition, GravityUseRestriction, lastResortCondition, MoveCondition, MoveRestriction, UpperHandCondition } from "#moves/move-condition";
|
||||||
|
import { areAllies } from "#utils/pokemon-utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function used to conditionally determine execution of a given {@linkcode MoveAttr}.
|
* A function used to conditionally determine execution of a given {@linkcode MoveAttr}.
|
||||||
@ -1810,15 +1811,22 @@ export class CounterDamageAttr extends FixedDamageAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
user.turnData.attacksReceived.find(ar => {
|
||||||
|
const category = allMoves[ar.move].category;
|
||||||
|
return (category !== MoveCategory.STATUS || areAllies(user.getBattlerIndex(), ar.sourceBattlerIndex))
|
||||||
|
})
|
||||||
let damage = 0;
|
let damage = 0;
|
||||||
|
const userBattlerIndex = user.getBattlerIndex();
|
||||||
for (const ar of user.turnData.attacksReceived) {
|
for (const ar of user.turnData.attacksReceived) {
|
||||||
// TODO: Adjust this for moves with variable damage categories
|
// TODO: Adjust this for moves with variable damage categories
|
||||||
const category = allMoves[ar.move].category;
|
const category = allMoves[ar.move].category;
|
||||||
if (category === MoveCategory.STATUS || (this.moveFilter && category !== this.moveFilter)) {
|
if (category === MoveCategory.STATUS
|
||||||
|
|| areAllies(userBattlerIndex, ar.sourceBattlerIndex)
|
||||||
|
|| (this.moveFilter && category !== this.moveFilter)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
damage += ar.damage;
|
damage = ar.damage;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
(args[0] as NumberHolder).value = toDmgValue(damage * this.multiplier);
|
(args[0] as NumberHolder).value = toDmgValue(damage * this.multiplier);
|
||||||
|
|
||||||
@ -1858,7 +1866,6 @@ export class CounterRedirectAttr extends MoveAttr {
|
|||||||
} else {
|
} else {
|
||||||
args[0].value = desiredTarget;
|
args[0].value = desiredTarget;
|
||||||
}
|
}
|
||||||
console.log(`CounterRedirectAttr: Redirecting move to battler index ${BattlerIndex[args[0].value]}`);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -4,6 +4,8 @@ import { allSpecies } from "#data/data-lists";
|
|||||||
import type { PokemonSpecies, PokemonSpeciesForm } from "#data/pokemon-species";
|
import type { PokemonSpecies, PokemonSpeciesForm } from "#data/pokemon-species";
|
||||||
import { BattlerIndex } from "#enums/battler-index";
|
import { BattlerIndex } from "#enums/battler-index";
|
||||||
import type { SpeciesId } from "#enums/species-id";
|
import type { SpeciesId } from "#enums/species-id";
|
||||||
|
// biome-ignore lint/correctness/noUnusedImports: Used in a TSDoc comment
|
||||||
|
import type { Pokemon } from "#field/pokemon";
|
||||||
import { randSeedItem } from "./common";
|
import { randSeedItem } from "./common";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +128,8 @@ export function getPokemonSpeciesForm(species: SpeciesId, formIndex: number): Po
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether two battler indices are allies
|
* Return whether two battler indices are considered allies.
|
||||||
|
* To instead check with {@linkcode Pokemon} objects, use {@linkcode Pokemon.isOpponent}.
|
||||||
* @param a - First battler index
|
* @param a - First battler index
|
||||||
* @param b - Second battler index
|
* @param b - Second battler index
|
||||||
* @returns Whether the two battler indices are allies. Always `false` if either index is `ATTACKER`.
|
* @returns Whether the two battler indices are allies. Always `false` if either index is `ATTACKER`.
|
||||||
|
Loading…
Reference in New Issue
Block a user