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

Commit

Permalink
Add implementation and tests for Two-Heavens Technique (#3333)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Oddy committed Jul 11, 2019
1 parent d291508 commit 2d610fe
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/game/cards/09.2-BoB/TwoHeavensTechnique.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const DrawCard = require('../../drawcard.js');
const AbilityDsl = require('../../abilitydsl');

class TwoHeavensTechnique extends DrawCard {
setupCardAbilities() {
this.whileAttached({
condition: context => context.source.parent && context.source.parent.attachments.filter(card => card.hasTrait('weapon')).length === 2,
effect: AbilityDsl.effects.addKeyword('covert')
});
}

canAttach(card, context) {
if(!card.hasTrait('bushi')) {
return false;
}
return super.canAttach(card, context);
}
}

TwoHeavensTechnique.id = 'two-heavens-technique';

module.exports = TwoHeavensTechnique;
74 changes: 74 additions & 0 deletions test/server/cards/09.2-BoB/TwoHeavensTechnique.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
describe('Two-Heavens Technique', function() {
integration(function() {
describe('Two-Heavens Technique', function() {
beforeEach(function() {
this.setupTest({
phase: 'conflict',
player1: {
inPlay: ['brash-samurai', 'doji-whisperer'],
hand: ['two-heavens-technique', 'fine-katana', 'pathfinder-s-blade', 'ornate-fan', 'kakita-blade']
},
player2: {
inPlay: ['matsu-berserker']
}
});
this.brashSamurai = this.player1.findCardByName('brash-samurai');
this.dojiWhisperer = this.player1.findCardByName('doji-whisperer');
this.twoHeavensTechnique = this.player1.findCardByName('two-heavens-technique');
this.fineKatana = this.player1.findCardByName('fine-katana');
this.pathfindersBlade = this.player1.findCardByName('pathfinder-s-blade');
this.ornateFan = this.player1.findCardByName('ornate-fan');
this.kakitaBlade = this.player1.findCardByName('kakita-blade');
this.matsuBerserker = this.player2.findCardByName('matsu-berserker');
});

it('should only be attachable to bushi characters', function() {
this.player1.clickCard(this.twoHeavensTechnique);
expect(this.player1).toBeAbleToSelect(this.brashSamurai);
expect(this.player1).not.toBeAbleToSelect(this.dojiWhisperer);
expect(this.player1).toBeAbleToSelect(this.matsuBerserker);
});

it('should not give covert when the character has 1 or fewer weapons attached', function() {
this.player1.clickCard(this.twoHeavensTechnique);
this.player1.clickCard(this.brashSamurai);
expect(this.brashSamurai.isCovert()).toBe(false);
this.player2.pass();
this.player1.clickCard(this.fineKatana);
this.player1.clickCard(this.brashSamurai);
expect(this.brashSamurai.isCovert()).toBe(false);
this.player2.pass();
this.player1.clickCard(this.ornateFan);
this.player1.clickCard(this.brashSamurai);
expect(this.brashSamurai.isCovert()).toBe(false);
});

it('should not give covert when the character has 3 or more weapons attached', function() {
this.player1.clickCard(this.twoHeavensTechnique);
this.player1.clickCard(this.brashSamurai);
this.player2.pass();
this.player1.clickCard(this.fineKatana);
this.player1.clickCard(this.brashSamurai);
this.player2.pass();
this.player1.clickCard(this.pathfindersBlade);
this.player1.clickCard(this.brashSamurai);
this.player2.pass();
this.player1.clickCard(this.kakitaBlade);
this.player1.clickCard(this.brashSamurai);
expect(this.brashSamurai.isCovert()).toBe(false);
});

it('should give covert when the character has 2 weapons attached', function() {
this.player1.clickCard(this.twoHeavensTechnique);
this.player1.clickCard(this.brashSamurai);
this.player2.pass();
this.player1.clickCard(this.fineKatana);
this.player1.clickCard(this.brashSamurai);
this.player2.pass();
this.player1.clickCard(this.kakitaBlade);
this.player1.clickCard(this.brashSamurai);
expect(this.brashSamurai.isCovert()).toBe(true);
});
});
});
});

0 comments on commit 2d610fe

Please sign in to comment.