Commit Graph

1088 Commits

Author SHA1 Message Date
Myrd
c67a809367 [Simulated AI] Get target candidates from the SA that requires targets, rather than the root one.
This makes sense correct target restrictions are used.
2016-12-29 06:44:14 +00:00
Myrd
1d1b94e757 [Simulated AI] Teach simulated AI how to choose card modes (e.g. on Charms and Commands).
Note: There's still a limitation in the simulated AI where it doesn't know what to do when multiple effects from an ability require targets. This can be addressed in the future to support things like Cryptic Command to both counter a spell and bounce a permanent.
2016-12-29 06:36:08 +00:00
Myrd
485623b631 Fix dev mode restoring game state with counters (e.g. planeswalker loyalty). 2016-12-28 21:32:29 +00:00
Myrd
4b13094945 Remove debug print lines. 2016-12-27 20:24:47 +00:00
Myrd
0cd378b442 [Simulated AI] Fix a bug in my previous changes.
resetTargets() needs to be called before tgt.getAllCandidates() so that the currently-set target is also considered.
2016-12-27 20:24:18 +00:00
Myrd
2a6ab7ec26 [Simulated AI] Introduce an optimization that skips evaluating a target for a spell/ability if it's the same as a different target that was already evaluated (e.g. when there's lots of tokens on the field and AI is evaluating removal). 2016-12-27 20:10:59 +00:00
Myrd
8f64ad3638 [Simulated AI] Fix game copy error caused by marked damage not being copied.
Since marked damage affects attack/block decisions and this is used for scoring, it resulted in a different score being computed in the sub game, triggering a copy error.

Adds a test.

Also fixes creature power evaluation copy paste error.
2016-12-27 19:11:18 +00:00
Myrd
7521c33c30 [Simulated AI] Fix issue with empty card names when pretty-printing SpellAbilities. 2016-12-27 04:28:02 +00:00
Myrd
77a526b6d9 [Simulated AI] Fix copying tokens with abilities, like Eldrazi Scions.
Also fixes a bug in the main game code where if you have Clone try to copy a token with abilities, like an Eldrazi Scion, it would previously not get those abilities.

Adds a test for the game simulation/copy case.
2016-12-27 04:09:18 +00:00
Myrd
5f634730ff [Simulated AI] Some cards, like Wild Slash, have targeting as part of their sub-ability.
This fixes all the simulated AI logic to correctly look at all the sub-abilities for target choices. However, it still doesn't support multiple sub-abilities with targets.

Also fixes an issue - still with Wild Slash - where the AI would only look at top-level SA restrictions when determining whether a card is playable. For Wild slash, the top-level SA is the ferocious clause - while the 2 damage clause is a sub-ability and doesn't have the same restrictions.
2016-12-27 02:14:40 +00:00
Myrd
eafaaf5088 [Simulated AI] Copy combat when copying game state. This fixes an NPE in AI code that expects the Combat object to exist if we're in the corresponding phase. 2016-12-26 17:28:50 +00:00
Hanmac
e2eb916d72 make TokenDoubler use new Replacement Effect 2016-12-26 16:57:28 +00:00
Myrd
d3723daa6d [Simulated AI] Fix game copy error with dashed creatures and add a test. 2016-12-26 16:29:21 +00:00
Myrd
0b7c70230a [Simulation AI] Fix broken tests. 2016-12-26 16:12:46 +00:00
Hanmac
a67da177ff add new Replacement Effect its for manipulating the original request
Card#addCounter does show how it is done
2016-12-26 13:31:20 +00:00
Myrd
4f61ca9f3b [Simulated AI] Remove limitation of playing spells only in MAIN2 which I added a few commits ago. 2016-12-26 05:42:19 +00:00
Myrd
a78455051d [Simulated AI] Now that we're pruning the search tree a bit, enable land-play simulation and increase search depth. 2016-12-26 05:34:21 +00:00
Myrd
496f63c814 [Simulated AI] Add logic to prune some targeting decisions that have been evaluated previously in the decision tree and found lacking. 2016-12-26 05:11:36 +00:00
Myrd
6831c990a6 [Simulated AI] Add capability to simulate land plays, allowing the AI to prioritize which lands to play.
Currently, this is disabled because enabling this requires increasing the search depth and that slows things down too much currently.
2016-12-25 19:42:15 +00:00
Myrd
c3b9332e59 A few more cleanups to AIController. 2016-12-25 17:10:02 +00:00
Myrd
da9694c515 Some cleanups to AIController.
Marks some functions as private.
Renames a function to avoid confusion because of a different function with same name. Some other whitespace changes and moves attack/blocker decisions away from all the functions dealing with choosing SAs.
2016-12-25 17:04:00 +00:00
Myrd
5def006bcd Remove some extra printing. 2016-12-25 15:53:56 +00:00
Myrd
b74b952584 [Simulated AI] Remove a wasteful GameSimulator instantiation. 2016-12-25 06:39:10 +00:00
Myrd
328922029a [Simulated AI] Refactor code to create a Plan object.
This allows coming up with a multi-step planning and caching it, so it doesn't need to be re-computed at subsequent steps if nothing meaningful changed.
2016-12-25 05:05:18 +00:00
Hanmac
e2cbbd7575 ComputerUtil & HumanPlay: fixed Splice onto Arcane only for Spells 2016-12-24 11:01:48 +00:00
Hanmac
0c2b9e7445 AiController: add orderPlaySa and add it to PlayerControllerAi 2016-12-24 10:56:12 +00:00
Agetian
d2172519b4 - Clear the temporary EndOfTurnLeavePlay SVar from a Dashed creature to avoid making it linger permanently on the card for the rest of the duel. 2016-12-24 07:05:30 +00:00
Agetian
3f95f34acc - Use LKI copy for Dash AI simulation. 2016-12-23 20:42:34 +00:00
Agetian
cabd71c4f6 - Removed a test code I forgot to take out last time. 2016-12-23 20:12:30 +00:00
Agetian
4f00ae9424 - Create a new object when considering Dash and simulating it by the AI (if it has the same ID as the original card copied by the simulation, that can mess up with time stamp checks later and the card can become untargetable by spells, e.g. Kolaghan, the Storm of Fury + Force Away in Commander mode). 2016-12-23 20:08:48 +00:00
Myrd
c272cde429 Simulated AI: Evaluate different fetch targets.
This lets the AI figure out such sequences as:

