Commit Graph

1180 Commits

Author SHA1 Message Date
Agetian
75ae31c071 - A less confusing parameter name for AI PayLife threshold. 2017-01-07 15:16:39 +00:00
Agetian
b3a8fcf7cb - Corrected a couple mistypes. 2017-01-07 14:55:51 +00:00
Agetian
bd0e4fb2bc - Refactored the card-specific AIs implemented so far to its own class SpecialCardAi, will consider moving other card-specific hardcoded logic there later.
- Implemented rudimentary AI logic for Necropotence and Yawgmoth's Bargain, could use improvement but should be fine in typical situations.
- Promoted Necropotence and Yawgmoth's Bargain from RemAIDeck to RemRandomDeck.
- Propagated the SA parameter to checkLifeCost (and closed the previous TODO associated with that), was also necessary to support the Necro AI logic.
2017-01-07 14:11:57 +00:00
Hanmac
fa0b0277e6 PumpAi: refactor it to use better logic for MoveCounter (not complete yet) also refactor Donate Logic to work with multiple Opponents 2017-01-05 19:54:09 +00:00
Agetian
46674dca85 - A generic solution for Donate, now supports potentially donating cards other than Illusions of Grandeur (via SVar DonateMe specifying the donate priority, with 5 being the highest and 1 being the lowest priority). 2017-01-05 19:03:54 +00:00
Agetian
a168875f37 - Added Chain of Smog with basic AI support when the player casts it targeting AI, it will only continue the chain if it ends up having no cards in hand. The AI itself currently does not know when/how to time it properly when casting it from hand (will always cast it), 2017-01-05 16:16:42 +00:00
Agetian
18b465b879 - Removed an unused import. 2017-01-05 14:25:29 +00:00
Agetian
c5d83f177f - Added AI cast preferences to either always cast a card when AI life is under a certain threshold or never to cast it under these circumstances.
- Set Illusions of Grandeur to always be cast if life is at 3 or below (in hope to save the AI's virtual skin via a topdecked/tutor-topdecked/looted Donate).
- Set Bitterblossom to never be cast if life is at 3 or below to avoid dying to it (not sure if maybe it needs to be set higher).
2017-01-05 14:24:58 +00:00
Agetian
880b7664d1 - Somewhat more generic solution for Nykthos, Shrine to Nyx AI. Currently still hard-coded to that card only, but can potentially be reused later for other cards (AILogic is already taken on Nykthos; maybe via a special AI SVar?) 2017-01-05 12:44:09 +00:00
Agetian
b6f21f5492 - More appropriate variable name in ChooseColorAi. 2017-01-05 06:58:59 +00:00
Agetian
1c40bc3215 - A little modification to make the Illusions-Donate AI smarter (currently hardcoded). 2017-01-05 06:04:28 +00:00
Agetian
2853fcc200 - Added AI logic to play a simple Illusions-Donate Trix deck.
- Added a quest opponent The Great and Powerful Trixie 4, a mono blue Trix combo deck with Illusions of Grandeur and Donate and a wide array of permission. It may be a little haphazard and not always very consistent, but it does beat many hard and very hard opponents with a decent chance.
2017-01-04 18:48:56 +00:00
Agetian
70ada910be - Improved mana source detection for Nykthos, Shrine to Nyx AI. 2017-01-04 14:35:18 +00:00
Hanmac
d96a79177b API: add ReplaceSplitDamageEffect its used for Damage splitting like en-Kor 2017-01-03 19:06:48 +00:00
Agetian
e1deb2541d - Removed a debug print line. 2017-01-03 18:48:10 +00:00
Agetian
ba68e337b7 - Added some AI priorities for Cryptic Command to specify a subability that is generally good and a subability that is good under a particular circumstance. Tests show that the AI plays the card rather sensibly with these priorities in mind, on par with other Command cards.
- Marking Cryptic Command as AI playable.
2017-01-03 18:47:34 +00:00
Agetian
a89c37af02 - Removing debug line. 2017-01-03 17:26:15 +00:00
Agetian
a8b48da7c3 - For now, limit Nykthos, Shrine to Nyx activations to abilities coming from cards in hand, on the battlefield or in command zone (fixes some more wasted activations). 2017-01-03 17:25:43 +00:00
Agetian
e59ed8a34a - Removed unused imports. 2017-01-03 13:39:29 +00:00
Agetian
103c62cab7 - Improved AI logic for Nykthos, Shrine to Nyx. Should prevent wasted activations in many (but not all) cases. 2017-01-03 13:39:01 +00:00
Agetian
2687b9a6a3 - Clarification. 2017-01-03 10:50:15 +00:00
Agetian
d6f084e6e3 - Play Combustible Gearhulk even if the opponent can't be targeted (e.g. through Sigarda, Heron's Grace), a 6/6 first strike creature is decent. 2017-01-03 10:49:21 +00:00
Agetian
faa2634ec4 - Don't forget to set target opponent for Combustible Gearhulk 2017-01-03 10:45:30 +00:00
Agetian
50760a396c - A more targeted solution for Combustible Gearhulk (in ChooseGenericEffectAi), since that card has a special hard-coded AI logic for it anyway. 2017-01-03 09:18:17 +00:00
Agetian
0290413128 - The AI should not immediately disregard triggered abilities in doTriggerAINoCost that have AI logic specified for them (fixes e.g. the AI never playing Combustible Gearhulk at all). 2017-01-03 08:54:21 +00:00
Agetian
c6b8c2cf4e - Some tidying up in ChooseColorAi 2017-01-02 15:25:20 +00:00
Agetian
9f2158c762 - Code formatting. 2017-01-02 15:17:50 +00:00
Agetian
0c18195558 - Added some basic hardcoded logic for Nykthos, Shrine to Nyx to make the AI not to waste it completely and to try to use it to get a mana advantage in main phase 2 instead, when possible.
- Marked Nykthos, Shrine to Nyx as AI playable.
2017-01-02 15:15:13 +00:00
Myrd
d45da5f3db [Simulated AI] Move out anon class to make the code more readable. 2017-01-02 00:53:21 +00:00
Myrd
7f068eb87a [Simulated AI] Refactor SpellAbilityChoicesIterator to its own class. 2017-01-02 00:46:37 +00:00
Myrd
0c6a7bbd18 [Simulated AI] Support modal spells where allowRepeat is true. (e.g. C15 confluence cycle) 2017-01-02 00:29:56 +00:00
Myrd
51af35db2e [Simulated AI] Remove SIMULATE_LAND_PLAYS constant since it's enabled by default now. 2016-12-31 18:38:52 +00:00
Myrd
52711b7b33 [Simulated AI] Make game copier copy player mana pools along with a test. 2016-12-31 18:07:36 +00:00
Myrd
6f0eda7509 [Simulated AI] Fix inverted logic I accidentally landed earlier. 2016-12-30 18:10:19 +00:00
Myrd
a2e2753429 [Simulated AI] Fix energy counters propagation with a test. 2016-12-30 18:03:58 +00:00
Myrd
ce4ef7a4d7 [Simulated AI] More safety guards around executing a planned decision.
This keeps the index and list size of the available decisions as part of the plan, to be compared with when following through with the plan. Among other things, this ensures that the correct SA is chosen from the list when there are multiple similar SAs (e.g. correctly crewing the 2nd Smuggler's Copter).
2016-12-30 17:50:47 +00:00
Myrd
6ac9182701 [Simulated AI] Fix a NPE in target caching code. 2016-12-30 17:21:51 +00:00
Myrd
503ee37c8a [Simulated AI] Make a SpellAbilityRef helper class.
I plan to expand it in the future, but for now this doesn't introduce any functional changes.
2016-12-30 17:08:34 +00:00
Myrd
4ffa41f624 [Simulated AI] Stop recursing when we've found a winning move already. 2016-12-29 22:56:19 +00:00
Myrd
1c1de9a195 [Simulated AI] Fix transformed state with a test and commit part of my fix from my previous change.
I forgot to actually commit the validation and activatedPlayer setting part of my last change, so this change contains that too.
2016-12-29 22:42:37 +00:00
Myrd
0e9b327fd9 [Simulated AI] Fix memory leak caused by SAs making it into the wrong game's spabCache.
The problem was that during copying of SAs, the spabCache was not updated correctly due to the code being in the wrong order. A further problem was that activatingPlayer was not being correctly set on the new abilities, so you would end up referencing a Player from a different Game object from an SA that was in a spabCache, resulting in many previously-simulated Game objects being leaked through this reference chain.

This change fixes both of those problems and also adds a validation function that checks the contents of the spabCache at every game copy.
2016-12-29 22:31:18 +00:00
Myrd
c3f30c6871 [Simulated AI] Make printing of the decision tree a bit better.
Also removes a print line from a test.
2016-12-29 18:22:31 +00:00
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