Implemented Disguise

Somehow it works.
This commit is contained in:
NxKarim 2024-04-17 02:59:25 -06:00
parent b116828b07
commit 7a6307d200
5 changed files with 160 additions and 76 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

View File

@ -4923,6 +4923,48 @@
"h": 22
}
},
{
"filename": "778-busted",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 40,
"h": 30
},
"spriteSourceSize": {
"x": 13,
"y": 5,
"w": 17,
"h": 22
},
"frame": {
"x": 156,
"y": 443,
"w": 17,
"h": 22
}
},
{
"filename": "778s-busted",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 40,
"h": 30
},
"spriteSourceSize": {
"x": 13,
"y": 5,
"w": 17,
"h": 22
},
"frame": {
"x": 217,
"y": 367,
"w": 17,
"h": 22
}
},
{
"filename": "741s-pompom",
"rotated": false,

View File

@ -235,7 +235,7 @@ export class StabBoostAbAttr extends AbAttr {
}
export class ReceivedMoveDamageMultiplierAbAttr extends PreDefendAbAttr {
private condition: PokemonDefendCondition;
protected condition: PokemonDefendCondition;
private powerMultiplier: number;
constructor(condition: PokemonDefendCondition, powerMultiplier: number) {
@ -261,6 +261,21 @@ export class ReceivedTypeDamageMultiplierAbAttr extends ReceivedMoveDamageMultip
}
}
export class SetMovePowerToOneAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
constructor(condition: PokemonDefendCondition) {
super(condition, 1);
}
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (this.condition(pokemon, attacker, move.getMove())) {
(args[0] as Utils.NumberHolder).value = 0.001;
return true;
}
return false;
}
}
export class TypeImmunityAbAttr extends PreDefendAbAttr {
private immuneType: Type;
private condition: AbAttrCondition;
@ -386,6 +401,26 @@ export class PostDefendAbAttr extends AbAttr {
}
}
export class PostDefendDisguiseAbAttr extends PostDefendAbAttr {
constructor(damageRatio?: number) {
super(true);
}
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (pokemon.formIndex == 0 && pokemon.battleData.hitCount != 0 && (move.getMove().category == MoveCategory.SPECIAL || move.getMove().category == MoveCategory.PHYSICAL)) {
const recoilDamage = Math.ceil((pokemon.getMaxHp() / 8) - attacker.turnData.damageDealt);
if (!recoilDamage)
return false;
pokemon.damageAndUpdate(recoilDamage, HitResult.OTHER);
pokemon.scene.queueMessage(getPokemonMessage(pokemon, '\'s disguise was busted!'));
return true;
}
return false;
}
}
export class FieldPriorityMoveImmunityAbAttr extends PreDefendAbAttr {
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean {
const attackPriority = new Utils.IntegerHolder(move.getMove().priority);
@ -2669,7 +2704,10 @@ export function initAbilities() {
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr),
new Ability(Abilities.DISGUISE, "Disguise (N)", "Once per battle, the shroud that covers the Pokémon can protect it from an attack.", 7)
new Ability(Abilities.DISGUISE, "Disguise (T)", "Once per battle, the shroud that covers the Pokémon can protect it from an attack.", 7)
.attr(SetMovePowerToOneAbAttr, (target, user, move) => target.formIndex == 0)
.attr(PostTurnFormChangeAbAttr, pokemon => pokemon.battleData.hitCount === 0 ? 0 : 1)
.attr(PostDefendDisguiseAbAttr)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)

View File

@ -565,6 +565,10 @@ export const pokemonFormChanges: PokemonFormChanges = {
new SpeciesFormChange(Species.MINIOR, 'violet-meteor', 'violet', new SpeciesFormChangeManualTrigger(), true),
new SpeciesFormChange(Species.MINIOR, 'violet', 'violet-meteor', new SpeciesFormChangeManualTrigger(), true)
],
[Species.MIMIKYU]: [
new SpeciesFormChange(Species.MIMIKYU, 'disguised', 'busted', new SpeciesFormChangeManualTrigger(), true),
new SpeciesFormChange(Species.MIMIKYU, 'busted', 'disquised', new SpeciesFormChangeManualTrigger(), true)
],
[Species.NECROZMA]: [
new SpeciesFormChange(Species.NECROZMA, '', 'dawn-wings', new SpeciesFormChangeItemTrigger(FormChangeItem.N_LUNARIZER)),
new SpeciesFormChange(Species.NECROZMA, '', 'dusk-mane', new SpeciesFormChangeItemTrigger(FormChangeItem.N_SOLARIZER))