mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
Fix boss immunity and ally fainting
This commit is contained in:
parent
8343426110
commit
678c0de2ec
@ -266,8 +266,8 @@ export class DestinyBondTag extends BattlerTag {
|
||||
/**
|
||||
* Destiny bond tag.
|
||||
* Lapses either before the user's move and does nothing
|
||||
* or after receiving damage. If the damage received from foe
|
||||
* is fatal, it takes down the foe as well.
|
||||
* or after receiving fatal damage. When the damage is fatal,
|
||||
* the attacking Pokemon is taken down as well, unless it's a boss.
|
||||
*
|
||||
* @param {Pokemon} pokemon Pokemon that is attacking the Destiny Bond user.
|
||||
* @param {BattlerTagLapseType} lapseType CUSTOM or PRE_MOVE
|
||||
@ -278,11 +278,23 @@ export class DestinyBondTag extends BattlerTag {
|
||||
return super.lapse(pokemon, lapseType);
|
||||
}
|
||||
const source = pokemon.scene.getPokemonById(this.sourceId);
|
||||
if (source.isFainted()) {
|
||||
const targetMessage = getPokemonMessage(pokemon, '');
|
||||
pokemon.scene.queueMessage(`${getPokemonMessage(source, ` took\n${targetMessage} down with it!`)}`)
|
||||
pokemon.damageAndUpdate(pokemon.hp, HitResult.ONE_HIT_KO, false, false, true);
|
||||
if (!source.isFainted()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (source.getAlly() === pokemon) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const targetMessage = getPokemonMessage(pokemon, '');
|
||||
|
||||
if (pokemon.isBossImmune()) {
|
||||
pokemon.scene.queueMessage(`${targetMessage} is unaffected\nby the effects of Destiny Bond.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
pokemon.scene.queueMessage(`${getPokemonMessage(source, ` took\n${targetMessage} down with it!`)}`)
|
||||
pokemon.damageAndUpdate(pokemon.hp, HitResult.ONE_HIT_KO, false, false, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -4261,14 +4261,9 @@ export class DestinyBondAttr extends MoveEffectAttr {
|
||||
* @param {Pokemon} target N/A
|
||||
* @param {Move} move {@linkcode Move.DESTINY_BOND}
|
||||
* @param {any[]} args N/A
|
||||
* @returns false in boss battle, true otherwise
|
||||
* @returns true
|
||||
*/
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
if (user.scene.getField().some(p => p.isBossImmune())) {
|
||||
user.scene.queueMessage('But it failed!');
|
||||
return false;
|
||||
}
|
||||
|
||||
user.scene.queueMessage(`${getPokemonMessage(user, ' is trying\nto take its foe down with it!')}`);
|
||||
user.addTag(BattlerTagType.DESTINY_BOND, undefined, move.id, user.id);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user