[Misc] Enemy item override will now apply to all enemies (#4620)
* Enemy item override will now apply to all enemies * Update tsdocs
This commit is contained in:
parent
3f63c147a3
commit
407cd65dcb
|
@ -2676,7 +2676,7 @@ export default class BattleScene extends SceneBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all modifiers from enemy of PersistentModifier type
|
* Removes all modifiers from enemy pokemon of {@linkcode PersistentModifier} type
|
||||||
*/
|
*/
|
||||||
clearEnemyModifiers(): void {
|
clearEnemyModifiers(): void {
|
||||||
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PersistentModifier);
|
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PersistentModifier);
|
||||||
|
@ -2687,10 +2687,11 @@ export default class BattleScene extends SceneBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all modifiers from enemy of PokemonHeldItemModifier type
|
* Removes all modifiers from enemy pokemon of {@linkcode PokemonHeldItemModifier} type
|
||||||
|
* @param pokemon - If specified, only removes held items from that {@linkcode Pokemon}
|
||||||
*/
|
*/
|
||||||
clearEnemyHeldItemModifiers(): void {
|
clearEnemyHeldItemModifiers(pokemon?: Pokemon): void {
|
||||||
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PokemonHeldItemModifier);
|
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PokemonHeldItemModifier && (!pokemon || m.getPokemon(this) === pokemon));
|
||||||
for (const m of modifiersToRemove) {
|
for (const m of modifiersToRemove) {
|
||||||
this.enemyModifiers.splice(this.enemyModifiers.indexOf(m), 1);
|
this.enemyModifiers.splice(this.enemyModifiers.indexOf(m), 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3635,7 +3635,7 @@ export function overrideHeldItems(scene: BattleScene, pokemon: Pokemon, isPlayer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPlayer) {
|
if (!isPlayer) {
|
||||||
scene.clearEnemyHeldItemModifiers();
|
scene.clearEnemyHeldItemModifiers(pokemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
heldItemsOverride.forEach(item => {
|
heldItemsOverride.forEach(item => {
|
||||||
|
|
Loading…
Reference in New Issue