diff --git a/server/game/cards/04_JTL/units/FireballAnExplosionWithWings.ts b/server/game/cards/04_JTL/units/FireballAnExplosionWithWings.ts new file mode 100644 index 000000000..74b51a1f3 --- /dev/null +++ b/server/game/cards/04_JTL/units/FireballAnExplosionWithWings.ts @@ -0,0 +1,22 @@ +import AbilityHelper from '../../../AbilityHelper'; +import { NonLeaderUnitCard } from '../../../core/card/NonLeaderUnitCard'; +import { PhaseName } from '../../../core/Constants'; + +export default class FireballAnExplosionWithWings extends NonLeaderUnitCard { + protected override getImplementationId() { + return { + id: '4240570958', + internalName: 'fireball#an-explosion-with-wings', + }; + } + + public override setupCardAbilities() { + this.addTriggeredAbility({ + title: 'Deal 1 damage to this unit.', + when: { + onPhaseStarted: (context) => context.phase === PhaseName.Regroup + }, + immediateEffect: AbilityHelper.immediateEffects.damage({ amount: 1 }), + }); + } +} diff --git a/test/server/cards/04_JTL/units/FireballAnExplosionWithWings.spec.ts b/test/server/cards/04_JTL/units/FireballAnExplosionWithWings.spec.ts new file mode 100644 index 000000000..4bdfc2aa7 --- /dev/null +++ b/test/server/cards/04_JTL/units/FireballAnExplosionWithWings.spec.ts @@ -0,0 +1,44 @@ +describe('Fireball, An Explosion With Wings', function() { + integration(function(contextRef) { + describe('Fireball\'s ability', function() { + beforeEach(function () { + return contextRef.setupTestAsync({ + phase: 'action', + player1: { + hand: ['fireball#an-explosion-with-wings'] + }, + player2: { + spaceArena: ['tieln-fighter'] + } + }); + }); + + it('includes Ambush', function() { + const { context } = contextRef; + + context.player1.clickCard(context.fireball); + + expect(context.player1).toHavePrompt('Trigger the ability \'Ambush\' or pass'); + context.player1.clickPrompt('Trigger'); + context.player1.clickCard(context.tielnFighter); + + expect(context.tielnFighter).toBeInZone('discard'); + expect(context.fireball.damage).toBe(2); + }); + + it('deals 1 damage to itself at the start of the regroup phase', function() { + const { context } = contextRef; + + context.player1.clickCard(context.fireball); + context.player1.clickPrompt('Pass'); + + expect(context.fireball.damage).toBe(0); + + context.player2.claimInitiative(); + context.player1.passAction(); + + expect(context.fireball.damage).toBe(1); + }); + }); + }); +}); \ No newline at end of file