radar / mtg

Magic: The Gathering, but in Ruby
63 stars 11 forks source link

Prowess Keyword Handler Bug #491

Closed jxc136 closed 1 year ago

jxc136 commented 1 year ago

Issue:

The Prowess effect is being triggered by any player's spell casts, it should only be on the creature's controller.

Steps to reproduce a Bug

Add a test where opposing player to owner casts a spell:


require 'spec_helper'

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

  subject! { ResolvePermanent("Jeskai Elder", owner: p1) }

  context "when opponent casts a non-creature spell " do
    before do
      p2.add_mana(white: 1, blue: 1)
      action = cast_action(player: p2, card: Card("Revitalize"))
        .pay_mana(white: 1, generic: { blue: 1 })
        .perform
      game.tick!
    end

  end
end

Expected Result

Power and toughness should remain unchanged.

it "has a regular power and toughness" do
      expect(subject.power).to eq(1)
      expect(subject.toughness).to eq(2)
    end

Actual Result

Keyword is triggered and creature is buffed.


subject.power # => 1 
subject.toughness # => 2
radar commented 1 year ago

Thanks! I've added a regression spec to Jeskai Elder and have fixed this one up now.