diff --git a/res/ai/Default.ai b/res/ai/Default.ai index 09891c77225..e8206501075 100644 --- a/res/ai/Default.ai +++ b/res/ai/Default.ai @@ -1,4 +1,5 @@ DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1 +DEFAULT_MIN_TURN_TO_ROLL_PLANAR_DIE=3 DEFAULT_PLANAR_DIE_ROLL_CHANCE=50 MULLIGAN_THRESHOLD=5 PLANAR_DIE_ROLL_HESITATION_CHANCE=10 diff --git a/res/ai/Reckless.ai b/res/ai/Reckless.ai index c4db667386c..5d95749fd6c 100644 --- a/res/ai/Reckless.ai +++ b/res/ai/Reckless.ai @@ -1,4 +1,5 @@ DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN=1 +DEFAULT_MIN_TURN_TO_ROLL_PLANAR_DIE=1 DEFAULT_PLANAR_DIE_ROLL_CHANCE=100 MULLIGAN_THRESHOLD=2 PLANAR_DIE_ROLL_HESITATION_CHANCE=0 diff --git a/res/cardsfolder/a/akoum.txt b/res/cardsfolder/a/akoum.txt index ee9fcd2689f..5120859104e 100644 --- a/res/cardsfolder/a/akoum.txt +++ b/res/cardsfolder/a/akoum.txt @@ -6,4 +6,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ Destroy | Cost$ 0 | ValidTgts$ Creature.unenchanted | TgtPrompt$ Select target creature that isn't enchanted SVar:Picture:http://www.wizards.com/global/images/magic/general/akoum.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Players may cast enchantment cards as though they had flash.\nWhenever you roll {C}, destroy target creature that isn't enchanted. \ No newline at end of file diff --git a/res/cardsfolder/a/astral_arena.txt b/res/cardsfolder/a/astral_arena.txt index d09a2f74441..9c06bf7b4e6 100644 --- a/res/cardsfolder/a/astral_arena.txt +++ b/res/cardsfolder/a/astral_arena.txt @@ -6,4 +6,6 @@ S:Mode$ Continuous | EffectZone$ Command | GlobalRule$ No more than one creature T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll Chaos, CARDNAME deals 2 damage to each creature. SVar:RolledChaos:AB$ DamageAll | Cost$ 0 | NumDmg$ 2 | ValidCards$ Creature | ValidDescription$ each creature. SVar:Picture:http://www.wizards.com/global/images/magic/general/astral_arena.jpg +SVar:AIRollPlanarDie:Random +SVar:AIRollPlanarDieMinTurn:5 Oracle:No more than one creature can attack each combat.\nNo more than one creature can block each combat.\nWhenever you roll {C}, Astral Arena deals 2 damage to each creature. \ No newline at end of file diff --git a/res/cardsfolder/b/bloodhill_bastion.txt b/res/cardsfolder/b/bloodhill_bastion.txt index 0bb05ded72a..bd968811ef0 100644 --- a/res/cardsfolder/b/bloodhill_bastion.txt +++ b/res/cardsfolder/b/bloodhill_bastion.txt @@ -9,4 +9,5 @@ SVar:RestorationReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | De SVar:Picture:http://www.wizards.com/global/images/magic/general/bloodhill_bastion.jpg SVar:AIRollPlanarDie:Always SVar:AIRollPlanarDieInMain1:True +SVar:AIRollPlanarDieMinTurn:3 Oracle:Whenever a creature enters the battlefield, it gains double strike and haste until end of turn.\nWhenever you roll {C}, exile target nontoken creature you control, then return it to the battlefield under your control. \ No newline at end of file diff --git a/res/cardsfolder/f/feeding_grounds.txt b/res/cardsfolder/f/feeding_grounds.txt index 693c28bba79..9b250b810ad 100644 --- a/res/cardsfolder/f/feeding_grounds.txt +++ b/res/cardsfolder/f/feeding_grounds.txt @@ -8,4 +8,5 @@ SVar:DBPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select targe SVar:Y:Targeted$CardManaCost SVar:Picture:http://www.wizards.com/global/images/magic/general/feeding_grounds.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Red spells cost {1} less to cast.\nGreen spells cost {1} less to cast.\nWhenever you roll {C}, put X +1/+1 counters on target creature, where X is that creature's converted mana cost. \ No newline at end of file diff --git a/res/cardsfolder/f/furnace_layer.txt b/res/cardsfolder/f/furnace_layer.txt index 979f3366be7..6510c1e2e05 100644 --- a/res/cardsfolder/f/furnace_layer.txt +++ b/res/cardsfolder/f/furnace_layer.txt @@ -10,4 +10,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ Destroy | Cost$ 0 | ValidTgts$ Permanent.nonLand | TgtPrompt$ Select target nonland permanent to destroy SVar:Picture:http://www.wizards.com/global/images/magic/general/furnace_layer.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:When you planeswalk to Furnace Layer or at the beginning of your upkeep, select target player at random. That player discards a card. If that player discards a land card this way, he or she loses 3 life.\nWhenever you roll {C}, you may destroy target nonland permanent. diff --git a/res/cardsfolder/g/grixis.txt b/res/cardsfolder/g/grixis.txt index 5147b2bc41f..6e8e6c4b588 100644 --- a/res/cardsfolder/g/grixis.txt +++ b/res/cardsfolder/g/grixis.txt @@ -10,4 +10,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Battlefield | GainControl$ True | TgtPrompt$ Choose target creature card in a graveyard | ValidTgts$ Creature SVar:Picture:http://www.wizards.com/global/images/magic/general/grixis.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Blue, black, and/or red creature cards in your graveyard have unearth. The unearth cost is equal to the card's mana cost. (Pay the card's mana cost: Return it to the battlefield. The creature gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.)\nWhenever you roll {C}, put target creature card from a graveyard onto the battlefield under your control. \ No newline at end of file diff --git a/res/cardsfolder/g/grove_of_the_dreampods.txt b/res/cardsfolder/g/grove_of_the_dreampods.txt index 658fb792e49..6f93cd28eec 100644 --- a/res/cardsfolder/g/grove_of_the_dreampods.txt +++ b/res/cardsfolder/g/grove_of_the_dreampods.txt @@ -8,4 +8,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Battlefield | TgtPrompt$ Choose target creature card in your graveyard | ValidTgts$ Creature.YouCtrl SVar:Picture:http://www.wizards.com/global/images/magic/general/grove_of_the_dreampods.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:5 Oracle:When you planeswalk to Grove of the Dreampods or at the beginning of your upkeep, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield and the rest on the bottom of your library in a random order.\nWhenever you roll {C}, return target creature card from your graveyard to the battlefield. \ No newline at end of file diff --git a/res/cardsfolder/m/minamo.txt b/res/cardsfolder/m/minamo.txt index 8a69d7d4460..cd326def8d5 100644 --- a/res/cardsfolder/m/minamo.txt +++ b/res/cardsfolder/m/minamo.txt @@ -9,4 +9,6 @@ SVar:DBChoose:DB$ ChooseCard | Choices$ Card.RememberedPlayerCtrl+Blue | ChoiceZ SVar:DBChangeZoneAll:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered | Origin$ Graveyard | Destination$ Hand | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Picture:http://www.wizards.com/global/images/magic/general/minamo.jpg +SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:5 Oracle:Whenever a player casts a spell, that player may draw a card.\nWhenever you roll {C}, each player may return a blue card from his or her graveyard to his or her hand. \ No newline at end of file diff --git a/res/cardsfolder/o/orochi_colony.txt b/res/cardsfolder/o/orochi_colony.txt index e90f0d4c5d2..3f20e2db9e6 100644 --- a/res/cardsfolder/o/orochi_colony.txt +++ b/res/cardsfolder/o/orochi_colony.txt @@ -7,4 +7,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ Pump | Cost$ 0 | ValidTgts$ Creature | KW$ HIDDEN Unblockable SVar:Picture:http://www.wizards.com/global/images/magic/general/orochi_colony.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Whenever a creature you control deals combat damage to a player, you may search your library for a basic land card, put it onto the battlefield tapped, then shuffle your library.\nWhenever you roll {C}, target creature is unblockable this turn. \ No newline at end of file diff --git a/res/cardsfolder/r/ravens_run.txt b/res/cardsfolder/r/ravens_run.txt index 4009dd4b0b0..b2403258ff2 100644 --- a/res/cardsfolder/r/ravens_run.txt +++ b/res/cardsfolder/r/ravens_run.txt @@ -8,5 +8,6 @@ SVar:RolledChaos2:DB$ PutCounter | ValidTgts$ Creature.IsNotRemembered | Counter SVar:RolledChaos3:DB$ PutCounter | ValidTgts$ Creature.IsNotRemembered | CounterType$ M1M1 | CounterNum$ 3 | SubAbility$ RolledChaosCleanup SVar:RolledChaosCleanup:DB$ Cleanup | ClearRemembered$ True SVar:Picture:http://www.cardforge.org/fpics/lq_planes_promos/ravens_run.jpg -SVar:AIRollPlanarDie:Random +SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:5 Oracle:All creatures have wither. (They deal damage to creatures in the form of -1/-1 counters.)\nWhenever you roll {C}, put a -1/-1 counter on target creature, two -1/-1 counters on another target creature, and three -1/-1 counters on a third target creature. \ No newline at end of file diff --git a/res/cardsfolder/s/selesnya_loft_gardens.txt b/res/cardsfolder/s/selesnya_loft_gardens.txt index 6f8ae7af2e2..a6ae93a19cc 100644 --- a/res/cardsfolder/s/selesnya_loft_gardens.txt +++ b/res/cardsfolder/s/selesnya_loft_gardens.txt @@ -8,4 +8,5 @@ SVar:TrigTapForMana:Mode$ TapsForMana | TriggerZones$ Command | ValidCard$ Land. SVar:TrigMana:AB$ ManaReflected | Cost$ 0 | ColorOrType$ Type | Valid$ Defined.Triggered | ReflectProperty$ Produced | Defined$ TriggeredPlayer YouSVar:Picture:http://www.wizards.com/global/images/magic/general/selesnya_loft_gardens.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:1 Oracle:If an effect would put one or more tokens onto the battlefield, it puts twice that many of those tokens onto the battlefield instead.\nIf an effect would place one or more counters on a permanent, it places twice that many of those counters on that permanent instead.\nWhenever you roll {C}, until end of turn, whenever you tap a land for mana, add one mana to your mana pool of any type that land produced. \ No newline at end of file diff --git a/res/cardsfolder/t/the_great_forest.txt b/res/cardsfolder/t/the_great_forest.txt index 2aa5e41fe07..0a2f3691e7f 100644 --- a/res/cardsfolder/t/the_great_forest.txt +++ b/res/cardsfolder/t/the_great_forest.txt @@ -6,4 +6,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ PumpAll | Cost$ 0 | ValidCards$ Creature.ActivePlayerCtrl | NumDef$ 2 | KW$ Trample SVar:Picture:http://www.wizards.com/global/images/magic/general/the_great_forest.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Each creature assigns combat damage equal to its toughness rather than its power.\nWhenever you roll {C}, creatures you control get +0/+2 and gain trample until end of turn. \ No newline at end of file diff --git a/res/cardsfolder/t/the_zephyr_maze.txt b/res/cardsfolder/t/the_zephyr_maze.txt index 618eefe88df..f06e694095a 100644 --- a/res/cardsfolder/t/the_zephyr_maze.txt +++ b/res/cardsfolder/t/the_zephyr_maze.txt @@ -7,4 +7,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ Flying SVar:Picture:http://www.wizards.com/global/images/magic/general/the_zephyr_maze.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Creatures with flying get +2/+0.\nCreatures without flying get -2/-0.\nWhenever you roll {C}, target creature gains flying until end of turn. \ No newline at end of file diff --git a/res/cardsfolder/v/velis_vel.txt b/res/cardsfolder/v/velis_vel.txt index 8030b75fe58..bb95d6c962b 100644 --- a/res/cardsfolder/v/velis_vel.txt +++ b/res/cardsfolder/v/velis_vel.txt @@ -7,4 +7,5 @@ T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChao SVar:RolledChaos:AB$ Animate | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | Types$ AllCreatureTypes SVar:Picture:http://www.wizards.com/global/images/magic/general/velis_vel.jpg SVar:AIRollPlanarDie:Always +SVar:AIRollPlanarDieMinTurn:3 Oracle:Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Elemental Shamans and an Elemental Spirit are on the battlefield, each gets +2/+2.)\nWhenever you roll {C}, target creature gains all creature types until end of turn. \ No newline at end of file diff --git a/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java b/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java index 9854a1c12c1..10ed29c8e30 100644 --- a/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java +++ b/src/main/java/forge/card/ability/ai/RollPlanarDiceAi.java @@ -24,13 +24,8 @@ public class RollPlanarDiceAi extends SpellAbilityAi { int maxActivations = aic.getIntProperty(AiProps.DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN); int chance = aic.getIntProperty(AiProps.DEFAULT_PLANAR_DIE_ROLL_CHANCE); int hesitationChance = aic.getIntProperty(AiProps.PLANAR_DIE_ROLL_HESITATION_CHANCE); + int minTurnToRoll = aic.getIntProperty(AiProps.DEFAULT_MIN_TURN_TO_ROLL_PLANAR_DIE); - if (!plane.hasSVar("AIRollPlanarDieInMain1") && ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)) { - return false; - } else if (plane.hasSVar("AIRollPlanarDieInMain1") && plane.getSVar("AIRollPlanarDieInMain1").toLowerCase().equals("false")) { - return false; - } - if (plane.hasSVar("AIRollPlanarDie")) { switch (plane.getSVar("AIRollPlanarDie")) { case "Always": @@ -45,22 +40,32 @@ public class RollPlanarDiceAi extends SpellAbilityAi { } break; case "Never": - break; + return false; default: - break; + return false; } - } - if (plane.hasSVar("AIRollPlanarDieMaxPerTurn")) { - maxActivations = Integer.parseInt(plane.getSVar("AIRollPlanarDieMaxPerTurn")); - } - if (ai.getGame().getPhaseHandler().getPlanarDiceRolledthisTurn() >= maxActivations) { - decideToRoll = false; - } + if (!plane.hasSVar("AIRollPlanarDieMinTurn") && ai.getGame().getPhaseHandler().getTurn() < minTurnToRoll) { + decideToRoll = false; + } else if (plane.hasSVar("AIRollPlanarDieMinTurn") && ai.getGame().getPhaseHandler().getTurn() < Integer.parseInt(plane.getSVar("AIRollPlanarDieMinTurn"))) { + decideToRoll = false; + } else if (!plane.hasSVar("AIRollPlanarDieInMain1") && ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)) { + decideToRoll = false; + } else if (plane.hasSVar("AIRollPlanarDieInMain1") && plane.getSVar("AIRollPlanarDieInMain1").toLowerCase().equals("false")) { + decideToRoll = false; + } + + if (plane.hasSVar("AIRollPlanarDieMaxPerTurn")) { + maxActivations = Integer.parseInt(plane.getSVar("AIRollPlanarDieMaxPerTurn")); + } + if (ai.getGame().getPhaseHandler().getPlanarDiceRolledthisTurn() >= maxActivations) { + decideToRoll = false; + } - // check if the AI hesitates - if (MyRandom.getRandom().nextInt(100) < hesitationChance) { - decideToRoll = false; // hesitate + // check if the AI hesitates + if (MyRandom.getRandom().nextInt(100) < hesitationChance) { + decideToRoll = false; // hesitate + } } return decideToRoll ? true : false; diff --git a/src/main/java/forge/game/ai/AiProps.java b/src/main/java/forge/game/ai/AiProps.java index 04841f2097f..8dfc7422500 100644 --- a/src/main/java/forge/game/ai/AiProps.java +++ b/src/main/java/forge/game/ai/AiProps.java @@ -25,6 +25,7 @@ package forge.game.ai; */ public enum AiProps { /** */ DEFAULT_MAX_PLANAR_DIE_ROLLS_PER_TURN ("1"), /** */ + DEFAULT_MIN_TURN_TO_ROLL_PLANAR_DIE ("3"), /** */ DEFAULT_PLANAR_DIE_ROLL_CHANCE ("50"), /** */ MULLIGAN_THRESHOLD ("5"), /** */ PLANAR_DIE_ROLL_HESITATION_CHANCE ("10"); /** */