From d4e72f07f9ae9d2c482c03f3ad2af8b510d1f58b Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 3 Oct 2017 11:09:10 +0000 Subject: [PATCH] - RemAIDeck update: next iteration. --- forge-ai/src/main/java/forge/ai/SpecialCardAi.java | 11 ++++++++--- forge-ai/src/main/java/forge/ai/ability/DigAi.java | 9 +++------ forge-gui/res/cardsfolder/m/magus_of_the_library.txt | 2 +- forge-gui/res/cardsfolder/m/magus_of_the_will.txt | 5 ++--- forge-gui/res/cardsfolder/m/malicious_intent.txt | 2 +- forge-gui/res/cardsfolder/m/mana_leech.txt | 1 - forge-gui/res/cardsfolder/m/mana_vapors.txt | 2 ++ forge-gui/res/cardsfolder/m/marsh_crocodile.txt | 7 ++++--- .../res/cardsfolder/m/meloku_the_clouded_mirror.txt | 2 +- forge-gui/res/cardsfolder/m/meteor_shower.txt | 2 +- forge-gui/res/cardsfolder/m/mind_shatter.txt | 1 - forge-gui/res/cardsfolder/m/misfortune.txt | 1 - forge-gui/res/cardsfolder/m/mishras_groundbreaker.txt | 1 - forge-gui/res/cardsfolder/m/murderers_axe.txt | 3 ++- .../res/cardsfolder/m/muzzio_visionary_architect.txt | 3 +-- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/SpecialCardAi.java b/forge-ai/src/main/java/forge/ai/SpecialCardAi.java index 59b74c24685..4c28b51528f 100644 --- a/forge-ai/src/main/java/forge/ai/SpecialCardAi.java +++ b/forge-ai/src/main/java/forge/ai/SpecialCardAi.java @@ -38,6 +38,7 @@ import forge.game.phase.PhaseType; import forge.game.player.Player; import forge.game.player.PlayerPredicates; import forge.game.spellability.SpellAbility; +import forge.game.spellability.SpellPermanent; import forge.game.staticability.StaticAbility; import forge.game.trigger.Trigger; import forge.game.zone.ZoneType; @@ -1265,12 +1266,16 @@ public class SpecialCardAi { } } - // Yawgmoth's Will (can potentially be expanded for other broadly similar effects too) + // Yawgmoth's Will and other cards with similar effect, e.g. Magus of the Will public static class YawgmothsWill { public static boolean consider(final Player ai, final SpellAbility sa) { CardCollectionView cardsInGY = ai.getCardsIn(ZoneType.Graveyard); if (cardsInGY.size() == 0) { return false; + } else if (ai.getGame().getPhaseHandler().getPlayerTurn() != ai) { + // The AI is not very good at deciding for what to viably do during the opp's turn when this + // comes from an instant speed effect (e.g. Magus of the Will) + return false; } int minManaAdj = 2; // we want the AI to have some spare mana for possible other spells to cast @@ -1287,8 +1292,8 @@ public class SpecialCardAi { continue; } - if (ComputerUtilAbility.getAbilitySourceName(ab).equals(ComputerUtilAbility.getAbilitySourceName(sa)) - || ab.hasParam("AINoRecursiveCheck")) { + if ((ComputerUtilAbility.getAbilitySourceName(ab).equals(ComputerUtilAbility.getAbilitySourceName(sa)) + && !(ab instanceof SpellPermanent)) || ab.hasParam("AINoRecursiveCheck")) { // prevent infinitely recursing abilities that are susceptible to reentry continue; } diff --git a/forge-ai/src/main/java/forge/ai/ability/DigAi.java b/forge-ai/src/main/java/forge/ai/ability/DigAi.java index 8f0b15261a4..f997cfaab19 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DigAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DigAi.java @@ -1,11 +1,6 @@ package forge.ai.ability; -import forge.ai.ComputerUtil; -import forge.ai.ComputerUtilAbility; -import forge.ai.ComputerUtilCard; -import forge.ai.ComputerUtilMana; -import forge.ai.SpecialCardAi; -import forge.ai.SpellAbilityAi; +import forge.ai.*; import forge.game.Game; import forge.game.ability.AbilityUtils; import forge.game.card.Card; @@ -46,6 +41,8 @@ public class DigAi extends SpellAbilityAi { if ("Never".equals(sa.getParam("AILogic"))) { return false; + } else if ("AtOppEndOfTurn".equals(sa.getParam("AILogic"))) { + return game.getPhaseHandler().getNextTurn() == ai && game.getPhaseHandler().is(PhaseType.END_OF_TURN); } // don't deck yourself diff --git a/forge-gui/res/cardsfolder/m/magus_of_the_library.txt b/forge-gui/res/cardsfolder/m/magus_of_the_library.txt index 0d3e18d00cf..b7379d91737 100644 --- a/forge-gui/res/cardsfolder/m/magus_of_the_library.txt +++ b/forge-gui/res/cardsfolder/m/magus_of_the_library.txt @@ -4,6 +4,6 @@ Types:Creature Human Wizard PT:1/1 A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C} to your mana pool. A:AB$ Draw | Cost$ T | NumCards$ 1 | ActivationCardsInHand$ 7 | SpellDescription$ Draw a card. Activate this ability only if you have exactly seven cards in hand. -SVar:RemAIDeck:True +SVar:RemRandomDeck:True SVar:Picture:http://resources.wizards.com/magic/cards/plc/en-us/card134741.jpg Oracle:{T}: Add {C} to your mana pool.\n{T}: Draw a card. Activate this ability only if you have exactly seven cards in hand. diff --git a/forge-gui/res/cardsfolder/m/magus_of_the_will.txt b/forge-gui/res/cardsfolder/m/magus_of_the_will.txt index 1571b747245..56b18542571 100644 --- a/forge-gui/res/cardsfolder/m/magus_of_the_will.txt +++ b/forge-gui/res/cardsfolder/m/magus_of_the_will.txt @@ -2,13 +2,12 @@ Name:Magus of the Will ManaCost:2 B Types:Creature Human Wizard PT:3/3 -A:AB$ Effect | Cost$ 2 B T Exile<1/CARDNAME> | Name$ Magus of the Will Effect | ReplacementEffects$ GraveToExile | StaticAbilities$ STPlay | SVars$ Exile | SpellDescription$ Until end of turn, you may play cards from your graveyard. If a card would be put into your graveyard from anywhere this turn, exile that card instead. +A:AB$ Effect | Cost$ 2 B T Exile<1/CARDNAME> | Name$ Magus of the Will Effect | ReplacementEffects$ GraveToExile | StaticAbilities$ STPlay | SVars$ Exile | AILogic$ YawgmothsWill | SpellDescription$ Until end of turn, you may play cards from your graveyard. If a card would be put into your graveyard from anywhere this turn, exile that card instead. SVar:STPlay:Mode$ Continuous | EffectZone$ Command | Affected$ Card.YouCtrl | AffectedZone$ Graveyard | MayPlay$ True | Description$ You may play cards from your graveyard. SVar:GraveToExile:Event$ Moved | ActiveZones$ Command | Destination$ Graveyard | ValidCard$ Card.nonToken+YouOwn | ReplaceWith$ Exile | Description$ If a card would be put into your graveyard from anywhere, exile it instead. -SVar:Exile:AB$ ChangeZone | Cost$ 0 | Hidden$ True | Origin$ All | Destination$ Exile | Defined$ ReplacedCard -SVar:RemAIDeck:True +SVar:Exile:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Exile | Defined$ ReplacedCard SVar:Picture:http://www.wizards.com/global/images/magic/general/magus_of_the_will.jpg Oracle:{2}{B}, {T}, Exile Magus of the Will: Until end of turn, you may play cards from your graveyard. If a card would be put into your graveyard from anywhere this turn, exile that card instead. diff --git a/forge-gui/res/cardsfolder/m/malicious_intent.txt b/forge-gui/res/cardsfolder/m/malicious_intent.txt index 166cdcc113b..b4a888c2ca4 100644 --- a/forge-gui/res/cardsfolder/m/malicious_intent.txt +++ b/forge-gui/res/cardsfolder/m/malicious_intent.txt @@ -6,6 +6,6 @@ A:SP$ Attach | Cost$ 1 R | ValidTgts$ Creature | AILogic$ Pump S:Mode$ Continuous | Affected$ Card.EnchantedBy | AddAbility$ HostileAct | Description$ Enchanted creature has "{T}: Target creature can't block this turn." SVar:HostileAct:AB$Pump | Cost$ T | ValidTgts$ Creature | TgtPrompt$ Select target creature | IsCurse$ True | KW$ HIDDEN CARDNAME can't block. | SpellDescription$ Target creature can't block this turn. SVar:NonStackingAttachEffect:True -SVar:RemAIDeck:True +SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/malicious_intent.jpg Oracle:Enchant creature\nEnchanted creature has "{T}: Target creature can't block this turn." diff --git a/forge-gui/res/cardsfolder/m/mana_leech.txt b/forge-gui/res/cardsfolder/m/mana_leech.txt index 402f1f35ffe..767ed2321cb 100644 --- a/forge-gui/res/cardsfolder/m/mana_leech.txt +++ b/forge-gui/res/cardsfolder/m/mana_leech.txt @@ -7,6 +7,5 @@ A:AB$ Tap | Cost$ T | ValidTgts$ Land | RememberTapped$ True | AlwaysRemember$ T S:Mode$ Continuous | Affected$ Land.IsRemembered | AddHiddenKeyword$ CARDNAME doesn't untap during your untap step. T:Mode$ Untaps | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ ClearRemembered | Static$ True SVar:ClearRemembered:DB$ Cleanup | ClearRemembered$ True -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/mana_leech.jpg Oracle:You may choose not to untap Mana Leech during your untap step.\n{T}: Tap target land. It doesn't untap during its controller's untap step for as long as Mana Leech remains tapped. diff --git a/forge-gui/res/cardsfolder/m/mana_vapors.txt b/forge-gui/res/cardsfolder/m/mana_vapors.txt index 17e73505467..3409d6c7b2a 100644 --- a/forge-gui/res/cardsfolder/m/mana_vapors.txt +++ b/forge-gui/res/cardsfolder/m/mana_vapors.txt @@ -2,6 +2,8 @@ Name:Mana Vapors ManaCost:1 U Types:Sorcery A:SP$ PumpAll | Cost$ 1 U | ValidTgts$ Player | IsCurse$ True | ValidCards$ Land.TargetedPlayerCtrl | KW$ HIDDEN This card doesn't untap during your next untap step. | Permanent$ True | SpellDescription$ Lands target player controls don't untap during his or her next untap step. +#TODO: the AI doesn't really target the opponent with the tapped lands in a multiplayer game (not necessarily, anyway). Could use improvement before this card is marked AI playable. +SVar:NeedsToPlay:Land.OppCtrl+tapped SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/mana_vapors.jpg Oracle:Lands target player controls don't untap during his or her next untap step. diff --git a/forge-gui/res/cardsfolder/m/marsh_crocodile.txt b/forge-gui/res/cardsfolder/m/marsh_crocodile.txt index 05401109601..b6b8ab54543 100644 --- a/forge-gui/res/cardsfolder/m/marsh_crocodile.txt +++ b/forge-gui/res/cardsfolder/m/marsh_crocodile.txt @@ -4,8 +4,9 @@ Types:Creature Crocodile PT:4/4 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, return a blue or black creature you control to its owner's hand. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDiscard | TriggerDescription$ When CARDNAME enters the battlefield, each player discards a card. -SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Battlefield | Destination$ Hand | Hidden$ True | Mandatory$ True | ChangeType$ Creature.Black+YouCtrl,Creature.Blue+YouCtrl -SVar:TrigDiscard:AB$Discard | Cost$ 0 | Defined$ Player | NumCards$ 1 | Mode$ TgtChoose -SVar:RemAIDeck:True +SVar:TrigChange:DB$ ChangeZone | Origin$ Battlefield | Destination$ Hand | Hidden$ True | Mandatory$ True | ChangeType$ Creature.Black+YouCtrl,Creature.Blue+YouCtrl +SVar:TrigDiscard:DB$ Discard | Defined$ Player | NumCards$ 1 | Mode$ TgtChoose +SVar:NeedsToPlay:Creature.Black+YouCtrl+cmcLE3+inZoneBattlefield,Creature.Blue+YouCtrl+cmcLE3+inZoneBattlefield +SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/marsh_crocodile.jpg Oracle:When Marsh Crocodile enters the battlefield, return a blue or black creature you control to its owner's hand.\nWhen Marsh Crocodile enters the battlefield, each player discards a card. diff --git a/forge-gui/res/cardsfolder/m/meloku_the_clouded_mirror.txt b/forge-gui/res/cardsfolder/m/meloku_the_clouded_mirror.txt index 2e7b65deefb..d3af1117534 100644 --- a/forge-gui/res/cardsfolder/m/meloku_the_clouded_mirror.txt +++ b/forge-gui/res/cardsfolder/m/meloku_the_clouded_mirror.txt @@ -4,6 +4,6 @@ Types:Legendary Creature Moonfolk Wizard PT:2/4 K:Flying A:AB$ Token | Cost$ 1 Return<1/Land> | TokenAmount$ 1 | TokenName$ Illusion | TokenTypes$ Creature,Illusion | TokenOwner$ You | TokenColors$ Blue | TokenPower$ 1 | TokenToughness$ 1 | TokenKeywords$ Flying | SpellDescription$ Create a 1/1 blue Illusion creature token with flying. -SVar:RemAIDeck:True +SVar:RemRandomDeck:True SVar:Picture:http://resources.wizards.com/magic/cards/chk/en-us/card75268.jpg Oracle:Flying\n{1}, Return a land you control to its owner's hand: Create a 1/1 blue Illusion creature token with flying. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/m/meteor_shower.txt b/forge-gui/res/cardsfolder/m/meteor_shower.txt index 5816dfae98f..8ef6bd7a1f0 100644 --- a/forge-gui/res/cardsfolder/m/meteor_shower.txt +++ b/forge-gui/res/cardsfolder/m/meteor_shower.txt @@ -1,7 +1,7 @@ Name:Meteor Shower ManaCost:X X R Types:Sorcery -A:SP$ DealDamage | Cost$ X X R | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature and/or player to distribute damage to | NumDmg$ DistroDmg | TargetMin$ 1 | TargetMax$ MaxTgts | DividedAsYouChoose$ DistroDmg | References$ DistroDmg,X,MaxTgts | SpellDescription$ CARDNAME deals X plus 1 damage divided as you choose among any number of target creatures and/or players. +A:SP$ DealDamage | Cost$ X X R | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature and/or player to distribute damage to | NumDmg$ DistroDmg | TargetMin$ 1 | TargetMax$ MaxTgts | DividedAsYouChoose$ DistroDmg | References$ DistroDmg,X,MaxTgts,NumPlayers,NumCreatures | SpellDescription$ CARDNAME deals X plus 1 damage divided as you choose among any number of target creatures and/or players. SVar:NumPlayers:PlayerCountPlayers$Amount/Plus.NumCreatures SVar:NumCreatures:Count$Valid Creature SVar:MaxTgts:SVar$NumPlayers/Plus.1 diff --git a/forge-gui/res/cardsfolder/m/mind_shatter.txt b/forge-gui/res/cardsfolder/m/mind_shatter.txt index 24892d971c3..e455b57fce1 100644 --- a/forge-gui/res/cardsfolder/m/mind_shatter.txt +++ b/forge-gui/res/cardsfolder/m/mind_shatter.txt @@ -3,6 +3,5 @@ ManaCost:X B B Types:Sorcery A:SP$ Discard | Cost$ X B B | ValidTgts$ Player | NumCards$ X | References$ X | Mode$ Random | SpellDescription$ Target player discards X cards at random. SVar:X:Count$xPaid -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/mind_shatter.jpg Oracle:Target player discards X cards at random. diff --git a/forge-gui/res/cardsfolder/m/misfortune.txt b/forge-gui/res/cardsfolder/m/misfortune.txt index cea4967967d..6f5cf40353f 100644 --- a/forge-gui/res/cardsfolder/m/misfortune.txt +++ b/forge-gui/res/cardsfolder/m/misfortune.txt @@ -7,6 +7,5 @@ SVar:DBGainLife:DB$ GainLife | LifeAmount$ 4 SVar:Misfortune:DB$ PutCounterAll | ValidCards$ Creature.ChosenCtrl | CounterType$ M1M1 | CounterNum$ 1 | SubAbility$ DBLoseLife | SpellDescription$ You put a -1/-1 counter on each creature that player controls and CARDNAME deals 4 damage to him or her. | SubAbility$ DBDamage SVar:DBDamage:DB$ DealDamage | Defined$ ChosenPlayer | NumDmg$ 4 SVar:ChooserDraws:DB$ Draw | NumCards$ 3 | Defined$ ChosenPlayer -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/misfortune.jpg Oracle:An opponent chooses one —\n• You put a +1/+1 counter on each creature you control and gain 4 life.\n• You put a -1/-1 counter on each creature that player controls and Misfortune deals 4 damage to him or her. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/m/mishras_groundbreaker.txt b/forge-gui/res/cardsfolder/m/mishras_groundbreaker.txt index 4e06631d31c..0cb44472314 100644 --- a/forge-gui/res/cardsfolder/m/mishras_groundbreaker.txt +++ b/forge-gui/res/cardsfolder/m/mishras_groundbreaker.txt @@ -2,6 +2,5 @@ Name:Mishra's Groundbreaker ManaCost:4 Types:Artifact A:AB$ Animate | Cost$ T Sac<1/CARDNAME> | ValidTgts$ Land | TgtPrompt$ Select target land | Power$ 3 | Toughness$ 3 | Types$ Artifact,Creature | Permanent$ True | SpellDescription$ Target land becomes a 3/3 artifact creature that's still a land. (This effect lasts indefinitely.) -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/mishras_groundbreaker.jpg Oracle:{T}, Sacrifice Mishra's Groundbreaker: Target land becomes a 3/3 artifact creature that's still a land. (This effect lasts indefinitely.) diff --git a/forge-gui/res/cardsfolder/m/murderers_axe.txt b/forge-gui/res/cardsfolder/m/murderers_axe.txt index 66263f436ed..7b9a7cb532c 100644 --- a/forge-gui/res/cardsfolder/m/murderers_axe.txt +++ b/forge-gui/res/cardsfolder/m/murderers_axe.txt @@ -3,7 +3,8 @@ ManaCost:4 Types:Artifact Equipment S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 2 | AddToughness$ 2 | Description$ Equipped creature gets +2/+2. K:Equip Discard<1/Card> -SVar:RemAIDeck:True +SVar:AIPreference:DiscardCost$Card +SVar:RemRandomDeck:True DeckHas:Ability$Discard DeckHints:Keyword$Madness & Ability$Delirium SVar:Picture:http://www.wizards.com/global/images/magic/general/murderers_axe.jpg diff --git a/forge-gui/res/cardsfolder/m/muzzio_visionary_architect.txt b/forge-gui/res/cardsfolder/m/muzzio_visionary_architect.txt index 0e15e0bb7dd..8a7b3236354 100644 --- a/forge-gui/res/cardsfolder/m/muzzio_visionary_architect.txt +++ b/forge-gui/res/cardsfolder/m/muzzio_visionary_architect.txt @@ -2,8 +2,7 @@ Name:Muzzio, Visionary Architect ManaCost:1 U U Types:Legendary Creature Human Artificer PT:1/3 -A:AB$ Dig | Cost$ 3 U T | DigNum$ X | References$ X | Optional$ True | ChangeValid$ Artifact | DestinationZone$ Battlefield | SpellDescription$ Look at the top X cards of your library, where X is the highest converted mana cost among artifacts you control. You may reveal an artifact card from among them and put it onto the battlefield. Put the rest on the bottom of your library in any order. +A:AB$ Dig | Cost$ 3 U T | DigNum$ X | References$ X | Optional$ True | ChangeValid$ Artifact | DestinationZone$ Battlefield | AILogic$ AtOppEndOfTurn | SpellDescription$ Look at the top X cards of your library, where X is the highest converted mana cost among artifacts you control. You may reveal an artifact card from among them and put it onto the battlefield. Put the rest on the bottom of your library in any order. SVar:X:Count$HighestCMC_Artifact.YouCtrl+inZoneBattlefield -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/muzzio_visionary_architect.jpg Oracle:{3}{U}, {T}: Look at the top X cards of your library, where X is the highest converted mana cost among artifacts you control. You may reveal an artifact card from among them and put it onto the battlefield. Put the rest on the bottom of your library in any order.