mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added a new AI SVar: "NeedsToPlayVar".
- Added a sample to Hidden Horror.
This commit is contained in:
@@ -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