Skip to content

Commit

Permalink
Add Eiodolon of Blossoms
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Nov 9, 2024
1 parent ee98eb0 commit 26cf92e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
29 changes: 29 additions & 0 deletions lib/magic/cards/eidolon_of_blossoms.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module Magic
module Cards
EidolonOfBlossoms = Creature("Eidolon of Blossoms") do
enchantment_creature_type "Spirit"
cost generic: 2, green: 2
power 2
toughness 2
end

class EidolonOfBlossoms < Creature
class LifeGain < TriggeredAbility::EnterTheBattlefield
def should_perform?
enchantment? && under_your_control?
end

def call
actor.trigger_effect(:draw)
end
end

def event_handlers
{
# Whenever this or another enchantment you control enters, draw a card.
Events::EnteredTheBattlefield => LifeGain
}
end
end
end
end
2 changes: 1 addition & 1 deletion lib/magic/cards/shared/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def trigger_effect(effect, source: self, **args)
game.add_effect(Effects::DealDamage.new(source: source, **args))
when :destroy_target
game.add_effect(Effects::DestroyTarget.new(source: source, **args))
when :draw_cards
when :draw_cards, :draw_card, :draw
game.add_effect(Effects::DrawCards.new(source: source, **args))
when :exile
if args[:target].is_a?(Permanent)
Expand Down
4 changes: 4 additions & 0 deletions lib/magic/cards/shared/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def artifact_creature_type(types)
set_types(T::Artifact, T::Creature, *creature_types(types))
end

def enchantment_creature_type(types)
set_types(T::Enchantment, T::Creature, *creature_types(types))
end

def legendary_creature_type(types)
set_types(T::Legendary, T::Creature, *creature_types(types))
end
Expand Down
37 changes: 37 additions & 0 deletions spec/cards/eidolon_of_blossoms_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
require "spec_helper"

RSpec.describe Magic::Cards::EidolonOfBlossoms do
include_context "two player game"

context "when it enters" do
subject { Card("Eidolon of Blossoms") }

it "draws a card" do
expect(p1).to receive(:draw!)

p1.add_mana(green: 4)
p1.cast(card: subject) do
_1.auto_pay_mana
end

game.stack.resolve!
end
end

context "when its already on the field and another enchantment enters" do
let(:nine_lives) { Card("Nine Lives") }

subject! { ResolvePermanent("Eidolon of Blossoms") }

it "draws a card" do
expect(p1).to receive(:draw!)

p1.add_mana(white: 3)
p1.cast(card: nine_lives) do
_1.auto_pay_mana
end

game.stack.resolve!
end
end
end

0 comments on commit 26cf92e

Please sign in to comment.