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

Add Han Solo & Wedge Antilles leaders and Cassian Andor unit #792

Merged
merged 6 commits into from
Mar 6, 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
63 changes: 63 additions & 0 deletions server/game/cards/04_JTL/leaders/HanSoloNeverTellMeTheOdds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import AbilityHelper from '../../../AbilityHelper';
import type { Attack } from '../../../core/attack/Attack';
import { LeaderUnitCard } from '../../../core/card/LeaderUnitCard';
import { AbilityType, DeployType, WildcardZoneName } from '../../../core/Constants';

export default class HanSoloNeverTellMeTheOdds extends LeaderUnitCard {
protected override getImplementationId() {
return {
id: '0616724418',
internalName: 'han-solo#never-tell-me-the-odds',
};
}

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

this.addActionAbility({
title: 'Reveal the top card of your deck',
immediateEffect: AbilityHelper.immediateEffects.reveal((context) => ({
target: context.player.getTopCardOfDeck()
})),
then: (thenContext) => ({
title: 'Attack with a unit',
initiateAttack: {
attackerLastingEffects: {
effect: AbilityHelper.ongoingEffects.modifyStats({ power: 1, hp: 0 }),
condition: (attack: Attack) => {
// This means that the deck was empty or no card could be revealed
if (thenContext.events.length === 0) {
return false;
}
const attackerCost = attack.attacker.cost;
const revealedCardCost = thenContext.events[0].card[0].cost;
return this.isOdd(attackerCost) && this.isOdd(revealedCardCost) && attackerCost !== revealedCardCost;
}
}
}
})
});
}

protected override setupLeaderUnitSideAbilities() {
this.addPilotingAbility({
title: 'For each friendly unit or upgrade that has an odd cost, ready a resource.',
type: AbilityType.Triggered,
when: {
onLeaderDeployed: (event, context) => event.card === context.source && event.type === DeployType.LeaderUpgrade
},
zoneFilter: WildcardZoneName.AnyArena,
immediateEffect: AbilityHelper.immediateEffects.readyResources((context) => {
const friendlyUnits = context.player.getArenaUnits().filter((unit) => unit.isUnit() && this.isOdd(unit.cost)).length;
const friendlyUpgrades = context.player.getArenaUpgrades().filter((upgrade) => this.isOdd(upgrade.cost)).length;
return {
amount: friendlyUnits + friendlyUpgrades
};
})
});
}

private isOdd(num: number): boolean {
return num % 2 === 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import AbilityHelper from '../../../AbilityHelper';
import { LeaderUnitCard } from '../../../core/card/LeaderUnitCard';
import { AbilityType, CardType, KeywordName, PlayType, RelativePlayer, Trait, ZoneName } from '../../../core/Constants';
import { CostAdjustType } from '../../../core/cost/CostAdjuster';

export default class WedgeAntillesLeaderOfRedSquadron extends LeaderUnitCard {
protected override getImplementationId() {
return {
id: '0011262813',
internalName: 'wedge-antilles#leader-of-red-squadron',
};
}

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

this.addActionAbility({
title: 'Play a card from your hand using Piloting. It costs 1 less.',
cost: AbilityHelper.costs.exhaustSelf(),
targetResolver: {
controller: RelativePlayer.Self,
zoneFilter: ZoneName.Hand,
cardCondition: (card) => card.hasSomeKeyword(KeywordName.Piloting), // This helps prevent a prompt error
immediateEffect: AbilityHelper.immediateEffects.playCard({
playType: PlayType.Piloting,
adjustCost: { costAdjustType: CostAdjustType.Decrease, amount: 1 }
})
}
});
}

protected override setupLeaderUnitSideAbilities() {
this.addPilotingGainAbilityTargetingAttached({
type: AbilityType.Triggered,
title: 'The next Pilot you play this phase costs 1 less',
when: {
onAttackDeclared: (event, context) => event.attack.attacker === context.source
},
immediateEffect: AbilityHelper.immediateEffects.forThisPhasePlayerEffect({
effect: AbilityHelper.ongoingEffects.decreaseCost({
cardTypeFilter: CardType.BasicUnit, // TODO: does this need to allow upgrades?
match: (card) => card.hasSomeTrait(Trait.Pilot),
limit: AbilityHelper.limit.perGame(1),
amount: 1
})
})
});
}
}
31 changes: 31 additions & 0 deletions server/game/cards/04_JTL/units/CassianAndorThreadingTheEye.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import AbilityHelper from '../../../AbilityHelper';
import { NonLeaderUnitCard } from '../../../core/card/NonLeaderUnitCard';
import { AbilityType } from '../../../core/Constants';

export default class CassianAndorThreadingTheEye extends NonLeaderUnitCard {
protected override getImplementationId() {
return {
id: '3475471540',
internalName: 'cassian-andor#threading-the-eye'
};
}

public override setupCardAbilities() {
this.addPilotingGainAbilityTargetingAttached({
type: AbilityType.Triggered,
title: 'Discard a card from the defending player\'s deck',
when: {
onAttackDeclared: (event, context) => event.attack.attacker === context.source
},
immediateEffect: AbilityHelper.immediateEffects.discardFromDeck((context) => ({
amount: 1,
target: context.source.activeAttack.target.controller
})),
ifYouDo: {
title: 'Draw a card',
ifYouDoCondition: (ifYouDoContext) => ifYouDoContext.events[0].card.cost <= 3,
immediateEffect: AbilityHelper.immediateEffects.draw()
}
});
}
}
Loading