Files
commander/frontend/app/components/PseudoGuide.vue
2026-10-27 12:42:57 +01:00

213 lines
6.4 KiB
Vue

<template>
<section class="pseudo-guide">
<header class="guide-head">
<h2>Card pseudocode guide</h2>
<p class="muted">
The editor and the compiler use the same two-way format. The
<strong>Visual</strong> tab is a node canvas: drag sockets to connect an ability to its
effects, and drag green value nodes (players, targets, selectors, costs) into argument
sockets. Selector <strong>OR</strong>/<strong>AND</strong> nodes can combine two selector
slots. It writes the same source as the text editor. Use <strong>Draft with AI</strong> for
a first pass, then review and save.
</p>
</header>
<article>
<h3>Shape</h3>
<p>
One ability per block. The header starts at column 0 and ends with a colon; effects are
indented two spaces, one call per line. A leading <code># Card [status]</code> line is
optional and ignored. Multi-face cards use <code>## Face Name [status]</code> sections in
card order. Use <code>(no abilities)</code> for an empty face.
</p>
<pre># Soul Warden [supported]
on enters(each other creature):
gain_life(you, 1)
# Llanowar Elves [supported]
activate {T}:
add_mana(you, {G})</pre>
</article>
<article>
<h3>Ability blocks</h3>
<table>
<thead>
<tr><th>Header</th><th>Example</th></tr>
</thead>
<tbody>
<tr><td><code>on &lt;trigger&gt;:</code></td><td><code>on dies(this):</code></td></tr>
<tr><td><code>activate &lt;cost&gt;:</code></td><td><code>activate {2}, {T}:</code></td></tr>
<tr><td><code>static:</code></td><td><code>static:</code></td></tr>
<tr><td><code>spell:</code></td><td>An instant or sorcery effect line.</td></tr>
<tr><td><code>keyword &lt;name&gt;</code></td><td><code>keyword Flying</code></td></tr>
<tr><td><code>keywords &lt;a&gt;, &lt;b&gt;</code></td><td><code>keywords Flying, vigilance</code></td></tr>
<tr><td><code>additional cost: &lt;cost&gt;</code></td><td><code>additional cost: pay 2 life</code></td></tr>
<tr><td><code>if &lt;condition&gt;:</code></td><td>Nested effects, indented below.</td></tr>
<tr><td><code>choose &lt;n&gt;:</code></td><td>Numbered modes <code>1.</code>, <code>2.</code></td></tr>
<tr><td><code>schedule(next_upkeep):</code></td><td>Delayed effects.</td></tr>
</tbody>
</table>
</article>
<article>
<h3>Effect calls</h3>
<p>Effects are lowercase calls. Separate several on one line with <code>;</code>.</p>
<pre>damage(target creature, 3)
draw(you, 2)
gain_life(you, 1)
create_token(you, 1, 1/1 red goblin creature)
put_counters(target creature, +1/+1, 2)
destroy(target creature)
exile(target artifact you control)
add_mana(you, {G}{G})
search(you, creature, 1, to hand, shuffle)
scry(you, 2)
pump(each creature you control, 1/1, until end of turn)</pre>
</article>
<article>
<h3>Targets, values and costs</h3>
<table>
<tbody>
<tr>
<th>Targets</th>
<td><code>this</code>, <code>the triggering object</code>, <code>target creature</code>, <code>each opponent</code>, <code>up to 2 target creatures</code>, <code>any target</code></td>
</tr>
<tr>
<th>Selectors</th>
<td><code>other tapped creature you control</code>, <code>red instant from a graveyard</code>, <code>creature with power 4 or greater</code></td>
</tr>
<tr>
<th>Values</th>
<td><code>2</code>, <code>X</code>, <code>count(creature you control)</code>, <code>its power</code>, <code>that much</code></td>
</tr>
<tr>
<th>Costs</th>
<td><code>{2}{U}</code>, <code>{T}</code>, <code>pay 3 life</code>, <code>discard 1 card(s)</code>, <code>sacrifice this</code>, <code>remove 1 +1/+1 counter(s) from this</code></td>
</tr>
<tr>
<th>Durations</th>
<td><code>until end of turn</code>, <code>until your next turn</code>, <code>until the end of your next turn</code>, <code>for as long as this remains on the battlefield</code></td>
</tr>
</tbody>
</table>
</article>
<article>
<h3>Triggers, conditions and modes</h3>
<pre>on attacks(this):
create_token(you, 1, tapped 1/1 red goblin creature)
on upkeep(you):
if you control at least 3 artifacts:
draw(you, 1)
spell:
choose 1:
1. draw(you, 2)
2. gain_life(you, 3)
static:
grant(each creature you control, Flying)</pre>
<p class="muted">
Common triggers: <code>enters</code>, <code>dies</code>, <code>attacks</code>,
<code>upkeep</code>, <code>end_step</code>, <code>cast</code>,
<code>deals_damage</code>. Always check the generated line after saving.
</p>
</article>
<article>
<h3>When the syntax cannot express it</h3>
<p>
Never guess a wrong effect. Use the preserved form and leave the line unsupported:
</p>
<pre>unsupported (modal bullet outside a choose block): Choose one — ...</pre>
<p class="muted">
The full reference lives in <code>backend/docs/card-effects.md</code>.
</p>
</article>
</section>
</template>
<style scoped>
.pseudo-guide {
flex: 1;
min-height: 0;
overflow-y: auto;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 8px;
padding: 1rem 1.25rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.guide-head {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
h3 {
margin-bottom: 0.4rem;
}
p {
line-height: 1.5;
font-size: 0.9rem;
}
code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.85em;
background: #11151d;
border: 1px solid var(--line);
border-radius: 4px;
padding: 0.05rem 0.3rem;
}
pre {
margin: 0.5rem 0 0;
padding: 0.65rem 0.8rem;
background: #11151d;
border: 1px solid var(--line);
border-radius: 6px;
overflow-x: auto;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.82rem;
line-height: 1.5;
}
table {
border-collapse: collapse;
width: 100%;
font-size: 0.85rem;
}
th,
td {
border-bottom: 1px solid var(--line);
padding: 0.35rem 0.5rem;
text-align: left;
vertical-align: top;
}
th {
white-space: nowrap;
color: var(--muted);
font-weight: 600;
}
tbody th {
width: 7rem;
}
@media (max-width: 800px) {
tbody th {
width: auto;
}
}
</style>