mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 05:12:19 +02:00
Update pokemon.ts
Moved where PRE_APPLY was being triggered so if the defender is Type immune, then it does not apply the move attribute.
This commit is contained in:
parent
c2c81af1a9
commit
0f55640bd6
@ -1467,8 +1467,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (cancelled.value)
|
if (cancelled.value)
|
||||||
result = HitResult.NO_EFFECT;
|
result = HitResult.NO_EFFECT;
|
||||||
else {
|
else {
|
||||||
applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.PRE_APPLY && (!attr.firstHitOnly || firstHit), source, this, moveEffectPhase.move.getMove())
|
|
||||||
|
|
||||||
let typeBoost = source.findTag(t => t instanceof TypeBoostTag && (t as TypeBoostTag).boostedType === type) as TypeBoostTag;
|
let typeBoost = source.findTag(t => t instanceof TypeBoostTag && (t as TypeBoostTag).boostedType === type) as TypeBoostTag;
|
||||||
if (typeBoost) {
|
if (typeBoost) {
|
||||||
power.value *= typeBoost.boostValue;
|
power.value *= typeBoost.boostValue;
|
||||||
@ -1478,6 +1476,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
const arenaAttackTypeMultiplier = new Utils.NumberHolder(this.scene.arena.getAttackTypeMultiplier(type, source.isGrounded()));
|
const arenaAttackTypeMultiplier = new Utils.NumberHolder(this.scene.arena.getAttackTypeMultiplier(type, source.isGrounded()));
|
||||||
applyMoveAttrs(IgnoreWeatherTypeDebuffAttr, source, this, move, arenaAttackTypeMultiplier);
|
applyMoveAttrs(IgnoreWeatherTypeDebuffAttr, source, this, move, arenaAttackTypeMultiplier);
|
||||||
|
const isTypeImmune = (typeMultiplier.value * arenaAttackTypeMultiplier.value) === 0;
|
||||||
|
|
||||||
|
if (!isTypeImmune) {
|
||||||
|
applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.PRE_APPLY && (!attr.firstHitOnly || firstHit), source, this, moveEffectPhase.move.getMove());
|
||||||
|
}
|
||||||
|
|
||||||
if (this.scene.arena.getTerrainType() === TerrainType.GRASSY && this.isGrounded() && type === Type.GROUND && move.moveTarget === MoveTarget.ALL_NEAR_OTHERS)
|
if (this.scene.arena.getTerrainType() === TerrainType.GRASSY && this.isGrounded() && type === Type.GROUND && move.moveTarget === MoveTarget.ALL_NEAR_OTHERS)
|
||||||
power.value /= 2;
|
power.value /= 2;
|
||||||
applyMoveAttrs(VariablePowerAttr, source, this, move, power);
|
applyMoveAttrs(VariablePowerAttr, source, this, move, power);
|
||||||
@ -1522,7 +1526,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (!isCritical) {
|
if (!isCritical) {
|
||||||
this.scene.arena.applyTagsForSide(WeakenMoveScreenTag, this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, move.category, this.scene.currentBattle.double, screenMultiplier);
|
this.scene.arena.applyTagsForSide(WeakenMoveScreenTag, this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, move.category, this.scene.currentBattle.double, screenMultiplier);
|
||||||
}
|
}
|
||||||
const isTypeImmune = (typeMultiplier.value * arenaAttackTypeMultiplier.value) === 0;
|
|
||||||
const sourceTypes = source.getTypes();
|
const sourceTypes = source.getTypes();
|
||||||
const matchesSourceType = sourceTypes[0] === type || (sourceTypes.length > 1 && sourceTypes[1] === type);
|
const matchesSourceType = sourceTypes[0] === type || (sourceTypes.length > 1 && sourceTypes[1] === type);
|
||||||
let stabMultiplier = new Utils.NumberHolder(1);
|
let stabMultiplier = new Utils.NumberHolder(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user