Added a new function for explosion attacks

"explosionDamageFunc"

Added an exception for explosion moves on 2257
phases.ts, probably can be done in a better way.

Removed debugger on settings.ts 154
This commit is contained in:
Tiduzz 2024-05-06 00:13:48 -03:00
parent 3a218eb92b
commit a95051cfe4
3 changed files with 25 additions and 4 deletions

View File

@ -2506,6 +2506,18 @@ const crashDamageFunc = (user: Pokemon, move: Move) => {
return true;
};
const explosionDamageFunc = (user: Pokemon, move: Move) => {
const cancelled = new Utils.BooleanHolder(false);
applyAbAttrs(BlockNonDirectDamageAbAttr, user, cancelled);
if (cancelled.value)
return false;
user.damageAndUpdate(user.hp, HitResult.OTHER, false, true);
user.turnData.damageTaken += user.hp;
return true;
};
export class TypelessAttr extends MoveAttr { }
export class DisableMoveAttr extends MoveEffectAttr {
@ -4229,7 +4241,9 @@ export function initMoves() {
.attr(SacrificialAttr)
.makesContact(false)
.condition(failIfDampCondition)
.target(MoveTarget.ALL_NEAR_OTHERS),
.target(MoveTarget.ALL_NEAR_OTHERS)
.attr(MissEffectAttr, explosionDamageFunc)
.attr(NoEffectAttr, explosionDamageFunc),
new AttackMove(Moves.EGG_BOMB, Type.NORMAL, MoveCategory.PHYSICAL, 100, 75, 10, -1, 0, 1)
.makesContact(false)
.ballBombMove(),
@ -4320,7 +4334,9 @@ export function initMoves() {
.condition(failIfDampCondition)
.attr(SacrificialAttr)
.makesContact(false)
.target(MoveTarget.ALL_NEAR_OTHERS),
.target(MoveTarget.ALL_NEAR_OTHERS)
.attr(MissEffectAttr, explosionDamageFunc)
.attr(NoEffectAttr, explosionDamageFunc),
new AttackMove(Moves.FURY_SWIPES, Type.NORMAL, MoveCategory.PHYSICAL, 18, 80, 15, -1, 0, 1)
.attr(MultiHitAttr),
new AttackMove(Moves.BONEMERANG, Type.GROUND, MoveCategory.PHYSICAL, 50, 90, 10, -1, 0, 1)
@ -6090,7 +6106,9 @@ export function initMoves() {
.attr(SacrificialAttr)
.target(MoveTarget.ALL_NEAR_OTHERS)
.attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.MISTY && user.isGrounded() ? 1.5 : 1)
.condition(failIfDampCondition),
.condition(failIfDampCondition)
.attr(MissEffectAttr, explosionDamageFunc)
.attr(NoEffectAttr, explosionDamageFunc),
new AttackMove(Moves.GRASSY_GLIDE, Type.GRASS, MoveCategory.PHYSICAL, 55, 100, 20, -1, 0, 8)
.partial(),
new AttackMove(Moves.RISING_VOLTAGE, Type.ELECTRIC, MoveCategory.SPECIAL, 70, 100, 20, -1, 0, 8)

View File

@ -2254,8 +2254,11 @@ export class MovePhase extends BattlePhase {
if ((moveQueue.length && moveQueue[0].move === Moves.NONE) || !targets.length) {
moveQueue.shift();
if (this.move.moveId === 153 || this.move.moveId === 120 || this.move.moveId === 802){ //Currently all explosions, AKA, kamikaze-attacks. There might be a better way to do it except to hardcode it, but i haven't found how yet.
} else {
this.cancel();
}
}
if (this.cancelled) {
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });

View File

@ -151,7 +151,7 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
case Setting.Gamepad_Support:
scene.gamepadSupport = settingOptions[setting][value] !== 'Disabled';
break;
case Setting.Swap_A_and_B:debugger;
case Setting.Swap_A_and_B:
scene.setGamepadConfirm(settingOptions[setting][value] !== 'Enabled');
break;
case Setting.Touch_Controls: