Commit Graph

2301 Commits

Author SHA1 Message Date
Seravy
7e9312a93c Added :
-Never play if would suicide, unless we are losing the game next turn anyway AND it results in a double KO
-If AI has the cards that work better on small hand, do play Price of Progress even if it doesn't deal good damage to the enemy. (important synergy within Tempest block with major tournament tier cards)
2018-02-14 21:39:49 +01:00
Seravy
4048ba18f3 Merge remote-tracking branch 'remotes/origin/AINecrologia' into PriceOfProgress 2018-02-14 21:34:24 +01:00
Seravy
3ed563d3f1 Force use of Sudden Impact during enemy draw step after drawing if enemy holds 4+ cards - there likely won't be a better chance, the AI does need enough untapped mana and the human player will likely play cards over time, emptying their hand.
TODO : Ideally, the AI should hold 4 mana untapped as soon as it has 4 lands in play, and play Sudden Impact ASAP if there are 4+ cards, before the human has a chance to use up any.

Note : This might be slightly suboptimal for decks where the AI is forcing the other player to draw, and thus might deal more damage if waiting, but considering cards that force draw are usually played before this due to their mana cost and timing, I don't think this will be a problem (if such AI decks even exist right now) - especially as using one now and another later is always better than only using one and those decks should have many copies.
2018-02-14 20:58:51 +01:00
Seravy
11aef9f054 Never use if would kill self by doing so 2018-02-14 19:52:20 +01:00
Seravy
556a8e7176 One more branch where it could pick the player so "avoidtgtP" needs to be added 2018-02-14 19:36:57 +01:00
Seravy
465066c04c Had to move this part to a new "AvoidTargetP" function - shouldtargetP is not absolute, the AI still targets the player if there is no better target move, but we want it to not use the ability instead. 2018-02-14 19:20:57 +01:00
Seravy
668eaa1a7c Orcish Artielly marked as self damage
Will now target players if granted Lifelink or equivalent even if otherwise would not - self damage is not a concern
Are there any other cards that need AILogic "SelfDamage" or Svar "LikeLifeLink" added? If you are aware of any, please add!
2018-02-14 18:20:04 +01:00
Seravy
0bed673340 Do not use Fireslinger on players if our life lower
Do prefer targeting the player if has a "when this deals damage to an opponent" trigger

Important : The AI should be able to recognize the ability stacks - if there are multiple cards that deal damage, they should be used to kill the target together. (for example, tap two prodigal sorcerers to kill a 2/2 creature!)
Unfortunately, I don't think I can implement this with my current knowledge.
2018-02-14 18:06:13 +01:00
Seravy
13f606999c Improved playing conditions 2018-02-14 16:32:50 +01:00
Seravy
b0677ca006 Merge branch 'DumpTurn' into PriceOfProgress 2018-02-14 16:14:22 +01:00
Seravy
22846db1a3 Dump/Setup game state will now save current game turn.
Needed to test cards and AI that care about how many turns it have been since the start of the game.
2018-02-14 16:13:44 +01:00
Seravy
c9b634a274 fixed order of operations 2018-02-14 14:09:18 +01:00
Seravy
c37a492cb7 Was in wrong file, moved 2018-02-14 13:27:17 +01:00
Seravy
92f663c753 AI for Price of Progress 2018-02-14 13:25:13 +01:00
Michael Kamensky
2dcf4b23b7 Merge branch 'AIDestroyAllInDanger' into 'master'
AI will activate ~DestroyAll~ abilities during combat if it would lose the game,…

See merge request core-developers/forge!206
2018-02-14 03:48:09 +00:00
Michael Kamensky
22b2f30ffb Merge branch 'AICoffinQueen' into 'master'
Will not untap Coffin Queen if already reanimating a creature

See merge request core-developers/forge!204
2018-02-14 03:46:50 +00:00
Michael Kamensky
9a7215a2a2 Merge branch 'AINecrologia' into 'master'
Ai necrologia

