It is currently 19 Oct 2018, 18:14
   
Text Size

AI "DamageAll" patch

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, friarsol, Blacksmith, KrazyTheFox, Agetian, CCGHQ Admins

AI "DamageAll" patch

Postby Seravy » 11 Jul 2017, 20:19

"And now for something completely different"

Quest patches conflicting in the options menu isn't a reason to stop me from making patches that aren't related to that.

This patch should improve AI logic on "deals damage to all players" type effects, by allowing the AI use these when the ability is expected to kill the opponent faster than themselves, if used repeatedly. The condition is the enemy being lower than 10 life, or the damage dealt in one go being enough to kill in two shots. This should be strict enough to make sure the card is not wasted early when it could be saved to kill creatures instead.
Furthermore, the card "Pestilence" got a special rule - if used to deal direct damage to the other player with the intention to kill them over multiple turns, it will only be used at the end of the opponent's turn, so mana is preserved for other uses if necessary.

This should allow the AI to do plays such as tapping 4 swamps for pestilence, then untapping next turn and tapping another 3 to kill an opponent at 7 life, or play two earthquakes for 9 each to kill an opponent at 18 life. (in both cases the AI has to be able to survive doing so, obviously.)

Furthermore, the AI will always use such abilities if it's expected to take no damage from it, and lose no creatures. This should allow combos such as Pestilence and Urza's Armor to function. Or Earthquake+Solitary Confinement.

I've formatted the changes using the "source->format" menu, I hope the result is what you wanted.

There is still a lot of room for improvement - the AI doesn't seem to be able to "pump" Pestilence to kill a 2/2 creature for example, nor will it "sacrifice" own creatures to kill the player - but it should be a lot more competent at playing the card, which is important as it's in a lot of sets and is drafted often. I've won at least half a dozen draft games where the AI could have finished me off using Pestilence, but failed to do so. I'm planning to improve this patch once I get better understanding of the available procedures and functions to call - but it definitely will take time so please integrate the patch meanwhile and don't wait for that.

I've tested the patch with the card "Pestilence" so far but I expect it to work the same way for every card that has "X damage to all players".
AIPestileceFirst.txt
(3.71 KiB) Downloaded 26 times
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: AI "DamageAll" patch

Postby Agetian » 13 Jul 2017, 05:32

Tested and integrated. Thanks! :)

- Agetian
Agetian
Programmer
 
Posts: 3274
Joined: 14 Mar 2011, 05:58
Has thanked: 629 times
Been thanked: 477 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 9 guests


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 9 guests

Login Form