Fix Gratuitous Violence bug

This commit is contained in:
cg5 2016-08-29 20:10:01 +02:00
parent 2439b99031
commit 8cbffb3e69
2 changed files with 9 additions and 3 deletions

View file

@ -95,7 +95,9 @@ class GratuitousViolenceReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
return permanent != null && permanent.getControllerId().equals(source.getControllerId());
return permanent != null
&& permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(source.getControllerId());
}
@Override

View file

@ -11,7 +11,9 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*/
public class GratuitousViolenceTest extends CardTestPlayerBase {
@Test
public void testWorksOnCreatures() {
public void testDoublesDamageFromCreatures() {
// Enchantment: If a creature you control would deal damage to a creature
// or player, it deals double that damage to that creature or player instead.
addCard(Zone.BATTLEFIELD, playerA, "Gratuitous Violence");
addCard(Zone.BATTLEFIELD, playerA, "Elvish Visionary"); // 1/1
@ -24,8 +26,10 @@ public class GratuitousViolenceTest extends CardTestPlayerBase {
@Test
public void testIgnoresNonCreatures() {
addCard(Zone.BATTLEFIELD, playerA, "Gratuitous Violence");
// Legendary Enchantment - Shrine: At the beginning of your upkeep, Honden of Infinite
// Rage deals damage to target creature or player equal to the number of Shrines you control.
addCard(Zone.BATTLEFIELD, playerA, "Honden of Infinite Rage");
addCard(Zone.BATTLEFIELD, playerA, "Gratuitous Violence");
addTarget(playerA, playerB);