Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Rio Durant, Wisecracking Wheelman #786

Merged
merged 2 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import AbilityHelper from '../../../AbilityHelper';
import { LeaderUnitCard } from '../../../core/card/LeaderUnitCard';
import { KeywordName, RelativePlayer, Trait, WildcardCardType, ZoneName } from '../../../core/Constants';

export default class RioDurantWisecrackingWheelman extends LeaderUnitCard {
protected override getImplementationId() {
return {
id: '8656409691',
internalName: 'rio-durant#wisecracking-wheelman',
};
}

protected override setupLeaderSideAbilities () {
this.addPilotDeploy();

this.addActionAbility({
title: 'Attack with a space unit. It gets +1/+0 and gains Saboteur for this attack',
cost: [AbilityHelper.costs.exhaustSelf(), AbilityHelper.costs.abilityResourceCost(1)],
targetResolver: {
cardTypeFilter: WildcardCardType.Unit,
zoneFilter: ZoneName.SpaceArena,
controller: RelativePlayer.Self,
immediateEffect: AbilityHelper.immediateEffects.attack({
attackerLastingEffects: [
{ effect: AbilityHelper.ongoingEffects.gainKeyword(KeywordName.Saboteur) },
{ effect: AbilityHelper.ongoingEffects.modifyStats({ power: 1, hp: 0 }) },
]
})
}
});
}

protected override setupLeaderUnitSideAbilities () {
this.addPilotingGainKeywordTargetingAttached({
keyword: KeywordName.Saboteur,
});

this.addPilotingConstantAbilityTargetingAttached({
title: 'This unit has +1/+0.',
condition: (context) => context.source.parentCard.hasSomeTrait(Trait.Transport),
ongoingEffect: AbilityHelper.ongoingEffects.modifyStats({ power: 1, hp: 0 })
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

describe('Rio Durant, Wisecracking Wheelman', function() {
integration(function(contextRef) {
beforeEach(function() {
return contextRef.setupTestAsync({
phase: 'action',
player1: {
leader: 'rio-durant#wisecracking-wheelman',
groundArena: ['atst', 'crafty-smuggler'],
spaceArena: ['seventh-fleet-defender', 'corellian-freighter'],
resources: 10
},
player2: {
groundArena: ['patrolling-aat'],
spaceArena: ['system-patrol-craft']
}
});
});

it('Rio Durant\'s leader side ability should attack with a space unit and give it +1/0 and Saboteur', function() {
const { context } = contextRef;

context.player1.clickCard(context.rioDurant);
context.player1.clickPrompt('Attack with a space unit. It gets +1/+0 and gains Saboteur for this attack');

expect(context.player1).toBeAbleToSelectExactly([context.seventhFleetDefender, context.corellianFreighter]);

context.player1.clickCard(context.seventhFleetDefender);

// Able to attack base instead of the Sentinel because leader gives Saboteur and +1/0
expect(context.player1).toBeAbleToSelectExactly([context.systemPatrolCraft, context.p2Base]);

context.player1.clickCard(context.p2Base);

expect(context.player1.readyResourceCount).toBe(9);
expect(context.p2Base.damage).toBe(4);
expect(context.player2).toBeActivePlayer();
});

it('Rio Durant\'s pilot ability should give a vehicle unit Saboteur but not +1/0 when it is not a Transport', function() {
const { context } = contextRef;

context.player1.clickCard(context.rioDurant);
context.player1.clickPrompt('Deploy Rio Durant as a Pilot');

expect(context.player1).toBeAbleToSelectExactly([context.seventhFleetDefender, context.corellianFreighter, context.atst]);

context.player1.clickCard(context.seventhFleetDefender);

// Should gain Saboteur but not +1/0 because it is not a Transport
expect(context.seventhFleetDefender.hasSomeKeyword('saboteur')).toBe(true);
// 3 power from unit + 3 power from leader pilot
expect(context.seventhFleetDefender.getPower()).toBe(6);
expect(context.seventhFleetDefender.getHp()).toBe(7);

context.player2.passAction();
context.player1.clickCard(context.seventhFleetDefender);

expect(context.player1).toBeAbleToSelectExactly([context.systemPatrolCraft, context.p2Base]);

context.player1.clickCard(context.p2Base);

expect(context.p2Base.damage).toBe(6);
expect(context.player2).toBeActivePlayer();
});

it('Rio Durant\'s pilot ability should give a vehicle unit Saboteur and +1/0 for being a Transport', function() {
const { context } = contextRef;

context.player1.clickCard(context.rioDurant);
context.player1.clickPrompt('Deploy Rio Durant as a Pilot');

expect(context.player1).toBeAbleToSelectExactly([context.seventhFleetDefender, context.corellianFreighter, context.atst]);

context.player1.clickCard(context.corellianFreighter);

// Should gain Saboteur and +1/0 because it is a Transport
expect(context.corellianFreighter.hasSomeKeyword('saboteur')).toBe(true);
// 4 power from unit + 3 power from leader pilot + 1 power for being a Transport
expect(context.corellianFreighter.getPower()).toBe(8);
expect(context.corellianFreighter.getHp()).toBe(9);

context.player2.passAction();
context.player1.clickCard(context.corellianFreighter);

expect(context.player1).toBeAbleToSelectExactly([context.systemPatrolCraft, context.p2Base]);

context.player1.clickCard(context.p2Base);

expect(context.p2Base.damage).toBe(8);
expect(context.player2).toBeActivePlayer();
});
});
});