mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merieke Ri Berit: use Effect for Destroy Trigger
This commit is contained in:
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.GameCommand;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameEntity;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
@@ -18,7 +17,6 @@ import forge.game.combat.Combat;
|
||||
import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.event.GameEventCombatChanged;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.Ability;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.collect.FCollectionView;
|
||||
@@ -26,9 +24,7 @@ import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
public class ControlGainEffect extends SpellAbilityEffect {
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.abilityfactory.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected String getStackDescription(SpellAbility sa) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
@@ -86,11 +82,9 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
|
||||
final boolean bUntap = sa.hasParam("Untap");
|
||||
final boolean bTapOnLose = sa.hasParam("TapOnLose");
|
||||
final boolean bNoRegen = sa.hasParam("NoRegen");
|
||||
final boolean remember = sa.hasParam("RememberControlled");
|
||||
final boolean forget = sa.hasParam("ForgetControlled");
|
||||
final boolean attacking = sa.hasParam("Attacking");
|
||||
final List<String> destroyOn = sa.hasParam("DestroyTgt") ? Arrays.asList(sa.getParam("DestroyTgt").split(",")) : null;
|
||||
final List<String> keywords = sa.hasParam("AddKWs") ? Arrays.asList(sa.getParam("AddKWs").split(" & ")) : null;
|
||||
final List<String> lose = sa.hasParam("LoseControl") ? Arrays.asList(sa.getParam("LoseControl").split(",")) : null;
|
||||
|
||||
@@ -191,18 +185,6 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (destroyOn != null) {
|
||||
if (destroyOn.contains("LeavesPlay")) {
|
||||
sa.getHostCard().addLeavesPlayCommand(getDestroyCommand(tgtC, source, bNoRegen));
|
||||
}
|
||||
if (destroyOn.contains("Untap")) {
|
||||
sa.getHostCard().addUntapCommand(getDestroyCommand(tgtC, source, bNoRegen));
|
||||
}
|
||||
if (destroyOn.contains("LoseControl")) {
|
||||
sa.getHostCard().addChangeControllerCommand(getDestroyCommand(tgtC, source, bNoRegen));
|
||||
}
|
||||
}
|
||||
|
||||
if (keywords != null) {
|
||||
// Add keywords only until end of turn
|
||||
final GameCommand untilKeywordEOT = new GameCommand() {
|
||||
@@ -243,43 +225,6 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
} // end foreach target
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getDestroyCommand.
|
||||
* </p>
|
||||
*
|
||||
* @param i
|
||||
* a int.
|
||||
* @return a {@link forge.GameCommand} object.
|
||||
*/
|
||||
private static GameCommand getDestroyCommand(final Card c, final Card hostCard, final boolean bNoRegen) {
|
||||
final GameCommand destroy = new GameCommand() {
|
||||
private static final long serialVersionUID = 878543373519872418L;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Game game = hostCard.getGame();
|
||||
final Ability ability = new Ability(hostCard, ManaCost.ZERO) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
game.getAction().destroy(c, null, !bNoRegen, null);
|
||||
}
|
||||
};
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(hostCard).append(" - destroy ").append(c.getName()).append(".");
|
||||
if (bNoRegen) {
|
||||
sb.append(" It can't be regenerated.");
|
||||
}
|
||||
ability.setStackDescription(sb.toString());
|
||||
ability.setTrigger(true);
|
||||
|
||||
game.getStack().addSimultaneousStackEntry(ability);
|
||||
}
|
||||
|
||||
};
|
||||
return destroy;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getLoseControlCommand.
|
||||
|
||||
Reference in New Issue
Block a user