mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Apply suggestions from code review
Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
This commit is contained in:
parent
266f9e9066
commit
c20aa9f10d
@ -2996,7 +2996,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param ignoreFaintPhase boolean to ignore adding a FaintPhase, passsed to damage()
|
||||
* @returns integer of damage done
|
||||
*/
|
||||
damageAndUpdate(damage: number, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon, move?: Move): number {
|
||||
damageAndUpdate(damage: number, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon): number {
|
||||
const damagePhase = new DamageAnimPhase(this.scene, this.getBattlerIndex(), damage, result as DamageResult, critical);
|
||||
this.scene.unshiftPhase(damagePhase);
|
||||
damage = this.damage(damage, ignoreSegments, preventEndure, ignoreFaintPhase);
|
||||
@ -3006,8 +3006,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* Run PostDamageAbAttr from any source of damage that is not from a multi-hit
|
||||
* Multi-hits are handled in move-effect-phase.ts for PostDamageAbAttr
|
||||
*/
|
||||
const multiHitModifier = source?.getHeldItems().find(m => m instanceof PokemonMultiHitModifier);
|
||||
if (!multiHitModifier && !source?.hasAbilityWithAttr(AddSecondStrikeAbAttr) && !move?.hasAttr(MultiHitAttr)) {
|
||||
if (source.turnData.hitCount <= 1) {
|
||||
applyPostDamageAbAttrs(PostDamageAbAttr, this, damage, this.hasPassive(), false, [], source);
|
||||
}
|
||||
return damage;
|
||||
|
@ -306,13 +306,10 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||
* Multi-Lens, Multi Hit move and Parental Bond check for PostDamageAbAttr
|
||||
* other damage source are calculated in damageAndUpdate in pokemon.ts
|
||||
*/
|
||||
if (target.hasAbilityWithAttr(PostDamageForceSwitchAbAttr)) {
|
||||
const multiHitModifier = user.getHeldItems().find(m => m instanceof PokemonMultiHitModifier);
|
||||
if (multiHitModifier || user.hasAbilityWithAttr(AddSecondStrikeAbAttr) || move.hasAttr(MultiHitAttr)) {
|
||||
if (user.turnData.hitCount > 1) {
|
||||
applyPostDamageAbAttrs(PostDamageAbAttr, target, 0, target.hasPassive(), false, [], user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Promise that applys *all* effects from the invoked move's MoveEffectAttrs.
|
||||
|
Loading…
Reference in New Issue
Block a user