Added TSDoc Documentation

Added documentation to the new IgnoreTypeStatusEffectImunnityAbAttr and added comments to the checks for this ability attribute.
This commit is contained in:
Dread134 2024-05-12 14:15:04 -04:00
parent 00a4cfee36
commit d3b1804f2e
2 changed files with 10 additions and 3 deletions

View File

@ -2562,6 +2562,9 @@ export class IgnoreTypeImmunityAbAttr extends AbAttr {
}
}
/**
* Ignores the type immunity to Status Effects of the defender if the defender is of a certain type
*/
export class IgnoreTypeStatusEffectImmunityAbAttr extends AbAttr {
statusEffect: StatusEffect[];
defenderType: Type[];

View File

@ -2000,12 +2000,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
switch (effect) {
case StatusEffect.POISON:
case StatusEffect.TOXIC:
// Check if the Pokemon is immune to Poison/Toxic or if the source pokemon is canceling the immunity
let poisonImmunity = types.map(defType => {
const cancelImmunity = new Utils.BooleanHolder(false);
if (defType !== Type.POISON && defType !== Type.STEEL) {
return false;
}
// Check if the Pokemon is not immune to Poison/Toxic
if (defType !== Type.POISON && defType !== Type.STEEL)
return false;
// Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity
if (source) {
applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, source, cancelImmunity, effect, defType);
if (cancelImmunity.value)
@ -2017,6 +2020,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return true;
}
})
if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)){
if (poisonImmunity.includes(true))
return false;