K'rrik and his phyrexian like ability

This commit is contained in:
Hans Mackowiak
2019-08-17 10:43:53 +00:00
committed by swordshine
parent ea552253ef
commit b554198a96
4 changed files with 80 additions and 9 deletions

View File

@@ -707,4 +707,13 @@ public class ManaCostBeingPaid {
} }
return result; return result;
} }
public boolean hasAnyKind(int kind) {
for (ManaCostShard s : unpaidShards.keySet()) {
if (s.isOfKind(kind)) {
return true;
}
}
return false;
}
} }

View File

@@ -0,0 +1,10 @@
Name:K'rrik, Son of Yawgmoth
ManaCost:4 B/P B/P B/P
Types:Legendary Creature Horror Minion
PT:2/2
K:Lifelink
S:Mode$ Continuous | Affected$ You | AddKeyword$ PayLifeInsteadOf:B | Description$ For each {B} in a cost, you may pay 2 life rather than pay that mana.
T:Mode$ SpellCast | ValidCard$ Card.Black | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Whenever you cast a black spell, put a +1/+1 counter on CARDNAME.
SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
SVar:BuffedBy:Card.Black
Oracle:({B/P} can be paid with either {B} or 2 life.)\nLifelink\nFor each {B} in a cost, you may pay 2 life rather than pay that mana.\nWhenever you cast a black spell, put a +1/+1 counter on K'rrik, Son of Yawgmoth.

View File

@@ -1,5 +1,11 @@
package forge.match.input; package forge.match.input;
import java.util.List;
import com.google.common.collect.Lists;
import forge.card.mana.ManaAtom;
import forge.card.mana.ManaCostShard;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.mana.ManaConversionMatrix; import forge.game.mana.ManaConversionMatrix;
import forge.game.mana.ManaCostBeingPaid; import forge.game.mana.ManaCostBeingPaid;
@@ -9,6 +15,7 @@ import forge.model.FModel;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.util.ITriggerEvent; import forge.util.ITriggerEvent;
import forge.util.Lang;
public class InputPayManaOfCostPayment extends InputPayMana { public class InputPayManaOfCostPayment extends InputPayMana {
public InputPayManaOfCostPayment(final PlayerControllerHuman controller, ManaCostBeingPaid cost, SpellAbility spellAbility, Player payer, ManaConversionMatrix matrix) { public InputPayManaOfCostPayment(final PlayerControllerHuman controller, ManaCostBeingPaid cost, SpellAbility spellAbility, Player payer, ManaConversionMatrix matrix) {
@@ -19,14 +26,21 @@ public class InputPayManaOfCostPayment extends InputPayMana {
} }
private static final long serialVersionUID = 3467312982164195091L; private static final long serialVersionUID = 3467312982164195091L;
private int phyLifeToLose = 0; //private int phyLifeToLose = 0;
private ManaConversionMatrix extraMatrix; private ManaConversionMatrix extraMatrix;
@Override @Override
protected final void onPlayerSelected(Player selected, final ITriggerEvent triggerEvent) { protected final void onPlayerSelected(Player selected, final ITriggerEvent triggerEvent) {
if (player == selected) { if (player == selected) {
if (player.canPayLife(this.phyLifeToLose + 2) && manaCost.payPhyrexian()) { if (player.canPayLife(this.phyLifeToLose + 2)) {
this.phyLifeToLose += 2; if (manaCost.payPhyrexian()) {
this.phyLifeToLose += 2;
} else {
if (player.hasKeyword("PayLifeInsteadOf:B") && manaCost.hasAnyKind(ManaAtom.BLACK)) {
manaCost.decreaseShard(ManaCostShard.BLACK, 1);
this.phyLifeToLose += 2;
}
}
} }
this.showMessage(); this.showMessage();
@@ -71,8 +85,20 @@ public class InputPayManaOfCostPayment extends InputPayMana {
msg.append(" life paid for phyrexian mana)"); msg.append(" life paid for phyrexian mana)");
} }
if (manaCost.containsPhyrexianMana()) { boolean isLifeInsteadBlack = player.hasKeyword("PayLifeInsteadOf:B") && manaCost.hasAnyKind(ManaAtom.BLACK);
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
if (manaCost.containsPhyrexianMana() || isLifeInsteadBlack) {
StringBuilder sb = new StringBuilder();
sb.append("Click on your life total to pay life for ");
List<String> list = Lists.newArrayList();
if (manaCost.containsPhyrexianMana()) {
list.add("phyrexian mana");
}
if (isLifeInsteadBlack) {
list.add("black mana");
}
sb.append(Lang.joinHomogenous(list, null, "or")).append(".");
msg.append("\n(").append(sb).append(")");
} }
return msg.toString(); return msg.toString();

View File

@@ -17,7 +17,13 @@
*/ */
package forge.match.input; package forge.match.input;
import java.util.List;
import com.google.common.collect.Lists;
import forge.card.mana.ManaAtom;
import forge.card.mana.ManaCost; import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostShard;
import forge.game.Game; import forge.game.Game;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.mana.ManaCostBeingPaid; import forge.game.mana.ManaCostBeingPaid;
@@ -27,6 +33,7 @@ import forge.model.FModel;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.util.ITriggerEvent; import forge.util.ITriggerEvent;
import forge.util.Lang;
//pays the cost of a card played from the player's hand //pays the cost of a card played from the player's hand
//the card is removed from the players hand if the cost is paid //the card is removed from the players hand if the cost is paid
@@ -64,8 +71,15 @@ public class InputPayManaSimple extends InputPayMana {
@Override @Override
protected final void onPlayerSelected(final Player selected, final ITriggerEvent triggerEvent) { protected final void onPlayerSelected(final Player selected, final ITriggerEvent triggerEvent) {
if (player == selected) { if (player == selected) {
if (player.canPayLife(this.phyLifeToLose + 2) && manaCost.payPhyrexian()) { if (player.canPayLife(this.phyLifeToLose + 2)) {
this.phyLifeToLose += 2; if (manaCost.payPhyrexian()) {
this.phyLifeToLose += 2;
} else {
if (player.hasKeyword("PayLifeInsteadOf:B") && manaCost.hasAnyKind(ManaAtom.BLACK)) {
manaCost.decreaseShard(ManaCostShard.BLACK, 1);
this.phyLifeToLose += 2;
}
}
} }
this.showMessage(); this.showMessage();
@@ -132,8 +146,20 @@ public class InputPayManaSimple extends InputPayMana {
msg.append(" life paid for phyrexian mana)"); msg.append(" life paid for phyrexian mana)");
} }
if (this.manaCost.containsPhyrexianMana()) { boolean isLifeInsteadBlack = player.hasKeyword("PayLifeInsteadOf:B") && manaCost.hasAnyKind(ManaAtom.BLACK);
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
if (manaCost.containsPhyrexianMana() || isLifeInsteadBlack) {
StringBuilder sb = new StringBuilder();
sb.append("Click on your life total to pay life for ");
List<String> list = Lists.newArrayList();
if (manaCost.containsPhyrexianMana()) {
list.add("phyrexian mana");
}
if (isLifeInsteadBlack) {
list.add("black mana");
}
sb.append(Lang.joinHomogenous(list, null, "or")).append(".");
msg.append("\n(").append(sb).append(")");
} }
// has its own variant of checkIfPaid // has its own variant of checkIfPaid