From a99cef6a7247ea956a7f2239d2c7515bac12da4c Mon Sep 17 00:00:00 2001 From: Noah Date: Tue, 26 Jun 2018 13:53:03 -0400 Subject: [PATCH] BotK: Shiotome Encampment (#2070) * Implements Shiotome Encampment * Removed debugging --- .eslintrc | 2 +- .../cards/04.1-BotK/ShiotomeEncampment.js | 19 ++++++- test/server/cards/01-Core/Ambush.spec.js | 1 - .../04.1-BotK/ShiotomeEncampment.spec.js | 55 +++++++++++++++++++ tsconfig.json | 2 +- 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 test/server/cards/04.1-BotK/ShiotomeEncampment.spec.js diff --git a/.eslintrc b/.eslintrc index 194ea0190b..c504c52a2f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,7 +1,7 @@ { "env": { "node": true, - "es6": true + "es6": true }, "extends": "eslint:recommended", "rules": { diff --git a/server/game/cards/04.1-BotK/ShiotomeEncampment.js b/server/game/cards/04.1-BotK/ShiotomeEncampment.js index 37135db81d..ed95b0cbc6 100644 --- a/server/game/cards/04.1-BotK/ShiotomeEncampment.js +++ b/server/game/cards/04.1-BotK/ShiotomeEncampment.js @@ -1,10 +1,25 @@ const DrawCard = require('../../drawcard.js'); class ShiotomeEncampment extends DrawCard { - setupCardAbilities(ability) { // eslint-disable-line no-unused-vars + setupCardAbilities(ability) { + this.action({ + title: 'Ready a Cavalry character', + effect: 'ready a Cavalry character', + condition: context => + Object.values(this.game.rings).some( + ring => + ring.isConsideredClaimed(context.player) && + ring.isConflictType('military') + ), + target: { + cardType: 'character', + cardCondition: card => card.hasTrait('cavalry'), + gameAction: ability.actions.ready() + } + }); } } -ShiotomeEncampment.id = 'shiotome-encampment'; // This is a guess at what the id might be - please check it!!! +ShiotomeEncampment.id = 'shiotome-encampment'; module.exports = ShiotomeEncampment; diff --git a/test/server/cards/01-Core/Ambush.spec.js b/test/server/cards/01-Core/Ambush.spec.js index bf30373158..844fa99d9b 100644 --- a/test/server/cards/01-Core/Ambush.spec.js +++ b/test/server/cards/01-Core/Ambush.spec.js @@ -28,7 +28,6 @@ describe('Ambush', function() { describe('When playing Ambush', function() { beforeEach(function() { this.player2.clickCard(this.ambush, 'hand'); - }); it('should not allow the player to select more than 2 characters', function() { diff --git a/test/server/cards/04.1-BotK/ShiotomeEncampment.spec.js b/test/server/cards/04.1-BotK/ShiotomeEncampment.spec.js new file mode 100644 index 0000000000..9ff2e3b13d --- /dev/null +++ b/test/server/cards/04.1-BotK/ShiotomeEncampment.spec.js @@ -0,0 +1,55 @@ +describe('Shiotome Encampment', function() { + integration(function() { + beforeEach(function() { + this.setupTest({ + phase: 'conflict', + player1: { + dynastyDeck: ['shiotome-encampment'], + inPlay: ['miya-mystic', 'aggressive-moto'] + } + }); + this.shiotomeEncampment = this.player1.placeCardInProvince( + 'shiotome-encampment', + 'province 1' + ); + this.miyaMystic = this.player1.findCardByName('miya-mystic'); + this.aggressiveMoto = this.player1.findCardByName('aggressive-moto'); + this.miyaMystic.bow(); + this.aggressiveMoto.bow(); + }); + + describe('Using Shiotome Encampment', function() { + it('shouldn\'t work if there is no claimed ring', function() { + this.player1.clickCard(this.shiotomeEncampment); + expect(this.player1).toHavePrompt('Initiate an action'); + }); + + it('shouldn\'t work if the only claimed ring is political', function() { + this.game.rings.earth.claimRing(this.player1); + this.player1.clickCard(this.shiotomeEncampment); + expect(this.player1).toHavePrompt('Initiate an action'); + }); + + it('should work if at least one claimed ring is military', function() { + this.game.rings.air.claimRing(this.player1); + this.game.rings.earth.claimRing(this.player1); + this.player1.clickCard(this.shiotomeEncampment); + expect(this.player1).toHavePrompt('Choose a character'); + }); + + it('should only target cavalry characters', function() { + this.game.rings.air.claimRing(this.player1); + this.player1.clickCard(this.shiotomeEncampment); + expect(this.player1).toBeAbleToSelect(this.aggressiveMoto); + expect(this.player1).not.toBeAbleToSelect(this.miyaMystic); + }); + + it('should ready bowed character', function() { + this.game.rings.air.claimRing(this.player1); + this.player1.clickCard(this.shiotomeEncampment); + this.player1.clickCard(this.aggressiveMoto); + expect(this.aggressiveMoto.bowed).not.toBe(true); + }); + }); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 86b855f23e..78bf6f9ed5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "allowJs": true, "checkJs": true, "lib": [ - "es2016" + "es2017" ] }, "exclude": [