mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
* Gratuitous Violence - FIxed that if the damage of a creature with lifelink was doubeled only the non doubled amount was added to life.
This commit is contained in:
parent
88eeb2e0e1
commit
899046cf16
3 changed files with 106 additions and 9 deletions
|
@ -25,19 +25,17 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.cards.o;
|
package mage.cards.o;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.LandfallAbility;
|
import mage.abilities.common.LandfallAbility;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
|
||||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||||
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
@ -55,6 +53,8 @@ public class ObNixilisTheFallen extends CardImpl {
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Landfall - Whenever a land enters the battlefield under your control, you may have target player lose 3 life.
|
||||||
|
// If you do, put three +1/+1 counters on Ob Nixilis, the Fallen.
|
||||||
Ability ability = new LandfallAbility(new LoseLifeTargetEffect(3), true);
|
Ability ability = new LandfallAbility(new LoseLifeTargetEffect(3), true);
|
||||||
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)));
|
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)));
|
||||||
ability.addTarget(new TargetPlayer());
|
ability.addTarget(new TargetPlayer());
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package org.mage.test.cards.replacement;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class DamageEffectsTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just encountered another bug. With Wurmcoil Engine out and with a
|
||||||
|
* Gratuitous Violence on the field, I only gained 6 life on blocking rather
|
||||||
|
* than 12 life.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDamageIsDoubledWithLifelink() {
|
||||||
|
// Landfall - Whenever a land enters the battlefield under your control, you may have target player lose 3 life.
|
||||||
|
// If you do, put three +1/+1 counters on Ob Nixilis, the Fallen.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Ob Nixilis, the Fallen");
|
||||||
|
addCard(Zone.HAND, playerB, "Mountain");
|
||||||
|
|
||||||
|
// Deathtouch, lifelink
|
||||||
|
// When Wurmcoil Engine dies, create a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Wurmcoil Engine");
|
||||||
|
// 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");
|
||||||
|
|
||||||
|
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Mountain");
|
||||||
|
setChoice(playerB, "Yes");
|
||||||
|
addTarget(playerB, playerA);
|
||||||
|
|
||||||
|
attack(2, playerB, "Ob Nixilis, the Fallen");
|
||||||
|
block(2, playerA, "Wurmcoil Engine", "Ob Nixilis, the Fallen");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerB, "Ob Nixilis, the Fallen", 1);
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Wurmcoil Engine", 1);
|
||||||
|
assertPermanentCount(playerA, "Wurm", 2);
|
||||||
|
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
assertLife(playerA, 29); // -2 from Ob Nixilis + 12 from double damage with lifelink from Wurmcoil Engine
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDamageToPlayer() {
|
||||||
|
// Deathtouch, lifelink
|
||||||
|
// When Wurmcoil Engine dies, create a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Wurmcoil Engine");
|
||||||
|
// 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");
|
||||||
|
|
||||||
|
attack(1, playerA, "Wurmcoil Engine");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Wurmcoil Engine", 1);
|
||||||
|
|
||||||
|
assertLife(playerB, 8);
|
||||||
|
assertLife(playerA, 32);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,7 +28,6 @@
|
||||||
package mage.game.permanent;
|
package mage.game.permanent;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
@ -751,7 +750,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
if (source != null && sourceAbilities != null) {
|
if (source != null && sourceAbilities != null) {
|
||||||
if (sourceAbilities.containsKey(LifelinkAbility.getInstance().getId())) {
|
if (sourceAbilities.containsKey(LifelinkAbility.getInstance().getId())) {
|
||||||
Player player = game.getPlayer(sourceControllerId);
|
Player player = game.getPlayer(sourceControllerId);
|
||||||
player.gainLife(damageAmount, game);
|
player.gainLife(damageDone, game);
|
||||||
}
|
}
|
||||||
if (sourceAbilities.containsKey(DeathtouchAbility.getInstance().getId())) {
|
if (sourceAbilities.containsKey(DeathtouchAbility.getInstance().getId())) {
|
||||||
deathtouched = true;
|
deathtouched = true;
|
||||||
|
|
Loading…
Reference in a new issue