Fa triggers malament
This commit is contained in:
@@ -175,6 +175,24 @@ test('static anthem', () => {
|
||||
assert.equal(target.selector.controller, 'you')
|
||||
})
|
||||
|
||||
test('negative colors become an excluded color filter', () => {
|
||||
const [ability] = spell('Destroy target nonblack creature.')
|
||||
assert.equal(ability.kind, 'spell')
|
||||
if (ability.kind !== 'spell') return
|
||||
assert.deepEqual(ability.effects[0], {
|
||||
op: 'destroy',
|
||||
target: {
|
||||
kind: 'object',
|
||||
selector: { types: ['creature'], excludeColors: ['B'] },
|
||||
mode: 'target',
|
||||
},
|
||||
})
|
||||
|
||||
const source = formatAbility(ability)
|
||||
assert.match(source, /withoutColor\('black'\)/)
|
||||
assert.equal(formatAbility(parseCardSource(`export default [${source}]`).abilities[0]), source)
|
||||
})
|
||||
|
||||
test('enters-with-counters is a static replacement effect', () => {
|
||||
const [ability] = creature('This creature enters with X +1/+1 counters on it.')
|
||||
assert.equal(ability.kind, 'static')
|
||||
@@ -234,6 +252,36 @@ test('token copy of the triggering nontoken Dragon loses legendary', () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('token-doubling replacement lines compile and round-trip', () => {
|
||||
const cases: Array<[string, object]> = [
|
||||
[
|
||||
'If an effect would create one or more tokens under your control, it creates twice that many of those tokens instead.',
|
||||
{ op: 'token_multiplier', multiplier: 2, who: 'you' },
|
||||
],
|
||||
[
|
||||
'If one or more tokens would be created under your control, twice that many of those tokens are created instead.',
|
||||
{ op: 'token_multiplier', multiplier: 2, who: 'you' },
|
||||
],
|
||||
[
|
||||
'If one or more tokens would be created, twice that many of those tokens are created instead.',
|
||||
{ op: 'token_multiplier', multiplier: 2, who: 'each_player' },
|
||||
],
|
||||
[
|
||||
'If one or more creature tokens would be created under your control, three times that many of those tokens are created instead.',
|
||||
{ op: 'token_multiplier', multiplier: 3, who: 'you', creatureOnly: true },
|
||||
],
|
||||
]
|
||||
for (const [text, expected] of cases) {
|
||||
const [ability] = creature(text)
|
||||
assert.equal(ability.kind, 'static')
|
||||
if (ability.kind !== 'static') return
|
||||
assert.deepEqual(ability.effects[0], expected)
|
||||
|
||||
const source = formatAbility(ability)
|
||||
assert.equal(formatAbility(parseCardSource(`export default [${source}]`).abilities[0]), source)
|
||||
}
|
||||
})
|
||||
|
||||
test('all effects are typed', () => {
|
||||
const [ability] = spell('Draw two cards, then discard a card.')
|
||||
assert.equal(ability.kind, 'spell')
|
||||
@@ -577,3 +625,24 @@ test('new abilities, effects and conditions round-trip through card source', ()
|
||||
assert.equal(formatAbility(reparsed), source)
|
||||
}
|
||||
})
|
||||
|
||||
test('Role token creation compiles with the attachment target', () => {
|
||||
for (const role of ['Cursed', 'Monster', 'Royal', 'Sorcerer', 'Virtuous', 'Wicked', 'Young Hero']) {
|
||||
const [ability] = spell(`Create a ${role} Role token attached to target creature you control.`)
|
||||
assert.equal(ability.kind, 'spell')
|
||||
if (ability.kind !== 'spell') return
|
||||
const effect = ability.effects[0]
|
||||
assert.equal(effect.op, 'create_token')
|
||||
if (effect.op !== 'create_token') return
|
||||
assert.equal(effect.token.name, role)
|
||||
assert.deepEqual(effect.token.subtypes, ['aura', 'role'])
|
||||
assert.deepEqual(effect.attachTo, {
|
||||
kind: 'object',
|
||||
selector: { controller: 'you', types: ['creature'] },
|
||||
mode: 'target',
|
||||
})
|
||||
|
||||
const source = formatAbility(ability)
|
||||
assert.equal(formatAbility(parseCardSource(`export default [${source}]`).abilities[0]), source)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user