mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-23 15:59:26 +02:00
Changed function names
This commit is contained in:
parent
6114bb216f
commit
da75260e0a
@ -77,7 +77,7 @@ export abstract class ArenaTag {
|
|||||||
* @param scene medium to retrieve the source Pokemon
|
* @param scene medium to retrieve the source Pokemon
|
||||||
* @returns The source {@linkcode Pokemon} or `null` if none is found
|
* @returns The source {@linkcode Pokemon} or `null` if none is found
|
||||||
*/
|
*/
|
||||||
public retrieveSource(scene: BattleScene): Pokemon | null {
|
getSourcePokemon(scene: BattleScene): Pokemon | null {
|
||||||
return this.sourceId ? scene.getPokemonById(this.sourceId) : null;
|
return this.sourceId ? scene.getPokemonById(this.sourceId) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ export abstract class ArenaTag {
|
|||||||
* @param scene - medium to retrieve the involved Pokemon
|
* @param scene - medium to retrieve the involved Pokemon
|
||||||
* @returns list of PlayerPokemon or EnemyPokemon on the field
|
* @returns list of PlayerPokemon or EnemyPokemon on the field
|
||||||
*/
|
*/
|
||||||
public retrieveField(scene: BattleScene): Pokemon[] {
|
getAffectedPokemon(scene: BattleScene): Pokemon[] {
|
||||||
switch (this.side) {
|
switch (this.side) {
|
||||||
case ArenaTagSide.PLAYER:
|
case ArenaTagSide.PLAYER:
|
||||||
return scene.getPlayerField() ?? [];
|
return scene.getPlayerField() ?? [];
|
||||||
@ -1012,10 +1012,10 @@ class ImprisonTag extends ArenaTrapTag {
|
|||||||
* @param arena
|
* @param arena
|
||||||
*/
|
*/
|
||||||
override onAdd({ scene }: Arena) {
|
override onAdd({ scene }: Arena) {
|
||||||
const source = this.retrieveSource(scene);
|
const source = this.getSourcePokemon(scene);
|
||||||
if (source) {
|
if (source) {
|
||||||
const party = this.retrieveField(scene);
|
const party = this.getAffectedPokemon(scene);
|
||||||
party?.forEach((p: Pokemon) => {
|
party?.forEach((p: Pokemon ) => {
|
||||||
if (p.isAllowedInBattle()) {
|
if (p.isAllowedInBattle()) {
|
||||||
p.addTag(BattlerTagType.IMPRISON, 1, Moves.IMPRISON, this.sourceId);
|
p.addTag(BattlerTagType.IMPRISON, 1, Moves.IMPRISON, this.sourceId);
|
||||||
}
|
}
|
||||||
@ -1030,7 +1030,7 @@ class ImprisonTag extends ArenaTrapTag {
|
|||||||
* @returns `true` if the source of the tag is still active on the field | `false` if not
|
* @returns `true` if the source of the tag is still active on the field | `false` if not
|
||||||
*/
|
*/
|
||||||
override lapse({ scene }: Arena): boolean {
|
override lapse({ scene }: Arena): boolean {
|
||||||
const source = this.retrieveSource(scene);
|
const source = this.getSourcePokemon(scene);
|
||||||
return source ? source.isActive(true) : false;
|
return source ? source.isActive(true) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1040,7 +1040,7 @@ class ImprisonTag extends ArenaTrapTag {
|
|||||||
* @returns `true`
|
* @returns `true`
|
||||||
*/
|
*/
|
||||||
override activateTrap(pokemon: Pokemon): boolean {
|
override activateTrap(pokemon: Pokemon): boolean {
|
||||||
const source = this.retrieveSource(pokemon.scene);
|
const source = this.getSourcePokemon(pokemon.scene);
|
||||||
if (source && source.isActive(true) && pokemon.isAllowedInBattle()) {
|
if (source && source.isActive(true) && pokemon.isAllowedInBattle()) {
|
||||||
pokemon.addTag(BattlerTagType.IMPRISON, 1, Moves.IMPRISON, this.sourceId);
|
pokemon.addTag(BattlerTagType.IMPRISON, 1, Moves.IMPRISON, this.sourceId);
|
||||||
}
|
}
|
||||||
@ -1052,7 +1052,7 @@ class ImprisonTag extends ArenaTrapTag {
|
|||||||
* @param arena
|
* @param arena
|
||||||
*/
|
*/
|
||||||
override onRemove({ scene }: Arena): void {
|
override onRemove({ scene }: Arena): void {
|
||||||
const party = this.retrieveField(scene);
|
const party = this.getAffectedPokemon(scene);
|
||||||
party?.forEach((p: Pokemon) => {
|
party?.forEach((p: Pokemon) => {
|
||||||
p.removeTag(BattlerTagType.IMPRISON);
|
p.removeTag(BattlerTagType.IMPRISON);
|
||||||
});
|
});
|
||||||
|
@ -97,7 +97,7 @@ export class BattlerTag {
|
|||||||
* @param scene medium to retrieve the source Pokemon
|
* @param scene medium to retrieve the source Pokemon
|
||||||
* @returns The source {@linkcode Pokemon} or `null` if none is found
|
* @returns The source {@linkcode Pokemon} or `null` if none is found
|
||||||
*/
|
*/
|
||||||
public retrieveSource(scene: BattleScene): Pokemon | null {
|
getSourcePokemon(scene: BattleScene): Pokemon | null {
|
||||||
return this.sourceId ? scene.getPokemonById(this.sourceId) : null;
|
return this.sourceId ? scene.getPokemonById(this.sourceId) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2625,7 +2625,7 @@ export class ImprisonTag extends MoveRestrictionBattlerTag {
|
|||||||
* @returns `true` if the source is still active
|
* @returns `true` if the source is still active
|
||||||
*/
|
*/
|
||||||
public override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
public override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
const source = this.retrieveSource(pokemon.scene);
|
const source = this.getSourcePokemon(pokemon.scene);
|
||||||
if (source) {
|
if (source) {
|
||||||
if (lapseType === BattlerTagLapseType.PRE_MOVE) {
|
if (lapseType === BattlerTagLapseType.PRE_MOVE) {
|
||||||
return super.lapse(pokemon, lapseType) && source.isActive(true);
|
return super.lapse(pokemon, lapseType) && source.isActive(true);
|
||||||
@ -2643,7 +2643,7 @@ export class ImprisonTag extends MoveRestrictionBattlerTag {
|
|||||||
* @returns `false` if either condition is not met
|
* @returns `false` if either condition is not met
|
||||||
*/
|
*/
|
||||||
public override isMoveRestricted(move: Moves, user: Pokemon): boolean {
|
public override isMoveRestricted(move: Moves, user: Pokemon): boolean {
|
||||||
const source = this.retrieveSource(user.scene);
|
const source = this.getSourcePokemon(user.scene);
|
||||||
if (source) {
|
if (source) {
|
||||||
const sourceMoveset = source.getMoveset().map(m => m!.moveId);
|
const sourceMoveset = source.getMoveset().map(m => m!.moveId);
|
||||||
return sourceMoveset?.includes(move) && source.isActive(true);
|
return sourceMoveset?.includes(move) && source.isActive(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user