[duel-cards] Doctrines: attach + static pump on attached (DUEL_API encoding); the buff was ignored by the engine

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 23:23:29 -05:00
co-authored by Claude Opus 5.5
parent ae14bc7b89
commit 067de837a8
4 changed files with 157 additions and 31 deletions
+120 -22
View File
@@ -851,9 +851,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "figure",
"template": "T12"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": -3,
"toughness": -3,
"duration": "permanent",
"template": "T12"
}
],
@@ -943,15 +948,19 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
},
{
"trigger": "onCombatDamageToPlayer",
"op": "draw",
"target": "attached",
"amount": 1,
"template": "T11"
}
@@ -1272,15 +1281,19 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
},
{
"trigger": "onCombatDamageToPlayer",
"op": "draw",
"target": "attached",
"amount": 1,
"template": "T11"
}
@@ -3753,9 +3766,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
}
],
@@ -4189,9 +4207,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 2,
"toughness": 2,
"duration": "permanent",
"template": "T11"
}
],
@@ -4325,9 +4348,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
}
],
@@ -4787,9 +4815,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 2,
"toughness": 2,
"duration": "permanent",
"template": "T11"
}
],
@@ -5010,9 +5043,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"grant": [
"Well-sourced"
],
@@ -5059,9 +5097,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
}
],
@@ -5196,9 +5239,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"grant": [
"Well-sourced"
],
@@ -6030,9 +6078,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 2,
"toughness": 2,
"duration": "permanent",
"template": "T11"
}
],
@@ -7070,9 +7123,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 2,
"toughness": 2,
"duration": "permanent",
"grant": [
"Well-sourced"
],
@@ -7120,9 +7178,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "figure",
"template": "T12"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": -2,
"toughness": -2,
"duration": "permanent",
"template": "T12"
}
],
@@ -7830,9 +7893,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "figure",
"template": "T12"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": -2,
"toughness": -2,
"duration": "permanent",
"template": "T12"
}
],
@@ -8132,9 +8200,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 1,
"toughness": 1,
"duration": "permanent",
"template": "T11"
}
],
@@ -8552,9 +8625,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 2,
"toughness": 2,
"duration": "permanent",
"grant": [
"Well-sourced"
],
@@ -9028,9 +9106,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 2,
"toughness": 2,
"duration": "permanent",
"template": "T11"
}
],
@@ -9074,9 +9157,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
}
],
@@ -9384,9 +9472,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 3,
"toughness": 3,
"duration": "permanent",
"template": "T11"
}
],
@@ -9559,9 +9652,14 @@
"trigger": "onPlay",
"op": "attach",
"target": "ownFigure",
"template": "T11"
},
{
"trigger": "static",
"op": "pump",
"target": "attached",
"power": 1,
"toughness": 1,
"duration": "permanent",
"template": "T11"
}
],
+9 -6
View File
@@ -116,12 +116,15 @@ function baseEffects(type: CardType, subtype: string | null, cost: number): Effe
default: return [{ trigger: 'static', op: 'pump', target: 'ownFigures', power: 1, toughness: 0, condition: { maxPower: 2 } }];
}
case 'Doctrine': {
if (subtype === 'pathology') return [{ trigger: 'onPlay', op: 'attach', target: 'figure', power: -k, toughness: -k, duration: 'permanent' }];
const attach: EffectSpec = { trigger: 'onPlay', op: 'attach', target: 'ownFigure', power: k, toughness: k, duration: 'permanent' };
if (subtype === 'mathematics') return [{ ...attach, grant: ['Well-sourced'] }];
if (subtype === 'language') return [attach, { trigger: 'onCombatDamageToPlayer', op: 'draw', target: 'attached', amount: 1 }];
if (subtype === 'ideology') return [attach, { trigger: 'static', op: 'pump', target: 'ownFigures', power: 1, toughness: 0, condition: { samePortal: true } }];
return [attach];
// DUEL_API "Doctrine": `attach` picks the Figure; the buff is a static pump on `attached`.
const pathology = subtype === 'pathology';
const attach: EffectSpec = { trigger: 'onPlay', op: 'attach', target: pathology ? 'figure' : 'ownFigure' };
const buff: EffectSpec = { trigger: 'static', op: 'pump', target: 'attached', power: pathology ? -k : k, toughness: pathology ? -k : k };
if (pathology) return [attach, buff];
if (subtype === 'mathematics') return [attach, { ...buff, grant: ['Well-sourced'] }];
if (subtype === 'language') return [attach, buff, { trigger: 'onCombatDamageToPlayer', op: 'draw', amount: 1 }];
if (subtype === 'ideology') return [attach, buff, { trigger: 'static', op: 'pump', target: 'ownFigures', power: 1, toughness: 0, condition: { samePortal: true } }];
return [attach, buff];
}
default: return [];
}
+12 -3
View File
@@ -75,8 +75,16 @@ export function effectText(effects: readonly EffectSpec[]): string[] {
for (let i = 0; i < effects.length; i++) {
const e = effects[i];
if (e.op === 'attach') {
const grant = e.grant?.length ? ` and has ${keywordsAsText(e.grant)}` : '';
lines.push(`Attach to ${e.target === 'figure' ? 'target Figure' : 'target Figure you control'}. It gets ${pt(e.power, e.toughness)}${grant}.`);
// The Doctrine's buff is the static pump on `attached` that follows (DUEL_API "Doctrine").
const next = effects[i + 1];
const buff = next && next.trigger === 'static' && next.op === 'pump' && next.target === 'attached' ? next : null;
let line = `Attach to ${e.target === 'figure' ? 'target Figure' : 'target Figure you control'}.`;
if (buff) {
const grant = buff.grant?.length ? ` and has ${keywordsAsText(buff.grant)}` : '';
line += ` It gets ${pt(buff.power, buff.toughness)}${grant}.`;
i++;
}
lines.push(line);
continue;
}
if (e.op === 'fight' && i > 0 && effects[i - 1].op === 'pump') {
@@ -95,7 +103,8 @@ export function effectText(effects: readonly EffectSpec[]): string[] {
break;
}
case 'onCombatDamageToPlayer':
lines.push(`Whenever ${e.target === 'attached' ? 'it' : 'this'} deals combat damage to a player, ${actionText(e)}.`);
// On a Doctrine the trigger belongs to the attached Figure ("it"); on a Figure, to "this".
lines.push(`Whenever ${effects.some(x => x.op === 'attach') ? 'it' : 'this'} deals combat damage to a player, ${actionText(e)}.`);
break;
}
}
+16
View File
@@ -203,3 +203,19 @@ test('Connected fires in a plausible share of sample pairs (BRIEF target 15–30
const rate = hits / pairs;
assert.ok(rate > 0.1 && rate < 0.4, `rate ${rate}`);
});
test('Doctrines use the engine encoding: attach picks the Figure, a static pump on `attached` carries ±k (DUEL_API)', () => {
for (const c of CARDS.filter(x => x.type === 'Doctrine')) {
assert.equal(c.effects[0].op, 'attach', c.title);
const buff = c.effects[1];
assert.equal(buff.trigger, 'static', c.title);
assert.equal(buff.op, 'pump');
assert.equal(buff.target, 'attached');
const magnitude = c.basis.magnitude;
const sign = c.subtype === 'pathology' ? -1 : 1;
assert.deepEqual([buff.power, buff.toughness], [sign * magnitude, sign * magnitude], c.title);
assert.equal(c.effects[0].target, c.subtype === 'pathology' ? 'figure' : 'ownFigure');
}
assert.deepEqual(byTitle('Heart rot').effects.map(e => [e.trigger, e.op, e.target, e.power ?? null]),
[['onPlay', 'attach', 'figure', null], ['static', 'pump', 'attached', -3]]);
});