Skip to content

Commit

Permalink
Make Arklight compatible with Merger
Browse files Browse the repository at this point in the history
  • Loading branch information
kberg committed Jan 3, 2025
1 parent 0b9cd1a commit 2883d56
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/server/cards/colonies/Arklight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {CorporationCard} from '../corporation/CorporationCard';
import {IPlayer} from '../../IPlayer';
import {Tag} from '../../../common/cards/Tag';
import {CardResource} from '../../../common/CardResource';
import {IProjectCard} from '../IProjectCard';
import {ICorporationCard} from '../corporation/ICorporationCard';
import {ICard} from '../ICard';
import {CardName} from '../../../common/cards/CardName';
import {CardRenderer} from '../render/CardRenderer';

Expand Down Expand Up @@ -36,7 +37,11 @@ export class Arklight extends CorporationCard {
});
}

public onCardPlayed(player: IPlayer, card: IProjectCard): void {
public onCorpCardPlayed(player: IPlayer, card: ICorporationCard) {
this.onCardPlayed(player, card);
}

public onCardPlayed(player: IPlayer, card: ICard): void {
if (player.isCorporation(CardName.ARKLIGHT)) {
player.addResourceTo(this, {qty: card.tags.filter((cardTag) => cardTag === Tag.ANIMAL || cardTag === Tag.PLANT).length, log: true});
}
Expand Down
28 changes: 22 additions & 6 deletions tests/cards/colonies/Arklight.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import {expect} from 'chai';
import {Predators} from '../../../src/server/cards/base/Predators';
import {Arklight} from '../../../src/server/cards/colonies/Arklight';
import {runAllActions, testGame} from '../../TestingUtils';
import {cast, runAllActions, testGame} from '../../TestingUtils';
import {EcoLine} from '../../../src/server/cards/corporation/EcoLine';

describe('Arklight', function() {
it('Should play', function() {
describe('Arklight', () => {
it('Should play', () => {
const card = new Arklight();
const [game, player/* , player2 */] = testGame(2);
const play = card.play(player);
expect(play).is.undefined;
cast(card.play(player), undefined);
player.corporations.push(card);
runAllActions(game);

expect(card.resourceCount).to.eq(1);
player.corporations.push(card);

card.onCardPlayed(player, new Predators());

expect(card.resourceCount).to.eq(2);
expect(card.getVictoryPoints(player)).to.eq(1);
});

it('Compatible with Merger', () => {
const card = new Arklight();
const [game, player/* , player2 */] = testGame(2);
player.corporations.push(card);
runAllActions(game);

card.resourceCount = 0;

player.playAdditionalCorporationCard(new EcoLine());

expect(card.resourceCount).to.eq(1);
});
});

0 comments on commit 2883d56

Please sign in to comment.