mirror of
https://github.com/correl/mage.git
synced 2024-11-29 03:00:12 +00:00
[ALA] Finish fixing Death Baron and add test
This commit is contained in:
parent
ff5efb525a
commit
a48dedcd76
5 changed files with 77 additions and 9 deletions
|
@ -44,7 +44,7 @@ public final class DeathBaron extends CardImpl {
|
||||||
1, 1, Duration.WhileOnBattlefield, filter, false
|
1, 1, Duration.WhileOnBattlefield, filter, false
|
||||||
));
|
));
|
||||||
ability.addEffect(new GainAbilityControlledEffect(
|
ability.addEffect(new GainAbilityControlledEffect(
|
||||||
DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield, filter, true
|
DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield, filter
|
||||||
).setText("and have deathtouch"));
|
).setText("and have deathtouch"));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package org.mage.test.cards.single.ala;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.keyword.DeathtouchAbility;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author awjackson
|
||||||
|
*/
|
||||||
|
public class DeathBaronTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
private static final String baron = "Death Baron";
|
||||||
|
private static final String skeleton = "Drudge Skeletons";
|
||||||
|
private static final String zombie = "Scathe Zombies";
|
||||||
|
private static final String knight = "Black Knight";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDoesntNormallyAffectSelf() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, baron);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, skeleton);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, zombie);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, knight);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, skeleton);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, zombie);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
Ability deathtouch = DeathtouchAbility.getInstance();
|
||||||
|
|
||||||
|
// Death Baron doesn't normally affect itself
|
||||||
|
assertPowerToughness(playerA, baron, 2, 2);
|
||||||
|
assertAbility(playerA, baron, deathtouch, false);
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, skeleton, 2, 2);
|
||||||
|
assertPowerToughness(playerA, zombie, 3, 3);
|
||||||
|
assertPowerToughness(playerA, knight, 2, 2);
|
||||||
|
assertAbility(playerA, skeleton, deathtouch, true);
|
||||||
|
assertAbility(playerA, zombie, deathtouch, true);
|
||||||
|
assertAbility(playerA, knight, deathtouch, false);
|
||||||
|
|
||||||
|
assertPowerToughness(playerB, skeleton, 1, 1);
|
||||||
|
assertPowerToughness(playerB, zombie, 2, 2);
|
||||||
|
assertAbility(playerB, skeleton, deathtouch, false);
|
||||||
|
assertAbility(playerB, zombie, deathtouch, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBecomeSkeleton() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, baron);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Amoeboid Changeling");
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Target creature gains", baron);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// If you manage to turn it into a Skeleton, however, then it will give itself +1/+1 and deathtouch
|
||||||
|
assertPowerToughness(playerA, baron, 3, 3);
|
||||||
|
assertAbility(playerA, baron, DeathtouchAbility.getInstance(), true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -117,8 +117,9 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (perm.isControlledBy(source.getControllerId())
|
||||||
|
&& (!(excludeSource && perm.getId().equals(source.getSourceId())))) {
|
||||||
perm.addPower(power.calculate(game, source, this));
|
perm.addPower(power.calculate(game, source, this));
|
||||||
perm.addToughness(toughness.calculate(game, source, this));
|
perm.addToughness(toughness.calculate(game, source, this));
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,9 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (perm.isControlledBy(source.getControllerId())
|
||||||
|
&& !(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
for (Ability abilityToAdd : ability) {
|
for (Ability abilityToAdd : ability) {
|
||||||
perm.addAbility(abilityToAdd, source.getSourceId(), game);
|
perm.addAbility(abilityToAdd, source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
@ -149,5 +150,4 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
||||||
setText();
|
setText();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,8 +237,8 @@ public class Battlefield implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all {@link Permanent} on the battlefield that match the supplied
|
* Returns all {@link Permanent} on the battlefield that match the supplied
|
||||||
* filter. This method ignores the range of influence. It ignores controller
|
* filter. This method ignores the range of influence and ignores
|
||||||
* predicates
|
* ObjectSourcePlayer predicates in the filter (e.g. controller predicates)
|
||||||
*
|
*
|
||||||
* @param filter
|
* @param filter
|
||||||
* @param game
|
* @param game
|
||||||
|
@ -254,7 +254,8 @@ public class Battlefield implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all {@link Permanent} that match the filter and are controlled by
|
* Returns all {@link Permanent} that match the filter and are controlled by
|
||||||
* controllerId. This method ignores the range of influence.
|
* controllerId. This method ignores the range of influence and ignores
|
||||||
|
* ObjectSourcePlayer predicates in the filter
|
||||||
*
|
*
|
||||||
* @param filter
|
* @param filter
|
||||||
* @param controllerId
|
* @param controllerId
|
||||||
|
|
Loading…
Reference in a new issue