Merge pull request #179 from Northmoc/sncHoldForRansom

SNC: Hold for Ransom and support
This commit is contained in:
Paul Hammerton
2022-05-01 14:39:05 +01:00
committed by GitHub
3 changed files with 28 additions and 11 deletions

View File

@@ -1035,6 +1035,11 @@ public class AbilityUtils {
if (root != null) {
addPlayer(Lists.newArrayList(root), defined, players);
}
} else if (defined.startsWith("OriginalHost")) {
Card originalHost = sa.getOriginalHost();
if (originalHost != null) {
addPlayer(Lists.newArrayList(originalHost), defined, players);
}
}
else if (defined.startsWith("DelayTriggerRemembered") && sa instanceof SpellAbility) {
SpellAbility root = ((SpellAbility)sa).getRootAbility();

View File

@@ -1,5 +1,6 @@
package forge.game.ability.effects;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Maps;
@@ -18,25 +19,27 @@ import forge.game.card.CardZoneTable;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.Lang;
public class SacrificeAllEffect extends SpellAbilityEffect {
@Override
protected String getStackDescription(SpellAbility sa) {
// when getStackDesc is called, just build exactly what is happening
final StringBuilder sb = new StringBuilder();
/*
* This is not currently targeted ArrayList<Player> tgtPlayers;
*
* Target tgt = af.getAbTgt(); if (tgt != null) tgtPlayers =
* tgt.getTargetPlayers(); else tgtPlayers =
* AbilityFactory.getDefinedPlayers(sa.getHostCard(),
* sa.get("Defined"), sa);
*/
sb.append("Sacrifice permanents.");
if (sa.hasParam("Controller")) {
List<Player> conts = getDefinedPlayersOrTargeted(sa, "Controller");
sb.append(Lang.joinHomogenous(conts)).append(conts.size() == 1 ? " sacrifices " : " sacrifice ");
} else {
sb.append("Sacrifice ");
}
if (sa.hasParam("Defined")) {
List<Card> toSac = getDefinedCardsOrTargeted(sa);
sb.append(Lang.joinHomogenous(toSac)).append(".");
} else {
sb.append("permanents.");
}
return sb.toString();
}

View File

@@ -0,0 +1,9 @@
Name:Hold for Ransom
ManaCost:1 W
Types:Enchantment Aura
K:Enchant creature
A:SP$ Attach | ValidTgts$ Creature | AILogic$ Curse
S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CARDNAME can't attack or block. | AddAbility$ PayRansom | Description$ Enchanted creature can't attack or block and has "{7}: Hold for Ransom's controller sacrifices it and draws a card. Activate only as a sorcery."
SVar:PayRansom:AB$ SacrificeAll | Cost$ 7 | Defined$ OriginalHost | Controller$ OriginalHostController | SubAbility$ DBDraw | SorcerySpeed$ True | SpellDescription$ ORIGINALHOST's controller sacrifices it and draws a card. Activate only as a sorcery.
SVar:DBDraw:DB$ Draw | Defined$ OriginalHostController
Oracle:Enchant creature\nEnchanted creature can't attack or block and has "{7}: Hold for Ransom's controller sacrifices it and draws a card. Activate only as a sorcery."