- Rewrote the Bloodthirst keyword as a macro for a proper replacement effect.

This commit is contained in:
Sloth
2012-11-12 21:52:22 +00:00
parent 6ded6de74f
commit 1df6154ef4
3 changed files with 27 additions and 35 deletions

View File

@@ -2322,22 +2322,7 @@ public class Card extends GameEntity implements Comparable<Card> {
sbLong.append(keywords.get(i).toString()).append("\r\n"); sbLong.append(keywords.get(i).toString()).append("\r\n");
} else if (keyword.toString().contains("tap: add ")) { } else if (keyword.toString().contains("tap: add ")) {
sbMana.append(keywords.get(i).toString()).append("\r\n"); sbMana.append(keywords.get(i).toString()).append("\r\n");
} else if (keyword.contains("Bloodthirst")) { } else if (keyword.startsWith("Modular") || keyword.startsWith("Soulshift") || keyword.startsWith("Bloodthirst")
final String k = keywords.get(i);
final String[] kk = k.split(" ");
sbLong.append(keywords.get(i)).append(
" (If an opponent was dealt damage this turn, this creature enters the battlefield with ");
sbLong.append(kk[1]).append(" +1/+1 counter");
if (kk[1].equals("X")) {
sbLong.append("s on it, where X is the damage dealt to your opponents this turn.)");
sbLong.append("\r\n");
} else {
if (Integer.parseInt(kk[1]) > 1) {
sbLong.append("s");
}
sbLong.append(" on it.)").append("\r\n");
}
} else if (keyword.startsWith("Modular") || keyword.startsWith("Soulshift")
|| keyword.startsWith("ETBReplacement") || keyword.startsWith("MayEffectFromOpeningHand")) { || keyword.startsWith("ETBReplacement") || keyword.startsWith("MayEffectFromOpeningHand")) {
continue; continue;
} else if (keyword.startsWith("Provoke")) { } else if (keyword.startsWith("Provoke")) {

View File

@@ -2108,6 +2108,10 @@ public class CardFactoryUtil {
return CardFactoryUtil.doXMath(c.getDamageDoneThisTurn(), m, c); return CardFactoryUtil.doXMath(c.getDamageDoneThisTurn(), m, c);
} }
if (sq[0].equals("BloodthirstAmount")) {
return CardFactoryUtil.doXMath(c.getController().getBloodthirstAmount(), m, c);
}
if (sq[0].contains("RegeneratedThisTurn")) { if (sq[0].contains("RegeneratedThisTurn")) {
return CardFactoryUtil.doXMath(c.getRegeneratedThisTurn(), m, c); return CardFactoryUtil.doXMath(c.getRegeneratedThisTurn(), m, c);
} }
@@ -2203,7 +2207,11 @@ public class CardFactoryUtil {
} }
if (sq[0].contains("LifeOppLostThisTurn")) { if (sq[0].contains("LifeOppLostThisTurn")) {
return CardFactoryUtil.doXMath(cardController.getOpponent().getLifeLostThisTurn(), m, c); int lost = 0;
for (Player opp : cardController.getOpponents()) {
lost += opp.getLifeLostThisTurn();
}
return CardFactoryUtil.doXMath(lost, m, c);
} }
if (sq[0].equals("TotalDamageDoneByThisTurn")) { if (sq[0].equals("TotalDamageDoneByThisTurn")) {
@@ -4668,24 +4676,17 @@ public class CardFactoryUtil {
final int bloodthirst = CardFactoryUtil.hasKeyword(card, "Bloodthirst"); final int bloodthirst = CardFactoryUtil.hasKeyword(card, "Bloodthirst");
if (bloodthirst != -1) { if (bloodthirst != -1) {
final String numCounters = card.getKeyword().get(bloodthirst).split(" ")[1]; final String numCounters = card.getKeyword().get(bloodthirst).split(" ")[1];
String desc = "Bloodthirst "
card.addComesIntoPlayCommand(new Command() { + numCounters + " (If an opponent was dealt damage this turn, this creature enters the battlefield with "
private static final long serialVersionUID = -1849308549161972508L; + numCounters + " +1/+1 counters on it.)";
@Override
public void execute() {
if (card.getController().hasBloodthirst()) {
int toAdd = -1;
if (numCounters.equals("X")) { if (numCounters.equals("X")) {
toAdd = card.getController().getBloodthirstAmount(); desc = "Bloodthirst X (This creature enters the battlefield with X +1/+1 counters on it, " +
} else { "where X is the damage dealt to your opponents this turn.)";
toAdd = Integer.parseInt(numCounters); card.setSVar("X", "Count$BloodthirstAmount");
}
card.addCounter(Counters.P1P1, toAdd);
}
} }
card.setSVar("X", "Count$BloodthirstAmount");
}); card.addIntrinsicKeyword("etbCounter:P1P1:" + numCounters + ":Bloodthirst$ True:" + desc);
} // bloodthirst } // bloodthirst
final int storm = card.getKeywordAmount("Storm"); final int storm = card.getKeywordAmount("Storm");

View File

@@ -198,6 +198,12 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
} }
} }
if (this.getMapParams().containsKey("Bloodthirst")) {
if (this.getMapParams().get("Bloodthirst").equals("True") && !this.getHostCard().getController().hasBloodthirst()) {
return false;
}
}
if (this.getMapParams().containsKey("PlayersPoisoned")) { if (this.getMapParams().containsKey("PlayersPoisoned")) {
if (this.getMapParams().get("PlayersPoisoned").equals("You") if (this.getMapParams().get("PlayersPoisoned").equals("You")
&& (this.getHostCard().getController().getPoisonCounters() == 0)) { && (this.getHostCard().getController().getPoisonCounters() == 0)) {