mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Simple logic for Tawnos's Weaponry and potentially other similar cards.
This commit is contained in:
@@ -554,7 +554,33 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
public boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultVal) {
|
public boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultVal) {
|
||||||
switch(kindOfChoice) {
|
switch(kindOfChoice) {
|
||||||
case TapOrUntap: return true;
|
case TapOrUntap: return true;
|
||||||
case UntapOrLeaveTapped: return defaultVal != null && defaultVal.booleanValue();
|
case UntapOrLeaveTapped:
|
||||||
|
Card source = sa.getHostCard();
|
||||||
|
if (source != null && source.hasSVar("AIUntapPreference")) {
|
||||||
|
switch (source.getSVar("AIUntapPreference")) {
|
||||||
|
case "Always":
|
||||||
|
return true;
|
||||||
|
case "Never":
|
||||||
|
return false;
|
||||||
|
case "BetterTgtThanRemembered":
|
||||||
|
if (source.getRememberedCount() > 0) {
|
||||||
|
Card rem = (Card) source.getFirstRemembered();
|
||||||
|
if (!rem.getZone().is(ZoneType.Battlefield)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (Card c : source.getController().getCreaturesInPlay()) {
|
||||||
|
if (c != rem && ComputerUtilCard.evaluateCreature(c) > ComputerUtilCard.evaluateCreature(rem) + 30) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// The default is to always untap
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultVal != null && defaultVal.booleanValue();
|
||||||
case UntapTimeVault: return false; // TODO Should AI skip his turn for time vault?
|
case UntapTimeVault: return false; // TODO Should AI skip his turn for time vault?
|
||||||
case LeftOrRight: return brains.chooseDirection(sa);
|
case LeftOrRight: return brains.chooseDirection(sa);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import forge.game.player.PlayerActionConfirmMode;
|
|||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.spellability.SpellAbilityRestriction;
|
import forge.game.spellability.SpellAbilityRestriction;
|
||||||
import forge.game.spellability.TargetRestrictions;
|
import forge.game.spellability.TargetRestrictions;
|
||||||
|
import forge.game.staticability.StaticAbility;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -337,6 +338,20 @@ public class PumpAi extends PumpAiBase {
|
|||||||
attack = AbilityUtils.calculateAmount(sa.getHostCard(), numAttack, sa);
|
attack = AbilityUtils.calculateAmount(sa.getHostCard(), numAttack, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("ContinuousBonus".equals(aiLogic)) {
|
||||||
|
// P/T bonus in a continuous static ability
|
||||||
|
for (StaticAbility stAb : source.getStaticAbilities()) {
|
||||||
|
if ("Continuous".equals(stAb.getParam("Mode"))) {
|
||||||
|
if (stAb.hasParam("AddPower")) {
|
||||||
|
attack += AbilityUtils.calculateAmount(source, stAb.getParam("AddPower"), stAb);
|
||||||
|
}
|
||||||
|
if (stAb.hasParam("AddToughness")) {
|
||||||
|
defense += AbilityUtils.calculateAmount(source, stAb.getParam("AddToughness"), stAb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((numDefense.contains("X") && defense == 0) || (numAttack.contains("X") && attack == 0 && !isBerserk)) {
|
if ((numDefense.contains("X") && defense == 0) || (numAttack.contains("X") && attack == 0 && !isBerserk)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -436,7 +451,7 @@ public class PumpAi extends PumpAiBase {
|
|||||||
|
|
||||||
CardCollection list;
|
CardCollection list;
|
||||||
if (sa.hasParam("AILogic")) {
|
if (sa.hasParam("AILogic")) {
|
||||||
if (sa.getParam("AILogic").equals("HighestPower")) {
|
if (sa.getParam("AILogic").equals("HighestPower") || sa.getParam("AILogic").equals("ContinuousBonus")) {
|
||||||
list = CardLists.getValidCards(CardLists.filter(game.getCardsIn(ZoneType.Battlefield), Presets.CREATURES), tgt.getValidTgts(), ai, source, sa);
|
list = CardLists.getValidCards(CardLists.filter(game.getCardsIn(ZoneType.Battlefield), Presets.CREATURES), tgt.getValidTgts(), ai, source, sa);
|
||||||
list = CardLists.getTargetableCards(list, sa);
|
list = CardLists.getTargetableCards(list, sa);
|
||||||
CardLists.sortByPowerDesc(list);
|
CardLists.sortByPowerDesc(list);
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ Name:Tawnos's Weaponry
|
|||||||
ManaCost:2
|
ManaCost:2
|
||||||
Types:Artifact
|
Types:Artifact
|
||||||
K:You may choose not to untap CARDNAME during your untap step.
|
K:You may choose not to untap CARDNAME during your untap step.
|
||||||
A:AB$ Pump | Cost$ 2 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | RememberTargets$ True | SpellDescription$ Target creature gets +1/+1 for as long as CARDNAME remains tapped. | StackDescription$ SpellDescription
|
A:AB$ Pump | Cost$ 2 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | RememberTargets$ True | AILogic$ ContinuousBonus | SpellDescription$ Target creature gets +1/+1 for as long as CARDNAME remains tapped. | StackDescription$ SpellDescription
|
||||||
S:Mode$ Continuous | Affected$ Creature.IsRemembered | AddPower$ 1 | AddToughness$ 1
|
S:Mode$ Continuous | Affected$ Creature.IsRemembered | AddPower$ 1 | AddToughness$ 1
|
||||||
T:Mode$ Untaps | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ ClearRemembered | Static$ True
|
T:Mode$ Untaps | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ ClearRemembered | Static$ True
|
||||||
SVar:ClearRemembered:DB$ Cleanup | ClearRemembered$ True
|
SVar:ClearRemembered:DB$ Cleanup | ClearRemembered$ True
|
||||||
SVar:RemAIDeck:True
|
SVar:AIUntapPreference:BetterTgtThanRemembered
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/tawnoss_weaponry.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/tawnoss_weaponry.jpg
|
||||||
Oracle:You may choose not to untap Tawnos's Weaponry during your untap step.\n{2}, {T}: Target creature gets +1/+1 for as long as Tawnos's Weaponry remains tapped.
|
Oracle:You may choose not to untap Tawnos's Weaponry during your untap step.\n{2}, {T}: Target creature gets +1/+1 for as long as Tawnos's Weaponry remains tapped.
|
||||||
|
|||||||
Reference in New Issue
Block a user