Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

aCF - Court Musician #3615

Merged
merged 2 commits into from
Nov 10, 2019
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
35 changes: 35 additions & 0 deletions server/game/cards/09.5-aCF/CourtMusician.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const DrawCard = require('../../drawcard.js');
const AbilityDsl = require('../../abilitydsl');

const { Durations, Players } = require('../../Constants');

class CourtMusician extends DrawCard {
setupCardAbilities() {
this.action({
title: 'Decrease cost to play cards',
condition: context => context.source.isParticipating(),
effect: 'decrease the cost of cards played by 1 for each player\'s next action opportunity',
gameAction: AbilityDsl.actions.playerLastingEffect(context => {
const currentActionWindow = context.game.currentActionWindow;
const opportunityCounter = currentActionWindow.opportunityCounter;
return {
targetController: Players.Any,
duration: Durations.Custom,
effect: AbilityDsl.effects.reduceCost({
amount: 1
}),
until: {
onPassActionPhasePriority: event =>
event.player === context.player && event.actionWindow === currentActionWindow &&
currentActionWindow.opportunityCounter > opportunityCounter + 1
}
};
})
});
}
}

CourtMusician.id = 'court-musician';

module.exports = CourtMusician;

93 changes: 93 additions & 0 deletions test/server/cards/09.5-aCF/CourtMusician.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
describe('Court Musician', function() {
integration(function() {
describe('Court Musician\'s ability for regular actions', function() {
beforeEach(function () {
this.setupTest({
phase: 'conflict',
player1: {
inPlay: ['solemn-scholar'],
hand: ['bayushi-kachiko', 'against-the-waves', 'clarity-of-purpose'],
fate: 10
},
player2: {
inPlay: ['court-musician'],
hand: ['earth-becomes-sky', 'mirumoto-daisho', 'festival-for-the-fortunes'],
fate: 10
}
});

this.solemn = this.player1.findCardByName('solemn-scholar');
this.kachiko = this.player1.findCardByName('bayushi-kachiko');
this.againstTheWaves = this.player1.findCardByName('against-the-waves');
this.clarity = this.player1.findCardByName('clarity-of-purpose');

this.courtMusician = this.player2.findCardByName('court-musician');
this.ebs = this.player2.findCardByName('earth-becomes-sky');
this.daisho = this.player2.findCardByName('mirumoto-daisho');
this.festival = this.player2.findCardByName('festival-for-the-fortunes');

this.noMoreActions();
this.initiateConflict({
type: 'political',
attackers: [this.solemn],
defenders: [this.courtMusician]
});

this.solemn.bowed = true;
});

it('should decrease the cost of the next actions by each player by 1. (event/attachment)', function () {
this.player2.clickCard(this.courtMusician);

this.player1.clickCard(this.clarity);
this.player1.clickCard(this.solemn);

expect(this.player1.fate).toBe(10);

this.player2.clickCard(this.daisho);
this.player2.clickCard(this.courtMusician);

expect(this.player2.fate).toBe(9);

this.player1.clickCard(this.kachiko);
this.player1.clickPrompt('0');
this.player1.clickPrompt('Conflict');

expect(this.player1.fate).toBe(5);

this.player2.clickCard(this.festival);

expect(this.player2.fate).toBe(6);
});

it('should decrease the cost of the next actions by each player by 1. (conflict character)', function () {
this.player2.clickCard(this.courtMusician);

this.player1.clickCard(this.kachiko);
this.player1.clickPrompt('0');
this.player1.clickPrompt('Conflict');

expect(this.player1.fate).toBe(6);

this.player2.clickCard(this.festival);
this.player2.clickCard(this.courtMusician);

expect(this.player2.fate).toBe(8);
});

it('should also decrease the cost of any interrupts/reactions during the next action opportunities by each player by 1.', function () {
this.player2.clickCard(this.courtMusician);

this.player1.clickCard(this.againstTheWaves);
this.player1.clickCard(this.solemn);
expect(this.player1.fate).toBe(10);
this.player2.clickCard(this.ebs);
expect(this.player2.fate).toBe(10);

expect(this.solemn.bowed).toBe(true);
expect(this.player2).toHavePrompt('Conflict Action Window');
});
});
});
});