See merge request core-developers/forge!205
2018-02-14 03:44:30 +00:00
Michael Kamensky
6d4cc6efcb Merge branch 'bloodyCardTraits' into 'master'
CardTaits: make cardtraits inside LKI has the same id's as the in the original

See merge request core-developers/forge!197
2018-02-14 03:28:25 +00:00
Seravy
ead64864f4 Now it actually works and doesn't break the card.
Marked card AI playable.

Note : This also adds a new function to ComputerUtil,that checks if the AI is in danger of being killed, or if it has a same amount of life remaning - useful for future "pay life" AI decisions.
2018-02-13 18:07:51 +01:00
Seravy
8521387312 AI can play Necrologia 2018-02-13 17:40:03 +01:00
Seravy
3e5b47185e Special case for Null Brooch because it needs to be used even though its cost has a "discard". 2018-02-13 14:59:15 +01:00
Seravy
b5dbb7da90 Countering from abilities will have a 100% chance to get used, unless it costs cards to activate, otherwise normal counter settings are used.
This ensures the AI never wastes an opportunity to counter a spell if it does not cost him a card - holding a "tap to counter target spell" ability for later use is generally bad as the AI cannot determine if they need the mana later or not - but in most cases they don't.

Required for cards Null Brooch and Ertai Wizard Adept in Tempest quest world.
2018-02-13 13:57:30 +01:00
Seravy
03886905bd Will not untap Coffin Queen if already reanimating a creature 2018-02-13 13:03:44 +01:00
Seravy
2b688a99ff Improves AI logic for Hermit Druid
-Will now use at end of enemy turn at 100% chance instead of wasting opportunity to get land and fill grave

Not sure if "RemRandomDeck" is still needed? Card is now safe to play unless the deck has fewer than 4-5 basic lands in it.
2018-02-13 11:19:55 +01:00
Seravy
2ff32d3b90 MIssing ! in the check for nonvigilence creature. 2018-02-13 03:11:18 +01:00
Seravy
76bcbc632e Rearranged to fix rounding problem 2018-02-12 00:03:09 +01:00
Seravy
e04d88977e adding to cards L-Z
Added creatures with low power that have
-abilities that tap for something really valuable like drawing a card
-abilities that usually need to be saved until enemy turn (counter a spell, tap a creature, prevent damage)
-abilities that usually deal equal or more damage if not attacking (prodigal sorcerer, grim lavamancer)
Generally avoided abilities where activating before combat is an acceptable choice and thus the attack decision doesn't come up anyway as the AI already used the ability.
However, this behavior is unacceptable on certain abilities (mostly those with higher mana costs) which should not be used before the end of main 2 as it prevents the AI from actually playing their cards. (like Hanna Ship Navigator)

