mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
rework MayhemLandAbility to work properly
This commit is contained in:
parent
37ade28c31
commit
d98d59cc55
3 changed files with 92 additions and 32 deletions
|
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
||||||
public final class OscorpIndustries extends CardImpl {
|
public final class OscorpIndustries extends CardImpl {
|
||||||
|
|
||||||
public OscorpIndustries(UUID ownerId, CardSetInfo setInfo) {
|
public OscorpIndustries(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
|
||||||
|
|
||||||
|
|
||||||
// This land enters tapped.
|
// This land enters tapped.
|
||||||
|
|
@ -35,7 +35,7 @@ public final class OscorpIndustries extends CardImpl {
|
||||||
this.addAbility(new RedManaAbility());
|
this.addAbility(new RedManaAbility());
|
||||||
|
|
||||||
// Mayhem
|
// Mayhem
|
||||||
this.addAbility(new MayhemLandAbility(this));
|
this.addAbility(new MayhemLandAbility());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class OscorpIndustriesTest extends CardTestPlayerBase {
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw");
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw");
|
||||||
setChoice(playerA, oscorpIndustries);
|
setChoice(playerA, oscorpIndustries);
|
||||||
|
|
||||||
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, oscorpIndustries + " with Mayhem");
|
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, oscorpIndustries);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
@ -49,4 +49,56 @@ public class OscorpIndustriesTest extends CardTestPlayerBase {
|
||||||
assertLife(playerA, 20 - 2);
|
assertLife(playerA, 20 - 2);
|
||||||
assertPermanentCount(playerA, oscorpIndustries, 1);
|
assertPermanentCount(playerA, oscorpIndustries, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOscorpIndustriesNoMayhem() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.HAND, playerA, oscorpIndustries);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, thoughtCourier);
|
||||||
|
|
||||||
|
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, oscorpIndustries);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertPermanentCount(playerA, oscorpIndustries, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCantPlayWithoutDiscard() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, oscorpIndustries);
|
||||||
|
|
||||||
|
checkPlayableAbility("Can't play without discard", 1, PhaseStep.PRECOMBAT_MAIN, playerA,
|
||||||
|
"Play " + oscorpIndustries, false);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertPermanentCount(playerA, oscorpIndustries, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOscorpIndustriesNextTurn() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.HAND, playerA, oscorpIndustries);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, thoughtCourier);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw");
|
||||||
|
setChoice(playerA, oscorpIndustries);
|
||||||
|
|
||||||
|
checkPlayableAbility("Can't play without discard", 3, PhaseStep.PRECOMBAT_MAIN, playerA,
|
||||||
|
"Play " + oscorpIndustries, false);
|
||||||
|
|
||||||
|
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertPermanentCount(playerA, oscorpIndustries, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.MageIdentifier;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.PlayLandAbility;
|
import mage.abilities.StaticAbility;
|
||||||
import mage.cards.Card;
|
import mage.abilities.effects.AsThoughEffect;
|
||||||
import mage.constants.Zone;
|
import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
|
import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class MayhemLandAbility extends PlayLandAbility {
|
public class MayhemLandAbility extends StaticAbility {
|
||||||
|
|
||||||
private final String rule;
|
private final String rule;
|
||||||
|
|
||||||
public MayhemLandAbility(Card card) {
|
public MayhemLandAbility() {
|
||||||
super(card.getName());
|
super(AbilityType.STATIC, Zone.GRAVEYARD);
|
||||||
this.zone = Zone.GRAVEYARD;
|
|
||||||
this.newId();
|
this.newId();
|
||||||
this.name += " with Mayhem";
|
this.addEffect(new MayhemPlayEffect());
|
||||||
this.addWatcher(new MayhemWatcher());
|
this.addWatcher(new MayhemWatcher());
|
||||||
this.setRuleAtTheTop(true);
|
this.setRuleAtTheTop(true);
|
||||||
this.rule = "Mayhem " +
|
this.rule = "Mayhem " +
|
||||||
|
|
@ -30,24 +29,6 @@ public class MayhemLandAbility extends PlayLandAbility {
|
||||||
this.rule = ability.rule;
|
this.rule = ability.rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
|
||||||
if (!Zone.GRAVEYARD.match(game.getState().getZone(getSourceId()))
|
|
||||||
|| !MayhemWatcher.checkCard(getSourceId(), game)) {
|
|
||||||
return ActivationStatus.getFalse();
|
|
||||||
}
|
|
||||||
return super.canActivate(playerId, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean activate(Game game, Set<MageIdentifier> allowedIdentifiers, boolean noMana) {
|
|
||||||
if (!super.activate(game, allowedIdentifiers, noMana)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.setCostsTag(MayhemAbility.MAYHEM_ACTIVATION_VALUE_KEY, null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MayhemLandAbility copy() {
|
public MayhemLandAbility copy() {
|
||||||
return new MayhemLandAbility(this);
|
return new MayhemLandAbility(this);
|
||||||
|
|
@ -57,4 +38,31 @@ public class MayhemLandAbility extends PlayLandAbility {
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MayhemPlayEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
|
public MayhemPlayEffect() {
|
||||||
|
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileInGraveyard, Outcome.Neutral);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MayhemPlayEffect(final MayhemPlayEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
return Zone.GRAVEYARD.match(game.getState().getZone(sourceId))
|
||||||
|
&& MayhemWatcher.checkCard(sourceId, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsThoughEffect copy() {
|
||||||
|
return new MayhemPlayEffect(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue