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 implementation and tests for Two-Heavens Technique (#3333)
- Loading branch information
James Oddy
committed
Jul 11, 2019
1 parent
d291508
commit 2d610fe
Showing
2 changed files
with
96 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,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; |
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,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); | ||
}); | ||
}); | ||
}); | ||
}); |