mirror of
https://github.com/correl/mage.git
synced 2025-01-14 03:00:10 +00:00
[KHM] improved Tergrid, God of Fright: ask steps info, AI support;
This commit is contained in:
parent
e5863eb99f
commit
8f4d3d9673
1 changed files with 27 additions and 21 deletions
|
@ -1,14 +1,9 @@
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.ModalDoubleFacesCard;
|
|
||||||
import mage.constants.*;
|
|
||||||
import mage.game.Game;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
@ -16,7 +11,11 @@ import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.UntapSourceEffect;
|
import mage.abilities.effects.common.UntapSourceEffect;
|
||||||
import mage.abilities.keyword.MenaceAbility;
|
import mage.abilities.keyword.MenaceAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.cards.ModalDoubleFacesCard;
|
||||||
|
import mage.constants.*;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentToken;
|
import mage.game.permanent.PermanentToken;
|
||||||
|
@ -26,6 +25,8 @@ import mage.target.TargetPlayer;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
|
@ -54,14 +55,14 @@ public final class TergridGodOfFright extends ModalDoubleFacesCard {
|
||||||
// Legendary Artifact
|
// Legendary Artifact
|
||||||
this.getRightHalfCard().addSuperType(SuperType.LEGENDARY);
|
this.getRightHalfCard().addSuperType(SuperType.LEGENDARY);
|
||||||
|
|
||||||
// Tap: Target player loses 3 life unless they sacrifice a nonland permanent or discard a card.
|
// {T}: Target player loses 3 life unless they sacrifice a nonland permanent or discard a card.
|
||||||
Ability tergridsLaternActivatedAbility = new SimpleActivatedAbility(
|
Ability tergridsLaternActivatedAbility = new SimpleActivatedAbility(
|
||||||
new TergridsLaternEffect(), new TapSourceCost()
|
new TergridsLaternEffect(), new TapSourceCost()
|
||||||
);
|
);
|
||||||
tergridsLaternActivatedAbility.addTarget(new TargetPlayer());
|
tergridsLaternActivatedAbility.addTarget(new TargetPlayer());
|
||||||
this.getRightHalfCard().addAbility(tergridsLaternActivatedAbility);
|
this.getRightHalfCard().addAbility(tergridsLaternActivatedAbility);
|
||||||
|
|
||||||
// 3{B}: Untap Tergrid’s Lantern.
|
// {3}{B}: Untap Tergrid’s Lantern.
|
||||||
this.getRightHalfCard().addAbility(new SimpleActivatedAbility(new UntapSourceEffect(), new ManaCostsImpl("{3}{B}")));
|
this.getRightHalfCard().addAbility(new SimpleActivatedAbility(new UntapSourceEffect(), new ManaCostsImpl("{3}{B}")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,7 @@ class TergridGodOfFrightTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
private static final String RULE_TEXT = "Whenever an opponent sacrifices a nontoken permanent or discards a permanent card, you may put that card from a graveyard onto the battlefield under your control";
|
private static final String RULE_TEXT = "Whenever an opponent sacrifices a nontoken permanent or discards a permanent card, you may put that card from a graveyard onto the battlefield under your control";
|
||||||
|
|
||||||
public TergridGodOfFrightTriggeredAbility() {
|
public TergridGodOfFrightTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new TergridGodOfFrightEffect());
|
super(Zone.BATTLEFIELD, new TergridGodOfFrightEffect(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TergridGodOfFrightTriggeredAbility(final TergridGodOfFrightTriggeredAbility ability) {
|
public TergridGodOfFrightTriggeredAbility(final TergridGodOfFrightTriggeredAbility ability) {
|
||||||
|
@ -110,7 +111,7 @@ class TergridGodOfFrightTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
&& !(permanent instanceof PermanentToken)
|
&& !(permanent instanceof PermanentToken)
|
||||||
&& game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
&& game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(((Card) permanent).getId(), game));
|
effect.setTargetPointer(new FixedTarget(permanent.getId(), game));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -184,10 +185,17 @@ class TergridsLaternEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetedPlayer = game.getPlayer(source.getTargets().getFirstTarget());
|
Player targetedPlayer = game.getPlayer(source.getTargets().getFirstTarget());
|
||||||
if (targetedPlayer != null
|
if (targetedPlayer == null) {
|
||||||
&& targetedPlayer.chooseUse(Outcome.Neutral, "Do you wish to sacrifice a nonland permanent to prevent the loss of 3 life?", source, game)) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AI hint to discard/sacrifice before die
|
||||||
|
Outcome aiOutcome = (targetedPlayer.getLife() <= 3 * 2) ? Outcome.Benefit : Outcome.Detriment;
|
||||||
|
|
||||||
|
if (targetedPlayer.chooseUse(aiOutcome, "Question 1 of 2: do you wish to sacrifice a nonland permanent to prevent the loss of 3 life?", source, game)) {
|
||||||
TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND);
|
TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND);
|
||||||
if (targetedPlayer.choose(Outcome.Detriment, target, source.getSourceId(), game)) {
|
target.setNotTarget(true);
|
||||||
|
if (targetedPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
|
||||||
Permanent chosenLand = game.getPermanent(target.getFirstTarget());
|
Permanent chosenLand = game.getPermanent(target.getFirstTarget());
|
||||||
if (chosenLand != null) {
|
if (chosenLand != null) {
|
||||||
if (chosenLand.sacrifice(source, game)) {
|
if (chosenLand.sacrifice(source, game)) {
|
||||||
|
@ -196,10 +204,10 @@ class TergridsLaternEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (targetedPlayer != null
|
|
||||||
&& targetedPlayer.chooseUse(Outcome.Neutral, "Do you wish to discard a card to prevent the loss of 3 life?", source, game)) {
|
if (targetedPlayer.chooseUse(aiOutcome, "Question 2 of 2: do you wish to discard a card to prevent the loss of 3 life?", source, game)) {
|
||||||
TargetCardInHand targetCard = new TargetCardInHand();
|
TargetCardInHand targetCard = new TargetCardInHand();
|
||||||
if (targetedPlayer.chooseTarget(Outcome.Detriment, targetCard, source, game)) {
|
if (targetedPlayer.chooseTarget(Outcome.Discard, targetCard, source, game)) {
|
||||||
Card chosenCard = game.getCard(targetCard.getFirstTarget());
|
Card chosenCard = game.getCard(targetCard.getFirstTarget());
|
||||||
if (chosenCard != null) {
|
if (chosenCard != null) {
|
||||||
if (targetedPlayer.discard(chosenCard, false, source, game)) {
|
if (targetedPlayer.discard(chosenCard, false, source, game)) {
|
||||||
|
@ -208,10 +216,8 @@ class TergridsLaternEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (targetedPlayer != null) {
|
|
||||||
targetedPlayer.loseLife(3, game, source, false);
|
targetedPlayer.loseLife(3, game, source, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue