mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
Tweak Faint Cry in Permanent Faint
This commit is contained in:
parent
37ff766d3e
commit
a0e08ec954
@ -4558,8 +4558,17 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const key = this.species.getCryKey(this.formIndex);
|
const key = this.species.getCryKey(this.formIndex);
|
||||||
let rate = 0.85;
|
const crySoundConfig = { rate: 0.85, detune: 0 };
|
||||||
const cry = globalScene.playSound(key, { rate: rate }) as AnySound;
|
if (this.isPlayer()) {
|
||||||
|
// If fainting is permanent, emphasize impact
|
||||||
|
const preventRevive = new BooleanHolder(false);
|
||||||
|
applyChallenges(ChallengeType.PREVENT_REVIVE, preventRevive);
|
||||||
|
if (preventRevive.value) {
|
||||||
|
crySoundConfig.detune = -100;
|
||||||
|
crySoundConfig.rate = 0.7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const cry = globalScene.playSound(key, crySoundConfig) as AnySound;
|
||||||
if (!cry || globalScene.fieldVolume === 0) {
|
if (!cry || globalScene.fieldVolume === 0) {
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
@ -4578,7 +4587,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
delay: fixedInt(delay),
|
delay: fixedInt(delay),
|
||||||
repeat: -1,
|
repeat: -1,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
frameThreshold = sprite.anims.msPerFrame / rate;
|
frameThreshold = sprite.anims.msPerFrame / crySoundConfig.rate;
|
||||||
frameProgress += delay;
|
frameProgress += delay;
|
||||||
while (frameProgress > frameThreshold) {
|
while (frameProgress > frameThreshold) {
|
||||||
if (sprite.anims.duration) {
|
if (sprite.anims.duration) {
|
||||||
@ -4588,8 +4597,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
frameProgress -= frameThreshold;
|
frameProgress -= frameThreshold;
|
||||||
}
|
}
|
||||||
if (cry && !cry.pendingRemove) {
|
if (cry && !cry.pendingRemove) {
|
||||||
rate *= 0.99;
|
cry.setRate(crySoundConfig.rate * 0.99);
|
||||||
cry.setRate(rate);
|
|
||||||
} else {
|
} else {
|
||||||
faintCryTimer?.destroy();
|
faintCryTimer?.destroy();
|
||||||
faintCryTimer = null;
|
faintCryTimer = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user