Game state:

In play: Urborg, Thespian's stage & fetch land
In hand: Crop rotation

Sequence:
  1. Fetch for a forest.
  2. Crop rotate forest into Dark Depths.
  3. Activate Thespian's stage targeting Dark Depths.
  4. Profit!
2016-12-23 17:50:26 +00:00
Myrd
ca0e940069 Don't ignore counterspells in simulated AI. 2016-12-23 06:26:25 +00:00
Myrd
fce93840c0 Don't warn about cards AI can't play when using simulation AI. 2016-12-23 06:16:53 +00:00
Myrd
4b14c9d943 Fix copying of emblems for simulated AI along with a test. 2016-12-22 19:45:16 +00:00
Hanmac
94681b6675 Splice: do a total rewrite to make it better for the player and more rules conform 2016-12-21 18:32:50 +00:00
Agetian
4b46daf963 - AI should not confirm the AF Tap action if nothing at all was targeted by it (prevents e.g. the AI pouring all available mana into Waxmane Baku). 2016-12-20 13:59:53 +00:00
Hanmac
0000700320 CountersMoveAi: total refacor of AI class, now it has better logic for Tgt -> Defined and Source -> Tgt and for without Tgt 2016-12-18 06:33:40 +00:00
Hanmac
90ffab69de ClashAi & ManifestAi: use shorter form now for looking at TopCard of Library 2016-12-18 06:28:59 +00:00
Hanmac
d8c97d9c4e CardFactoryUtil: moved "At the beginning of your upkeep, sacrifice" as "UpkeepCost" in CardFactoryUtil
delete Upkeep class because its not needed anymore
2016-12-17 18:03:43 +00:00
Agetian
141f66d54d - Reset targets for ChangeZoneAi SameName logic (hopefully fixes Declaration in Stone AI targeting errors). 2016-12-17 15:05:57 +00:00
Agetian
1da0063310 - Somewhat better structuring of ChangeZoneAll AI targeting check. 2016-12-17 14:41:19 +00:00
Agetian
e09d57562f - A better idea: for non-targeted AF ChangeZoneAll, just return "true" for now without trying to target it. This allows to keep Paradigm Shift as non-RemAIDeck. 2016-12-17 14:35:45 +00:00
Agetian
8977d1ad8f - AI should not attempt targeting AF ChangeZoneAll which does not need any targets (e.g. Timetwister, Memory Jar, etc., which the current AI can't use). 2016-12-17 14:16:02 +00:00
Agetian
c789fc32f7 - List most likely can't be null at this point since it's instantiated, so just check for empty. 2016-12-16 19:02:30 +00:00
Agetian
4aec9031d3 - NPE prevention measure in ControlGainAi (potentially trying to sort an empty list when the AI has nothing to target). 2016-12-16 19:01:52 +00:00
Agetian
d3951c0061 - Added an extra check for Genju of the <X> AI. 2016-12-16 12:02:19 +00:00
Agetian
f076b765de - Removed an extra blank line. 2016-12-16 10:53:58 +00:00
Agetian
b46aabf6c6 - Prevent the AI from animating a land enchanted with an animating aura (i.e. Genju of the Cedars) by tapping the land that is to be animated. 2016-12-16 10:53:20 +00:00
Agetian
fbf3845ca6 - Fixed CountersPutAi NPEing on divided counter allocation (e.g. Ajani, Mentor of Heroes +1) 2016-12-15 06:16:55 +00:00
Sol
79813ceed7 Fix Cumulative Upkeep not hitting the stack for AI 2016-12-10 20:54:55 +00:00