Skip to content

Instantly share code, notes, and snippets.

@pilaf
Created May 16, 2017 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pilaf/612ac693c5bb62d0f586b449f36868b3 to your computer and use it in GitHub Desktop.
Save pilaf/612ac693c5bb62d0f586b449f36868b3 to your computer and use it in GitHub Desktop.
DSL brainstorming for Magic implementation in Ruby
class AbandonHope < Magic::Card
# short for:
# name "Abandon Hope"
# cost "{X}{1}{B}"
head "Abandon Hope", "{X}{1}{B}"
# short for `type :sorcery`
sorcery
text "As an additional cost to cast :name, discard X cards",
"Look at target opponent's hand and choose X cards from it. That player discards those cards."
additional_cost do |spell|
spell.owner.discard spell.cost.x
end
effect do |spell|
end
end
class LizardWarrior < Magic::Card
head "Lizard Warrior", "{3}{R}"
# short for `type :creature, "Lizard Warrior"`
creature "Lizard Warrior"
strength_and_toughness 4, 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment