- Basic AI for Torgaar (currently won't sac anything as a part of cost payment)

- Fixed references in the script for Torgaar.
This commit is contained in:
Agetian
2018-04-18 09:25:58 +03:00
parent e186356591
commit 4bae4c7491
3 changed files with 20 additions and 6 deletions

View File

@@ -510,6 +510,15 @@ public class AiCostDecision extends CostDecisionMakerBase {
Integer c = cost.convertAmount(); Integer c = cost.convertAmount();
if (c == null) { if (c == null) {
if (ability.getSVar(cost.getAmount()).equals("XChoice")) { if (ability.getSVar(cost.getAmount()).equals("XChoice")) {
if ("SacToReduceCost".equals(ability.getParam("AILogic"))) {
// e.g. Torgaar, Famine Incarnate
// TODO: currently returns an empty list, so the AI doesn't sacrifice anything. Trying to make
// the AI decide on creatures to sac makes the AI sacrifice them, but the cost is not reduced and the
// AI pays the full mana cost anyway (despite sacrificing creatures).
return PaymentDecision.card(new CardCollection());
}
// Other cards are assumed to be flagged RemAIDeck for now
return null; return null;
} }

View File

@@ -124,6 +124,13 @@ public class LifeSetAi extends SpellAbilityAi {
amount = AbilityUtils.calculateAmount(sa.getHostCard(), amountStr, sa); amount = AbilityUtils.calculateAmount(sa.getHostCard(), amountStr, sa);
} }
// special cases when amount can't be calculated without targeting first
if (amount == 0 && "TargetedPlayer$StartingLife/HalfDown".equals(source.getSVar(amountStr))) {
// TODO: this assumes equal starting life for all players, which is not true e.g. for Archenemy
amount = ai.getStartingLife() / 2;
}
if (sourceName.equals("Eternity Vessel") if (sourceName.equals("Eternity Vessel")
&& (opponent.isCardInPlay("Vampire Hexmage") || (source.getCounters(CounterType.CHARGE) == 0))) { && (opponent.isCardInPlay("Vampire Hexmage") || (source.getCounters(CounterType.CHARGE) == 0))) {
return false; return false;
@@ -131,8 +138,7 @@ public class LifeSetAi extends SpellAbilityAi {
// If the Target is gaining life, target self. // If the Target is gaining life, target self.
// if the Target is modifying how much life is gained, this needs to // if the Target is modifying how much life is gained, this needs to
// be // be handled better
// handled better
final TargetRestrictions tgt = sa.getTargetRestrictions(); final TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) { if (tgt != null) {
sa.resetTargets(); sa.resetTargets();

View File

@@ -2,12 +2,11 @@ Name:Torgaar, Famine Incarnate
ManaCost:6 B B ManaCost:6 B B
Types:Legendary Creature Avatar Types:Legendary Creature Avatar
PT:7/6 PT:7/6
A:SP$ PermanentCreature | Cost$ 6 B B Sac<X/Creature> | Announce$ X A:SP$ PermanentCreature | Cost$ 6 B B Sac<X/Creature> | Announce$ X | References$ X,Y | AILogic$ SacToReduceCost
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ Y | EffectZone$ All | Description$ As an additional cost to cast this spell, you may sacrifice any number of creatures. This spell costs {2} less to cast for each creature sacrificed as an additional cost. S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ Y | EffectZone$ All | References$ Y | Description$ As an additional cost to cast this spell, you may sacrifice any number of creatures. This spell costs {2} less to cast for each creature sacrificed as an additional cost.
SVar:X:XChoice SVar:X:XChoice
SVar:Y:SVar$X/Times.2 SVar:Y:SVar$X/Times.2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSetLife | TriggerDescription$ When CARDNAME enters the battlefield, up to one target players life total becomes half their starting life total, rounded down. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSetLife | TriggerDescription$ When CARDNAME enters the battlefield, up to one target players life total becomes half their starting life total, rounded down.
SVar:TrigSetLife:DB$ SetLife | ValidTgts$ Player | LifeAmount$ HalfLife | TargetMin$ 0 | TargetMax$ 1 SVar:TrigSetLife:DB$ SetLife | ValidTgts$ Player | LifeAmount$ HalfLife | TargetMin$ 0 | TargetMax$ 1 | References$ HalfLife
SVar:HalfLife:TargetedPlayer$StartingLife/HalfDown SVar:HalfLife:TargetedPlayer$StartingLife/HalfDown
SVar:RemAIDeck:True
Oracle:As an additional cost to cast this spell, you may sacrifice any number of creatures. This spell costs {2} less to cast for each creature sacrificed as an additional cost.\nWhen Torgaar, Famine Incarnate enters the battlefield, up to one target players life total becomes half their starting life total, rounded down. Oracle:As an additional cost to cast this spell, you may sacrifice any number of creatures. This spell costs {2} less to cast for each creature sacrificed as an additional cost.\nWhen Torgaar, Famine Incarnate enters the battlefield, up to one target players life total becomes half their starting life total, rounded down.