This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new PersonalHonorStatus enum * Add implementation and tests for Shameless Gossip * Removed PersonalHonorStatus
- Loading branch information
James Oddy
committed
Jun 25, 2019
1 parent
1459f8e
commit 0814915
Showing
2 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const DrawCard = require('../../drawcard.js'); | ||
const AbilityDsl = require('../../abilitydsl'); | ||
const { Players, CardTypes } = require('../../Constants'); | ||
|
||
class ShamelessGossip extends DrawCard { | ||
setupCardAbilities() { | ||
this.action({ | ||
title: 'Move a status token', | ||
condition: context => context.source.isParticipating(), | ||
targets: { | ||
first: { | ||
activePromptTitle: 'Choose a Character to move a status token from', | ||
cardType: CardTypes.Character, | ||
controller: Players.Any, | ||
cardCondition: card => card.isHonored || card.isDishonored | ||
}, | ||
second: { | ||
activePromptTitle: 'Choose a Character to move the status token to', | ||
dependsOn: 'first', | ||
cardType: CardTypes.Character, | ||
cardCondition: (card, context) => | ||
card.controller === context.targets.first.controller && | ||
card !== context.targets.first, | ||
gameAction: AbilityDsl.actions.moveStatusToken(context => ({ | ||
target: context.targets.first.personalHonor, | ||
recipient: context.targets.second | ||
})) | ||
} | ||
}, | ||
effect: 'move {1}\'s {2} to {3}', | ||
effectArgs: context => [context.targets.first, context.targets.first.personalHonor, context.targets.second] | ||
}); | ||
} | ||
} | ||
|
||
ShamelessGossip.id = 'shameless-gossip'; | ||
|
||
module.exports = ShamelessGossip; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
describe('Shameless Gossip', function() { | ||
integration(function() { | ||
describe('Shameless Gossip\'s ability', function() { | ||
beforeEach(function() { | ||
this.setupTest({ | ||
phase: 'conflict', | ||
player1: { | ||
inPlay: ['shameless-gossip', 'alibi-artist', 'bayushi-liar'] | ||
}, | ||
player2: { | ||
inPlay: ['doji-whisperer', 'doji-hotaru'] | ||
} | ||
}); | ||
|
||
this.shamelessGossip = this.player1.findCardByName('shameless-gossip'); | ||
this.shamelessGossip.dishonor(); | ||
this.alibiArtist = this.player1.findCardByName('alibi-artist'); | ||
this.alibiArtist.dishonor(); | ||
this.bayushiLiar = this.player1.findCardByName('bayushi-liar'); | ||
|
||
this.dojiWhisperer = this.player2.findCardByName('doji-whisperer'); | ||
this.dojiWhisperer.dishonor(); | ||
this.dojiHotaru = this.player2.findCardByName('doji-hotaru'); | ||
this.dojiHotaru.honor(); | ||
}); | ||
|
||
it('should not be triggerable if not participating', function() { | ||
expect(this.player1).toHavePrompt('Action Window'); | ||
this.player1.clickCard(this.shamelessGossip); | ||
expect(this.player1).toHavePrompt('Action Window'); | ||
this.noMoreActions(); | ||
this.initiateConflict({ | ||
attackers: [this.alibiArtist], | ||
defenders: [this.dojiWhisperer], | ||
type: 'political' | ||
}); | ||
this.player2.pass(); | ||
expect(this.player1).toHavePrompt('Conflict Action Window'); | ||
this.player1.clickCard(this.shamelessGossip); | ||
expect(this.player1).toHavePrompt('Conflict Action Window'); | ||
}); | ||
|
||
it('should prompt to choose any character with a personal honor token', function() { | ||
this.noMoreActions(); | ||
this.initiateConflict({ | ||
attackers: [this.shamelessGossip], | ||
defenders: [] | ||
}); | ||
this.player2.pass(); | ||
this.player1.clickCard(this.shamelessGossip); | ||
expect(this.player1).toHavePrompt('Choose a Character to move a status token from'); | ||
expect(this.player1).toBeAbleToSelect(this.shamelessGossip); | ||
expect(this.player1).toBeAbleToSelect(this.alibiArtist); | ||
expect(this.player1).not.toBeAbleToSelect(this.bayushiLiar); | ||
expect(this.player1).toBeAbleToSelect(this.dojiWhisperer); | ||
expect(this.player1).toBeAbleToSelect(this.dojiHotaru); | ||
}); | ||
|
||
it('should prompt to choose a second character controlled by the same player (without the same honor status) (controller)', function() { | ||
this.noMoreActions(); | ||
this.initiateConflict({ | ||
attackers: [this.shamelessGossip], | ||
defenders: [] | ||
}); | ||
this.player2.pass(); | ||
this.player1.clickCard(this.shamelessGossip); | ||
this.player1.clickCard(this.alibiArtist); | ||
expect(this.player1).toHavePrompt('Choose a Character to move the status token to'); | ||
expect(this.player1).not.toBeAbleToSelect(this.shamelessGossip); | ||
expect(this.player1).not.toBeAbleToSelect(this.alibiArtist); | ||
expect(this.player1).toBeAbleToSelect(this.bayushiLiar); | ||
expect(this.player1).not.toBeAbleToSelect(this.dojiWhisperer); | ||
expect(this.player1).not.toBeAbleToSelect(this.dojiHotaru); | ||
}); | ||
|
||
it('should prompt to choose a second character controlled by the same player (without the same honor status) (opponent)', function() { | ||
this.noMoreActions(); | ||
this.initiateConflict({ | ||
attackers: [this.shamelessGossip], | ||
defenders: [] | ||
}); | ||
this.player2.pass(); | ||
this.player1.clickCard(this.shamelessGossip); | ||
this.player1.clickCard(this.dojiHotaru); | ||
expect(this.player1).toHavePrompt('Choose a Character to move the status token to'); | ||
expect(this.player1).not.toBeAbleToSelect(this.shamelessGossip); | ||
expect(this.player1).not.toBeAbleToSelect(this.alibiArtist); | ||
expect(this.player1).not.toBeAbleToSelect(this.bayushiLiar); | ||
expect(this.player1).toBeAbleToSelect(this.dojiWhisperer); | ||
expect(this.player1).not.toBeAbleToSelect(this.dojiHotaru); | ||
}); | ||
|
||
it('should move the status token from the first character to the second', function() { | ||
this.noMoreActions(); | ||
this.initiateConflict({ | ||
attackers: [this.shamelessGossip], | ||
defenders: [] | ||
}); | ||
this.player2.pass(); | ||
this.player1.clickCard(this.shamelessGossip); | ||
this.player1.clickCard(this.dojiHotaru); | ||
this.player1.clickCard(this.dojiWhisperer); | ||
expect(this.dojiWhisperer.isHonored).toBe(false); | ||
expect(this.dojiWhisperer.isDishonored).toBe(false); | ||
expect(this.dojiHotaru.isHonored).toBe(false); | ||
expect(this.dojiHotaru.isDishonored).toBe(false); | ||
expect(this.getChatLogs(3)).toContain('player1 uses Shameless Gossip to move Doji Hotaru\'s Honored Token to Doji Whisperer'); | ||
}); | ||
}); | ||
}); | ||
}); |