DMU: Defiler cycle and support

This commit is contained in:
Northmoc
2022-10-29 18:20:43 -04:00
parent f67fe035f5
commit a264344485
9 changed files with 112 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import com.google.common.collect.*;
import forge.game.card.*;
import forge.game.staticability.StaticAbility;
import forge.util.Aggregates;
import org.apache.commons.lang3.StringUtils;
@@ -446,6 +447,41 @@ public final class GameActionUtil {
game.getAction().checkStaticAbilities(false, Sets.newHashSet(source), preList);
}
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
if (!stAb.getParam("Mode").equals("OptionalCost") || stAb.isSuppressed() || !stAb.checkConditions()) {
continue;
}
if (!stAb.matchesValidParam("ValidCard", source)) {
continue;
}
if (!stAb.matchesValidParam("ValidSA", sa)) {
continue;
}
if (!stAb.matchesValidParam("Activator", sa.getActivatingPlayer())) {
continue;
}
final Cost cost = new Cost(stAb.getParam("Cost"), false);
if (stAb.hasParam("ReduceColor")) {
if (stAb.getParam("ReduceColor").equals("W")) {
costs.add(new OptionalCostValue(OptionalCost.ReduceW, cost));
} else if (stAb.getParam("ReduceColor").equals("U")) {
costs.add(new OptionalCostValue(OptionalCost.ReduceU, cost));
} else if (stAb.getParam("ReduceColor").equals("B")) {
costs.add(new OptionalCostValue(OptionalCost.ReduceB, cost));
} else if (stAb.getParam("ReduceColor").equals("R")) {
costs.add(new OptionalCostValue(OptionalCost.ReduceR, cost));
} else if (stAb.getParam("ReduceColor").equals("G")) {
costs.add(new OptionalCostValue(OptionalCost.ReduceG, cost));
}
} else {
costs.add(new OptionalCostValue(OptionalCost.AltCost, cost));
}
}
}
for (KeywordInterface inst : source.getKeywords()) {
final String keyword = inst.getOriginal();
if (keyword.startsWith("Buyback")) {

View File

@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import forge.game.spellability.OptionalCost;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Strings;
@@ -208,6 +209,22 @@ public class CostAdjustment {
// need to reduce generic extra because of 2 hybrid mana
cost.decreaseGenericMana(sumGeneric);
if (sa.isSpell() && sa.isOptionalCostPaid(OptionalCost.ReduceW)) {
cost.decreaseShard(ManaCostShard.parseNonGeneric("W"), 1);
}
if (sa.isSpell() && sa.isOptionalCostPaid(OptionalCost.ReduceU)) {
cost.decreaseShard(ManaCostShard.parseNonGeneric("U"), 1);
}
if (sa.isSpell() && sa.isOptionalCostPaid(OptionalCost.ReduceB)) {
cost.decreaseShard(ManaCostShard.parseNonGeneric("B"), 1);
}
if (sa.isSpell() && sa.isOptionalCostPaid(OptionalCost.ReduceR)) {
cost.decreaseShard(ManaCostShard.parseNonGeneric("R"), 1);
}
if (sa.isSpell() && sa.isOptionalCostPaid(OptionalCost.ReduceG)) {
cost.decreaseShard(ManaCostShard.parseNonGeneric("G"), 1);
}
if (sa.isSpell() && sa.isOffering()) { // cost reduction from offerings
adjustCostByOffering(cost, sa);
}

View File

@@ -11,6 +11,11 @@ public enum OptionalCost {
Kicker2("Kicker"),
Retrace("Retrace"),
Jumpstart("Jump-start"),
ReduceW("(to reduce white mana)"),
ReduceU("(to reduce blue mana)"),
ReduceB("(to reduce black mana)"),
ReduceR("(to reduce red mana)"),
ReduceG("(to reduce green mana)"),
AltCost(""),
Flash("Flash"), // used for Pay Extra for Flash
Generic("Generic"); // used by "Dragon Presence" and pseudo-kicker cards

View File

@@ -51,11 +51,12 @@ public class OptionalCostValue implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (type != OptionalCost.Generic) {
if (type != OptionalCost.Generic && !type.getName().startsWith("(to reduce")) {
sb.append(type.getName());
sb.append(" ");
}
sb.append(cost.toSimpleString());
sb.append(type.getName().startsWith("(to reduce") ? " " + type.getName() : "");
return sb.toString();
}
}

View File

@@ -0,0 +1,10 @@
Name:Defiler of Dreams
ManaCost:3 U U
Types:Creature Phyrexian Sphinx
PT:4/3
K:Flying
S:Mode$ OptionalCost | ValidCard$ Permanent.Blue | ValidSA$ Spell | Activator$ You | Cost$ PayLife<2> | ReduceColor$ U | Description$ As an additional cost to cast blue permanent spells, you may pay 2 life. Those spells cost {U} less to cast if you paid life this way. This effect reduces only the amount of blue mana you pay.
T:Mode$ SpellCast | ValidCard$ Permanent.Blue | ValidActivatingPlayer$ You | Execute$ TrigDraw | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a blue permanent spell, draw a card.
SVar:TrigDraw:DB$ Draw
SVar:BuffedBy:Permanent.Blue
Oracle:Flying\nAs an additional cost to cast blue permanent spells, you may pay 2 life. Those spells cost {U} less to cast if you paid life this way. This effect reduces only the amount of blue mana you pay.\nWhenever you cast a blue permanent spell, draw a card.

View File

@@ -0,0 +1,11 @@
Name:Defiler of Faith
ManaCost:3 W W
Types:Creature Phyrexian Human
PT:5/5
K:Vigilance
S:Mode$ OptionalCost | ValidCard$ Permanent.White | ValidSA$ Spell | Activator$ You | Cost$ PayLife<2> | ReduceColor$ W | Description$ As an additional cost to cast white permanent spells, you may pay 2 life. Those spells cost {W} less to cast if you paid life this way. This effect reduces only the amount of white mana you pay.
T:Mode$ SpellCast | ValidCard$ Permanent.White | ValidActivatingPlayer$ You | Execute$ TrigToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a white permanent spell, create a 1/1 white Soldier creature token.
SVar:TrigToken:DB$ Token | TokenScript$ w_1_1_soldier
DeckHas:Ability$Token & Type$Soldier
SVar:BuffedBy:Permanent.White
Oracle:Vigilance\nAs an additional cost to cast white permanent spells, you may pay 2 life. Those spells cost {W} less to cast if you paid life this way. This effect reduces only the amount of white mana you pay.\nWhenever you cast a white permanent spell, create a 1/1 white Soldier creature token.

View File

@@ -0,0 +1,10 @@
Name:Defiler of Flesh
ManaCost:2 B B
Types:Creature Phyrexian Horror
PT:4/4
K:Menace
S:Mode$ OptionalCost | ValidCard$ Permanent.Black | ValidSA$ Spell | Activator$ You | Cost$ PayLife<2> | ReduceColor$ B | Description$ As an additional cost to cast black permanent spells, you may pay 2 life. Those spells cost {B} less to cast if you paid life this way. This effect reduces only the amount of black mana you pay.
T:Mode$ SpellCast | ValidCard$ Permanent.Black | ValidActivatingPlayer$ You | Execute$ TrigPump | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a black permanent spell, target creature you control gets +1/+1 and gains menace until end of turn.
SVar:TrigPump:DB$ Pump | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | NumAtt$ 1 | NumDef$ 1 | KW$ Menace
SVar:BuffedBy:Permanent.Black
Oracle:Menace\nAs an additional cost to cast black permanent spells, you may pay 2 life. Those spells cost {B} less to cast if you paid life this way. This effect reduces only the amount of black mana you pay.\nWhenever you cast a black permanent spell, target creature you control gets +1/+1 and gains menace until end of turn.

View File

@@ -0,0 +1,10 @@
Name:Defiler of Instinct
ManaCost:2 R R
Types:Creature Phyrexian Kavu
PT:4/4
K:First Strike
S:Mode$ OptionalCost | ValidCard$ Permanent.Red | ValidSA$ Spell | Activator$ You | Cost$ PayLife<2> | ReduceColor$ R | Description$ As an additional cost to cast red permanent spells, you may pay 2 life. Those spells cost {R} less to cast if you paid life this way. This effect reduces only the amount of red mana you pay.
T:Mode$ SpellCast | ValidCard$ Permanent.Red | ValidActivatingPlayer$ You | Execute$ TrigDamage | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a red permanent spell, CARDNAME deals 1 damage to any target.
SVar:TrigDamage:DB$ DealDamage | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ 1
SVar:BuffedBy:Permanent.Red
Oracle:First strike\nAs an additional cost to cast red permanent spells, you may pay 2 life. Those spells cost {R} less to cast if you paid life this way. This effect reduces only the amount of red mana you pay.\nWhenever you cast a red permanent spell, Defiler of Instinct deals 1 damage to any target.

View File

@@ -0,0 +1,11 @@
Name:Defiler of Vigor
ManaCost:3 G G
Types:Creature Phyrexian Wurm
PT:6/6
K:Trample
S:Mode$ OptionalCost | ValidCard$ Permanent.Green | ValidSA$ Spell | Activator$ You | Cost$ PayLife<2> | ReduceColor$ G | Description$ As an additional cost to cast green permanent spells, you may pay 2 life. Those spells cost {G} less to cast if you paid life this way. This effect reduces only the amount of green mana you pay.
T:Mode$ SpellCast | ValidCard$ Permanent.Green | ValidActivatingPlayer$ You | Execute$ TrigCounters | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a green permanent spell, put a +1/+1 counter on each creature you control.
SVar:TrigCounters:DB$ PutCounterAll | ValidCards$ Creature.YouCtrl | CounterType$ P1P1
DeckHas:Ability$Counters
SVar:BuffedBy:Permanent.Green
Oracle:Trample\nAs an additional cost to cast green permanent spells, you may pay 2 life. Those spells cost {G} less to cast if you paid life this way. This effect reduces only the amount of green mana you pay.\nWhenever you cast a green permanent spell, put a +1/+1 counter on each creature you control.