kjdskjdsk

This commit is contained in:
2026-10-27 19:14:33 +01:00
parent c962800876
commit bb85881cac
19 changed files with 2355 additions and 185 deletions

View File

@@ -58,11 +58,12 @@ function formatSelector(selector: ObjectSelector): string {
if (selector.token) parts.push('token')
if (selector.token === false) parts.push('nontoken')
if (selector.attached) parts.push(selector.attached)
const joiner = selector.match === 'any' ? ' or ' : ' and '
if (selector.colors?.length) {
parts.push(selector.colors.map(color => COLOR_NAMES[color] ?? color).join(' and '))
parts.push(selector.colors.map(color => COLOR_NAMES[color] ?? color).join(joiner))
}
if (selector.supertypes?.length) parts.push(...selector.supertypes)
if (selector.subtypes?.length) parts.push(selector.subtypes.join(' '))
if (selector.supertypes?.length) parts.push(selector.supertypes.join(joiner))
if (selector.subtypes?.length) parts.push(selector.subtypes.join(joiner))
if (selector.types?.length) {
parts.push(selector.types.join(selector.match === 'any' ? ' or ' : ' '))
}
@@ -281,7 +282,7 @@ export function formatEffect(effect: Effect): string {
case 'surveil':
return `surveil(${effect.player}, ${formatValue(effect.amount)})`
case 'search':
return `search(${effect.player}, ${formatSelector(effect.selector)}, ${formatValue(effect.amount)}, to ${effect.destination}${effect.zones?.length === 2 ? ', library+graveyard' : ''}${effect.tapped ? ', tapped' : ''}${effect.shuffle ? ', shuffle' : ''})`
return `search(${effect.player}, ${formatSelector(effect.selector)}, ${formatValue(effect.amount)}, to ${effect.destination}${effect.zones?.length === 2 ? ', library+graveyard' : ''}${effect.tapped ? ', tapped' : ''}${effect.split ? `, then ${effect.split.destination}${effect.split.tapped ? ' tapped' : ''}` : ''}${effect.shuffle ? ', shuffle' : ''})`
case 'shuffle':
return `shuffle(${effect.player})`
case 'add_mana':
@@ -329,6 +330,12 @@ export function formatEffect(effect: Effect): string {
return `schedule(${effect.when}):\n${indent(effect.effects.map(formatEffect).join('\n'))}`
case 'damage_divided':
return `damage_divided(${formatValue(effect.amount)}, ${formatTarget(effect.target)})`
case 'exile_graveyards':
return 'exile_graveyards()'
case 'hideaway':
return `hideaway(${formatValue(effect.amount)})`
case 'play_exiled':
return `play_exiled(${effect.player}${effect.free ? ', free' : ''})`
}
}
@@ -460,6 +467,16 @@ function formatCondition(condition: Condition): string {
return "you don't"
case 'otherwise':
return 'otherwise'
case 'you_control_commander':
return 'you control a commander'
case 'distinct_names':
return `you control ${condition.atLeast}+ ${formatSelector(condition.selector)} with different names`
case 'opponent_damaged_this_turn':
return `an opponent was dealt ${condition.atLeast}+ damage this turn`
case 'attacked_with_creatures':
return `you attacked with ${condition.atLeast}+ creatures this turn`
case 'library_at_most':
return `a library has ${condition.atMost} or fewer cards in it`
}
}
@@ -536,7 +553,13 @@ function formatStaticEffect(effect: StaticEffect): string {
case 'replacement':
return `replace(${effect.what}${effect.target ? `, ${formatTarget(effect.target)}` : ''}, instead ${effect.instead})`
case 'cost_reduction':
return `cost_reduction(${formatTarget(effect.target)}, ${formatValue(effect.amount)}${effect.condition ? `, if ${formatCondition(effect.condition)}` : ''})`
return `cost_reduction(${formatTarget(effect.target)}, ${effect.symbols ?? (effect.amount ? formatValue(effect.amount) : '0')}${effect.condition ? `, if ${formatCondition(effect.condition)}` : ''})`
case 'cost_increase':
return `cost_increase(${formatValue(effect.amount)}${effect.spellType ? `, ${effect.spellType}` : ''})`
case 'search_restriction':
return `search_restriction(${effect.who}, ${formatValue(effect.amount)})`
case 'exile_instead_of_graveyard':
return `exile_instead_of_graveyard(${effect.owner ?? ''})`
}
}
@@ -575,6 +598,12 @@ export function formatAbility(ability: Ability): string {
return `spell${ability.optional ? ' (may)' : ''}:\n${indent(ability.effects.map(formatEffect).join('\n'))}`
case 'additional_cost':
return `additional cost${ability.optional ? ' (may)' : ''}: ${ability.costs.map(formatCost).join(', ')}`
case 'alternative_cost': {
const condition = ability.condition ? ` if ${formatCondition(ability.condition)}` : ''
return `alternative cost${condition}: ${ability.costs.length ? ability.costs.map(formatCost).join(', ') : 'free'}`
}
case 'overload':
return `overload ${ability.cost}`
case 'chapter':
return `chapter ${ability.chapters.join(', ')}${ability.optional ? ' (may)' : ''}:\n${indent(ability.effects.map(formatEffect).join('\n'))}`
case 'level_band': {