mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
Implementation of Destiny Bond
This commit is contained in:
parent
d1fc149458
commit
bedd5f3492
@ -254,6 +254,25 @@ export class ConfusedTag extends BattlerTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class DestinyBondTag extends BattlerTag {
|
||||||
|
constructor(sourceMove: Moves, sourceId: integer) {
|
||||||
|
super(BattlerTagType.DESTINY_BOND, BattlerTagLapseType.PRE_MOVE, 1, sourceMove, sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
|
if (lapseType !== BattlerTagLapseType.CUSTOM) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class InfatuatedTag extends BattlerTag {
|
export class InfatuatedTag extends BattlerTag {
|
||||||
constructor(sourceMove: integer, sourceId: integer) {
|
constructor(sourceMove: integer, sourceId: integer) {
|
||||||
super(BattlerTagType.INFATUATED, BattlerTagLapseType.MOVE, 1, sourceMove, sourceId);
|
super(BattlerTagType.INFATUATED, BattlerTagLapseType.MOVE, 1, sourceMove, sourceId);
|
||||||
@ -1405,6 +1424,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||||||
return new MagnetRisenTag(tagType, sourceMove);
|
return new MagnetRisenTag(tagType, sourceMove);
|
||||||
case BattlerTagType.MINIMIZED:
|
case BattlerTagType.MINIMIZED:
|
||||||
return new MinimizeTag();
|
return new MinimizeTag();
|
||||||
|
case BattlerTagType.DESTINY_BOND:
|
||||||
|
return new DestinyBondTag(sourceMove, sourceId);
|
||||||
case BattlerTagType.NONE:
|
case BattlerTagType.NONE:
|
||||||
default:
|
default:
|
||||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||||
|
@ -56,5 +56,6 @@ export enum BattlerTagType {
|
|||||||
CHARGED = "CHARGED",
|
CHARGED = "CHARGED",
|
||||||
GROUNDED = "GROUNDED",
|
GROUNDED = "GROUNDED",
|
||||||
MAGNET_RISEN = "MAGNET_RISEN",
|
MAGNET_RISEN = "MAGNET_RISEN",
|
||||||
MINIMIZED = "MINIMIZED"
|
MINIMIZED = "MINIMIZED",
|
||||||
|
DESTINY_BOND = "DESTINY_BOND"
|
||||||
}
|
}
|
||||||
|
@ -4250,6 +4250,18 @@ export class MoneyAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class DestinyBondAttr extends MoveEffectAttr {
|
||||||
|
constructor() {
|
||||||
|
super(true, MoveEffectTrigger.PRE_APPLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
user.scene.queueMessage(`${getPokemonMessage(user, ' is trying\nto take its foe down with it!')}`);
|
||||||
|
target.addTag(BattlerTagType.DESTINY_BOND, undefined, move.id, user.id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class LastResortAttr extends MoveAttr {
|
export class LastResortAttr extends MoveAttr {
|
||||||
getCondition(): MoveConditionFunc {
|
getCondition(): MoveConditionFunc {
|
||||||
return (user: Pokemon, target: Pokemon, move: Move) => {
|
return (user: Pokemon, target: Pokemon, move: Move) => {
|
||||||
@ -4944,8 +4956,8 @@ export function initMoves() {
|
|||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
new SelfStatusMove(Moves.DESTINY_BOND, Type.GHOST, -1, 5, -1, 0, 2)
|
new SelfStatusMove(Moves.DESTINY_BOND, Type.GHOST, -1, 5, -1, 0, 2)
|
||||||
.ignoresProtect()
|
.ignoresProtect()
|
||||||
.condition(failOnBossCondition)
|
.attr(DestinyBondAttr)
|
||||||
.unimplemented(),
|
.condition(failOnBossCondition),
|
||||||
new StatusMove(Moves.PERISH_SONG, Type.NORMAL, -1, 5, -1, 0, 2)
|
new StatusMove(Moves.PERISH_SONG, Type.NORMAL, -1, 5, -1, 0, 2)
|
||||||
.attr(FaintCountdownAttr)
|
.attr(FaintCountdownAttr)
|
||||||
.ignoresProtect()
|
.ignoresProtect()
|
||||||
|
@ -1610,6 +1610,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
console.log('damage', damage.value, move.name, power.value, sourceAtk, targetDef);
|
console.log('damage', damage.value, move.name, power.value, sourceAtk, targetDef);
|
||||||
|
|
||||||
|
// In case of fatal damage, this tag would have gotten cleared before we could lapse it.
|
||||||
|
const destinyTag = this.getTag(BattlerTagType.DESTINY_BOND);
|
||||||
|
|
||||||
if (damage.value) {
|
if (damage.value) {
|
||||||
if (this.getHpRatio() === 1)
|
if (this.getHpRatio() === 1)
|
||||||
applyPreDefendAbAttrs(PreDefendFullHpEndureAbAttr, this, source, battlerMove, cancelled, damage);
|
applyPreDefendAbAttrs(PreDefendFullHpEndureAbAttr, this, source, battlerMove, cancelled, damage);
|
||||||
@ -1655,8 +1658,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage)
|
if (damage) {
|
||||||
this.scene.clearPhaseQueueSplice();
|
this.scene.clearPhaseQueueSplice();
|
||||||
|
|
||||||
|
const attacker = this.scene.getPokemonById(source.id);
|
||||||
|
destinyTag?.lapse(attacker, BattlerTagLapseType.CUSTOM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MoveCategory.STATUS:
|
case MoveCategory.STATUS:
|
||||||
|
Loading…
Reference in New Issue
Block a user