[Featrue] Add Dark-type immunity to Prankster (#2355)

This commit is contained in:
innerthunder 2024-06-18 08:21:54 -07:00 committed by GitHub
parent cf1f958a07
commit 21f1e077fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 7 deletions

View File

@ -278,12 +278,14 @@ export default class Move implements Localizable {
} }
/** /**
* Checks if the move is immune to certain types * Checks if the move is immune to certain types.
* currently only look at case of Grass types and powder moves * Currently looks at cases of Grass types with powder moves and Dark types with moves affected by Prankster.
* @param type {@linkcode Type} enum * @param {Pokemon} user the source of this move
* @param {Pokemon} target the target of this move
* @param {Type} type the type of the move's target
* @returns boolean * @returns boolean
*/ */
isTypeImmune(type: Type): boolean { isTypeImmune(user: Pokemon, target: Pokemon, type: Type): boolean {
if (this.moveTarget === MoveTarget.USER) { if (this.moveTarget === MoveTarget.USER) {
return false; return false;
} }
@ -294,6 +296,11 @@ export default class Move implements Localizable {
return true; return true;
} }
break; break;
case Type.DARK:
if (user.hasAbility(Abilities.PRANKSTER) && this.category === MoveCategory.STATUS && (user.isPlayer() !== target.isPlayer())) {
return true;
}
break;
} }
return false; return false;
} }
@ -4599,7 +4606,7 @@ export class RemoveTypeAttr extends MoveEffectAttr {
export class CopyTypeAttr extends MoveEffectAttr { export class CopyTypeAttr extends MoveEffectAttr {
constructor() { constructor() {
super(true); super(false);
} }
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {

View File

@ -1730,11 +1730,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (typeless) { if (typeless) {
typeMultiplier.value = 1; typeMultiplier.value = 1;
} }
if (types.find(t => move.isTypeImmune(t))) { if (types.find(t => move.isTypeImmune(source, this, t))) {
typeMultiplier.value = 0; typeMultiplier.value = 0;
} }
// Apply arena tags for conditional protection // Apply arena tags for conditional protection
if (!move.checkFlag(MoveFlags.IGNORE_PROTECT, source, this) && !move.isAllyTarget()) { if (!move.checkFlag(MoveFlags.IGNORE_PROTECT, source, this) && !move.isAllyTarget()) {
const defendingSide = this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY; const defendingSide = this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY;