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()
|
* @param ignoreFaintPhase boolean to ignore adding a FaintPhase, passsed to damage()
|
||||||
* @returns integer of damage done
|
* @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);
|
const damagePhase = new DamageAnimPhase(this.scene, this.getBattlerIndex(), damage, result as DamageResult, critical);
|
||||||
this.scene.unshiftPhase(damagePhase);
|
this.scene.unshiftPhase(damagePhase);
|
||||||
damage = this.damage(damage, ignoreSegments, preventEndure, ignoreFaintPhase);
|
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
|
* 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
|
* Multi-hits are handled in move-effect-phase.ts for PostDamageAbAttr
|
||||||
*/
|
*/
|
||||||
const multiHitModifier = source?.getHeldItems().find(m => m instanceof PokemonMultiHitModifier);
|
if (source.turnData.hitCount <= 1) {
|
||||||
if (!multiHitModifier && !source?.hasAbilityWithAttr(AddSecondStrikeAbAttr) && !move?.hasAttr(MultiHitAttr)) {
|
|
||||||
applyPostDamageAbAttrs(PostDamageAbAttr, this, damage, this.hasPassive(), false, [], source);
|
applyPostDamageAbAttrs(PostDamageAbAttr, this, damage, this.hasPassive(), false, [], source);
|
||||||
}
|
}
|
||||||
return damage;
|
return damage;
|
||||||
|
@ -306,11 +306,8 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
* Multi-Lens, Multi Hit move and Parental Bond check for PostDamageAbAttr
|
* Multi-Lens, Multi Hit move and Parental Bond check for PostDamageAbAttr
|
||||||
* other damage source are calculated in damageAndUpdate in pokemon.ts
|
* other damage source are calculated in damageAndUpdate in pokemon.ts
|
||||||
*/
|
*/
|
||||||
if (target.hasAbilityWithAttr(PostDamageForceSwitchAbAttr)) {
|
if (user.turnData.hitCount > 1) {
|
||||||
const multiHitModifier = user.getHeldItems().find(m => m instanceof PokemonMultiHitModifier);
|
applyPostDamageAbAttrs(PostDamageAbAttr, target, 0, target.hasPassive(), false, [], user);
|
||||||
if (multiHitModifier || user.hasAbilityWithAttr(AddSecondStrikeAbAttr) || move.hasAttr(MultiHitAttr)) {
|
|
||||||
applyPostDamageAbAttrs(PostDamageAbAttr, target, 0, target.hasPassive(), false, [], user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user