I suspect this will need quite a bit of improvement in the future but we have to start somewhere.
2018-02-11 22:13:58 +01:00
Seravy
07439cfeeb Exclude creatures with vigilance - attacking does not prevent using the ability 2018-02-11 20:27:03 +01:00
Seravy
15715cec10 Tested and now it works, unfortunately it's not as smart as I originally wanted, but it'll do. 2018-02-11 18:34:33 +01:00
Seravy
3662bb8e84 Implements Feature 2018-02-11 17:31:20 +01:00
Agetian
8a880a3f89 - Simplify a target num check in AiController. 2018-02-11 13:27:11 +03:00
Agetian
670966be57 - Fixed the AI targeting restrictions check in AiController to account for the AILogics that can pre-target cards.
- Added an AI logic for The Scarab God (can be generalized later).
2018-02-11 07:46:38 +03:00
Seravy
3a9af0480d Improves "NonStackingEffect" Svar behavior for the AI.
The AI will now not play a second copy of these cards if and only if, there is no copy of the card owned by that AI in play, except copies that are enchanted by Auras owned by other players.
Later, a better logic that actually determines whether the enchanting aura removes the relevant ability from the card or not should be added - Warp Artifact will not stop a disk from activating, but Arrest will (if it's a creature).

Note : Only add NonStackingEffect to permanents the AI shouldn't play more than one of at a time if and only if, removal of enchantment is not pontentially leathal to the AI.
For example, do not add to Ensnaring Bridge or Moat, as loss of those allows the enemy to swing with possibly accumulated large armies for likely too much damage.
Those cards will need a different logic, that avoids playing a second copy if and only if the threat the card protects from is already too dangerous.
2018-02-10 23:21:03 +01:00
Hanmac
2e196fc41b CardTaits: make cardtraits inside LKI has the same id's as the in the original object\nReplaceMoved now works with Blood Moon and Blood Sun 2018-02-10 18:50:22 +01:00
Seravy
0fe8c1f121 AI will activate ~DestroyAll~ abilities during combat if it would lose the game, or it would take too much damage (Nevinnyrral's Disk, Pernicious Deed) 2018-02-10 13:30:22 +01:00
Agetian
647e9f6a14 - Got rid of an esoteric component for logging, switched over to standard err printout like it's done in most other places. 2018-02-08 15:28:50 +03:00
Hanmac
ff7a0f1ae6 Regeneration Rework:
- Regenerate or RegenerateAll does create an Effect
in Command which does replace Destroy if possible
- Trigger Regenerated will be added to the Effect
if something does care about "regenerated that way"
- new Regeneration Api is the internal effect
that does handle the actual regeneration
- ReplaceDestroy has Section to handle if Regeneration is possible
- CardShields are removed with the option in PlayerController
2018-02-06 12:56:02 +01:00
Agetian
ecd4a5dedd - Fixed the AI trying to e.g. Embalm a Vizier of Many Faces ignoring the NeedsToPlay SVar requirement. 2018-02-04 20:24:51 +03:00
Agetian
369c4f77a0 - AiController: a more robust check for potential targets in order to avoid the AI activating an ability it can't legally target due to restrictions (e.g. Wicked Akuba). 2018-01-30 19:26:14 +03:00
Agetian
b763e06560 - AiAttackController: Don't check targeting restrictions if the ability doesn't target. 2018-01-30 08:45:25 +03:00
Agetian
2447ea4fb0 - AiAttackController/AiBlockController: do not count activated abilities that can't target the attacker/blocker when trying to predict P/T bonus from AF Pump (fixes the AI suicide attacking/blocking with cards like Pia Nalaar) 2018-01-30 08:45:25 +03:00
Agetian
b0037faa11 - Fixed an AI logic error in CountersPutAi which caused the AI to buff the opponent's creatures with Incremental Growth. 2018-01-27 19:34:11 +03:00
Agetian
1e59b75d08 - Don't order cards from Discard<0/Hand> if there's only one card going to graveyard.
- Allow to order the cards going to graveyard from Discard<X/Random>.
2018-01-24 16:53:30 +03:00
Agetian
bfef8b125c - Fixed the cost "discard your hand" not allowing to order the cards going to graveyard when and if needed. 2018-01-24 16:41:12 +03:00
Agetian
714f21913b - Method name unification. 2018-01-24 09:14:08 +03:00
Agetian
6e1733821c - Somewhat better logic for Glimmer of Genius, part 2. 2018-01-24 09:07:00 +03:00
Agetian
2be734f137 - Somewhat better logic for Glimmer of Genius. 2018-01-24 08:23:28 +03:00
Agetian
89184b97dd - ScryAi: Glimmer of Genius -> at opp EOT 2018-01-23 23:50:48 +03:00
Agetian
ce35c6232e - Simple AI logic for Explore with a target (e.g. Enter the Unknown), fixes the AI wasting its activation. 2018-01-23 18:17:36 +03:00
Agetian
2e51375c0f - Somewhat less risky logic for the AI Glimmer of Genius (otherwise it manalocks itself too much) 2018-01-23 18:03:31 +03:00