-
-
Notifications
You must be signed in to change notification settings - Fork 32
Card Specification
Vincent Cunningham edited this page Jun 11, 2020
·
6 revisions
Cards are specified using a custom tailored Groovy DSL syntax.
basic (this, hp:HP080, type:WATER, retreatCost:2) {
weakness GRASS, X2
resistance FIRE, MINUS20
bwAbility "Ability Name", {
text "Ability description"
// any actionA, delayedA, getterA, onActivate, onDeactivate clauses
}
move "Move Name", {
text "Move description. IMPORTANT: If the move has any damage text like 20, prepend it to text as: 20 damage."
energyCost P, C, C
attackRequirement { //check for requirements with assert clause
}
onAttack { //main attack phase, attack is now happening
damage 20
afterDamage { //this clause runs after damages are applied, many effects go here
}
}
}
evolution (this, from: "...", ...) { // all other properties are same as basic
}
Example:
case DUSCLOPS_52:
return evolution (this, from:"Duskull", hp:HP090, type:PSYCHIC, retreatCost:3) {
weakness DARKNESS
resistance FIGHTING, MINUS20
move "Night Roam", {
text "Put 1 damage counter on each Pokémon in play (both yours and your opponent's)."
energyCost P
onAttack {
all.each {
directDamage 10, it
}
}
}
move "Ambush", {
text "30+ damage. Flip a coin. If heads, this attack does 30 more damage."
energyCost P, C, C
onAttack {
damage 30
flip{damage 30}
}
}
};
It starts with either basicTrainer
or supporter
or itemCard
.
supporter (this) {
text "Card text"
onPlay {
// on play effect(s)
}
playRequirement{
// assertions
}
};
They stay attached to a pokemon, so they work a bit differently.
pokemonTool (this) {
text "Card text"
onPlay { reason->
// activation effects, self denotes the pokemon, reason is the activation reason of the card
}
onRemoveFromPlay {
// run when the card is being removed from the battleground, use it for unregistering delayed effects, etc
}
allowAttach { pcs->
// (optional) use it to restrict the card to be attached to some specific pokemon, return boolean
// example: pcs.pokemonEX would only allow this card to be attached to EX pokemon.
}
}
basicEnergy (this, GRASS)
Required closures: onPlay
, onRemoveFromPlay
Optional closures: onMove
, getEnergyTypesOverride
Optional list: typeImagesOverride
Example:
specialEnergy (this, [[C]]) {
text "Prism Energy provides [C] Energy. If the Pokémon Prism Energy is attached to is a Basic Pokémon, Prism Energy provides every type of Energy but provides only 1 Energy at a time. (Doesn't count as a basic Energy card.)"
typeImagesOverride = (self==null || self.evolution) ? [C] : [RAINBOW] // (optional) Override the displayed type images
onPlay {reason->
// activation effects, self denotes the pokemon, reason is the activation reason of the card
}
onRemoveFromPlay {
// run when the card is being removed from the battleground, use it for unregistering delayed
}
onMove {to->
// (optional) run when the card is being moved to a different pokemon.
// use to adjust some effects or discard if needed.
}
allowAttach {to->
// (optional) run when attempting to attach to a pokemon.
// use to only allow attachments if certain conditions are met.
}
getEnergyTypesOverride {
// (optional) hard override for the provided energy types.
// use it for energy cards whose energy output can dynamically change
// (such as prism energy only activates while it is attached to a basic pokemon)
if(self==null || self.evolution)
return [[C] as Set]
else
return [[W, G, D, M, F, R, P, L, Y] as Set]
}
};