mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Added a new AI SVar: "NeedsToPlayVar".
- Added a sample to Hidden Horror.
This commit is contained in:
@@ -8,6 +8,8 @@ SVar:TrigDiscard:AB$ Discard | Cost$ 0 | NumCards$ 1 | DiscardValid$ Creature |
|
||||
SVar:DBSacSelf:DB$ Sacrifice | Cost$ 0 | Defined$ Self | SubAbility$ DBCleanup | ConditionCheckSVar$ X | ConditionSVarCompare$ LT1
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
SVar:X:Remembered$Amount
|
||||
SVar:NeedsToPlayVar:Y GE2
|
||||
SVar:Y:Count$TypeInYourHand.Creature
|
||||
SVar:RemAIDeck:True
|
||||
SVar:Rarity:Uncommon
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/hidden_horror.jpg
|
||||
|
||||
@@ -27,6 +27,7 @@ import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.PhaseHandler;
|
||||
import forge.Player;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.cost.CostPayment;
|
||||
import forge.card.staticability.StaticAbility;
|
||||
@@ -138,6 +139,28 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (card.getSVar("NeedsToPlayVar").length() > 0) {
|
||||
final String needsToPlay = card.getSVar("NeedsToPlayVar");
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
String sVar = needsToPlay.split(" ")[0];
|
||||
String comparator = needsToPlay.split(" ")[1];
|
||||
String compareTo = comparator.substring(2);
|
||||
try {
|
||||
x = Integer.parseInt(sVar);
|
||||
} catch (final NumberFormatException e) {
|
||||
x = CardFactoryUtil.xCount(card, card.getSVar(sVar));
|
||||
}
|
||||
try {
|
||||
y = Integer.parseInt(compareTo);
|
||||
} catch (final NumberFormatException e) {
|
||||
y = CardFactoryUtil.xCount(card, card.getSVar(compareTo));
|
||||
}
|
||||
System.out.println("NeedsToPlayVar: " + sVar + "(" + x + ")" + comparator + "(" + y + ")");
|
||||
if (!AllZoneUtil.compare(x, comparator, y)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return super.canPlayAI();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user