Compare commits

..

2474 Commits

Author SHA1 Message Date
Blacksmith
35706d71f7 [maven-release-plugin] prepare release forge-1.6.7 2018-02-25 22:49:41 +00:00
Blacksmith
c38f0900d1 Update README.txt for release 2018-02-25 22:48:23 +00:00
Blacksmith
ea4b82f11e Fix SCM URLs again 2018-02-25 21:56:15 +00:00
Blacksmith
8cfff4299a Fix SCM URLs 2018-02-25 21:35:49 +00:00
Sol
d4d376c8c6 Merge branch 'PlaneshiftPromos' into 'master'
Fixing Planeshift set alter foils in boosters

See merge request core-developers/forge!202
2018-02-25 20:19:19 +00:00
Blacksmith
0146357eed Remove test file 2018-02-25 18:13:04 +00:00
Blacksmith
9759264aec Test direct commit access for Blacksmith 2018-02-25 18:06:22 +00:00
Sol
c17465a2a7 Merge branch 'git-pom-update' into 'master'
Update pom file to support git releases

See merge request core-developers/forge!258
2018-02-25 17:52:34 +00:00
KrazyTheFox
dc3795d1cd Update pom file to support git releases 2018-02-25 12:45:02 -05:00
Sol
fdf2b26fdf Merge branch 'multiplayer' into 'master'
Multiplayer

See merge request core-developers/forge!257
2018-02-25 04:45:31 +00:00
Jamin W. Collins
eff0012ea1 add warning to server connect dialog
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-24 15:32:30 -07:00
Jamin W. Collins
d74186e93c update release notes
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-24 14:12:29 -07:00
Jamin Collins
fe108bb354 Merge branch 'multiplayerandroidfixes' into 'master'
Fix to get multiplayer working on android - added more classes to the "keep"…

See merge request core-developers/forge!255
2018-02-24 21:03:49 +00:00
Jamin W. Collins
9fb556f180 add Serialization to Cost objects
Resolves forge/#160

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-24 14:02:09 -07:00
Michael Kamensky
f1db204e0d Merge branch 'challengerdecks3' into 'master'
URGENT - Added metadata to new challenger decks to fix NPE

See merge request core-developers/forge!256
2018-02-24 18:39:54 +00:00
Jamin W. Collins
fd35c8d862 add option to be alerted on receipt of priority
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-24 10:51:43 -07:00
maustin
4d134e5087 Merge remote-tracking branch 'origin/challengerdecks3' into challengerdecks3
# Conflicts:
#	forge-gui/res/quest/precons/Hazoret Aggro.dck
#	forge-gui/res/quest/precons/Second Sun Control.dck
#	forge-gui/res/quest/precons/Vehicle Rush.dck
2018-02-24 17:25:19 +00:00
austinio7116
1e3b4e34e5 Added metadata to new challenger decks to fix NPE 2018-02-24 17:24:53 +00:00
austinio7116
95a02bece7 Added metadata to new challenger decks to fix NPE 2018-02-24 17:22:32 +00:00
austinio7116
62ffb786b2 Fix to get multiplayer working on android - added more classes to the "keep" list in proguard.cfg. Lots more testing to do, but can start a game Android vs pc 2018-02-24 15:58:31 +00:00
Michael Kamensky
4d41ed60c9 Merge branch 'challengerdecks2' into 'master'
Added first batch of preconstructed challenger decks

See merge request core-developers/forge!253
2018-02-24 06:48:26 +00:00
Sol
fc8624c93b Merge branch 'multiplayer' into 'master'
ensure that View(s) are used for ManaAbility choice(s)

See merge request core-developers/forge!251
2018-02-24 00:14:05 +00:00
Sol
800a77b2e0 Merge branch 'multiplayerchatfixes' into 'master'
Extended multiplayer chat text box to 255 character max from 60 and fixed multiplayer chat focus stealing issue

See merge request core-developers/forge!254
2018-02-23 23:58:33 +00:00
austinio7116
361443d845 Extended multiplayer chat text box to 255 character max from 60
Prevented the game from stealing focus from the multi player chat box to ensure you do not auto end turn or pass priority due to typing in chat when you regain priority
2018-02-23 21:20:25 +00:00
maustin
7db9a6730a Merge remote-tracking branch 'origin/challengerdecks2' into challengerdecks2
# Conflicts:
#	forge-gui/res/quest/precons/Counter Surge.dck
#	forge-gui/res/quest/precons/Vehicle Rush.dck
2018-02-23 19:38:10 +00:00
austinio7116
5a784e6c9b Added first batch of preconstructed challenger decks 2018-02-23 19:37:31 +00:00
austinio7116
91c16a319c Added first batch of preconstructed challenger decks 2018-02-23 19:33:20 +00:00
Jamin W. Collins
06bc5e074a ensure that View(s) are used for ManaAbility choice(s)
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-22 20:06:23 -07:00
Michael Kamensky
85adc466b3 Merge branch 'master' into 'master'
- Code base cleanup.

See merge request core-developers/forge!237
2018-02-22 04:16:51 +00:00
Sol
afc02a856d Merge branch 'multiplayer' into 'master'
further multiplayer fixes

See merge request core-developers/forge!250
2018-02-22 01:29:23 +00:00
Jamin W. Collins
21d6b02410 submit previous deck if sideboarding timeout occurs
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-21 17:27:03 -07:00
Jamin W. Collins
5b0b719ce9 use SpellAbilityView for generic effect choice(s)
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-21 17:13:33 -07:00
Jamin W. Collins
9ce0315c3e give remote players 5 minutes per question
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-21 17:10:51 -07:00
Sol
d7bca1c232 Merge branch 'multiplayer' into 'master'
multiplayer fixes for graveyard and stack targeting

See merge request core-developers/forge!248
2018-02-21 04:11:16 +00:00
Jamin W. Collins
0a034f9acb ensure Stack targeting uses views
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-20 20:47:21 -07:00
Jamin W. Collins
98774c408c ensure that TargetSelection presents CardView(s)
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-20 20:20:41 -07:00
Jamin W. Collins
802036f693 print a message when unable to send event
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-20 15:27:18 -07:00
Agetian
5bb9ac6fcd - More cleanup. 2018-02-20 08:02:31 +03:00
Agetian
fcc02ed600 Merge branch 'master' of git.cardforge.org:core-developers/forge into agetian-master 2018-02-20 07:55:13 +03:00
Sol
1e45d14ec3 Merge branch 'AftermathFix' into 'master'
CardFactory: fixed keywords for SplitCards

See merge request core-developers/forge!239
2018-02-20 02:42:39 +00:00
Sol
97027e657e Merge branch 'multiplayer' into 'master'
further multiplayer fixes

See merge request core-developers/forge!238
2018-02-20 02:41:48 +00:00
Jamin W. Collins
487fec0258 multiplayer fix for 2nd and 3rd games of match
The server was not updating the lobby player's game reference.  So, the
remote client's response was being processed for the wrong game
instance.

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-19 16:03:48 -07:00
Hanmac
b25bc72f3e CardFactory: fixed keywords for SplitCards 2018-02-19 21:37:16 +01:00
Jamin W. Collins
d086e4d692 cleanup remote client game state creation
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-19 13:23:07 -07:00
Jamin W. Collins
8d2d66abb9 move external address out to a class attribute
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-19 13:23:07 -07:00
Agetian
83242e1fa9 - More cleanup. 2018-02-19 20:56:05 +03:00
Agetian
35fa4e7d8f - More cleanup. 2018-02-19 20:50:45 +03:00
Agetian
5022e96a48 - More cleanup. 2018-02-19 20:50:09 +03:00
Agetian
1779c8f84e - More cleanup and Price of Progress logic fix. 2018-02-19 20:15:12 +03:00
Michael Kamensky
74d9791f03 Merge branch 'ScorchedEarth' into 'master'
Scorched earth

See merge request core-developers/forge!234
2018-02-19 16:52:41 +00:00
Michael Kamensky
a6cb96c758 Merge branch 'BattleCry' into 'master'
Gerrard's Battle Cry : play before combat

See merge request core-developers/forge!235
2018-02-19 16:51:59 +00:00
Agetian
b05463ad6c - Code base cleanup. 2018-02-19 19:48:06 +03:00
Seravy
f229fbc4b1 Update DestroyAi.java 2018-02-19 12:54:16 +00:00
Seravy
1d470f87d4 Gerrard's Battle Cry : play before combat 2018-02-19 12:55:59 +01:00
Michael Kamensky
8c680da98c Merge branch 'PriceOfProgress' into 'master'
Price of progress

See merge request core-developers/forge!210
2018-02-19 04:37:54 +00:00
Michael Kamensky
21e682f54d Merge branch 'deck-editor' into 'master'
improve how foiling is done

See merge request core-developers/forge!233
2018-02-19 04:27:28 +00:00
Seravy
70593c2b6a Try to play Scorching Earth before playing a land for higher X. 2018-02-18 23:35:44 +01:00
Seravy
6b64667767 Do not spend more on X than the number of lands we can discard! 2018-02-18 21:37:20 +01:00
Hanmac
96d1777132 ChangeZoneEffect: it should Fizzle when removing to Command zone too 2018-02-18 20:58:12 +01:00
Jamin W. Collins
f6bd725633 improve how foiling is done
Previous implementation relied on the removed card becoming focused in
the full card inventory.  This implementation works directly with the
deck avoiding the full inventory.

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-18 12:51:55 -07:00
Michael Kamensky
dd7e2d933f Merge branch 'DumpTurn' into 'master'
Dump/Setup game state will now save current game turn.

See merge request core-developers/forge!209
2018-02-18 19:39:22 +00:00
Seravy
97177e379e Default turn = 1 if none set 2018-02-18 20:22:17 +01:00
Seravy
8df00a18e8 This should be 0 2018-02-18 19:55:59 +01:00
Michael Kamensky
6668fa5505 Merge branch 'revert-a9e15c2d' into 'master'
Revert "Merge branch 'Guavafix' into 'master'"

See merge request core-developers/forge!232
2018-02-18 18:54:35 +00:00
Seravy
c348ffa34e Now using SVar 2018-02-18 19:54:29 +01:00
Michael Kamensky
275e1be6be Revert "Merge branch 'Guavafix' into 'master'"
This reverts merge request !217
2018-02-18 18:54:20 +00:00
Hanmac
0c005bb3ff Commander: CommanderTax now is on the Player who casted the Commander 2018-02-18 18:47:59 +01:00
Hanmac
57b9a1b4c7 SpellAbility: copy manaPart 2018-02-18 18:07:41 +01:00
Hanmac
b29b1b3630 CardState: fixed copyState and LKI 2018-02-18 18:06:38 +01:00
Hanmac
3a071ea071 DestroyAi: extended havepact logic 2018-02-18 11:26:34 +01:00
Hanmac
25efe15329 fix final in ACEditor 2018-02-18 11:17:48 +01:00
Michael Kamensky
d544d69524 Merge branch 'AIInDangerRange' into 'master'
AI In danger threshold now configurable and can be random instead of being locked to always 4.

See merge request core-developers/forge!220
2018-02-18 09:15:34 +00:00
Michael Kamensky
bcc0fc9e00 Merge branch 'AINoncombatantCreatures' into 'master'
Ai noncombatant creatures

See merge request core-developers/forge!221
2018-02-18 09:10:39 +00:00
Seravy
7f2d2d6588 AI In danger threshold now configurable and can be random instead of being locked to always 4.
(As a player, I find the fact the AI always changes their behavior towards more defensive at exactly 5 life extremely abusable - I can always be 100% sure they won't block certain creatures or activate certain spells/abilties otherwise, and in many cases, if the AI already got down to 5 life, even if they do activate their big trump card, it's too late : the last 5 damage is way easy to deal.)

Used this for playing the past few days and it seemed to work without problems.
2018-02-18 10:08:29 +01:00
Michael Kamensky
2e70eb6718 Merge branch 'master' into 'master'
- Minor cleanup.

See merge request core-developers/forge!230
2018-02-18 08:59:38 +00:00
Agetian
b7601fded3 - Minor cleanup. 2018-02-18 11:59:10 +03:00
Michael Kamensky
13ace49230 Merge branch 'AISpiritMirror' into 'master'
Ai spirit mirror

See merge request core-developers/forge!223
2018-02-18 08:57:23 +00:00
Seravy
229ecc9ba7 missing an "s" in script 2018-02-18 09:39:18 +01:00
Seravy
602f761552 This should work? 2018-02-18 09:39:17 +01:00
Seravy
f271c7a74e Now the AI properly realizes this can be played, but doesn't actually play it.
Is there something that prevents it from playing things that destroy own tokens?
2018-02-18 09:39:15 +01:00
Seravy
c47242e40e fixed card name 2018-02-18 09:39:14 +01:00
Seravy
887f2f9a52 Mark Spirit Mirror and Breeding Pit tokens as things to sacrifice.
If Grave Pact is in play, activate Spirit Mirror to destroy own token and force enemy to sac a creature if possible.
2018-02-18 09:39:13 +01:00
Michael Kamensky
6b528a6d99 Merge branch 'DeckResetFixing' into 'master'
Deck reset fixing

See merge request core-developers/forge!213
2018-02-18 08:36:08 +00:00
Seravy
7ff8564077 Merge branch 'master' of https://git.cardforge.org/core-developers/forge 2018-02-18 09:35:39 +01:00
Michael Kamensky
77e79653ba Merge branch 'master' into 'master'
- Minor cleanup and updating CHANGES.txt.

See merge request core-developers/forge!229
2018-02-18 08:31:14 +00:00
Agetian
4665503caa - Minor cleanup and updating CHANGES.txt. 2018-02-18 11:29:02 +03:00
Michael Kamensky
1f922362a1 Merge branch 'mobile-dev' into 'master'
add commandline parsing/options to mobile-dev

See merge request core-developers/forge!216
2018-02-18 08:25:21 +00:00
Michael Kamensky
f5e095f345 Merge branch 'cantblock' into 'master'
CantBlockBy as Static Ability

See merge request core-developers/forge!218
2018-02-18 08:05:59 +00:00
Michael Kamensky
a392fc43f9 Merge branch 'deck-viewer' into 'master'
improve "Copy to Clipboard" - merge reprinted cards

See merge request core-developers/forge!215
2018-02-18 07:41:49 +00:00
Michael Kamensky
d444e8896c Merge branch 'Fireslinger' into 'master'
Fireslinger

See merge request core-developers/forge!211
2018-02-18 07:36:27 +00:00
Michael Kamensky
935d42af74 Merge branch 'SuddenImpact' into 'master'
Force use of Sudden Impact during enemy draw step after drawing if enemy holds…

See merge request core-developers/forge!212
2018-02-18 07:34:03 +00:00
Michael Kamensky
a9e15c2d33 Merge branch 'Guavafix' into 'master'
The guava fix

See merge request core-developers/forge!217
2018-02-18 07:17:15 +00:00
Michael Kamensky
b5ae52a3b6 Merge branch 'AiNonstacking' into 'master'
AI Nonstacking Permanents

See merge request core-developers/forge!222
2018-02-18 05:54:50 +00:00
Michael Kamensky
abf405fd20 Merge branch 'deck-editor' into 'master'
add option to foil cards in a deck

See merge request core-developers/forge!219
2018-02-18 05:50:49 +00:00
Michael Kamensky
3215eb9a8a Merge branch 'CounterFromAbilityAI' into 'master'
Counter from ability ai

See merge request core-developers/forge!224
2018-02-18 05:49:09 +00:00
Michael Kamensky
f2ddd697e9 Merge branch 'AICuriosity' into 'master'
Ai curiosity

See merge request core-developers/forge!225
2018-02-18 05:47:57 +00:00
Michael Kamensky
9e6fc59505 Merge branch 'Oaths' into 'master'
Oaths

See merge request core-developers/forge!227
2018-02-18 05:45:47 +00:00
Michael Kamensky
2dc0e10c34 Merge branch 'TreasureTroveFix' into 'master'
AI Logic name in code and actual card scripts did not match. Assuming the…

See merge request core-developers/forge!228
2018-02-18 05:45:14 +00:00
Sol
2a086c8b64 Merge branch 'token-artwork' into 'master'
Token artwork

See merge request core-developers/forge!214
2018-02-18 03:08:38 +00:00
Seravy
cf9e3a5f1d "Tap to deal X damage to target player" should be a priority target even if it's a defender or 0 attack creature 2018-02-17 22:58:45 +01:00
Jamin W. Collins
373e11bc41 add option to foil cards in a deck
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-17 12:42:56 -07:00
Seravy
bb27eab819 Merge branch 'Guavafix' 2018-02-17 16:53:49 +01:00
Jamin W. Collins
d99dd5f19f add commandline parsing/options to mobile-dev
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-17 08:50:41 -07:00
Jamin W. Collins
d60d350fcb token-artwork - try removing variant as a fallback
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-17 08:48:46 -07:00
Jamin W. Collins
b1e7e407a7 token artwork - try uppercase set name
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-17 08:48:46 -07:00
Jamin W. Collins
4e7d338144 improve "Copy to Clipboard" - merge reprinted cards
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-17 08:48:45 -07:00
Hanmac
4528541b3f AiController: add orderSa for token and pump effects for Hero of Bladehold 2018-02-17 16:25:41 +01:00
Hanmac
a829dc72bc CardFactoryUtil: make CantBeBlockedBy into new StaticAbility 2018-02-17 15:25:51 +01:00
Seravy
b6395aa463 The guava fix 2018-02-17 12:06:57 +01:00
Hanmac
3f1d6238ff CardFactoryUtil: add Battle cry as trigger 2018-02-17 12:01:53 +01:00
Hanmac
e990c3648e cards: update card scripts for new CantBlockByStatic 2018-02-17 10:29:07 +01:00
Seravy
67f9be5d4d endswith->equals 2018-02-17 01:19:37 +01:00
Seravy
8650a147aa AI Logic name in code and actual card scripts did not match. Assuming the scripts (6 cards) are correct as no card uses the other name. 2018-02-17 00:46:32 +01:00
Hanmac
8490f8d90b Card: fixed CARDNAME & EFFECTSOURCE on the static abilties 2018-02-16 20:55:17 +01:00
Hanmac
8f1c7bf40a EffectEffect: add AtEOT, remembering host card 2018-02-16 20:44:48 +01:00
Hanmac
ec87b64d0c Blazing Torch: CantBlockBy example 2018-02-16 16:51:37 +01:00
Hanmac
27eee4c8fa Card: show CantBlockBy on affected creature 2018-02-16 16:50:43 +01:00
Hanmac
af32152bcc CantBlockBy: now done as static ability 2018-02-16 16:49:25 +01:00
Hanmac
e72edb95b5 Manifest: fixed check with worms of the earth 2018-02-16 14:02:34 +01:00
Hanmac
efed143a11 ReplaceMoved: fixed zonetype check 2018-02-16 14:01:07 +01:00
Seravy
99f64d7565 Add fear to evasion abilities 2018-02-16 12:34:35 +01:00
Seravy
32ef472b0c AI prefers evasion or "tap to deal damage to player" creatures to enchant with these. 2018-02-16 12:22:50 +01:00
Sol
7ade1b9a52 Merge branch 'multiplayer' into 'master'
Multiplayer

See merge request core-developers/forge!207
2018-02-16 01:07:35 +00:00
Sol
cc664d1280 Merge branch 'DefaultFiltersOption' into 'master'
Default filters option

See merge request core-developers/forge!175
2018-02-16 01:00:20 +00:00
Jamin W. Collins
84874601a9 Continue but log NullPointerException in getMana
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-15 17:08:01 -07:00
Jamin W. Collins
b47d528bf0 ensure that remote client has trackers defined
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-15 17:07:14 -07:00
Seravy
59612c45ea Resolving conflicts 2018-02-15 10:03:54 +01:00
Seravy
e8be6f674e Add quest mode option to make Foil and Personal Rating filters default on all editor screens. 2018-02-15 10:01:59 +01:00
Seravy
33554dd9cc changed order 2018-02-15 09:48:26 +01:00
Seravy
4dd73930e3 p->P 2018-02-15 09:40:28 +01:00
Seravy
af14c33e39 Fixed problems with previous commit 2018-02-14 22:26:54 +01:00
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
Seravy
35a2f9bf2b Fixes Ghouls - this one benefits the player with the MORE cards, not less. 2018-02-14 12:46:09 +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
Jamin W. Collins
45a0c54fb8 Define getter for TrackableObject props
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:44:28 -07:00
Jamin W. Collins
e8c9c8b90c Define getter for ClientGameLobby
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:41:56 -07:00
Jamin W. Collins
367fcad53c Define getter for GameView
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:38:58 -07:00
Jamin W. Collins
3a6c5b0cd5 Allow arbitrarily setting a Tracker
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:36:19 -07:00
Jamin W. Collins
375adab087 gracefully handle failure to connect to server
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:33:25 -07:00
Jamin W. Collins
fbf0f98c3a Limit team editing to each player
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:30:58 -07:00
Jamin W. Collins
711342829b Improve interruption messaging
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:28:47 -07:00
Jamin W. Collins
daf3be6346 Improve reported multiplayer host IP
The existing IP selection logic was less than optimal on Linux hosts
where it would frequently select and report 127.0.0.1 as the IP address
to share.  The new logic will create a datagram socket, use it to locate
an interface with a default route, and further backtrack to the
interface's IPv4 address.

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-13 18:16:10 -07:00
Seravy
06edf9351a Oath of Druids, Oath of Lieges, Oath of Ghouls
Do not play if the enemy would immediately benefit from them in their upkeep.
2018-02-14 01:06:46 +01: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
Sol
f01282f12f Merge branch 'patch-6' into 'master'
Several updates to formats.txt

See merge request core-developers/forge!203
2018-02-13 03:06:11 +00:00
Sol
5e5fca9722 Merge branch 'LifeTotalBonusOption' into 'master'
Life total bonus option

See merge request core-developers/forge!176
2018-02-13 02:57:25 +00:00
Seravy
2ff32d3b90 MIssing ! in the check for nonvigilence creature. 2018-02-13 03:11:18 +01:00
Seravy
3b72bd18f0 Now quest data needs to be saved when changing decks, instead of quest preferences. 2018-02-13 02:14:42 +01:00
Rob Schnautz
fcb7f89001 typo (Trace Secrets > Trade Secrets) 2018-02-13 00:49:25 +00:00
Rob Schnautz
38cebf52c3 missed a couple 2018-02-13 00:48:05 +00:00
Seravy
56983b2553 Moves "Current_Deck" from Quest Preferences to Quest Data.
Without this, the selected deck name was global for all quests - switching to another quest retained the deck name from the previous quest
and if the new quest had a deck with the identical name, selected that one, otherwise selected nothing. (in one weird case, this resulted in quest data that crashed caused bugs when loading forge - as quest was saved with a selected deck from another quest data.)
Preferred behavior is to select the deck that was last selected in THAT QUEST when switching to another quest.
2018-02-13 01:37:00 +01:00
Rob Schnautz
04b347b968 we're not ready for block formats 2018-02-13 00:21:21 +00:00
Rob Schnautz
08a87ea112 Add conspiracy and ante cards to ban lists, update Standard, Modern, and Commander. Modern list is officially effective the 19th, all the rest is current. Add block formats. Reorder formats in the same order shown on the website. Move Extended to the end. To do: remove Extended. 2018-02-12 23:56:45 +00:00
Seravy
67e8046af6 Remove the line that resets the selected deck index to 0, so the next time the deck tab is opened, it autopicks the first deck instead of keeping what was last chosen. 2018-02-13 00:43:26 +01:00
Sol
dc11fad342 Merge branch 'QuestDraftRotation' into 'master'
Quest draft rotation

See merge request core-developers/forge!179
2018-02-12 03:06:40 +00:00
Seravy
8f9857e72d Fixing Planeshift set alter foils in boosters
-Now always foil, and with the (guesstimated) correct chance.
2018-02-12 01:11:03 +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
Hanmac
3e613a8b80 cards: remove triggerZones from Unequip trigger, it doesn't work with ChangeZoneAll effects 2018-02-11 21:04:49 +01:00
Seravy
1f364168e8 adding to cards D-K 2018-02-11 20:55:44 +01:00
Seravy
07439cfeeb Exclude creatures with vigilance - attacking does not prevent using the ability 2018-02-11 20:27:03 +01:00
Seravy
94eda92d21 Adding to cards A-C 2018-02-11 20:15:51 +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
Sol
14fc75be44 Merge branch 'QuestDraftSetFix' into 'master'
Quest draft set fix

See merge request core-developers/forge!174
2018-02-11 15:18:12 +00:00
Sol
a489e0845b Merge branch 'BonusForWinsOption' into 'master'
Bonus for wins option

See merge request core-developers/forge!173
2018-02-11 15:16:10 +00:00
Michael Kamensky
acf7a23965 Merge branch 'HornedKavuFix' into 'master'
Fixes Horned Kavu being played incorrectly (returning another Horned Kavu or itself)

See merge request core-developers/forge!201
2018-02-11 14:26:20 +00:00
Hanmac
a96a2fd825 Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-02-11 14:53:58 +01:00
Hanmac
d455653f11 Debuff: with keyword changes, directly remove of keywords is not needed anymore, let changed keywords handle that 2018-02-11 14:53:27 +01:00
Seravy
8579ae99a0 Fixes Horned Kavu being played incorrectly (returning another Horned Kavu or itself) 2018-02-11 14:42:41 +01:00
Hanmac
da5cb3d905 check lands: use shorter code for etb replacement 2018-02-11 12:11:04 +01:00
Michael Kamensky
81315e3db4 Merge branch 'assorted-fixes' into 'master'
- Simplify a target num check in AiController.

See merge request core-developers/forge!200
2018-02-11 10:28:08 +00:00
Agetian
8a880a3f89 - Simplify a target num check in AiController. 2018-02-11 13:27:11 +03:00
Michael Kamensky
d5da9a80f6 Merge branch 'assorted-fixes' into 'master'
- Fixed the AI targeting restrictions check, added an AI logic for The Scarab God.

See merge request core-developers/forge!199
2018-02-11 05:09:39 +00: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
Michael Kamensky
5879690fc0 Merge branch 'upcoming_rix2' into 'master'
Refresh of Frontier Cube to include RIX

See merge request core-developers/forge!194
2018-02-11 03:54:52 +00:00
Seravy
ff054d44b7 Adding to cards where needed part 3 - Done up to base set 10th ED, expansions Apocalypse 2018-02-11 02:14:58 +01:00
Seravy
e909cfc744 Adding to cards where needed part 2 2018-02-11 01:49:43 +01:00
Seravy
b51ca84a8f Adding to cards where needed (and removing from cards where it isn't safe to rely on one copy, like Moat) 2018-02-11 00:28:22 +01: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
Michael Kamensky
ebd0a8096c Merge branch 'error-msg-fixes' into 'master'
Disambiguate class name in error StorageReader errors

See merge request core-developers/forge!196
2018-02-10 18:54:01 +00:00
Michael Kamensky
a1f2f8d944 Merge branch 'svn-to-git' into 'master'
make development version reference GIT not SVN

See merge request core-developers/forge!198
2018-02-10 18:53:39 +00:00
Jamin W. Collins
0a4dc6961d make development version reference GIT not SVN
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-10 11:13:41 -07: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
Jamin W. Collins
844a7b5d76 Disambiguate class name in error StorageReader errors
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-02-10 10:28:39 -07:00
Michael Kamensky
ce343ffcdb Merge branch 'mobile-release' into 'master'
- Preparing Forge for Android publish v1.6.6.004 [incremental/bugfixes]

See merge request core-developers/forge!195
2018-02-10 16:17:12 +00:00
Agetian
25972aaa29 - Preparing Forge for Android publish v1.6.6.004 [incremental/bugfixes] 2018-02-10 19:11:33 +03: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
austinio7116
cb37cf0889 Refresh of Frontier Cube to include RIX 2018-02-10 09:36:49 +00:00
Michael Kamensky
b5721a7e36 Merge branch 'OkkFix' into 'master'
Had wrong card name in Oracle text

See merge request core-developers/forge!192
2018-02-10 03:35:54 +00:00
Michael Kamensky
93b40ad867 Merge branch 'descriptions' into 'master'
Descriptions

See merge request core-developers/forge!193
2018-02-10 03:35:40 +00:00
Rob Schnautz
a3e5e40385 description, premium Spearbreaker Behemoth 2018-02-10 01:17:19 +00:00
Rob Schnautz
e13ed6f46e description, premium Paleoloth 2018-02-10 01:15:18 +00:00
Rob Schnautz
65dffbbe3a description 2018-02-10 01:12:15 +00:00
Rob Schnautz
16dafc9c57 description
(cherry picked from commit 909ee41e066207a9c3e4d943fd190e229765be66)
2018-02-10 01:06:35 +00:00
Rob Schnautz
bcd2f95e4d description
(cherry picked from commit f274dbe74e3fcda7e97c40df996b8b1533c04673)
2018-02-10 01:06:16 +00:00
Rob Schnautz
51ae7fee7e description 2018-02-10 00:55:19 +00:00
Rob Schnautz
2eb276f995 description, premium Treasury Thrull 2018-02-10 00:51:03 +00:00
Rob Schnautz
6a98f9947a description 2018-02-10 00:48:28 +00:00
Rob Schnautz
66cbd1a30e description 2018-02-10 00:45:17 +00:00
Rob Schnautz
c8d1b56d9e description, premium Phyrexian Hydra 2018-02-10 00:44:44 +00:00
Rob Schnautz
457ce2958e description, premium Doomwake Giant 2018-02-10 00:44:01 +00:00
Rob Schnautz
b7b6d5672e description, premium Conundrum Sphinx 2018-02-10 00:15:14 +00:00
Rob Schnautz
7dac6197e3 premium Djinn of Wishes 2018-02-10 00:12:03 +00:00
Rob Schnautz
ea40b439ee description, premium Resolute Archangel 2018-02-10 00:05:32 +00:00
Rob Schnautz
7061f7f26a premium Flameblast Dragon 2018-02-10 00:00:30 +00:00
Rob Schnautz
de1342a5d7 description, premium Jace's Mindseeker 2018-02-09 23:57:44 +00:00
Rob Schnautz
2f976dbeb3 description, premium Hellkite Charger 2018-02-09 23:51:56 +00:00
Seravy
e37e242bae Had wrong card name in Oracle text 2018-02-10 00:13:48 +01:00
Michael Kamensky
78c676e858 Merge branch 'assorted-fixes' into 'master'
- Updating CHANGES.txt.

See merge request core-developers/forge!191
2018-02-09 18:31:48 +00:00
Agetian
9e74ef9e37 - Updating CHANGES.txt. 2018-02-09 21:30:37 +03:00
Michael Kamensky
1740be22ae Merge branch 'InvasionWorld' into 'master'
Invasion world

See merge request core-developers/forge!189
2018-02-09 18:23:10 +00:00
Hanmac
35c499a074 Crafty Cutpurse: make it use a Control Layer for the Token Create Effect 2018-02-09 17:07:48 +01:00
Seravy
048093522a Revert "Fixes compile/run bugs in IntelliJ"
This reverts commit 36917c0d18

(cherry picked from commit 1cf40f45ad9f39f98dd3232d0ae01e9c0c31329d)
2018-02-09 10:34:39 +00:00
Seravy
66c696bfec rotam ->rotation amount. 2018-02-09 11:26:04 +01:00
Seravy
5dc5082c4e Added MAX to option variable name. 2018-02-09 10:58:07 +01:00
Seravy
42f79630e6 Deleted commented parts as suggested 2018-02-09 10:43:43 +01:00
Seravy
f8ccf0a91e Adding suggested simplification 2018-02-09 10:25:35 +01:00
Seravy
b924c1a80c W -> w 2018-02-09 10:04:59 +01:00
Michael Kamensky
42a6340a95 Merge branch 'assorted-fixes' into 'master'
- Updating CHANGES.txt.

See merge request core-developers/forge!188
2018-02-09 05:20:46 +00:00
Agetian
8b2b1d453d - Updating CHANGES.txt. 2018-02-09 08:19:35 +03:00
Michael Kamensky
e70207fbac Merge branch 'assorted-fixes' into 'master'
- Updating CHANGES.txt.

See merge request core-developers/forge!186
2018-02-09 05:19:02 +00:00
Agetian
846db416ec - Updating CHANGES.txt. 2018-02-09 08:18:33 +03:00
Michael Kamensky
84288aafe9 Merge branch 'patch-5' into 'master'
Duel Decks: Elves vs. Inventors

See merge request core-developers/forge!185
2018-02-09 04:48:36 +00:00
Rob Schnautz
d2d4318659 Add new file 2018-02-09 04:17:32 +00:00
Michael Kamensky
324c3000a0 Merge branch 'assorted-fixes' into 'master'
- File name fix, updating CHANGES.txt.

See merge request core-developers/forge!184
2018-02-09 03:48:11 +00:00
Agetian
fc6d1d2ab8 - Filename fix.
- Updating CHANGES.txt.
2018-02-09 06:47:28 +03:00
Michael Kamensky
7fb12fa5b3 Merge branch 'mtgo-editions' into 'master'
Five editions from MTGO

See merge request core-developers/forge!182
2018-02-09 03:37:07 +00:00
Michael Kamensky
791e53a935 Merge branch 'amonkhet' into 'master'
Amonkhet quest world

See merge request core-developers/forge!181
2018-02-09 03:36:24 +00:00
Sol
3a705c3e5f Merge branch 'patch-5' into 'master'
comment out boosters until later to prevent corruption of quest files when shop…

See merge request core-developers/forge!183
2018-02-09 01:58:20 +00:00
Rob Schnautz
ca61291995 comment out boosters until later to prevent corruption of quest files when shop tries to generate a booster 2018-02-09 01:45:57 +00:00
Rob Schnautz
a875557000 Commander Theme Decks 2018-02-09 01:38:33 +00:00
Rob Schnautz
517590883c Duel Decks: Mirrodin Pure vs. New Phyrexia 2018-02-09 01:19:35 +00:00
Rob Schnautz
ffa58f71f0 Magic Online Deck Series (TD0, but since this abbreviation was used for two sets, using the TD1 abbreviation that MTGO skipped) 2018-02-09 01:08:08 +00:00
Rob Schnautz
9017f1488f Treasure Chests 2018-02-09 00:59:39 +00:00
Rob Schnautz
c6bac3a247 Legendary Cube 2018-02-08 23:46:55 +00:00
Seravy
a7e48e8af0 The Domain deck is currently AI unplayable, but likely easy to fix later, see (20)
Most decks were tested in the old version (roughly 2017 October-November?).
They are AI playable albeit the AI doesn't play them perfectly - still it's good enough to include the world in a release. AI can always be improved later, as long as it doesn't self-defeat all the time with all the deck. (which was a real issue in the Tempest block where ~20 out of the 40 decks were unplayable for the AI, thus that world is still unfinished - AI has to be improved first.)
This is a list of issues I observed with the AI while testing the Invasion decks :

AI minor :
2. AI should prioritize returning Flametongue Kavu or Kavu Climer or other beneficial trigger creatures for gating creatures (or to any other bonuce effects)
3. Pernicious Deed should have that flag that prevents the AI from playing a second copy (same for Obvlivion Stone, Nevynnirral's Disk if they don't have it yet)
4. The AI seems to prefer playing normal lands first, "enters play tapped" lands later. That's usually the wrong play for the first few turns, where the AI wouldn't have a card to play from the mana anyway.
5. The AI seems to randomly send Captain Sisay to attack or search a card, this should be done smarter, always search if hand is not full and enemy isn't below 7 life?
6. Would be nice if the AI could recognize Rith's ability as one that produces potential blockers for the next turn.
9. When the AI plays a second copy of Teferi's Moat, it shouldn't pick the same color (and shouldn't play the second copy if the opponent plays only one color)
11. Not related to the invasion block but a generic issue : The AI prefers to kill the creatures I steal with Preacher instead of Preacher itself. I'm winning 99% of the games where I draw that card due to this, which likely messes up the difficulty testing results.
13. AI probably shouldn't play Skizzik without kicker as it sometimes does so then doesn't attack anyway or should learn to always attack with it if it wasn't kicked.
15. The AI had enough mana to play Urza's Rage with kicked and could have won the game by doing so, yet it played it without kicker and dealt only 3 damage. This happened more than once, it probably can't pay the kicker cost at all.
17. The AI uses Order // Chaos to kill creatures that are already having leathal damage on the stack from Powerstone Minefield
18. The AI sometimes doesn't seem to be able to use Tahngarth's ability, other times uses it during upkeep. It should never be used before the declare attackers step. (take advantage of vigilance)
19. Once the AI attacked with a 2/2 Quiron Dryan into my 2/3. It had Wax // Wane in hand but no mana to play it - all 3 lands were tapped.
21. Making Pulse of Llanowar, Elfhame Sanctuary and Fertile Ground AI playable would likely increase the AI playability of the block a lot (currently none of these cards are included in AI decks)
23. The AI used a counterspell to counter a spell targeting Glimmering Angel instead of activating the ability
25. The AI activated Crosis the Purger when I had zero cards in my hand.
26. Creatures with the "tap target creature" ability like Benalish Trapper and Stormscape Appreneic should not attack if the opponent has creatures that could be tapped next upkeep to prevent them from attacking.
(this seems to be a generic problem - small creatures with important noncombat abilties should be marked "stay home" and not attack unless the enemy is so low on health they can be defeated by 3 swings from the creature. This was one of the main problems
in Tempest block, for example Hermit Druid, Tradewind Rider and Ertai Wizard Adept. I really wanted to implement AI logic for this myself but...)
27. Yawgomoth's Ageanda should also be marked as a spell where the AI should never play a second copy (also it shouldn't be played without a large graveyard but I don't think the AI did that even once so maybe that's already implemented?)
33. The AI always picks "lose 1 life" on Putrid Warrior even if the opposite would be better.
36. AI played played a creature before Desolation Giant in the same turn.
39. AI doesn't seem to pay a kicker cost for Verdeloth the Ancient even if it has mana to do so.
40. AI uses Nightscape Master to bounce cards it could be killing with the other ability instead.
41. AI probably shouldn't use Recoil to bonuce own cards.

AI major :
1. AI should not play gating creatures if it would return another gating creature to hand, unless it's triggering kavu lair or sparkcaster ability.
7. The AI shouldn't sacrifice Fires of Yawimaya to deal 2 more damage when I still have 20 life. This should only be used to save creatures, or deal leathal damage to a blocker or player.
7b - it especially shouldn't do this is that results in the buffed creature no longer having haste and failing to attack!
8. The AI uses Rout as an instant during its own upkeep instead of waiting until main 1 and saving 2 mana (or possibly attacking first and doing it in main 2), this should never be used as an instant during the AI's own turn.
10. The AI seems to consistently fail paying both kicker costs on volvers even if it can afford doing it - it only pays one of them.
12. AI might be unable to pay the kicker for Dralnu's Pet - it had the mana and creature in hand but didn't do it. (and the creature was of a color the AI cannot play from hand)
14. Like Rout, Ghitu Fire also shouldn't be played as an instant during the AI's own upkeep. In fact, the AI generally should not use instant effects or cards during its own upkeep, it's very rarely the correct move, if ever.
22. The AI seems to be unable to play the card "Meddling Mage" even though it's marked with a "?" not an "AI" tag. I wouldn't expect it to play "fair" and pretend it has no idea what cards are in my deck (it guesses the color of my cards for other choices anyway) but in worst case it should at least play it as a 2/2 for 2 and name any random card it has no copies of in its deck.
24. The AI does not consider the board when picking colors for Voice of All. Even if I have two big white flying creatures in play, it still picks black because my deck has more black cards than white.
28. Once the AI had Temporal Spring and AEther Mutation in hand, and 4 life while I had 3 2/x creatures and it didn't play either bonuce spell. Maybe it was holding mana to cast Fact or Fiction later? (it had 5 lands, 3 forest 2 island)
(surprisingly it didn't even try to play Fact or Fiction before I won. Bug?)
29. The AI probably shouldn't play Phyrexian Arena when at low (below 10?) health.
30. AI didn't activate Pernicious Deed to destroy my 3/3 animated swamp that was killing them, even though it only takes an activation cost of 0. It also didn't activate it when I had a 4/4, they had a 4/4 and I had a 2/1 flying and they had 2 life.
After further games : In general the AI does not use Pernicious Deed very well (on top of playing 2-3 copies), and lets me hit them each turn with creatures and even dies, as long as I don't play too many at a time.
While I won't rate decks unplayable for just this, I'm pretty sure the decks including the card perform significantly worse than they could be and the card is borderline unplayable in the sense the AI obstinently refuses to activate it to save itself.
I suspect there is a threashold for how much advantage it expects from the card, and will not use it otherwise, even if not using it means losing the game. (even if I would be the only one losing permanents!)
31. The AI doesn't attack with units enchanted by Armadillo Cloak, and keeps them as blockers, even if it could gain several times the life it would lose to not blocking by the attack (AI had a 7/7 trample with it, I had two 2/x to attack and a 2/1 flying)
32. On the long term some sort of logic to decide whether to waste a kicker card immediately or wait for mana to use it with kicker would be nice, but it'll likely be hard to make one. (This is especially important for creatures, like Kavu Titan, volvers, etc)
34. When the AI has a 1/1 creature enchanter with Quicksilver Dagger, it still uses it to attack instead of tapping it to deal damage AND draw a card. (and this actually risks losing the creature to a "destroy target attacking..." spell)
35. The AI should play Warp Devotion before the bounce spells. As is, that deck works poorly.
37. AI had a Bloodfire Colossus in play, had active red mana, I had 3 life, it had 12, didn't activate to win, instead used Rout to destroy all creatures, and it didn't even sac it in response!
(I thought we improved the DamageAll logic? Is this card not using it?)
38. AI doesn't recognize Gerrard Capashen's ability to tap when attacking, so it fails to notice it could win the game as I only have 3 life and 1 blocker which could be tapped.

AI severe :
16. The AI seems to be unable to play Orim's Thunder at all, even if I have both a creature and an artifact and the creature is weak enough to be killed by the kicker effect. It can't even play it without kicker.
(I'll rank the deck with this card 1 higher to account for this bug getting fixed in the future - most of the AI's losses came from holding these and not using them to kill my creatures.)
20. The AI is unable to play Harrow and Allied Strategies even if it has no other cards to play and has mana. I unfortunately have to conclude the "Domain" deck is not AI playable as is - land searching and drawing are essential for it.
Note : I did see the AI play Harrow once in a blue moon, for example when it was about to die in combat, but it usually does not play the card.
28. AI used Dromar to return itself to hand by picking white (I had no white creatures). As all 5 dragon legends are actual opponents with their cards in the deck, and Dromar's doesn't have another creature, this is quite a big problem.
2018-02-09 00:27:00 +01:00
Rob Schnautz
41b73da329 fix set 2018-02-08 23:08:28 +00:00
Rob Schnautz
48d4016f8d fix set 2018-02-08 23:05:45 +00:00
Rob Schnautz
ed3624ce7b Upload New File 2018-02-08 22:51:53 +00:00
Rob Schnautz
58eebd8bfd Upload New File 2018-02-08 22:51:43 +00:00
Rob Schnautz
cc95200289 Upload New File 2018-02-08 22:51:33 +00:00
Rob Schnautz
7035993a3f Upload New File 2018-02-08 22:51:22 +00:00
Rob Schnautz
663b10f767 Upload New File 2018-02-08 22:51:11 +00:00
Rob Schnautz
922e45a80d Upload New File 2018-02-08 22:51:01 +00:00
Rob Schnautz
3dca3752bc Upload New File 2018-02-08 22:50:51 +00:00
Rob Schnautz
336ca104e9 Upload New File 2018-02-08 22:50:41 +00:00
Rob Schnautz
7492e7d450 Upload New File 2018-02-08 22:50:29 +00:00
Rob Schnautz
7440702fea Upload New File 2018-02-08 22:50:14 +00:00
Rob Schnautz
e568f84dcb Upload New File 2018-02-08 22:48:10 +00:00
Rob Schnautz
d043161bdd Upload New File 2018-02-08 22:47:57 +00:00
Rob Schnautz
9768b80736 Upload New File 2018-02-08 22:47:45 +00:00
Rob Schnautz
93185e7e84 Upload New File 2018-02-08 22:47:34 +00:00
Rob Schnautz
18a717e90a Upload New File 2018-02-08 22:47:24 +00:00
Rob Schnautz
99ce255da8 Upload New File 2018-02-08 22:47:10 +00:00
Rob Schnautz
770e328865 Upload New File 2018-02-08 22:46:59 +00:00
Rob Schnautz
2776eaf640 Upload New File 2018-02-08 22:46:48 +00:00
Rob Schnautz
2d825e4095 Upload New File 2018-02-08 22:46:34 +00:00
Rob Schnautz
64cac6cd5a Upload New File 2018-02-08 22:46:16 +00:00
Rob Schnautz
8d7eccf92e Add new directory 2018-02-08 22:45:50 +00:00
Rob Schnautz
01cd80cc2f Add new directory 2018-02-08 22:45:35 +00:00
Rob Schnautz
801e218912 +amonkhet 2018-02-08 22:44:53 +00:00
Rob Schnautz
c1cb19a139 Add new directory 2018-02-08 22:41:02 +00:00
Hans Mackowiak
419f4a354f Merge branch 'assorted-fixes' into 'master'
- Got rid of an esoteric component for logging, switched over to standard err…

See merge request core-developers/forge!177
2018-02-08 17:48:41 +00:00
Seravy
569e884a2c Adds an option to choose between draft rotation deleting, or replacing old drafts.
Also moves the draft rotation settings to appear under "draft torunaments" where they belong.
2018-02-08 14:13:11 +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
Seravy
a24cffa9df Makes the maximal amount of bonus for life total difference optional 2018-02-08 13:12:35 +01:00
Michael Kamensky
58d0921696 Merge branch 'morph' into 'master'
Morph: some rework to use better KeywordInterfaces

See merge request core-developers/forge!172
2018-02-08 12:07:45 +00:00
Michael Kamensky
2b3e39cbb8 Merge branch 'regeneration' into 'master'
Regeneration

See merge request core-developers/forge!168
2018-02-08 12:07:41 +00:00
Seravy
689e5eecc4 Add options to control how much extra credits are given for accumulated wins 2018-02-08 12:04:07 +01:00
Seravy
36917c0d18 Fixes compile/run bugs in IntelliJ 2018-02-08 10:25:17 +01:00
Michael Kamensky
4421766850 Merge branch 'descriptions' into 'master'
Descriptions for preconstructed decks, premium foil inserts

See merge request core-developers/forge!169
2018-02-08 04:51:50 +00:00
Michael Kamensky
2d2af55849 Merge branch 'patch-3' into 'master'
Update Masters 25.txt

See merge request core-developers/forge!170
2018-02-08 04:51:02 +00:00
Rob Schnautz
906fef89f9 fix rarity 2018-02-08 01:55:55 +00:00
Rob Schnautz
479a468187 Update Masters 25.txt 2018-02-08 01:54:07 +00:00
Rob Schnautz
813e8deb8f description, premium Boltwing Marauder 2018-02-07 20:04:04 +00:00
Rob Schnautz
4c4259ed90 description, premium Havengul Runebinder 2018-02-07 20:01:36 +00:00
Rob Schnautz
b186958422 premium Captivating Vampire 2018-02-07 19:58:51 +00:00
Rob Schnautz
83b41e1479 description 2018-02-07 19:57:47 +00:00
Rob Schnautz
97477644fd description, premium Phyrexian Swarmlord 2018-02-07 19:54:28 +00:00
Rob Schnautz
f3e4f0d1fb description 2018-02-07 19:51:23 +00:00
Rob Schnautz
4175369f96 description, premium Mordant Dragon 2018-02-07 19:45:02 +00:00
Rob Schnautz
f2fcfe582f description, premium Hero of Goma Fada 2018-02-07 19:42:53 +00:00
Rob Schnautz
b2d546be2f description, premium Carnival Hellsteed 2018-02-07 19:40:20 +00:00
Rob Schnautz
a7db0dd75e description 2018-02-07 19:38:14 +00:00
Rob Schnautz
94127c1b76 description 2018-02-07 19:35:37 +00:00
Rob Schnautz
220690d4d0 description, premium Hoard-Smelter Dragon 2018-02-07 19:31:26 +00:00
Hanmac
fb3ffe679b Morph: some rework to use better KeywordInterfaces 2018-02-07 19:40:12 +01:00
Rob Schnautz
b38f7fe4f5 description 2018-02-07 17:16:41 +00:00
Rob Schnautz
110eb2b072 description, premium Elder of Laurels 2018-02-07 17:03:47 +00:00
Michael Kamensky
d474e6b8bb Merge branch 'assorted-fixes' into 'master'
- Do not allow the human to confirm a Reveal cost with 0 revealed cards (e.g. Morph - Reveal a green card when the player has no green card in hand)

See merge request core-developers/forge!167
2018-02-07 16:56:21 +00:00
Rob Schnautz
5b074f4c1c description, premium Malakir Bloodwitch 2018-02-07 16:53:13 +00:00
Rob Schnautz
8e4ab4d398 description 2018-02-07 16:52:23 +00:00
Rob Schnautz
7eb934d5d3 description 2018-02-07 16:51:50 +00:00
Agetian
c3b655f675 - Do not allow the human to confirm a Reveal cost with 0 revealed cards if the minimum is more than zero (fixes e.g. Morph costs with "Reveal a X card" when the human player doesn't have that kind of card in hand). 2018-02-06 22:17:48 +03:00
Hanmac
068efaeba7 Card: RegenEffect: add the Effect as Shield 2018-02-06 13:50:04 +01: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
Michael Kamensky
8b26deb477 Merge branch 'assorted-fixes' into 'master'
- Fixed the AI trying to e.g. Embalm a Vizier of Many Faces ignoring NeedsToPlay

See merge request core-developers/forge!166
2018-02-05 05:34:10 +00:00
Agetian
21fedd0d50 - Fixed Illusion of Choice. 2018-02-05 08:21:02 +03: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
Hanmac
047ee71259 Card: Planeswalker + Creature get extra damage
Signed-off-by: Hanmac <hanmac@gmx.de>
2018-02-02 23:52:11 +01:00
Michael Kamensky
1b97eb777c Merge branch 'mobile-release' into 'master'
- Preparing Forge for Android publish 1.6.6.003 [incremental/bugfixes].

See merge request core-developers/forge!165
2018-01-31 10:54:51 +00:00
Agetian
cd31c4e513 - Preparing Forge for Android publish 1.6.6.003 [incremental/bugfixes]. 2018-01-31 13:54:05 +03:00
Hans Mackowiak
1582f5a7bd Merge branch 'assorted-fixes' into 'master'
- Indirect aura attachment: fix Sovereigns of Lost Alara not attaching Cartouches

See merge request core-developers/forge!164
2018-01-31 06:01:00 +00:00
Agetian
32facbbc74 - Indirect aura attachment: check by aura controller if aura activating player check fails, fixes Sovereign of Lost Alara not being able to attach a Cartouche. 2018-01-31 08:00:26 +03:00
Michael Kamensky
7696b9d69c Merge branch 'assorted-fixes' into 'master'
- AiController: a more robust check for potential targets (e.g. Wicked Akuba)

See merge request core-developers/forge!161
2018-01-31 04:57:08 +00:00
Michael Kamensky
d2e1d5aacb Merge branch 'patch-3' into 'master'
Masters 25

See merge request core-developers/forge!163
2018-01-31 04:18:08 +00:00
Michael Kamensky
e70affe6c3 Merge branch 'upcoming_rix2' into 'master'
Updates to card-based deck generation data and improvements to handling of…

See merge request core-developers/forge!162
2018-01-31 04:17:05 +00:00
Rob Schnautz
d38f9c39e4 Add new file 2018-01-30 23:02:54 +00:00
austinio7116
f7209ef32c Updates to card-based deck generation data and improvements to handling of non-basic land selection in those decks 2018-01-30 22:33:40 +00:00
Agetian
1f10ba936a Merge remote-tracking branch 'origin/assorted-fixes' into assorted-fixes 2018-01-30 23:36:36 +03:00
Agetian
0332975a9a - Reset activations when cloning things with Saheeli Rai (fixes e.g. Saheeli Rai cloning a Saheeli Rai under Liquimetal Coating not able to activate its abilities) 2018-01-30 23:18:07 +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
Michael Kamensky
d8a284ebb9 Merge branch 'unstable-basic-lands' into 'master'
- Render Unstable basic lands borderless.

See merge request core-developers/forge!160
2018-01-30 16:22:08 +00:00
Agetian
dca62ce725 - 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:20:24 +03:00
Michael Kamensky
1c64ebd05b Merge branch 'upcoming_rix2' into 'master'
Added HOU, XLN and RIX image file paths to the lists for quest mode

See merge request core-developers/forge!159
2018-01-30 15:39:53 +00:00
Agetian
0727c83a43 - Render Unstable basic lands borderless. 2018-01-30 18:14:06 +03:00
maustin
eb4a8caefc Removed unneeded targeting of opponent in Huatli Radiant Champion 2018-01-30 12:51:53 +00:00
Michael Kamensky
253efc6c6d Merge branch 'assorted-fixes' into 'master'
Several card fixes and an AI pump prediction fix

See merge request core-developers/forge!158
2018-01-30 10:45:28 +00:00
Agetian
d8be06c165 - Fixed Battle at the Bridge SpellDescription. 2018-01-30 13:17:43 +03:00
Agetian
e02baac897 - Fixed Wandering Fumarole not gaining its {0} ability properly 2018-01-30 13:17:32 +03:00
Agetian
46f19b6079 Merge remote-tracking branch 'origin/assorted-fixes' into assorted-fixes 2018-01-30 13:12:32 +03:00
austinio7116
2f3ba53a89 Added HOU, XLN and RIX image file paths to the lists for quest mode 2018-01-30 08:56:48 +00: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
75f86352be - AiAttackController: Don't check targeting restrictions if the ability doesn't target. 2018-01-30 08:44:16 +03:00
Agetian
19dd58d1d3 - 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:34:01 +03:00
Hanmac
68843db5b8 Card: changed how instant and Sorcery show keywords 2018-01-29 22:52:02 +01:00
Hanmac
586c2eb9b0 cards: update Buyback scripts 2018-01-29 22:50:07 +01:00
Hanmac
156cdf812d CardFactoryUtil: use : for Buyback, make some effect Secondary 2018-01-29 22:49:51 +01:00
Michael Kamensky
5e6d9749fb Merge branch 'patch-3' into 'master'
Quick Start Set: Rivals

See merge request core-developers/forge!157
2018-01-29 05:00:54 +00:00
Rob Schnautz
2392aeeb0c Add new file 2018-01-28 20:01:16 +00:00
Rob Schnautz
6d89addb67 description, premium Spellbreaker Behemoth 2018-01-28 19:42:29 +00:00
Hanmac
5a29b05e88 CardFactoryUtil: move Totem Armor to ReplacementAbilities 2018-01-28 14:40:37 +01:00
Hanmac
90b46f4c0f Card & CardState: add has functions to check for SpellAbility, Trigger and ReplacementEffects 2018-01-28 12:31:13 +01:00
Michael Kamensky
1281af0994 Merge branch 'assorted-fixes' into 'master'
- Fixed a compile time error caused by an unused import statement.

See merge request core-developers/forge!156
2018-01-28 08:47:48 +00:00
Agetian
b31069866a - Fixed a compile time error caused by an unused import statement. 2018-01-28 11:30:29 +03:00
Michael Kamensky
00f896bbb4 Merge branch 'patch-2' into 'master'
remove Code2, not needed for this.

See merge request core-developers/forge!154
2018-01-28 06:47:54 +00:00
Michael Kamensky
cd5c03926f Merge branch 'deck-descriptions' into 'master'
Deck descriptions

See merge request core-developers/forge!155
2018-01-28 06:46:20 +00:00
Rob Schnautz
11218913a4 description, premium Aegis Angel 2018-01-28 03:00:13 +00:00
Rob Schnautz
0a039e4f53 description 2018-01-28 02:40:17 +00:00
Rob Schnautz
7e37b3d760 description, premium Grove of the Guardian 2018-01-28 02:37:52 +00:00
Rob Schnautz
d577c229e3 description, premium Noosegraf Mob 2018-01-28 02:36:51 +00:00
Rob Schnautz
6cd74946e4 description 2018-01-28 02:36:06 +00:00
Rob Schnautz
d34b6428ae description 2018-01-28 02:30:18 +00:00
Rob Schnautz
e242e3f371 description 2018-01-28 02:29:47 +00:00
Rob Schnautz
4165004491 description, premium Fathom Mage 2018-01-28 02:23:41 +00:00
Rob Schnautz
d290d5fbf4 typo 2018-01-28 02:21:41 +00:00
Rob Schnautz
81c99209ce description 2018-01-28 02:15:34 +00:00
Rob Schnautz
1962aac95b description, premium Harvester of Souls 2018-01-28 02:07:03 +00:00
Rob Schnautz
60a66585f3 Update Unstable.txt 2018-01-28 02:03:38 +00:00
Rob Schnautz
d7f3842a30 don't need code2 2018-01-28 01:59:23 +00:00
Rob Schnautz
81be883bee Update Unglued.txt 2018-01-28 01:56:30 +00:00
Rob Schnautz
0dfcb225e0 use UGL for pics. no good reason to use the two-letter code. 2018-01-28 01:48:05 +00:00
Sol
06f95efd52 Merge branch 'fix-deck-view' into 'master'
Improve deck view with multi-monitor systems

See merge request core-developers/forge!153
2018-01-27 23:50:18 +00:00
Sol
0dae411333 Merge branch 'custom-deck-directories' into 'master'
Custom deck directories

See merge request core-developers/forge!152
2018-01-27 21:34:03 +00:00
Jamin W. Collins
c1e1b6f29a Improve deck view with multi-monitor systems
On Linux multi-monitor systems, the existing logic would create a new
window that was slightly smaller than the total combined display size.
The new logic creates a window that is slightly smaller than the monitor
Forge is currently on.

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-01-27 09:49:13 -07:00
Michael Kamensky
a511bdbcd8 Merge branch 'assorted-fixes' into 'master'
Fixed an AI logic error in CountersPutAi

See merge request core-developers/forge!151
2018-01-27 16:35:09 +00: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
Jamin W. Collins
6dc6a7a29c add new parameters and descriptions to properties.example
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-01-27 09:23:51 -07:00
Jamin W. Collins
fd6192a88e remove trailing whitespace
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-01-27 09:12:55 -07:00
Jamin W. Collins
fcb8e1f8c9 allow for custom deck directory paths
This adds support for two additional configuration options to the
forge.profile.properties file:
 * decksDir
 * decksConstructedDir

The first sets the desired path for all decks.  The second sets the
desired path specifically for constructed decks.  This allows users to
reference an external directory that may be synced between multiple
users or systems by an external (to forge) mechanism.

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-01-27 08:53:54 -07:00
Michael Kamensky
2da04fed3d Merge branch 'patch' into 'master'
- Updated a few scripts

See merge request core-developers/forge!150
2018-01-27 15:28:17 +00:00
swordshine
00abdccc13 - Simplied two scripts 2018-01-27 21:44:26 +08:00
swordshine
9f25644645 - Fixed Phytotitan 2018-01-27 20:39:39 +08:00
swordshine
83b84dfff7 - Gaze of the Gorgon uses delayed triggers 2018-01-27 20:25:52 +08:00
swordshine
c0f5f0567b - Fixed Glyph of Doom 2018-01-27 20:16:41 +08:00
swordshine
f53a54a126 - Fixed blockedByRemembered when two or more cards are remembered 2018-01-27 19:56:41 +08:00
swordshine
e3ac4433e1 - Venomous Breath now uses delayed triggers 2018-01-27 19:39:20 +08:00
swordshine
1e831513a0 - Shifty Doppelganger now uses delayed triggers 2018-01-27 18:53:20 +08:00
swordshine
a40a6e8023 - Rescue from the Underworld now uses delayed triggers 2018-01-27 17:00:38 +08:00
swordshine
22982178e2 - Attempt to fix the CopyPermanent effect when Crafty Cutpurse is in play 2018-01-27 16:23:55 +08:00
swordshine
63e2854d7a - It should be a special action to remove the effect of Glass Asp (these effects might be transformed to delayed triggers in the future) 2018-01-27 14:53:27 +08:00
swordshine
7117580446 - Some keywords should be "hidden" 2018-01-27 14:42:33 +08:00
swordshine
691562324b - Giant Slug now uses a delayed trigger 2018-01-27 10:40:31 +08:00
swordshine
f0e6e20732 - Elkin Bottle should have a duration 2018-01-27 09:31:25 +08:00
Michael Kamensky
67ab3e1e01 Merge branch 'patch' into 'master'
- Necromancy and its friends now use delayed triggers instead of animated triggers

See merge request core-developers/forge!149
2018-01-26 16:54:50 +00:00
Hans Mackowiak
a048ab3327 Merge branch 'assorted-fixes' into 'master'
Fixed CardState#copyFrom copying non-intrinsic abilities, minor card fix (Nissa, Steward of Elements)

See merge request core-developers/forge!148
2018-01-26 14:13:22 +00:00
swordshine
af1be79f78 - Necromancy and its friends now use delayed triggers instead of animated triggers 2018-01-26 19:24:29 +08:00
Agetian
81366a1e14 Merge remote-tracking branch 'origin/assorted-fixes' into assorted-fixes 2018-01-26 13:46:23 +03:00
Agetian
21c4e2eeda - Fixed Nissa, Steward of Elements references and AI logic. 2018-01-26 13:36:48 +03:00
Agetian
b866338197 - Only copy the intrinsic abilities in CardState#copyFrom, fixes clone abilities copying too much (e.g. copied tokens from Splinter Twin gaining the copy ability). 2018-01-26 09:16:13 +03:00
Agetian
98e19db3fc Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-26 09:08:14 +03:00
Agetian
5221d871a0 - Only copy the intrinsic abilities in CardState#copyFrom, fixes clone abilities copying too much (e.g. copied tokens from Splinter Twin gaining the copy ability). 2018-01-26 09:07:50 +03:00
Sol
d48c93938f Merge branch 'patch-2' into 'master'
Simplify string generation in a few files

See merge request core-developers/forge!128
2018-01-26 01:51:30 +00:00
Michael Kamensky
0aa3583412 Merge branch 'assorted-fixes' into 'master'
- A couple AI tweaks and fixes, several card fixes

See merge request core-developers/forge!144
2018-01-25 15:42:32 +00:00
Michael Kamensky
38adbb7386 Merge branch 'patch-3' into 'master'
Fix spelling error in Might Makes Right quest opponent decks

See merge request core-developers/forge!147
2018-01-25 04:48:29 +00:00
Rob Schnautz
0ecdb07a0a description 2018-01-25 02:54:04 +00:00
Rob Schnautz
5191777fca description 2018-01-25 02:48:46 +00:00
Rob Schnautz
e1feff66b4 description 2018-01-25 02:42:42 +00:00
Rob Schnautz
e96f0e24b3 description, premium Nefarox, Overlord of Grixis 2018-01-25 02:26:19 +00:00
Rob Schnautz
891b2580c0 description 2018-01-25 02:23:12 +00:00
Rob Schnautz
8fa477a3f2 description 2018-01-25 02:22:16 +00:00
Rob Schnautz
48079df235 description 2018-01-25 02:21:38 +00:00
Rob Schnautz
4bd796c84b description 2018-01-25 02:21:00 +00:00
Rob Schnautz
efa38ea80a description, premium Lone Revenant 2018-01-25 02:20:21 +00:00
Rob Schnautz
b0be025f93 description 2018-01-25 02:18:14 +00:00
Rob Schnautz
08bc3170ad description 2018-01-25 02:17:12 +00:00
Rob Schnautz
b126a97e23 description, premium Angel of Flight Alabaster 2018-01-25 02:15:59 +00:00
Rob Schnautz
505940d9b4 description, premium Overwhelming Stampede 2018-01-25 02:12:21 +00:00
Rob Schnautz
41fbedbdb9 description, premium Flamerush Rider 2018-01-25 02:07:09 +00:00
Rob Schnautz
00379f8cd0 description, premium Rakshasa Vizier 2018-01-25 00:36:59 +00:00
Rob Schnautz
52e9772ef9 description 2018-01-25 00:32:48 +00:00
Rob Schnautz
634a9e7a6c description 2018-01-25 00:27:35 +00:00
Rob Schnautz
8383aeeddd Description + premium Tyrant of Valakut 2018-01-25 00:26:49 +00:00
Rob Schnautz
308c07c2b3 description 2018-01-25 00:25:31 +00:00
Rob Schnautz
ad352beb24 typo 2018-01-25 00:20:25 +00: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
b3f1bad6b7 - Fixed Jungle Creeper. 2018-01-24 16:02:11 +03:00
Agetian
8e3e38b72f Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-24 09:15:49 +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
Hans Mackowiak
d5c285bb63 Merge branch 'bestowfix' into 'master'
Spell: Bestow now works with StaticAbilities again

See merge request core-developers/forge!145
2018-01-24 05:41:04 +00:00
Agetian
2be734f137 - Somewhat better logic for Glimmer of Genius. 2018-01-24 08:23:28 +03:00
Agetian
67ab92359f Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-24 08:11:59 +03:00
Agetian
89184b97dd - ScryAi: Glimmer of Genius -> at opp EOT 2018-01-23 23:50:48 +03:00
Hanmac
466eac71a1 Spell: Bestow now works with StaticAbilities again 2018-01-23 21:32:45 +01: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
Michael Kamensky
e38b34e391 Merge branch 'master' into 'master'
- Preparing Forge for Android publish 1.6.6.002 [hotfix].

See merge request core-developers/forge!143
2018-01-23 08:06:39 +00:00
Agetian
2e0af3c3fe - Preparing Forge for Android publish 1.6.6.002 [hotfix]. 2018-01-23 11:05:17 +03:00
Michael Kamensky
ab1550e24b Merge branch 'master' into 'master'
- FIXME: Temporarily disabling preList in a checkStaticAbilities call for Bestow to avoid P/T corruption and flickering

See merge request core-developers/forge!142
2018-01-23 08:03:15 +00:00
Agetian
7d57af98fd - FIXME: Temporarily disabling preList in a checkStaticAbilities call for Bestow (causes P/T flickering on cards and related game state corruption, resulting in unwanted P/T changes between game phases). 2018-01-23 10:57:48 +03:00
Michael Kamensky
f1cb6b7b8e Merge branch 'patch' into 'master'
- Fixed two more cards with delayed triggers

See merge request core-developers/forge!141
2018-01-23 07:03:38 +00:00
swordshine
2cb03f1671 - Fixed two more cards with delayed triggers 2018-01-23 14:56:55 +08:00
Michael Kamensky
da68b22601 Merge branch 'master' into 'master'
Fixed Oracle text for Hanweir Battlements

See merge request core-developers/forge!140
2018-01-22 19:39:18 +00:00
Agetian
c68f1b8a03 - Fixed Oracle text for Hanweir Battlements. 2018-01-22 22:23:49 +03:00
Michael Kamensky
02ae5e301d Merge branch 'patch' into 'master'
- Fixed a few cards

See merge request core-developers/forge!138
2018-01-22 14:02:23 +00:00
Michael Kamensky
0dc7a4af2d Merge branch 'upcoming_rix2' into 'master'
Improved AI handling of Kumena

See merge request core-developers/forge!139
2018-01-22 13:50:07 +00:00
austinio7116
4d8bb5a844 Improved AI handling of Kumena 2018-01-22 08:33:33 +00:00
swordshine
a8ffdecef0 - Fixed Mountain Titan 2018-01-22 15:19:43 +08:00
swordshine
adf62cc5f5 - Fixed Cauldron Dance 2018-01-22 15:02:52 +08:00
Rob Schnautz
4aaafdf106 Description 2018-01-22 05:42:11 +00:00
Rob Schnautz
95e5f06554 fix typo 2018-01-22 05:00:37 +00:00
Michael Kamensky
361604d7f6 Merge branch 'patch-8' into 'master'
Several deck updates - descriptions and premium cards

See merge request core-developers/forge!137
2018-01-22 04:41:07 +00:00
Sol
97292d5a7f Merge branch 'patch-1' into 'master'
Fix for issue #124

See merge request core-developers/forge!125
2018-01-22 04:33:54 +00:00
Rob Schnautz
3a552823c8 Description 2018-01-22 01:55:38 +00:00
Rob Schnautz
a36c06ff2f Description, premium Drowner of Hope 2018-01-22 01:46:10 +00:00
Rob Schnautz
fe7cce1726 Description 2018-01-22 01:27:37 +00:00
Rob Schnautz
b4e5313160 Description 2018-01-22 01:20:10 +00:00
Rob Schnautz
151fb40e23 Description, premium Alhammarret, High Arbiter 2018-01-22 01:17:17 +00:00
Rob Schnautz
a111341293 Description 2018-01-22 01:15:04 +00:00
Rob Schnautz
4df7554d81 Description 2018-01-22 01:07:06 +00:00
Rob Schnautz
e58b0c219f Description 2018-01-22 01:05:18 +00:00
Rob Schnautz
e551c98ca4 Description 2018-01-22 01:02:57 +00:00
Rob Schnautz
0bd954e0c1 Description 2018-01-22 00:58:39 +00:00
Rob Schnautz
23f13ca87e Description 2018-01-22 00:55:06 +00:00
Rob Schnautz
2f66df36a7 Description 2018-01-22 00:52:30 +00:00
Rob Schnautz
03cc62f4df Description 2018-01-22 00:35:17 +00:00
Rob Schnautz
31fb23b83b Description 2018-01-22 00:31:16 +00:00
Rob Schnautz
445c87812d Description 2018-01-22 00:26:47 +00:00
Rob Schnautz
25b3ffbb6e Description 2018-01-22 00:23:25 +00:00
Rob Schnautz
358f5c6046 Description 2018-01-22 00:18:34 +00:00
Rob Schnautz
4fdc38b53f Description 2018-01-21 23:18:32 +00:00
Rob Schnautz
9fc669d897 Description 2018-01-21 21:00:33 +00:00
Michael Kamensky
f40f868429 Merge branch 'patch-7' into 'master'
Description, premium Sanctifier of Souls

See merge request core-developers/forge!136
2018-01-21 19:58:08 +00:00
Michael Kamensky
43bdd23b3c Merge branch 'patch-6' into 'master'
Description, premium Dragonscale General

See merge request core-developers/forge!135
2018-01-21 19:47:49 +00:00
Rob Schnautz
0bf12f0965 Description 2018-01-21 19:45:34 +00:00
Rob Schnautz
5434605984 Premium Heroes' Bane 2018-01-21 19:44:49 +00:00
Rob Schnautz
19a1bf0c0e Premium Gigantomancer 2018-01-21 19:39:34 +00:00
Rob Schnautz
16adb81cd2 Description, premium Deepfathom Skulker 2018-01-21 19:35:20 +00:00
Rob Schnautz
115b77682b Description, premium Nephalia Moondrakes 2018-01-21 19:26:57 +00:00
Rob Schnautz
82839cc500 Description, premium Sanctifier of Souls 2018-01-21 19:21:08 +00:00
Rob Schnautz
5dca460399 Description, premium Dragonscale General 2018-01-21 19:15:33 +00:00
Michael Kamensky
0eeb68737c Merge branch 'patch-4' into 'master'
Premium Sphinx of Jwar Isle

See merge request core-developers/forge!133
2018-01-21 19:15:10 +00:00
Michael Kamensky
389e21aca7 Merge branch 'patch-3' into 'master'
Update Untamed Wild.dck

See merge request core-developers/forge!132
2018-01-21 19:14:30 +00:00
Michael Kamensky
1eec2905b1 Merge branch 'patch-5' into 'master'
Premium Lich Lord of Unx

See merge request core-developers/forge!134
2018-01-21 19:13:22 +00:00
Rob Schnautz
7823368ebc Premium Lich Lord of Unx 2018-01-21 19:05:57 +00:00
Rob Schnautz
8b0f5ff91e Premium Sphinx of Jwar Isle 2018-01-21 18:36:42 +00:00
Rob Schnautz
f45a4d06a3 Update Untamed Wild.dck 2018-01-21 18:33:59 +00:00
Michael Kamensky
d16a197651 Merge branch 'assorted-fixes' into 'master'
- Fixed the AI for Hunt the Weak/Savage Storm, prevented a crash when trying to exec a trigger with a non-existent SVar

See merge request core-developers/forge!130
2018-01-21 18:04:27 +00:00
Hanmac
95263720f3 Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-01-21 17:56:35 +01:00
Hanmac
56f05c54f9 CardFactoryUtil: fixed Haunt for non creature 2018-01-21 17:53:45 +01:00
Agetian
b20c5acf75 - Issue a warning when trying to execute a trigger that references a SVar which does not exist and abort the execution of that trigger instead of hard-crashing the game (makes the issue with a manifested Hideaway land dying non-fatal). 2018-01-21 19:49:04 +03:00
Michael Kamensky
33f296da7c Merge branch 'newcard' into 'master'
- Daretti, Ingenious Iconoclast: Cleanup remembered for the second ability

See merge request core-developers/forge!131
2018-01-21 16:46:29 +00:00
Rob Schnautz
429ac3c072 TextUtil not needed in this file. 2018-01-21 16:17:13 +00:00
Agetian
4b5a555c1e - Fixed the AI overtargeting cards like Hunt the Weak and Savage Stomp and failing to add the card to stack. 2018-01-21 16:38:45 +03:00
swordshine
278d64d800 - Daretti, Ingenious Iconoclast: Cleanup remembered for the second ability 2018-01-21 20:24:30 +08:00
Michael Kamensky
6ceb08d41d Merge branch 'mobile-release' into 'master'
- Preparing Mobile Forge publish v1.6.6.001 [incremental].

See merge request core-developers/forge!129
2018-01-21 12:22:50 +00:00
Agetian
0e513614c3 - Preparing Mobile Forge publish v1.6.6.001 [incremental]. 2018-01-21 15:16:59 +03:00
Hans Mackowiak
b8ac0819aa Merge branch 'Keywordcache' into 'master'
Cache keywords to fix the slowdown issues on mobile Forge

See merge request core-developers/forge!127
2018-01-21 07:31:04 +00:00
Rob Schnautz
8380da7a10 Don't need transformPT anymore. 2018-01-21 04:59:46 +00:00
Rob Schnautz
cb7922fe15 Don't need TextUtils here 2018-01-21 04:57:51 +00:00
Rob Schnautz
3b6cfef67d TextUtil isn't needed here. 2018-01-21 04:46:22 +00:00
Rob Schnautz
b20bb2d023 simplify strings 2018-01-20 21:04:08 +00:00
Rob Schnautz
f8decaac41 simplify strings 2018-01-20 20:51:37 +00:00
Rob Schnautz
d7674c15b5 Update CardFace.java 2018-01-20 20:45:06 +00:00
Rob Schnautz
9d1c6eaa7f simplify string generation 2018-01-20 20:34:01 +00:00
Michael Kamensky
1927a94879 Merge branch 'assorted-fixes' into 'master'
- Fixed Oathsworn Vampire ability description.

See merge request core-developers/forge!126
2018-01-20 20:27:20 +00:00
Rob Schnautz
590b877f76 simplify string generation 2018-01-20 19:59:28 +00:00
Agetian
6c93862891 Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-20 22:44:48 +03:00
Agetian
cd9289bcdd - Fixed Oathsworn Vampire ability description. 2018-01-20 22:23:14 +03:00
Hanmac
c294e1f6df Card cached keywords move to CardState, tests still run 2018-01-20 18:52:34 +01:00
Rob Schnautz
9090cc70bf Probably want to use err, not out. 2018-01-20 15:41:55 +00:00
Rob Schnautz
244e2a9e8d Remove concatWithSpace since there's nothing to concatenate anymore. 2018-01-20 15:33:11 +00:00
Rob Schnautz
cc2b2921d9 Move the log output here to make it display the correct edition. 2018-01-20 15:02:24 +00:00
Rob Schnautz
88339864f7 The edition displayed isn't correct. Moving that part of the output to the class that creates the "unsupported card" object. 2018-01-20 14:57:44 +00:00
Michael Kamensky
f0ad9083a5 Merge branch 'volrath-fix' into 'master'
Fixed Volrath's Shapeshifter

See merge request core-developers/forge!124
2018-01-20 11:58:37 +00:00
Hanmac
e66194fb9d Card: getUnhiddenKeywords uses cache
that is updated by CardStateView#updateKeywords
2018-01-20 08:09:56 +01:00
Agetian
042693bf53 - Volrath's Shapeshifter: unfortunately, the generic solution for AB Discard on a SVar didn't work (doesn't work with cloning, crashes the game), so resorting to a non-generic version specific to VS. 2018-01-19 22:16:16 +03:00
Michael Kamensky
4a8cecd225 Merge branch 'assorted-fixes' into 'master'
Various minor card and definition fixes.

See merge request core-developers/forge!123
2018-01-19 19:04:14 +00:00
Agetian
1a9003c999 - Trim the spaces on TokenAltImages. 2018-01-19 21:51:20 +03:00
Michael Kamensky
e35f09ea2f Merge branch 'angrath-fix' into 'master'
- Fixed Angrath, the Flame-Chained [-3] ability.

See merge request core-developers/forge!120
2018-01-19 18:42:15 +00:00
Agetian
056d66b865 - Apparently the extra copy for activated ABs is no longer necessary for Volrath's Shapeshifter. 2018-01-19 21:40:36 +03:00
Agetian
ceafaf5e2e - Fixing Volrath's Shapeshifter, pass 2. 2018-01-19 21:31:45 +03:00
Agetian
5207e697dd - Fixing Volrath's Shapeshifter, pass 1. 2018-01-19 12:06:14 +03:00
Agetian
39a5da9a1b - Fixed Sporogenesis. 2018-01-19 07:45:30 +03:00
Agetian
4ed99e026f - Fixed Sword Guardian rarity in RIX def file. 2018-01-19 07:44:17 +03:00
Agetian
cdff15dade - Fixed TokenAltImages definition in Awakening Zone. 2018-01-19 07:44:00 +03:00
Michael Kamensky
16f2b16d22 Merge branch 'patch-3' into 'master'
DDT - Add periods in "vs."

See merge request core-developers/forge!122
2018-01-19 04:39:24 +00:00
Michael Kamensky
3efde7a2e3 Merge branch 'patch-2' into 'master'
Token image updates for cards beginning with A

See merge request core-developers/forge!113
2018-01-19 04:33:42 +00:00
Sol
032bcec313 Merge branch 'upcoming_rix2' into 'master'
Fixed TriggerZones for Storm the Vault plus corrected description on trigger

See merge request core-developers/forge!121
2018-01-19 03:05:59 +00:00
Rob Schnautz
a5d5ed8524 Add periods in "vs." 2018-01-18 23:53:24 +00:00
Rob Schnautz
c1e5d346c8 fix syntax 2018-01-18 22:03:04 +00:00
austinio7116
0a004b8f7e Fixed TriggerZones for Storm the Vault plus corrected description on trigger 2018-01-18 20:51:55 +00:00
Agetian
ffcd5b2f2c - Fixed Angrath, the Flame-Chained. 2018-01-18 18:57:51 +03:00
Sol
11ed680b5a Merge branch 'assorted-fixes' into 'master'
- Fixed some RIX cards, some long PTK quest deck file names, and updated CHANGES.txt.

See merge request core-developers/forge!111
2018-01-18 13:37:41 +00:00
Agetian
3abc22a855 - Attempted to fix Angrath, the Flame-Chained [-3] ability. 2018-01-18 11:38:48 +03:00
Agetian
ef9d6203c0 - Updating CHANGES.txt to reflect recent changes. 2018-01-18 09:15:19 +03:00
Agetian
016df27726 Merge remote-tracking branch 'origin/assorted-fixes' into assorted-fixes 2018-01-18 09:10:19 +03:00
Agetian
246ce114e2 - Rename some long deck file names in PTK quest to satisfy tar requirements for packaging. 2018-01-18 09:09:44 +03:00
Michael Kamensky
f3767417b0 Merge branch 'patch-3' into 'master'
Anthologies

See merge request core-developers/forge!114
2018-01-18 05:13:52 +00:00
Michael Kamensky
67fb62ec52 Merge branch 'patch-4' into 'master'
Battle Royale

See merge request core-developers/forge!115
2018-01-18 05:13:43 +00:00
Michael Kamensky
27f2dcc8d5 Merge branch 'patch-5' into 'master'
Beatdown

See merge request core-developers/forge!116
2018-01-18 05:13:26 +00:00
Michael Kamensky
9f37393a69 Merge branch 'patch-6' into 'master'
Deckmasters: Garfield vs. Finkel

See merge request core-developers/forge!117
2018-01-18 05:13:05 +00:00
Michael Kamensky
a7af6ecfc0 Merge branch 'patch-7' into 'master'
Duels of the Planeswalkers

See merge request core-developers/forge!118
2018-01-18 05:12:54 +00:00
Michael Kamensky
f772ab5fcc Merge branch 'newcard' into 'master'
- Fixed Palace Jailer

See merge request core-developers/forge!119
2018-01-18 05:12:26 +00:00
swordshine
6076954881 - Fixed Palace Jailer 2018-01-18 09:21:53 +08:00
Rob Schnautz
581bb74b9c revert 2018-01-17 21:17:06 +00:00
Rob Schnautz
81a8c93db4 revert 2018-01-17 21:16:45 +00:00
Rob Schnautz
6d8e162df3 revert 2018-01-17 21:16:36 +00:00
Rob Schnautz
9f44b46186 revert 2018-01-17 21:16:32 +00:00
Hanmac
e15f826190 Blessing: need to do blessing before condition 2018-01-17 21:04:44 +01:00
Rob Schnautz
f5ea2c0345 revert 2018-01-17 20:03:17 +00:00
Rob Schnautz
fff0051540 revert 2018-01-17 19:59:02 +00:00
Rob Schnautz
0fd3df021a revert 2018-01-17 19:58:09 +00:00
Rob Schnautz
44bbcfeebb revert 2018-01-17 19:57:08 +00:00
Rob Schnautz
5ae8e4c391 revert 2018-01-17 19:56:48 +00:00
Rob Schnautz
1e039cefcb revert 2018-01-17 19:52:31 +00:00
Rob Schnautz
eeafd84625 revert 2018-01-17 19:51:06 +00:00
Rob Schnautz
6955ad861c revert 2018-01-17 19:46:25 +00:00
Rob Schnautz
9fff6d70fe revert 2018-01-17 19:41:51 +00:00
Rob Schnautz
742e718c43 revert 2018-01-17 19:39:50 +00:00
Hanmac
d3020d591c StaticAbilityContinuous: use preList to check defined list other than zones 2018-01-17 20:34:24 +01:00
Rob Schnautz
ab44402886 revert 2018-01-17 19:31:15 +00:00
Hanmac
13cf87fa7a Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-01-17 20:28:53 +01:00
Rob Schnautz
c9a2ccb9f9 revert to INV 2018-01-17 19:13:37 +00:00
Rob Schnautz
3f78a5d595 missing pipe 2018-01-17 19:01:41 +00:00
Rob Schnautz
cdfdcba477 Duels of the Planeswalkers 2018-01-17 18:04:21 +00:00
Rob Schnautz
1dbbfb5112 Deckmasters: Garfield vs. Finkel 2018-01-17 17:42:47 +00:00
Rob Schnautz
d528d3854b Beatdown 2018-01-17 17:39:35 +00:00
Rob Schnautz
f6b5467663 add missing .txt extension 2018-01-17 17:37:02 +00:00
Rob Schnautz
77e22b355b add missing .txt extension 2018-01-17 17:36:22 +00:00
Rob Schnautz
74b2b1d4cf Battle Royale 2018-01-17 17:18:27 +00:00
Rob Schnautz
9736d6c3e4 Change Reprint to Other since it's a box set 2018-01-17 17:14:48 +00:00
Rob Schnautz
4c8f1be770 Anthologies 2018-01-17 17:06:12 +00:00
Agetian
3f88293d8e Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-17 18:26:27 +03:00
Michael Kamensky
40828d8f57 Merge branch 'newcard' into 'master'
- Added three cards

See merge request core-developers/forge!112
2018-01-17 15:21:46 +00:00
swordshine
c97d67e4fc - Added Imprison 2018-01-17 18:55:15 +08:00
swordshine
e3265ace4b - Added Palace Jailer 2018-01-17 18:32:08 +08:00
Rob Schnautz
2e3afcbe45 PCA tokens 2018-01-17 07:16:14 +00:00
Rob Schnautz
236ac800d6 DDP tokens 2018-01-17 07:10:16 +00:00
Rob Schnautz
d395c47d4d C16 tokens 2018-01-17 07:08:44 +00:00
Rob Schnautz
178944b3da MM3 tokens 2018-01-17 07:07:27 +00:00
Rob Schnautz
61457cbba8 ODY tokens 2018-01-17 07:06:22 +00:00
Rob Schnautz
a74d4ab0c6 C16 tokens 2018-01-17 07:00:49 +00:00
Rob Schnautz
3f561f004a C16 tokens, remove a period 2018-01-17 06:59:04 +00:00
Rob Schnautz
26a3d1b3be MM2 tokens 2018-01-17 06:53:59 +00:00
Hanmac
a4e619fba2 CardPredicates: add inZone check 2018-01-17 07:40:03 +01:00
Rob Schnautz
f6230e76fd IMA tokens 2018-01-17 06:38:52 +00:00
Rob Schnautz
5a7f35c6ab DDS tokens 2018-01-17 06:25:59 +00:00
Rob Schnautz
1c5c3eba74 C16 tokens 2018-01-17 06:19:13 +00:00
Rob Schnautz
59569a9bfc C15 tokens 2018-01-17 06:17:47 +00:00
Rob Schnautz
9c7e5ae8dd M11 tokens 2018-01-17 06:16:28 +00:00
Rob Schnautz
bd0049ef57 Use M14 tokens 2018-01-17 06:15:10 +00:00
Rob Schnautz
f936f443ea use C14 tokens 2018-01-17 06:13:48 +00:00
Rob Schnautz
4d85237f44 was reprinted in VMA, use VMA tokens 2018-01-17 06:12:28 +00:00
Rob Schnautz
1cf8a96c3d EVE tokens 2018-01-17 06:08:46 +00:00
Rob Schnautz
99242384f5 use DGM tokens 2018-01-17 06:07:09 +00:00
Rob Schnautz
aaed05bef8 use MRD tokens 2018-01-17 06:02:00 +00:00
Rob Schnautz
857e3fb4a1 normalize token image name 2018-01-17 05:58:16 +00:00
swordshine
c0ae7f42d9 - Added Orzhov Advokist (still need improved ai logic) 2018-01-17 13:47:03 +08:00
Rob Schnautz
37605ca2b8 ROE tokens 2018-01-17 05:42:26 +00:00
Rob Schnautz
89ecbda923 INV tokens 2018-01-17 05:10:36 +00:00
Rob Schnautz
dc24cabcbf INV tokens 2018-01-17 05:02:36 +00:00
Michael Kamensky
ae2d1a438c Update tomb_robber.txt (the TODO line is not strictly necessary, RemAIDeck is already a visible enough flag of AI-related issues) 2018-01-17 05:01:20 +00:00
Rob Schnautz
b85917140d RTR tokens 2018-01-17 04:59:41 +00:00
Rob Schnautz
4373e81508 OGW tokens 2018-01-17 04:58:53 +00:00
Rob Schnautz
d1293259e7 normalize token image name 2018-01-17 04:37:59 +00:00
Rob Schnautz
381304867b use ISD tokens 2018-01-17 04:34:07 +00:00
Rob Schnautz
1b4b5752aa Use EVG tokens 2018-01-17 04:25:09 +00:00
Rob Schnautz
94b3ae3715 Use SOM tokens 2018-01-17 04:22:22 +00:00
Rob Schnautz
b478099a2b Use either RTR token 2018-01-17 04:18:39 +00:00
Rob Schnautz
26d8419678 normalize token image name 2018-01-17 04:11:33 +00:00
Rob Schnautz
1eb2cbf275 use INV tokens 2018-01-17 03:59:34 +00:00
Rob Schnautz
e1f3c3ad1c use BFZ tokens 2018-01-17 03:55:41 +00:00
Rob Schnautz
98c3787ed4 normalize token image 2018-01-17 03:54:27 +00:00
Rob Schnautz
97fcce87c4 use ODY tokens 2018-01-17 03:50:51 +00:00
Agetian
1536996a02 - Fixed Mausoleum Harpy. 2018-01-17 06:49:48 +03:00
Rob Schnautz
542bc66f86 Use ODY tokens 2018-01-17 03:48:38 +00:00
Rob Schnautz
206d1639b5 Use OGW tokens 2018-01-17 03:40:13 +00:00
Rob Schnautz
3a9ae627db Normalize token reference 2018-01-17 03:32:25 +00:00
Agetian
831b5a8ba3 - Fixed Tomb Robber and Jadecraft Artisan oracle texts, marked Tomb Robber as currently AI-unplayable (needs a special ExploreAi logic). 2018-01-16 22:40:56 +03:00
Sol
9b4f423afa Merge branch 'assorted-fixes' into 'master'
Assorted fixes (Oracle text correction, Tendershoot Dryad fix, Planeswalkers in PW precons should be foil)

See merge request core-developers/forge!110
2018-01-16 14:56:35 +00:00
Agetian
e7ce5bcdb6 - Fixed Oracle text for Sun-Crested Pterodon. 2018-01-16 13:04:49 +03:00
Agetian
73bbb0d3dd - Updating CHANGES.txt. 2018-01-16 09:06:33 +03:00
Agetian
1e5d2ef239 Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-16 09:05:38 +03:00
Michael Kamensky
07b25b78ee Merge branch 'automatic_image_downloader' into 'master'
Automatic image downloader

See merge request core-developers/forge!107
2018-01-16 05:43:30 +00:00
Michael Kamensky
e67518d0f0 Merge branch 'patch-4' into 'master'
Card Workshop script loading fix for cards with punctuation and upcoming folder

See merge request core-developers/forge!109
2018-01-16 05:26:01 +00:00
Agetian
c1b7c46eca - Fixed Oracle text in Thunderherd Migration. 2018-01-16 08:25:15 +03:00
Agetian
d2d43aea2e Merge remote-tracking branch 'origin/assorted-fixes' into assorted-fixes 2018-01-16 08:24:12 +03:00
Agetian
1fa83a2d84 - Planeswalkers in planeswalker decks should be foil. 2018-01-16 08:17:52 +03:00
Agetian
6d1f698882 Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-16 08:15:04 +03:00
Agetian
3c4a34daaa - Fixed Tendershoot Dryad. 2018-01-16 08:12:31 +03:00
Michael Kamensky
590b487711 Merge branch 'patch-2' into 'master'
Update planeswalker decks with specific basic land printings, holo PWs

See merge request core-developers/forge!106
2018-01-16 04:51:59 +00:00
Michael Kamensky
7344c934a4 Merge branch 'patch-3' into 'master'
Update planeswalker-achievements.txt (RIX)

See merge request core-developers/forge!108
2018-01-16 04:51:17 +00:00
Rob Schnautz
9a67bc0f49 add support for split cards in card workshop 2018-01-16 04:19:02 +00:00
Rob Schnautz
cbc5dc79a0 remove punctuation from filename to match the format of three other cards with exclamation points in their names 2018-01-16 04:06:19 +00:00
Rob Schnautz
1fcde1cd4b Add support for "upcoming" folder in Card Workshop, and better filename calculation. 2018-01-16 04:04:40 +00:00
Rob Schnautz
a16e398feb Update planeswalker-achievements.txt (RIX) 2018-01-16 03:01:08 +00:00
Chris H
25ca71a97a Add Picture work to Changes file 2018-01-15 17:10:53 -05:00
Chris H
23618de189 Improve LQ Pictures Downloader 2018-01-15 17:02:33 -05:00
Chris H
43455723f6 Check for existing images in a single IO request. 2018-01-15 17:02:31 -05:00
Chris H
d646240c63 Update magiccards.info protocol 2018-01-15 17:02:30 -05:00
Chris H
d60ee9307d Grab LQ picture from primary server 2018-01-15 17:02:29 -05:00
Chris H
c2915d909d Update auto-fetcher to use Set LQ Pictures 2018-01-15 17:02:28 -05:00
Rob Schnautz
3187969200 Merge branch 'patch-3' into 'patch-2'
Update Vraska, Scheming Gorgon.dck

See merge request schnautzr/forge!2
2018-01-15 21:59:37 +00:00
Rob Schnautz
30f18cd947 Update Vraska, Scheming Gorgon.dck 2018-01-15 21:58:02 +00:00
Rob Schnautz
181a1d2f1a Update Angrath, Minotaur Pirate.dck 2018-01-15 21:53:28 +00:00
Michael Kamensky
3404d267f7 Merge branch 'manually-update-release-files' into 'master'
Manually update Pom files and release changes to be ready for next release

See merge request core-developers/forge!104
2018-01-15 19:50:47 +00:00
Michael Kamensky
0af6b92e9f Merge branch 'patch-2' into 'master'
Drafting correction and booster lands correction

See merge request core-developers/forge!105
2018-01-15 19:49:00 +00:00
Chris H
c87a2bff23 Manually update Pom files and release changes to be ready for next release 2018-01-15 13:57:46 -05:00
Rob Schnautz
32a42cf9ec Add basic lands in RIX. Assuming equal distribution, haven't seen anywhere that details the odds. 2018-01-15 18:57:17 +00:00
Rob Schnautz
e2189ea877 Fix drafting and basic lands 2018-01-15 18:49:07 +00:00
Sol
fe31d692f2 Merge branch 'patch-1' into 'master'
Update formats.txt, effective 1/19/18 with release of RIX.

See merge request core-developers/forge!103
2018-01-15 16:24:57 +00:00
Rob Schnautz
84c2ac918b Update formats.txt, effective 1/19/18 with release of RIX. 2018-01-15 16:17:51 +00:00
Sol
6cf97aa2fc Merge branch 'rix-cards' into 'master'
Added Golden Guardian [RIX]

See merge request core-developers/forge!102
2018-01-15 13:48:13 +00:00
Agetian
b58a561863 - Updating CHANGES.txt. 2018-01-15 16:02:01 +03:00
Agetian
06c13804a4 Merge branch 'master' of git.cardforge.org:core-developers/forge into rix-cards 2018-01-15 16:01:13 +03:00
Agetian
bf8e88f76b - Added Golden Guardian [RIX]. Will eventually need to be reworked to use AF DelayedTrigger. 2018-01-15 16:00:52 +03:00
Michael Kamensky
84528b5251 Merge branch 'newcard' into 'master'
- Merieke Ri Berit's ability has a delayed trigger

See merge request core-developers/forge!101
2018-01-15 12:18:26 +00:00
Sol
f76428b668 Merge branch 'two-explores' into 'master'
Fix Jadelight Ranger description

See merge request core-developers/forge!100
2018-01-15 04:31:41 +00:00
swordshine
d8abdf1a2e - Merieke Ri Berit's ability has a delayed trigger 2018-01-15 09:25:10 +08:00
Chris H
f9f83660f5 Fix Jadelight Ranger description 2018-01-14 17:55:24 -05:00
Michael Kamensky
ddfd97c395 Merge branch 'upcoming_rix2' into 'master'
Added token image for rekindling phoenix

See merge request core-developers/forge!99
2018-01-14 16:49:32 +00:00
austinio7116
f658ba29c9 Added token image for rekindling phoenix 2018-01-14 15:12:39 +00:00
Sol
57cf22af43 Merge branch 'newcard' into 'master'
Fixed a card

See merge request core-developers/forge!98
2018-01-14 14:48:51 +00:00
Sol
eaea379532 Merge branch 'upcoming_rix2' into 'master'
Ability description fix for Kumena

See merge request core-developers/forge!97
2018-01-14 13:36:33 +00:00
swordshine
2ac3829b6f - Wormfang Drake should not exile an opponent's creature 2018-01-14 18:07:14 +08:00
swordshine
29e3cf4a79 - Fixed the the plural merfolk in the typelist 2018-01-14 18:03:11 +08:00
maustin
d84e2e4e23 Merge remote-tracking branch 'origin/upcoming_rix2' into upcoming_rix2 2018-01-14 09:58:48 +00:00
austinio7116
02b8d39791 Ability description fix for Kumena 2018-01-14 09:58:32 +00:00
austinio7116
f7a74edc6e Ability description fix for Kumena 2018-01-14 09:50:31 +00:00
swordshine
8feaf0795f - Simplified the code 2018-01-14 10:53:21 +08:00
Sol
87a857220f Merge branch 'upcoming_rix2' into 'master'
Induced Amnesia

See merge request core-developers/forge!96
2018-01-14 01:48:59 +00:00
austinio7116
403550af5f Update ChooseCardEffect.java 2018-01-14 00:54:04 +00:00
maustin
d6ffdddfc6 Text correction "a creature" -> creature(s) for new WithTotalPower effect 2018-01-14 00:51:55 +00:00
austinio7116
7663df024c Added Induced Amnesia - cleaned up unneeded define 2018-01-14 00:32:17 +00:00
maustin
704c735bc5 Merge remote-tracking branch 'origin/upcoming_rix2' into upcoming_rix2 2018-01-14 00:21:21 +00:00
austinio7116
ec72e9f7d7 Added Induced Amnesia 2018-01-14 00:20:55 +00:00
austinio7116
f95ada602c Added Induced Amnesia 2018-01-14 00:19:04 +00:00
Hanmac
7c10272d03 Fix: added References to tilonallis_summoner 2018-01-13 22:17:36 +01:00
Hanmac
3c3c64a11a AtEOT: add AtEOTCondition & AtEOTDesc 2018-01-13 17:11:23 +01:00
Michael Kamensky
722c16e925 Merge branch 'rix-rename' into 'master'
Migrate RIX to appropriate card letter folders

See merge request core-developers/forge!95
2018-01-13 15:45:18 +00:00
Chris H
4a799cf45f Migrate RIX to appropriate card letter folders 2018-01-13 10:21:23 -05:00
Sol
16acf2d46c Merge branch 'rix-cards' into 'master'
Added Flood of Recollection [RIX]

See merge request core-developers/forge!91
2018-01-13 14:35:16 +00:00
Sol
413c14a1dc Merge branch 'RIX' into 'master'
Rix

See merge request core-developers/forge!94
2018-01-13 14:34:57 +00:00
swordshine
826f37e4b9 - Added Cherished Hatchling 2018-01-13 22:15:55 +08:00
swordshine
39654e498c - Updated more scripts 2018-01-13 21:56:05 +08:00
swordshine
e3432ced3c - More oracle updates 2018-01-13 21:25:20 +08:00
swordshine
917ae1daab - Updated the Dinosaur type for a few cards 2018-01-13 21:15:50 +08:00
Michael Kamensky
a09086bfc2 Merge branch 'RIX' into 'master'
Updated the chooseCard effect for Slaughter the Strong

See merge request core-developers/forge!93
2018-01-13 13:08:20 +00:00
swordshine
2ac38e6639 - one more update 2018-01-13 20:02:59 +08:00
swordshine
3dc54790cc - Updated the chooseCard effect for Slaughter the Strong 2018-01-13 19:50:14 +08:00
Agetian
ce780c5175 Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-01-13 12:25:02 +03:00
Michael Kamensky
35a76b4a43 Merge branch 'RIX' into 'master'
- Added Slaughter the Strong

See merge request core-developers/forge!92
2018-01-13 09:22:02 +00:00
swordshine
999f990870 - Added Awakened Amalgam by Marek14 2018-01-13 16:39:37 +08:00
swordshine
e050a62b0c - Added Slaughter the Strong 2018-01-13 16:21:59 +08:00
Agetian
1cd278afcf - Added Flood of Recollection [RIX]. 2018-01-13 09:05:09 +03:00
Agetian
208089a5cd Merge remote-tracking branch 'upstream/master' 2018-01-13 08:16:02 +03:00
Michael Kamensky
0c66c256b3 Merge branch 'sort-deck-folders' into 'master'
Sort the folder list in the deck editor

See merge request core-developers/forge!88
2018-01-13 05:13:59 +00:00
Agetian
66e8154243 Merge remote-tracking branch 'upstream/master' 2018-01-13 08:04:48 +03:00
Michael Kamensky
ff4db64802 Merge branch 'patch-6' into 'master'
Patch for Issue #8, coded by @friarsol

See merge request core-developers/forge!86
2018-01-13 04:51:09 +00:00
Michael Kamensky
4c29790b6c Merge branch 'patch-5' into 'master'
Sort Conspiracy before Eldrazi

See merge request core-developers/forge!85
2018-01-13 04:50:30 +00:00
Sol
3efc4807cf Merge branch 'RIX' into 'master'
- Added cost for Timestream Navigator

See merge request core-developers/forge!90
2018-01-13 03:24:17 +00:00
swordshine
a3b543cdd2 - Removed the extra line in the script 2018-01-13 11:04:12 +08:00
swordshine
a12eedfa93 - Added cost for Timestream Navigator 2018-01-13 10:30:20 +08:00
Sol
a97125d733 Merge branch 'patch-7' into 'master'
Fix DECK_EDITION tooltip

See merge request core-developers/forge!89
2018-01-13 00:21:43 +00:00
Rob Schnautz
7b5d2fc053 Fix DECK_EDITION tooltip 2018-01-12 22:42:51 +00:00
Jamin W. Collins
0e587c5b3a Sort the folder list in the deck editor
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
2018-01-12 12:09:27 -08:00
Michael Kamensky
6ea9a07a3d Merge branch 'upcoming_rix2' into 'master'
Corrected issues in editions file and rankings for RIX

See merge request core-developers/forge!87
2018-01-12 18:32:24 +00:00
austinio7116
090a47b17f Corrected issues in editions file and rankings for RIX 2018-01-12 18:08:46 +00:00
Rob Schnautz
f79b326010 Patch for Issue #8, coded by @friarsol 2018-01-12 18:06:02 +00:00
Rob Schnautz
4c6aa708c1 Sort Conspiracy before Eldrazi 2018-01-12 17:51:14 +00:00
Agetian
7ac66a298b Merge branch 'schnautzr/forge-patch-4' 2018-01-12 19:57:48 +03:00
Rob Schnautz
9e1baa9521 Add more spaces (non-functional) 2018-01-12 16:43:23 +00:00
Michael Kamensky
c1870b4ef8 Merge branch 'patch-5' into 'master'
Fix slowness issue when removing cards from decks.

See merge request core-developers/forge!84
2018-01-12 16:17:03 +00:00
Rob Schnautz
a9b068c89e fixed those spaces. 2018-01-12 16:13:07 +00:00
Sol
dab7d5030e Merge branch 'rix-planeswalker-decks' into 'master'
- Added RIX planeswalker decks as quest mode precons.

See merge request core-developers/forge!82
2018-01-12 15:40:23 +00:00
Sol
120a314a96 Merge branch 'assorted-fixes' into 'master'
- Renamed a couple cards in the RIX definition file.

See merge request core-developers/forge!80
2018-01-12 14:35:58 +00:00
Rob Schnautz
bd4305dd13 Fix slowness issue when removing cards from decks. 2018-01-12 14:24:40 +00:00
Michael Kamensky
d8b7214a2b Merge branch 'RIX' into 'master'
- Updated Commune with Dinosaurs

See merge request core-developers/forge!83
2018-01-12 08:25:55 +00:00
swordshine
95122ffcf8 - Updated Commune with Dinosaurs 2018-01-12 16:24:04 +08:00
Agetian
3b1b0bc92f - Update Commune with Dinosaurs to work with any Dinosaur card instead of just Creature.Dinosaur. 2018-01-12 11:20:58 +03:00
Agetian
49f789c404 - Removed a couple empty lines. 2018-01-12 10:43:04 +03:00
Agetian
9cf447d422 - Added RIX planeswalker decks as quest mode precons. 2018-01-12 10:36:47 +03:00
Agetian
1dc10b57c6 - Surge of Memories -> Flood of Recollection 2018-01-12 09:58:33 +03:00
Michael Kamensky
3d11422191 Merge branch 'revert-72e78226' into 'master'
Revert "Merge branch 'patch-4' into 'master'"

See merge request core-developers/forge!81
2018-01-12 06:48:03 +00:00
Michael Kamensky
fa0fc14c25 Revert "Merge branch 'patch-4' into 'master'"
This reverts merge request !77
2018-01-12 06:46:57 +00:00
Agetian
22cdb7e721 Merge branch 'master' of git.cardforge.org:core-developers/forge into assorted-fixes 2018-01-12 09:32:07 +03:00
Agetian
d215657641 - Renamed Shrine Altisaur to Temple Altisaur in the definition file 2018-01-12 09:30:21 +03:00
Rob Schnautz
df33b9388f Update ColumnDef.java 2018-01-12 05:41:09 +00:00
Rob Schnautz
ac53f16098 Sort Conspiracies before Eldrazi 2018-01-12 05:39:12 +00:00
Sol
36d6342e77 Merge branch 'fix-reckless-rage-desc' into 'master'
Fix reckless rage description

See merge request core-developers/forge!78
2018-01-12 04:04:48 +00:00
Sol
72e7822616 Merge branch 'patch-4' into 'master'
Fix slowness when removing a card from a deck by only getting the key once instead of twice.

See merge request core-developers/forge!77
2018-01-12 04:04:29 +00:00
Chris H
ea8f990172 Fix reckless rage description 2018-01-11 23:02:19 -05:00
Rob Schnautz
8003ade509 Fix slowness when removing a card from a deck by only getting the key once instead of twice. 2018-01-12 03:51:36 +00:00
Sol
3795232b2c Merge branch 'assorted-fixes' into 'master'
- Fix capitalization in the name of The City's Blessing token.

See merge request core-developers/forge!74
2018-01-12 02:20:45 +00:00
Sol
dda26098f4 Merge branch 'upcoming_rix2' into 'master'
Fixed Zacama's IsCast Property

See merge request core-developers/forge!76
2018-01-12 02:19:29 +00:00
maustin
ae042d98f4 Merge remote-tracking branch 'origin/upcoming_rix2' into upcoming_rix2 2018-01-11 21:53:07 +00:00
austinio7116
649faa3371 Fixed Zacama's IsCast property 2018-01-11 21:52:35 +00:00
Michael Kamensky
cea0c3f628 Merge branch 'upcoming_rix2' into 'master'
Added Release to the Wind (RIX)

See merge request core-developers/forge!75
2018-01-11 20:25:06 +00:00
Michael Kamensky
dce2ebbafb Update release_to_the_wind.txt (spell description fix). 2018-01-11 20:24:07 +00:00
austinio7116
c80d703acf Added Release to the Wind (RIX) 2018-01-11 19:54:27 +00:00
Agetian
f0418b8d2a - Name the Blessing token as it is named on the physical card. 2018-01-11 18:42:27 +03:00
Agetian
f363ae0f1e - Fix capitalization in the name of The City's Blessing token. 2018-01-11 18:31:49 +03:00
Michael Kamensky
24d3801316 Merge branch 'upcoming_rix2' into 'master'
Added Tilonallis Summoning with Swordshine's fixes

See merge request core-developers/forge!73
2018-01-11 15:29:45 +00:00
Sol
2a3f2c6dbd Merge branch 'fix-cantequip-crash' into 'master'
- Fix a crash when trying to equip a creature with an equipment that has CantEquip (e.g. O-Naginata)

See merge request core-developers/forge!70
2018-01-11 14:54:21 +00:00
Michael Kamensky
318a6e2924 Merge branch 'RIX' into 'master'
- Fixed a few cards

See merge request core-developers/forge!72
2018-01-11 14:15:07 +00:00
austinio7116
800311fed8 Added Tilonallis Summoning with Swordshine's fixes 2018-01-11 14:05:17 +00:00
swordshine
e49d45bf4f - Update more scripts 2018-01-11 21:59:33 +08:00
swordshine
356bd9c635 - Fixed P/T of two cards 2018-01-11 21:07:53 +08:00
Michael Kamensky
b400ea6d33 Merge branch 'upcoming_rix2' into 'master'
Corrected creature type of Forefunner of the Heralds

See merge request core-developers/forge!71
2018-01-11 11:28:34 +00:00
austinio7116
7352f9094a Corrected creature type of Forefunner of the Heralds 2018-01-11 10:06:36 +00:00
Agetian
c90e8bd356 - CantEquip: modify the card scripts such that they use a colon delimiter. 2018-01-11 09:41:38 +03:00
Agetian
9f79073d14 - Fix a crash when trying to equip a creature with an equipment that has CantEquip (e.g. O-Naginata). 2018-01-11 09:11:46 +03:00
Sol
249f8a4673 Merge branch 'RIX' into 'master'
- Added The Immortal Sun

See merge request core-developers/forge!69
2018-01-11 04:04:08 +00:00
swordshine
fe8ec70159 - Added The Immortal Sun 2018-01-11 11:09:08 +08:00
Sol
1f5375fed2 Merge branch 'rix_edition_file' into 'master'
Fix RIX edition missing rarity

See merge request core-developers/forge!68
2018-01-11 02:09:12 +00:00
Chris H
804d47df7b Fix RIX edition missing rarity 2018-01-10 21:07:52 -05:00
Sol
c6dfc1ceb2 Merge branch 'upcoming_rix2' into 'master'
Added Azor, the Lawbringer (RIX)

See merge request core-developers/forge!67
2018-01-11 00:30:50 +00:00
austinio7116
b3727f6821 Update azor_the_lawbringer.txt 2018-01-10 23:06:45 +00:00
austinio7116
bc538da8ea Added Azor, the Lawbringer (RIX) 2018-01-10 22:53:30 +00:00
Agetian
465e25adff - Updating CHANGES.txt (some clarifications). 2018-01-10 19:50:09 +03:00
Agetian
809fc513ea Merge remote-tracking branch 'upstream/master' 2018-01-10 19:38:45 +03:00
Agetian
ea101baf0d - Updating CHANGES.txt. 2018-01-10 19:37:28 +03:00
Michael Kamensky
19f88d6e6d Merge branch 'RIX' into 'master'
Fixed a few cards and added Peace Talks

See merge request core-developers/forge!64
2018-01-10 15:17:59 +00:00
Michael Kamensky
7499d05bbc Merge branch 'master' into 'master'
Merge Marek's latest RIX efforts (Ascend)

See merge request core-developers/forge!65
2018-01-10 15:08:32 +00:00
Agetian
de2e3fc070 Merge branch 'Marek14/forge-master' 2018-01-10 18:03:36 +03:00
Agetian
9b85293349 - Fix a couple cards. 2018-01-10 17:48:33 +03:00
swordshine
bee34c064b - Removed a param in the previous commit 2018-01-10 22:09:26 +08:00
swordshine
7ba64ce136 - Added Peack Talks 2018-01-10 22:06:57 +08:00
swordshine
d80d2c5cda - Fixed Touch of Vitae 2018-01-10 20:12:17 +08:00
Marek Čtrnáct
2419b93682 Update expel_from_orazca.txt 2018-01-10 11:48:03 +00:00
Marek Čtrnáct
740b3f0c49 Update expel_from_orazca.txt 2018-01-10 11:47:35 +00:00
Marek Čtrnáct
0925379a6d Add new file 2018-01-10 11:45:54 +00:00
Marek Čtrnáct
0c89087579 Add new file 2018-01-10 11:40:39 +00:00
Marek Čtrnáct
0565082309 Add new file 2018-01-10 11:37:11 +00:00
Marek Čtrnáct
cf7fcb07a1 Update kumenas_awakening.txt 2018-01-10 11:32:18 +00:00
Marek Čtrnáct
ad99d21cdf Add new file 2018-01-10 11:31:33 +00:00
Marek Čtrnáct
3ad4da4f49 Add new file 2018-01-10 11:27:47 +00:00
Marek Čtrnáct
62238e0f81 Update deadeye_brawler.txt 2018-01-10 11:21:09 +00:00
Marek Čtrnáct
2928f157fa Update mausoleum_harpy.txt 2018-01-10 11:21:03 +00:00
Marek Čtrnáct
cacb64b2ca Update twilight_prophet.txt 2018-01-10 11:20:55 +00:00
Marek Čtrnáct
1f65c4723d Update resplendent_griffin.txt 2018-01-10 11:20:42 +00:00
Marek Čtrnáct
c2d4923706 Add new file 2018-01-10 10:20:51 +00:00
Marek Čtrnáct
5ea07389b4 Add new file 2018-01-10 10:16:01 +00:00
Marek Čtrnáct
8c56bb51ed Update slippery_scoundrel.txt 2018-01-10 10:15:11 +00:00
Marek Čtrnáct
7c8057dbc6 Add new file 2018-01-10 10:14:42 +00:00
Marek Čtrnáct
841b9ae668 Add new file 2018-01-10 10:13:13 +00:00
Marek Čtrnáct
f847a39eaa Add new file 2018-01-10 10:11:59 +00:00
Marek Čtrnáct
f2eafb99d4 Update dusk_charger.txt 2018-01-10 10:10:03 +00:00
Marek Čtrnáct
847becccfe Add new file 2018-01-10 10:09:54 +00:00
Marek Čtrnáct
536c2483b0 Add new file 2018-01-10 10:08:02 +00:00
Marek Čtrnáct
af80228bcd Add new file 2018-01-10 10:05:21 +00:00
Marek Čtrnáct
334b086efb Add new file 2018-01-10 09:49:22 +00:00
Marek Čtrnáct
bddce9872f Add new file 2018-01-10 09:41:15 +00:00
Marek Čtrnáct
3d4e544573 Add new file 2018-01-10 09:37:53 +00:00
Marek Čtrnáct
7fe68a1c4a Add new file 2018-01-10 09:34:28 +00:00
Marek Čtrnáct
8693b6ce81 Add new file 2018-01-10 09:25:18 +00:00
Marek Čtrnáct
200b3f7092 Add new file 2018-01-10 09:20:42 +00:00
Marek Čtrnáct
69afbde352 Add new file 2018-01-10 09:09:03 +00:00
Hanmac
052fb65518 CardFactoryUtil: add Ascend for non-permanent Spell 2018-01-10 07:30:03 +01:00
swordshine
c2ec6978c4 - Added a planeswalker subtype: Angrath 2018-01-10 14:21:41 +08:00
Michael Kamensky
941e25d7a7 Merge branch 'RIX' into 'master'
- Added Sphinx's Decree

See merge request core-developers/forge!62
2018-01-09 15:28:08 +00:00
swordshine
0bddb07ba0 - Added Sphinx's Decree 2018-01-09 22:11:45 +08:00
Michael Kamensky
869697352d Merge branch 'master' into 'master'
Master

See merge request core-developers/forge!59
2018-01-09 13:58:43 +00:00
Agetian
9757fdb16b Merge branch 'Marek14/forge-master'
# Conflicts:
#	forge-gui/res/cardsfolder/upcoming/canal_monitor.txt
#	forge-gui/res/cardsfolder/upcoming/daring_buccaneer.txt
#	forge-gui/res/cardsfolder/upcoming/goblin_trailblazer.txt
#	forge-gui/res/cardsfolder/upcoming/impale.txt
#	forge-gui/res/cardsfolder/upcoming/orazca_raptor.txt
#	forge-gui/res/cardsfolder/upcoming/sadistic_skymarcher.txt
#	forge-gui/res/cardsfolder/upcoming/siegehorn_ceratops.txt
#	forge-gui/res/cardsfolder/upcoming/vampire_revenant.txt
2018-01-09 16:56:27 +03:00
Agetian
4d718177b6 - Update and fix more cards (according to Swordshine's recommendations). 2018-01-09 16:50:55 +03:00
Marek Čtrnáct
2dff30f2cd Merge branch 'Marek14/forge-master' into 'master'
Updating and fixing some cards.

See merge request Marek14/forge!1
2018-01-09 08:00:30 +00:00
Agetian
8b5128510b - Update and fix more cards. 2018-01-09 10:29:26 +03:00
Agetian
1efa8d030b - Added PREY counter (e.g. Tetzimoc, Primal Death) 2018-01-09 10:25:45 +03:00
Agetian
c855a107ab - Experimental (needs review): grant SVars to tokens before granting abilities and triggers in order to ensure that the game can see SubAbility SVars (e.g. Rekindling Phoenix). 2018-01-09 10:17:44 +03:00
Agetian
a379279956 - Update and fix some cards. 2018-01-09 09:24:49 +03:00
Agetian
3fb38ae682 Merge branch 'master' of git.cardforge.org:Marek14/forge into Marek14/forge-master 2018-01-09 08:35:56 +03:00
Michael Kamensky
ee29d4289c Merge branch 'Fix-RepeatEach-Changing-Zones' into 'master'
RepeatSubAbility host isn't set correctly if source changes zone

See merge request core-developers/forge!61
2018-01-09 05:18:46 +00:00
Chris H
eeccc8490d RepeatSubAbility host isn't set correctly if source changes zone 2018-01-08 23:44:40 -05:00
Sol
2ae735db74 Merge branch 'PossibilityStormPuzzles' into 'master'
- Added Possibility Storm puzzles for Ixalan and Iconic Masters (by Xitax).

See merge request core-developers/forge!58
2018-01-09 04:38:26 +00:00
Sol
248d6c57c9 Merge branch 'RIX' into 'master'
Rix

See merge request core-developers/forge!60
2018-01-09 04:37:46 +00:00
swordshine
5eba9bfc14 - Removed debug info 2018-01-09 12:17:05 +08:00
swordshine
7bc14a526d - Added Azor's Gateway 2018-01-09 12:14:19 +08:00
Marek Čtrnáct
769521c978 Update arguels_blood_fast_temple_of_aclazotz.txt 2018-01-08 17:31:45 +00:00
Marek Čtrnáct
bc71ef6a18 Add new file 2018-01-08 17:31:34 +00:00
Marek Čtrnáct
422ab9b835 Delete Bombard 2018-01-08 17:24:31 +00:00
Marek Čtrnáct
410f9b1acf Update dire_fleet_hoarder.txt 2018-01-08 17:14:07 +00:00
Marek Čtrnáct
f6b3cb4b53 Add new file 2018-01-08 17:09:18 +00:00
Marek Čtrnáct
6a72aab106 Add new file 2018-01-08 16:29:05 +00:00
Marek Čtrnáct
f3695e18ac Add new file 2018-01-08 16:19:36 +00:00
Marek Čtrnáct
f64846c690 Add new file 2018-01-08 15:17:14 +00:00
Marek Čtrnáct
79bb27d2a7 Add new file 2018-01-08 14:01:52 +00:00
Agetian
f0dba0ca0e - Added Possibility Storm puzzles for Ixalan and Iconic Masters (by Xitax). 2018-01-08 16:09:10 +03:00
Marek Čtrnáct
b70627bd3f Update dire_fleet_hoarder.txt 2018-01-08 13:08:31 +00:00
Marek Čtrnáct
91b894958c Add new file 2018-01-08 12:37:47 +00:00
Marek Čtrnáct
ef10e83f1c Add new file 2018-01-08 11:37:02 +00:00
Marek Čtrnáct
e958cb665e Add new file 2018-01-08 10:56:09 +00:00
Marek Čtrnáct
8413ec92d5 Add new file 2018-01-08 10:50:45 +00:00
Marek Čtrnáct
92d77b610d Update tezzerets_betrayal.txt 2018-01-08 10:10:18 +00:00
Marek Čtrnáct
42f445b1d2 Update arguels_blood_fast_temple_of_aclazotz.txt 2018-01-08 08:42:06 +00:00
Marek Čtrnáct
ca886f4c0c Add new file 2018-01-08 08:21:46 +00:00
Marek Čtrnáct
531ac8fc50 Add new file 2018-01-08 08:05:19 +00:00
Marek Čtrnáct
628c8f5ff1 Update arguels_blood_fast_temple_of_aclazotz.txt 2018-01-08 07:57:08 +00:00
Agetian
b63037caf3 Merge branch 'swordshine/forge-master' 2018-01-08 10:48:21 +03:00
Marek Čtrnáct
19127cb09d Add new file 2018-01-08 07:46:28 +00:00
Marek Čtrnáct
004e0a4265 Add new file 2018-01-08 07:45:52 +00:00
Marek Čtrnáct
9bbc23d550 Update safe_haven.txt 2018-01-08 07:33:49 +00:00
Marek Čtrnáct
77cea9f74e Add new file 2018-01-08 07:29:34 +00:00
Marek Čtrnáct
0bc57c145a Update military_intelligence.txt 2018-01-08 07:28:42 +00:00
swordshine
92545309e1 - Added Blood Sun 2018-01-08 13:01:16 +08:00
Sol
bdc2fe8e69 Merge branch 'master' into 'master'
- fixed a few cards

See merge request core-developers/forge!56
2018-01-08 04:22:33 +00:00
swordshine
1d3c5c85ec - fixed a few cards 2018-01-08 11:53:44 +08:00
Marek Čtrnáct
cd14da0454 Add new file 2018-01-07 22:58:10 +00:00
Marek Čtrnáct
73ccaac656 Add new file 2018-01-07 22:19:02 +00:00
Marek Čtrnáct
b19df1be9f Update tamiyo_the_moon_sage.txt 2018-01-07 22:11:17 +00:00
Marek Čtrnáct
f10bfe8e8d Add new file 2018-01-07 22:06:53 +00:00
Marek Čtrnáct
3418fdf822 Update dire_fleet_neckbreaker.txt 2018-01-07 22:01:23 +00:00
Marek Čtrnáct
f31098bf15 Add new file 2018-01-07 21:59:39 +00:00
Marek Čtrnáct
27ec3db33d Update ajanis_comrade.txt 2018-01-07 21:57:52 +00:00
Marek Čtrnáct
8b618df712 Update snapping_sailback.txt 2018-01-07 21:44:17 +00:00
Marek Čtrnáct
a87d428563 Update dire_fleet_neckbreaker.txt 2018-01-07 21:43:14 +00:00
Marek Čtrnáct
d778138f92 Add new file 2018-01-07 21:40:07 +00:00
Marek Čtrnáct
1197b1c59a Add new file 2018-01-07 21:37:17 +00:00
Marek Čtrnáct
e5cf4e8cea Add new file 2018-01-07 20:08:13 +00:00
Hanmac
4bbfb1852f CardFactoryUtil: add Ascend Trigger for Permanent and example 2018-01-07 20:46:22 +01:00
Marek Čtrnáct
d88ecc8505 Add new file 2018-01-07 19:18:27 +00:00
Marek Čtrnáct
6d1ef8257f Add new file 2018-01-07 19:13:48 +00:00
Marek Čtrnáct
5167eabb5c Add new file 2018-01-07 19:08:38 +00:00
Marek Čtrnáct
c8f08f61e5 Add new file 2018-01-07 19:01:25 +00:00
Marek Čtrnáct
9ed4822a93 Add new file 2018-01-07 18:58:30 +00:00
Marek Čtrnáct
0db2fba9fa Add new file 2018-01-07 18:53:17 +00:00
Marek Čtrnáct
117ee3d7bc Add new file 2018-01-07 18:43:42 +00:00
Marek Čtrnáct
c30261f9b8 Add new file 2018-01-07 18:42:46 +00:00
Marek Čtrnáct
5bd0fcf866 Update fall_of_the_hammer.txt 2018-01-07 18:23:04 +00:00
Hanmac
c888a09a40 AscendEffect: add Effect to add Blessing to Player 2018-01-07 18:56:52 +01:00
Marek Čtrnáct
c88818aa55 Add new file 2018-01-07 17:56:11 +00:00
Marek Čtrnáct
bafbdc8a5a Add new file 2018-01-07 17:44:10 +00:00
Marek Čtrnáct
a04c9f144a Update sun_crowned_hunters.txt 2018-01-07 17:42:06 +00:00
Marek Čtrnáct
3301d91ae7 Add new file 2018-01-07 17:37:00 +00:00
Marek Čtrnáct
6c4ed98ad4 Add new file 2018-01-07 17:29:53 +00:00
Marek Čtrnáct
273894b734 Add new file 2018-01-07 17:28:14 +00:00
Marek Čtrnáct
2fd3b13d86 Add new file 2018-01-07 17:22:41 +00:00
Marek Čtrnáct
e3ec921e3d Add new file 2018-01-07 17:18:00 +00:00
Marek Čtrnáct
8e4ce46891 Add new file 2018-01-07 17:16:20 +00:00
Marek Čtrnáct
9c50f45866 Add new file 2018-01-07 17:11:25 +00:00
Hanmac
2b3733a752 ExploreEffect: remove unused vars 2018-01-07 18:03:44 +01:00
Hanmac
ae709d210e Keyword: add Ascend to keywords 2018-01-07 18:03:08 +01:00
Hanmac
8f94bceaf2 CardTraitBase: make negative Conditions possible 2018-01-07 18:02:18 +01:00
Marek Čtrnáct
36fbb71e1d Add new file 2018-01-07 17:00:33 +00:00
Marek Čtrnáct
464a1fe51c Update impulsive_maneuvers.txt 2018-01-07 16:57:53 +00:00
Marek Čtrnáct
4067caa144 Add new file 2018-01-07 16:56:53 +00:00
Marek Čtrnáct
c576b0f65c Add new file 2018-01-07 16:46:09 +00:00
Marek Čtrnáct
6156ad254f Add new file 2018-01-07 16:42:04 +00:00
Marek Čtrnáct
3b0465aafe Add new file 2018-01-07 16:39:24 +00:00
Marek Čtrnáct
d7da7a3fd1 Add new file 2018-01-07 16:32:53 +00:00
Marek Čtrnáct
3fb515c73b Add new file 2018-01-07 16:29:53 +00:00
Marek Čtrnáct
8ef5fbc84b Add new file 2018-01-07 16:28:01 +00:00
Marek Čtrnáct
51f1c281e7 Add new file 2018-01-07 16:24:36 +00:00
Marek Čtrnáct
d93e9170ad Add new file 2018-01-07 16:17:13 +00:00
Michael Kamensky
418d4d5019 Merge branch 'upcoming_rix' into 'master'
Added Siegehorn Ceratops (RIX)

See merge request core-developers/forge!55
2018-01-07 16:14:31 +00:00
Michael Kamensky
bf6c569c01 Update siegehorn_ceratops.txt (em-dash) 2018-01-07 16:13:26 +00:00
Marek Čtrnáct
6e1a994971 Add new file 2018-01-07 16:10:22 +00:00
Marek Čtrnáct
0ed44d4afb Add new file 2018-01-07 16:09:01 +00:00
Marek Čtrnáct
92cc1c7718 Add new file 2018-01-07 16:03:52 +00:00
austinio7116
b4347ff53d Added Siegehorn Ceratops (RIX) 2018-01-07 15:54:41 +00:00
Marek Čtrnáct
3e2b4418ef Add new file 2018-01-07 15:53:31 +00:00
Michael Kamensky
691264c2c3 Merge branch 'upcoming_rix' into 'master'
Added Zacama, Primal Calamity (RIX)

See merge request core-developers/forge!54
2018-01-07 15:53:14 +00:00
Marek Čtrnáct
a21b2acf6f Add new file 2018-01-07 15:50:06 +00:00
Marek Čtrnáct
54a3052fdb Add new file 2018-01-07 15:42:16 +00:00
Marek Čtrnáct
33fdd2969a Add new file 2018-01-07 15:40:20 +00:00
Marek Čtrnáct
2f146c9648 Add new file 2018-01-07 15:37:12 +00:00
Marek Čtrnáct
d7ead4cc3d Add new file 2018-01-07 15:33:05 +00:00
Marek Čtrnáct
f5b275d0d1 Update forerunner_of_the_legion.txt 2018-01-07 15:30:18 +00:00
Marek Čtrnáct
5b18502378 Add new file 2018-01-07 15:28:06 +00:00
Marek Čtrnáct
792fa2e9ca Add new file 2018-01-07 15:21:31 +00:00
Marek Čtrnáct
c1f4400441 Add new file 2018-01-07 15:12:57 +00:00
austinio7116
18e813b3ed Added Zacama, Prinal Calamity (RIX) 2018-01-07 15:07:47 +00:00
Marek Čtrnáct
5bc66f4c76 Add new file 2018-01-07 15:05:57 +00:00
Marek Čtrnáct
df7d5e9c8e Update gonti_lord_of_luxury.txt 2018-01-07 15:00:44 +00:00
Marek Čtrnáct
a9c68d2942 Update gonti_lord_of_luxury.txt 2018-01-07 15:00:20 +00:00
Marek Čtrnáct
541afd807e Update gonti_lord_of_luxury.txt 2018-01-07 14:59:57 +00:00
Marek Čtrnáct
598a391c12 Add new file 2018-01-07 14:43:24 +00:00
Marek Čtrnáct
a9c536322e Add new file 2018-01-07 14:39:52 +00:00
Marek Čtrnáct
2635c1798d Add new file 2018-01-07 14:37:04 +00:00
Marek Čtrnáct
92f1596336 Update tasigurs_cruelty.txt 2018-01-07 14:33:17 +00:00
Marek Čtrnáct
9d41132be6 Add new file 2018-01-07 14:32:25 +00:00
Michael Kamensky
5c367ef940 Merge branch 'upcoming_rix' into 'master'
Polyraptor and Forerunner of the Heralds

See merge request core-developers/forge!53
2018-01-07 13:07:45 +00:00
Michael Kamensky
423d38c94e Update polyraptor.txt (em-dash) 2018-01-07 13:07:35 +00:00
Michael Kamensky
4ad20fd7d6 Update deeproot_elite.txt (select target description) 2018-01-07 13:06:48 +00:00
austinio7116
7cff83168f Added Polyraptor and Forerunner of the Heralds (RIX) 2018-01-07 07:21:54 +00:00
austinio7116
7ea109aaf8 Added Deeproot Elite and Jadelight Ranger (RIX) 2018-01-07 07:01:53 +00:00
Michael Kamensky
beb29502a7 Merge branch 'update-explore-sd' into 'master'
- Update ExploreEffect stack description (better implementation).

See merge request core-developers/forge!52
2018-01-07 05:47:29 +00:00
Agetian
1fed0a1264 - Update ExploreEffect stack description (better implementation). 2018-01-07 08:46:41 +03:00
Michael Kamensky
d2182ad49c Merge branch 'master' into 'master'
- Updated ExploreEffect to make the stack description account for cards that target other cards to explore.

See merge request core-developers/forge!44
2018-01-07 05:15:01 +00:00
Agetian
bb01e2a4d4 Merge branch 'Marek14/forge-master' 2018-01-07 08:10:01 +03:00
Agetian
b46c0bb05d - Several script corrections. 2018-01-07 08:08:42 +03:00
Agetian
192ef621f6 Merge branch 'master' of git.cardforge.org:Marek14/forge into Marek14/forge-master 2018-01-07 07:58:36 +03:00
Michael Kamensky
4a43abc905 Merge branch 'upcoming_rix' into 'master'
3 more green cards added

See merge request core-developers/forge!51
2018-01-07 04:52:13 +00:00
Michael Kamensky
07dfb2e9df Update cacophodon.txt (em-dash) 2018-01-07 04:47:12 +00:00
Agetian
2f8beff993 - Better implementation for ExploreEffect stack description. 2018-01-07 07:41:50 +03:00
Sol
72ec9a2b70 Merge branch 'update_ixalan_rankings' into 'master'
Update XLN rankings and add RIX rankings

See merge request core-developers/forge!46
2018-01-07 01:50:25 +00:00
austinio7116
1ce6979910 Added Cacophodon (RIX)
Added Crested Herdcaller
Added World Shaper
2018-01-06 23:43:54 +00:00
Marek Čtrnáct
c0794aff76 Add new file 2018-01-06 23:34:40 +00:00
Marek Čtrnáct
371ed047c6 Add new file 2018-01-06 23:29:47 +00:00
Marek Čtrnáct
b4cc04f32b Add new file 2018-01-06 23:19:35 +00:00
austinio7116
42596623a9 Added Cacophodon (RIX) 2018-01-06 23:15:40 +00:00
Marek Čtrnáct
345c809a23 Add new file 2018-01-06 23:12:36 +00:00
Marek Čtrnáct
fbe169f06d Add new file 2018-01-06 23:08:32 +00:00
Sol
4f5fc25195 Merge branch 'patch-2' into 'master'
Traveler's Amulet was missing.

See merge request core-developers/forge!48
2018-01-06 22:58:58 +00:00
Marek Čtrnáct
e1f3fb6ac0 Update snake_umbra.txt 2018-01-06 22:58:47 +00:00
Marek Čtrnáct
9915d3c9ac Update bident_of_thassa.txt 2018-01-06 22:57:26 +00:00
Sol
0bbed86241 Merge branch 'upcoming_rix' into 'master'
Preparing block data and draft rankings for RIX

See merge request core-developers/forge!47
2018-01-06 22:57:20 +00:00
Marek Čtrnáct
5076d03143 Add new file 2018-01-06 22:56:59 +00:00
Marek Čtrnáct
52b5ef7647 Update curious_obsession.txt 2018-01-06 22:53:03 +00:00
Marek Čtrnáct
e9f8877dec Add new file 2018-01-06 22:50:14 +00:00
Marek Čtrnáct
ed87267633 Add new file 2018-01-06 22:44:50 +00:00
Marek Čtrnáct
e4d469a408 Add new file 2018-01-06 22:42:08 +00:00
austinio7116
5c13e8d9aa Reverting rankings.txt update 2018-01-06 22:39:26 +00:00
austinio7116
7afdd4cbf5 Update formats.txt adding RIX to Standard and Modern 2018-01-06 22:38:19 +00:00
Marek Čtrnáct
c155317a6b Add new file 2018-01-06 22:36:59 +00:00
Marek Čtrnáct
a70513985a Add new file 2018-01-06 22:29:17 +00:00
Marek Čtrnáct
ffc2324dd5 Add new file 2018-01-06 22:24:06 +00:00
Rob Schnautz
9ef975d467 Traveler's Amulet was missing. 2018-01-06 21:51:38 +00:00
austinio7116
fa9c88c7be Preparing block data and draft rankings for RIX 2018-01-06 20:29:33 +00:00
Chris H
2d6b9b775e Update XLN rankings and add RIX rankings 2018-01-06 15:06:29 -05:00
Michael Kamensky
8a48371aec Merge branch 'patch-1' into 'master'
Update borderland_ranger.txt to E02 Oracle.

See merge request core-developers/forge!45
2018-01-06 19:13:57 +00:00
Rob Schnautz
c891a0fa26 Update borderland_ranger.txt to E02 Oracle. 2018-01-06 19:06:08 +00:00
Agetian
99728fd237 - Additional tweak for ExploreEffect stack description. 2018-01-06 21:56:37 +03:00
Agetian
b76c65441b Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-01-06 21:56:07 +03:00
Michael Kamensky
4ca8ec005d Merge branch 'patch-6' into 'master'
Update Evolving Wilds to IMA Oracle.

See merge request core-developers/forge!43
2018-01-06 18:54:17 +00:00
Michael Kamensky
db3c1b22ce Merge branch 'patch-5' into 'master'
Orazca Raptor (RIX)

See merge request core-developers/forge!42
2018-01-06 18:54:01 +00:00
Agetian
b0525bf06b - Additional tweak for ExploreEffect stack description. 2018-01-06 21:52:28 +03:00
Michael Kamensky
d884731691 Merge branch 'patch-3' into 'master'
Vampire Revenant (RIX)

See merge request core-developers/forge!40
2018-01-06 18:51:35 +00:00
Rob Schnautz
a4e4d089f7 Update Evolving Wilds to IMA Oracle. 2018-01-06 18:50:58 +00:00
Agetian
0b31ee8562 Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-01-06 21:50:55 +03:00
Michael Kamensky
aaf8969af2 Merge branch 'patch-2' into 'master'
Sadistic Skymarcher (RIX)

See merge request core-developers/forge!39
2018-01-06 18:48:34 +00:00
Michael Kamensky
f7c34aa572 Merge branch 'patch-4' into 'master'
Goblin Trailblazer (RIX)

See merge request core-developers/forge!41
2018-01-06 18:47:05 +00:00
Agetian
16e4c11961 - Updated ExploreEffect to make the stack description account for cards that actually target other cards to explore (e.g. Enter the Unknown). 2018-01-06 21:46:12 +03:00
Rob Schnautz
116003f189 Orazca Raptor (RIX) 2018-01-06 18:45:22 +00:00
Michael Kamensky
6c87de30dd Merge branch 'upcoming_rix' into 'master'
Added Enter the Unknown (RIX)

See merge request core-developers/forge!37
2018-01-06 18:44:03 +00:00
Michael Kamensky
60b2601d8c Merge branch 'patch-1' into 'master'
Impale (RIX)

See merge request core-developers/forge!38
2018-01-06 18:42:02 +00:00
Rob Schnautz
ca37bda739 Goblin Trailblazer (RIX) 2018-01-06 18:41:42 +00:00
Rob Schnautz
c4698212ce Vampire Revenant (RIX) 2018-01-06 18:17:02 +00:00
Rob Schnautz
0e0d4031c9 Sadistic Skymarcher (RIX) 2018-01-06 17:54:36 +00:00
Rob Schnautz
be1f885341 Impale (RIX) 2018-01-06 17:22:30 +00:00
austinio7116
a6c8eedfd4 Added Enter the Unknown (RIX) 2018-01-06 17:17:02 +00:00
Michael Kamensky
32f9600d51 Merge branch 'patch-1' into 'master'
Canal Monitor (RIX)

See merge request core-developers/forge!36
2018-01-06 17:02:46 +00:00
Rob Schnautz
03f99c88ae Canal Monitor (RIX) 2018-01-06 16:47:28 +00:00
Michael Kamensky
47882191bc Merge branch 'patch-4' into 'master'
Sworn Guardian (RIX)

See merge request core-developers/forge!35
2018-01-06 16:44:23 +00:00
Michael Kamensky
d7962ae659 Merge branch 'patch-3' into 'master'
Soul of the Rapids (RIX)

See merge request core-developers/forge!34
2018-01-06 16:35:40 +00:00
Michael Kamensky
cbd17b0290 Merge branch 'upcoming_rix' into 'master'
Several green RIX cards

See merge request core-developers/forge!33
2018-01-06 16:32:22 +00:00
Rob Schnautz
839325ab70 Sworn Guardian (RIX) 2018-01-06 16:26:08 +00:00
Rob Schnautz
13dc4304fc Soul of the Rapids (RIX) 2018-01-06 16:20:02 +00:00
maustin
c49a937fb8 Added Swift Warden, Thrashing Brontodon (RIX) 2018-01-06 16:18:51 +00:00
maustin
36d3905d0e Merge remote-tracking branch 'origin/upcoming_rix' into upcoming_rix 2018-01-06 16:09:33 +00:00
austinio7116
9ff748dfd5 Added Orazca Frillback, Strength of the Pack, Thunderherd Migration (RIX) 2018-01-06 15:59:54 +00:00
austinio7116
40878794cf Added Jade Bearer, Jadecraft Artisan, Jungleborn Pioneer (RIX) 2018-01-06 15:43:16 +00:00
austinio7116
a17a69c93a Added Overgrown Armasaur (RIX) 2018-01-06 15:23:14 +00:00
austinio7116
469ca98b8a Added Knight of the Stampede (RIX) 2018-01-06 15:10:28 +00:00
Michael Kamensky
330cc1cd3a Merge branch 'master' into 'master'
Merging Marek's RIX upcoming cards so far.

See merge request core-developers/forge!32
2018-01-06 15:07:17 +00:00
Agetian
5c61819b25 Merge branch 'Marek14/forge-master' 2018-01-06 17:55:44 +03:00
Agetian
2c31c26cb9 - Fixing some card scripts. 2018-01-06 17:52:54 +03:00
Hanmac
a4f490b607 ExploreEffect: fixed for trigger and game state 2018-01-06 15:01:51 +01:00
Marek Čtrnáct
36007330e9 Add new file 2018-01-06 09:07:12 +00:00
Marek Čtrnáct
fba890af81 Add new file 2018-01-06 09:00:42 +00:00
Marek Čtrnáct
619fee0821 Update curious_obsession.txt 2018-01-06 08:50:31 +00:00
Marek Čtrnáct
4f7d3f4e4e Add new file 2018-01-06 08:45:47 +00:00
Marek Čtrnáct
ac1f1d2de4 Add new file 2018-01-06 08:43:35 +00:00
Marek Čtrnáct
5856edd962 Add new file 2018-01-06 08:36:17 +00:00
Marek Čtrnáct
ac463d081e Delete Sanguine Glorifier 2018-01-06 08:32:33 +00:00
Michael Kamensky
dbd1a872c4 Merge branch 'integrate-qw-theros' into 'master'
- Added Theros quest world by Xyx.

See merge request core-developers/forge!22
2018-01-06 08:32:27 +00:00
Marek Čtrnáct
ff600d652d Add new file 2018-01-06 08:32:26 +00:00
Michael Kamensky
8a512a13a4 Merge branch 'update-draft-cubes' into 'master'
Update draft cubes

See merge request core-developers/forge!25
2018-01-06 08:32:16 +00:00
Marek Čtrnáct
a9f1a25da4 Add new file 2018-01-06 08:26:21 +00:00
Marek Čtrnáct
0fd05f2c36 Add new file 2018-01-06 08:15:27 +00:00
Michael Kamensky
aa0754a53f Merge branch 'upcoming_rix' into 'master'
Giltgrove Stalker and Hardy Veteran

See merge request core-developers/forge!30
2018-01-06 08:15:01 +00:00
Marek Čtrnáct
d31d0aa735 Add new file 2018-01-06 08:10:20 +00:00
Marek Čtrnáct
c92b26928c Delete temple 2018-01-06 08:07:24 +00:00
Marek Čtrnáct
70f5f1be30 Add new file 2018-01-06 08:07:13 +00:00
Marek Čtrnáct
4ae769506e Add new file 2018-01-06 08:05:19 +00:00
Marek Čtrnáct
73c6b67830 Add new file 2018-01-06 08:01:46 +00:00
Marek Čtrnáct
f05963c6ea Add new file 2018-01-06 07:59:42 +00:00
Marek Čtrnáct
d99b687989 Add new file 2018-01-06 07:40:48 +00:00
austinio7116
d57e4bd077 Added Giltgrove Stalker, Hardy Veteran (RIX) 2018-01-06 07:37:06 +00:00
Marek Čtrnáct
e5c2a18bd6 Add new file 2018-01-06 07:22:31 +00:00
Marek Čtrnáct
796a2b44c8 Add new file 2018-01-06 07:20:48 +00:00
Marek Čtrnáct
5e67cf8292 Add new file 2018-01-06 07:18:35 +00:00
Rob Schnautz
5e4880f1d1 Update Rivals of Ixalan.txt 2018-01-06 07:02:44 +00:00
Rob Schnautz
ea161d83fa Exultant Skymarcher (RIX) 2018-01-06 07:02:44 +00:00
Rob Schnautz
0f28ca779d Everdawn Champion (RIX) 2018-01-06 07:02:44 +00:00
Marek Čtrnáct
7711af1214 Add new file 2018-01-06 06:48:10 +00:00
Agetian
9817eb303b Merge branch 'master' of git.cardforge.org:core-developers/forge into update-draft-cubes 2018-01-06 08:57:40 +03:00
Michael Kamensky
21d782b4be Merge branch 'patch-3' into 'master'
Everdawn Champion (RIX)

See merge request core-developers/forge!27
2018-01-06 05:11:10 +00:00
Michael Kamensky
f14d816e6b Merge branch 'upcoming_rix' into 'master'
added torridus's contributions from the forum

See merge request core-developers/forge!26
2018-01-06 05:11:01 +00:00
Michael Kamensky
025ee4df18 Merge branch 'patch-4' into 'master'
Exultant Skymarcher (RIX)

See merge request core-developers/forge!28
2018-01-06 05:10:58 +00:00
Sol
1b2870a1b2 Merge branch 'patch-5' into 'master'
Update Rivals of Ixalan.txt

See merge request core-developers/forge!29
2018-01-06 01:52:45 +00:00
Rob Schnautz
03760521ac Update Rivals of Ixalan.txt 2018-01-06 00:18:22 +00:00
Rob Schnautz
e4d8983280 Exultant Skymarcher (RIX) 2018-01-05 23:48:30 +00:00
Rob Schnautz
64431e3661 Everdawn Champion (RIX) 2018-01-05 23:41:52 +00:00
Marek Čtrnáct
ace56ece7e Add new file 2018-01-05 23:37:52 +00:00
Marek Čtrnáct
135724fab5 Update nesting_wurm.txt 2018-01-05 23:32:11 +00:00
Marek Čtrnáct
5d72b7ce98 Update myr_servitor.txt 2018-01-05 23:31:43 +00:00
Marek Čtrnáct
6697a44259 Update muscle_burst.txt 2018-01-05 23:31:16 +00:00
Marek Čtrnáct
85165850c1 Delete legion_conquistador.txt (found out it's a reprint from XLN) 2018-01-05 23:30:04 +00:00
Marek Čtrnáct
3bd24d80c0 Update kindle.txt 2018-01-05 23:28:54 +00:00
Marek Čtrnáct
aab31719d4 Update howling_wolf.txt 2018-01-05 23:28:33 +00:00
Marek Čtrnáct
1ffc84663a Update flame_burst.txt 2018-01-05 23:27:53 +00:00
Marek Čtrnáct
9f703cf64e Update feast_of_flesh.txt 2018-01-05 23:27:19 +00:00
Marek Čtrnáct
44b1e2a4e5 Update aether_burst.txt 2018-01-05 23:26:30 +00:00
Marek Čtrnáct
3e7fa3e440 Update accumulated_knowledge.txt 2018-01-05 23:25:55 +00:00
Marek Čtrnáct
20154d8411 Update squadron_hawk.txt -- ability should use "Squadron Hawk" instead of "CARDNAME" 2018-01-05 23:25:17 +00:00
Marek Čtrnáct
26b2a2278e Add new file 2018-01-05 23:23:59 +00:00
maustin
886901b48e Merge remote-tracking branch 'origin/upcoming_rix' into upcoming_rix 2018-01-05 19:52:13 +00:00
austinio7116
a817967aa0 Added torridus's contributions from the forum 2018-01-05 19:51:56 +00:00
Marek Čtrnáct
52bbfdb9f4 Imperial Ceratops 2018-01-05 19:13:30 +00:00
Marek Čtrnáct
8c74096a7f Forerunner of the Legion 2018-01-05 19:13:11 +00:00
Marek Čtrnáct
153362393b Famished Paladin 2018-01-05 19:12:46 +00:00
Marek Čtrnáct
3185d0b38b Exultant Skymarcher 2018-01-05 19:12:30 +00:00
Marek Čtrnáct
0be8b711ac Everdawn Champion 2018-01-05 19:12:09 +00:00
Marek Čtrnáct
9e60002210 Cleansing Ray 2018-01-05 19:11:55 +00:00
Marek Čtrnáct
fe169f267d Blazing Hope 2018-01-05 19:11:28 +00:00
Marek Čtrnáct
26c09c3993 Bishop of Binding 2018-01-05 19:11:12 +00:00
Marek Čtrnáct
49f516685f Baffling Eng 2018-01-05 19:10:49 +00:00
Agetian
89ca710932 - Updating CHANGES.txt. 2018-01-05 13:22:54 +03:00
Agetian
f1d01341cf - Update draft cubes ported from XMage. 2018-01-05 13:21:59 +03:00
Michael Kamensky
c30beda09d Merge branch 'upcoming_rix' into 'master'
3 new RIX cards

See merge request core-developers/forge!24
2018-01-05 05:09:08 +00:00
Michael Kamensky
4b4d9da7b1 Update elenda_the_dusk_rose.txt (removed an extra period in the description; changed the token name to Vampire). 2018-01-05 05:07:29 +00:00
maustin
32a94fbb37 Merge remote-tracking branch 'origin/upcoming_rix' into upcoming_rix 2018-01-04 20:27:40 +00:00
austinio7116
a589857582 Added Elenda, the Dusk Rose 2018-01-04 20:27:29 +00:00
maustin
f9c20c4a91 Merge remote-tracking branch 'origin/upcoming_rix' into upcoming_rix 2018-01-04 20:10:06 +00:00
austinio7116
886d07a4c3 Added Atzocan Seer (RIX) 2018-01-04 20:05:54 +00:00
maustin
b1ca421e52 Added Aquatic Incursion (RIX) 2018-01-04 19:53:24 +00:00
Michael Kamensky
1cb583a3ba Merge branch 'upcoming_rix' into 'master'
Added Swaggering Corsair (RIX)

See merge request core-developers/forge!23
2018-01-04 12:56:54 +00:00
Michael Kamensky
4683318351 Update swaggering_corsair.txt (removed First Strike in Oracle text, removed an empty whitespace in the Name tag). 2018-01-04 12:56:16 +00:00
austinio7116
e17a4756e7 Added Swaggering Corsair (RIX) 2018-01-04 10:07:08 +00:00
Agetian
7622f7c550 - Updating CHANGES.txt. 2018-01-04 09:31:30 +03:00
Hanmac
e25332ed27 fixed isBlessing in Variables 2018-01-04 07:30:50 +01:00
Hanmac
1f270a5231 Merge branch 'master' of git.cardforge.org:core-developers/forge 2018-01-04 07:18:06 +01:00
Hanmac
cc32286389 add Player Blessing 2018-01-04 07:17:31 +01:00
Agetian
d78b2f2fc0 - Added Theros quest world by Xyx. 2018-01-04 09:15:14 +03:00
austinio7116
a406bc94a8 Added Kumena 2018-01-03 23:20:34 +00:00
maustin
765a743d5b Merge branch 'master' of https://git.cardforge.org/core-developers/forge 2018-01-03 06:54:15 +00:00
Michael Kamensky
40a0d3a3e4 Merge branch 'patch-3' into 'master'
Zetalpa, Primal Dawn (RIX)

See merge request core-developers/forge!18
2018-01-03 06:52:31 +00:00
austinio7116
b612791fc8 Added Frilled Deathspitter 2018-01-03 06:52:06 +00:00
Michael Kamensky
c4cc51cf8e Merge branch 'patch-5' into 'master'
Angrath's Ambusher (RIX)

See merge request core-developers/forge!20
2018-01-03 06:52:01 +00:00
Michael Kamensky
3494d388bb Merge branch 'patch-6' into 'master'
Daring Buccaneer (RIX)

See merge request core-developers/forge!21
2018-01-03 06:51:40 +00:00
Michael Kamensky
88b887c579 Merge branch 'patch-4' into 'master'
Update Rivals of Ixalan.txt

See merge request core-developers/forge!19
2018-01-03 06:33:48 +00:00
Rob Schnautz
061f3ce78f Update Rivals of Ixalan.txt 2018-01-03 01:14:15 +00:00
Rob Schnautz
944d2475dd Daring Buccaneer (RIX) 2018-01-02 23:56:54 +00:00
Rob Schnautz
1d1e57a265 Angrath's Ambusher (RIX) 2018-01-02 23:37:57 +00:00
Rob Schnautz
522b874f54 Update Rivals of Ixalan.txt 2018-01-02 23:32:09 +00:00
Rob Schnautz
dea2cfad1c Zetalpa, Primal Dawn (RIX) 2018-01-02 22:53:35 +00:00
Michael Kamensky
1c8369d6fd Merge branch 'forge_icon' into 'master'
added 64 and 128 forge icon size to make forge icon smooth in Windows in default DPI

See merge request core-developers/forge!17
2018-01-02 12:02:13 +00:00
Nikolay Hidalgo Diaz
98d8d65687 added 64 and 128 forge icon size to make forge icon smooth in Windows in default DPI 2018-01-02 11:53:52 +03:00
Michael Kamensky
c5c9f5a447 Merge branch 'patch-3' into 'master'
Captain's Hook from RIX

See merge request core-developers/forge!9
2018-01-02 08:13:05 +00:00
Michael Kamensky
c42a3ac6e0 Merge branch 'patch-9' into 'master'
Vampire Champion (RIX)

See merge request core-developers/forge!15
2018-01-02 08:12:40 +00:00
Rob Schnautz
be60c4f865 Fix title. 2018-01-02 08:10:06 +00:00
Rob Schnautz
fd9bb6f36a Fix title. Not sure why it was truncated. 2018-01-02 08:08:51 +00:00
Michael Kamensky
27118a0f7a Merge branch 'patch-4' into 'master'
Brass's Bounty (RIX)

See merge request core-developers/forge!10
2018-01-02 07:00:40 +00:00
Michael Kamensky
665d4af5a2 Merge branch 'patch-5' into 'master'
Ghalta, Primal Hunger (RIX)

See merge request core-developers/forge!11
2018-01-02 07:00:35 +00:00
Michael Kamensky
1fd2aa17d5 Merge branch 'patch-7' into 'master'
Angrath, Minotaur Pirate (RIX)

See merge request core-developers/forge!13
2018-01-02 07:00:29 +00:00
Michael Kamensky
bd8db95098 Merge branch 'patch-8' into 'master'
Swab Goblin (RIX)

See merge request core-developers/forge!14
2018-01-02 07:00:22 +00:00
Michael Kamensky
fcb3f64d9b Merge branch 'patch-10' into 'master'
add Rivals of Ixalan editions file

See merge request core-developers/forge!16
2018-01-02 06:34:59 +00:00
Michael Kamensky
ee36ab94b6 Merge branch 'patch-6' into 'master'
Add upcoming to cardsfolder

See merge request core-developers/forge!12
2018-01-02 06:34:51 +00:00
Rob Schnautz
ac86437b35 add Rivals of Ixalan editions file 2018-01-02 04:17:28 +00:00
Rob Schnautz
30d8d9f3fe Vampire Champion (RIX) 2018-01-02 03:37:12 +00:00
Rob Schnautz
f2ace5cd3d Swab Goblin (RIX) 2018-01-02 03:25:11 +00:00
Rob Schnautz
cc1a71f246 Angrath, Minotaur Pirate (RIX) 2018-01-02 03:09:45 +00:00
Rob Schnautz
b3d8eaee7d Add new directory 2018-01-02 03:04:22 +00:00
Rob Schnautz
c70861d7d3 Ghalta, Primal Hunger (RIX) 2018-01-02 01:35:29 +00:00
Rob Schnautz
4cfa915aec Add new directory 2018-01-02 01:32:46 +00:00
Rob Schnautz
2bf31add95 Revert "Add new file"
This reverts commit 1efe09eeca
2018-01-02 01:31:22 +00:00
Rob Schnautz
61526dea82 Brass's Bounty (RIX) 2018-01-02 01:28:44 +00:00
Rob Schnautz
5c719c27b0 Add new directory 2018-01-02 01:28:17 +00:00
Rob Schnautz
342207375e Revert "Brass's Bounty (RIX)"
This reverts commit 2375176d72
2018-01-02 01:22:41 +00:00
Rob Schnautz
ce5b26b0d0 Captain's Hook (RIX) 2018-01-02 01:18:09 +00:00
Rob Schnautz
6056bfbc49 Revert "Captain's Hook from RIX"
This reverts commit 3bfc7da93a
2018-01-02 01:12:09 +00:00
Rob Schnautz
4e925b0385 Add new directory. Hopefully this is landing in the right place this time. 2018-01-02 01:04:15 +00:00
Rob Schnautz
edff4117f5 Revert "Add new directory"
This reverts commit 64f2d62605
2018-01-02 01:00:05 +00:00
Rob Schnautz
64f2d62605 Add new directory 2018-01-02 00:57:55 +00:00
Rob Schnautz
1efe09eeca Add new file 2018-01-02 00:42:32 +00:00
Rob Schnautz
2375176d72 Brass's Bounty (RIX) 2018-01-02 00:34:31 +00:00
Rob Schnautz
3bfc7da93a Captain's Hook from RIX 2018-01-02 00:21:25 +00:00
Michael Kamensky
34b4e90d75 Merge branch 'patch-2' into 'master'
Add Un-set basic lands and Steamflogger Boss

See merge request core-developers/forge!8
2018-01-01 16:56:44 +00:00
Rob Schnautz
48ab353521 Change "Expansion" to "Other" 2018-01-01 05:12:04 +00:00
Rob Schnautz
73f872bf6e Change "Expansion" to "Other" 2018-01-01 05:09:51 +00:00
Rob Schnautz
f04c8be999 Change "Expansion" to "Other" 2018-01-01 05:09:33 +00:00
Rob Schnautz
d6eb49db68 Add Steamflogger Boss and basic lands from Unstable 2017-12-31 23:47:44 +00:00
Rob Schnautz
c03ada1e1c Add basic lands from Unhinged 2017-12-31 23:45:22 +00:00
Rob Schnautz
9ce3d6182b Add basic lands from Unglued 2017-12-31 23:38:54 +00:00
Mitchell Matthews
ff3f60cc68 Merge branch 'patch-1' into 'master'
Detail the new Collector Number sort column in CHANGES.TXT

See merge request core-developers/forge!7
2017-12-30 08:26:46 +00:00
Rob Schnautz
89aa4bfab3 Detail the new Collector Number sort column in CHANGES.TXT 2017-12-30 06:34:09 +00:00
Hans Mackowiak
746e60b517 Merge branch 'master' into 'master'
Master

See merge request core-developers/forge!4
2017-12-30 06:09:21 +00:00
Michael Kamensky
8634cc561f Merge branch 'draft_import_deck' into 'master'
deck import in drafted deck editor

See merge request core-developers/forge!6
2017-12-30 05:58:25 +00:00
Michael Kamensky
d384f0896a Merge branch 'flabel_bicubic' into 'master'
Bicubic interpolation in FLabel

See merge request core-developers/forge!5
2017-12-30 05:51:48 +00:00
Nikolay Hidalgo Diaz
9f5cc344ad copy all sections from imported deck in constructed deck edtior 2017-12-30 08:11:20 +03:00
Nikolay Hidalgo Diaz
45bebdff0c deck import in drafted deck editor 2017-12-30 07:46:10 +03:00
Nikolay Hidalgo Diaz
59ef9e132a Bicubic interpolation in FLabel to keep player state icons smooth when resizing player panel 2017-12-30 06:54:53 +03:00
Rob Schnautz
af8e9c2466 Update SColumnUtil.java 2017-12-29 18:47:01 +00:00
schnautzr
e11163f483 Add ColumnDef COLLECTOR_ORDER to SColumnUtil 2017-12-29 12:44:14 -06:00
Sol
d3ff20484d Merge branch 'line-endings' into 'master'
Normalize line endings

See merge request core-developers/forge!2
2017-12-29 13:22:52 +00:00
Mitchell Matthews
76cbbb2bfe Merge branch 'test-git' into 'master'
- Updating CHANGES.txt and testing Git commit in the process.

See merge request core-developers/forge!3
2017-12-29 06:48:19 +00:00
Agetian
c51ad4aaa6 - Updating CHANGES.txt and testing Git commit in the process. 2017-12-29 09:34:11 +03:00
KrazyTheFox
6d5e56f6bf Normalize line endings 2017-12-28 23:40:29 -05:00
Agetian
251569e81c - Added two tutorial puzzles by Ikeda. 2017-12-27 06:52:02 +00:00
Hanmac
be2759c354 ColumnDef: updates for SortingName and Sorting CollectionOrder 2017-12-26 15:54:31 +00:00
Hanmac
69ee8f3630 update pom.xml with my info 2017-12-24 10:30:12 +00:00
Hanmac
610991a222 ManaCost: add Shard#isHybrid 2017-12-23 21:45:51 +00:00
Agetian
f08a0eaffd - Added a new Puzzle Mode game state flag, "NoETBTrigs", which allows you to ignore the ETB triggers and replacement effects for a card when necessary.
- Fixed a bug that made it tricky to add several precast flags to a puzzle due to absence of whitespace trimming.
- Added puzzles PC_012616 and PC_020216 by Xitax.
- Updated the puzzle PC_122915 to set itself up automatically without being obnoxious.
2017-12-21 06:11:21 +00:00
Agetian
a0baa659ec - Removed accidentally committed PC_012616 (will recommit later once an issue with it is addressed). 2017-12-20 04:27:24 +00:00
Agetian
536a19b373 - Added puzzles PC_022416, PC_021616, PC_021816 by Xitax. 2017-12-20 04:26:14 +00:00
Sol
27a2d7f642 Experimental fix for Attacking/Passing race condition 2017-12-19 03:03:35 +00:00
Agetian
fc29cec8c8 - Puzzle PS_HOU3: added some more Mountains to the human library to make it solvable using the Reddit solution. 2017-12-11 14:59:08 +00:00
Indigo Dragon
5fe19d75a6 Changed Blood Speaker from an awkward TrigSacrifice to a TrigSearch that uses Cost$ Sac.
Territorial Gorger; You get energy, not gain energy.
2017-12-11 10:24:38 +00:00
Sol
3252489971 Contains keyword should be checking for Contains, not startswith 2017-12-11 04:31:25 +00:00
Sol
f90af4784e Fix Signets being exploitable by not actually paying for activation 2017-12-10 20:30:48 +00:00
Hanmac
a2f11fb829 RE: do CARDNAME after text changing effects 2017-12-09 15:47:13 +00:00
Indigo Dragon
b6e6d308a9 Fixed some — issues (Non UTF-8). 2017-12-09 14:43:17 +00:00
Sol
dd04888106 RarityFilter from Luke 2017-12-09 02:38:50 +00:00
Agetian
0c397a414e - A better place for replacement effect CARDNAME conversion. 2017-12-08 10:35:54 +00:00
Agetian
2a62001048 - Fixed a NPE on mobile Forge when looking up certain cards with replacement effects (e.g. Kess, Dissident Mage). 2017-12-08 10:31:27 +00:00
Indigo Dragon
3132e5dd5b Removed reminder text from Mark of the Vampire.
Fixed Dread Summons cleanup.
2017-12-08 06:22:17 +00:00
Indigo Dragon
8843a12333 Added the Modern Event Deck, March of the Multitudes. 2017-12-07 12:52:00 +00:00
Indigo Dragon
b2e97ac73b Changes to rankings.txt
1. Removed Basic Lands
2. Changed AEther to Aether (and one Aerathi)
3. Fixed 5DN by proper capitalisation.
4. Added Ugin's Fate rankings. Rank is based upon original KTK/FRF rank.
5. Fixed Horizon Canopy (EXP), Death Pits of Rath, Seance, Noggle Hedge Mage, Scragnoth, Transguild Courier, Flame Kin Zealot, Evil Eye of Orms By Gore, Brush with Death, Will o' the Wisp, The Tabernacle at Pendrell Vale, Torsten Von Ursus, Abu Ja'far, Brutal Nightstalker.

Bug: Ironclaw Orcs is missing in 2ED, LEB, and LEA ranks. Another run through of those sets should be sufficient.
Bug Progress: Borrowing 100,000 Arrows and Guan Yu's 1,000-Li March. I discovered through these fixes that rankings.txt is case sensitive. That means the only two cards that begin with a number (" 1") must scare it somehow, meaning that these two cards cannot be assinged a ranking.
2017-12-07 12:48:19 +00:00
Indigo Dragon
11c440209a Updated Draft Rankings, including Planechase, Archenemy, Planechase 2, Planechase Anthology (A copy of Planechase 2), Archenemy: Nicol Bolas, Explorers of Ixalan.
Also fixed a few AE issues.
2017-12-07 06:40:36 +00:00
Indigo Dragon
400adeed1c Added Commander Draft Rankings. The ranking is based upon EDHREC Rank from Scryfall.
These are COM, C13, C14, C15, C16, CMA, C17.

As such, some low power cards undeservingly get high rankings eg Evolving Wilds, Diabolic Tutor, Herald's Horn.

To Do: Add Rankings to similar large supplementary sets eg Planechase, Archenemy

Bug: Borrowing 100,000 Arrows is not recognised in rankings.txt. As such, it always has a rank of 500.0.
2017-12-06 15:46:58 +00:00
Indigo Dragon
abcdc7253e 1. DeckHints Synergy between Trials and Cartouches.
2. Some Play Before Combats.
3. General Deck Hints.
2017-12-05 09:13:05 +00:00
Agetian
b6b8b9440f - Removed a useless line from the previous commit. 2017-12-05 08:57:13 +00:00
Agetian
c9a64b8e96 - Attempting to fix a bug with the replacement handler not converting CARDNAME. 2017-12-05 04:59:58 +00:00
Indigo Dragon
327795855a Reapplying 36129, except this time it works.
Turns out I accidentally changed the Name of liberating_combustion.txt, wrecking everything.
2017-12-04 07:58:52 +00:00
Agetian
b3c5494e74 - Reverted r36129 as requested. 2017-12-04 07:29:52 +00:00
Indigo Dragon
9fc4a247aa EDIT: WHOOPS THIS BORKED EVERYTHING PLS REVERT
Added plenty of DeckHints:Name$, some DeckHints:Color, many DeckNeeds:Name$
Most notably the Planeswalker Deck Into pack exclusive cards eg. [[Chandra, Pyrogenius]] and [[Liberating Combustion]]. New Policy: If a card would refer to another card, each get DeckHints:Name$ of the other.
2017-12-04 07:12:25 +00:00
Agetian
013cd0a9a8 - Added puzzle PC_122915 by Xitax (has some start-of-the-game quirks, documented in the description for now, may be addressed later). 2017-12-04 05:30:59 +00:00
Hanmac
05a9da4eb8 CardFactoryUtil: removed extra line for Suspend 2017-12-03 17:00:27 +00:00
Agetian
81d853ac04 - Preparing Forge for Mobile publish 1.6.5.001 [incremental]. 2017-12-03 15:36:57 +00:00
Blacksmith
af8dfa685a Clear out release files in preparation for next release 2017-12-03 15:27:30 +00:00
Blacksmith
946a360652 [maven-release-plugin] prepare for next development iteration 2017-12-03 15:21:13 +00:00
Blacksmith
071fe9a910 [maven-release-plugin] prepare release forge-1.6.5 2017-12-03 15:21:05 +00:00
Blacksmith
ccb4e87002 Update README.txt for release 2017-12-03 15:19:10 +00:00
austinio7116
cd9adb166a Updated frontier cube from cubetutor to include newer sets 2017-12-01 22:52:09 +00:00
Agetian
4f95f2c842 - Attempting to update the Java warning dialog to play ball with Java 9. 2017-11-30 05:35:31 +00:00
Agetian
7e6771d550 - [Part 2] Adding support for DamageDone replacement effects and triggers to work with emblems (for cards with ChooseSource). 2017-11-29 07:35:58 +00:00
Agetian
0b025fd0ae - [Part 1] Adding support for DamageDone replacement effects and triggers to work with emblems (for some cards, most other cards would need an extension to ChooseSource and possibly other changes). 2017-11-29 06:48:42 +00:00
Indigo Dragon
9445204ffc Fixed Magus of the Mind by adding the proper sacrifice cost (Seriously? Been abused for how long?) 2017-11-28 10:09:03 +00:00
Hanmac
0b69923ad7 StaticAbility: fixed References there being copied to the Static Ability 2017-11-23 14:05:26 +00:00
Hanmac
00eb90bcc6 CardFactory: remove copyCopiableAbilities because it isn't needed anymore 2017-11-22 14:15:30 +00:00
Indigo Dragon
8478967c04 Equipment Reminder Text changes. 2017-11-22 08:42:11 +00:00
Agetian
08f4b5bbe6 - Added Forge Puzzle Tutorial #01 by Ikeda. 2017-11-21 19:07:52 +00:00
Indigo Dragon
828a5e7f46 More Minor ' fixes. 2017-11-20 14:00:57 +00:00
Indigo Dragon
2e6151fe25 Added a Description to Arlinn Kord Emblem 2017-11-20 07:05:50 +00:00
Hanmac
c5fad910ba remove use of CardFactory.copyCopiableAbilities, it is already done by copyCopiableCharacteristics 2017-11-19 09:02:38 +00:00
Indigo Dragon
8d7c672b94 Minor Text Changes 2017-11-19 05:22:30 +00:00
Hanmac
67de9ba209 Card: do Suspend and Hideaway as better keywords 2017-11-17 07:15:56 +00:00
Hanmac
d3486341f3 Trigger: split replaceTriggerText into two different functions 2017-11-14 06:29:19 +00:00
Hanmac
ac12412ec3 AbilityFactory: use CardState instead of Card for the Svar params and the Names 2017-11-13 05:20:04 +00:00
austinio7116
73e0a4d35a Update to card-based deck generation model to include up to XLN PT 2017-11-12 19:53:43 +00:00
Sol
1e09e9e3f8 Fix hideaway not etb tapped 2017-11-10 16:05:06 +00:00
Agetian
d97265f2f2 - Fixed the intervening if clause on Garruk, the Veil Cursed -1. 2017-11-09 05:37:05 +00:00
Hanmac
cd55c4077e Keyword: make Suspend extra class to make the special case if it doesn't have Cost or amount 2017-11-09 05:23:28 +00:00
Indigo Dragon
0a9d5b73d8 Removed unneeded reminder text. 2017-11-07 04:47:05 +00:00
Indigo Dragon
e5e1de83a1 Added E02, Explorers of Ixalan. 2017-11-07 04:20:12 +00:00
Indigo Dragon
359ab4233b Added V17, Transform 2017-11-06 15:45:05 +00:00
Indigo Dragon
715f991d0d Added Experience Counters to Desktop Forge
Experience counters are at the lowest priority from Poison>Energy>Experience. It uses the Commander 2015 symbol, in which Experience Counters appeared.
There was a lot of transplanting involved copying the Energy code to fit the Experience model. This means there might be some unforseen problems though so check it out. I did several run throughs with Aetherwind Basker, Attune with Aether, Caress of Phyrexia, Leeches, and the Experience counter commanders to find anything remaining. There's a difference between "There are no bugs" and "I found no bugs".

Speaking of Leeches, there was an odd bug in the ProcessRunLogThing, saying "SVar 'X' not found in ability, fallback to Card (Leeches). Ability is ()". Something to do with Svar:X:TargetedPlayer$PoisonCounters maybe?
2017-11-06 15:15:21 +00:00
Indigo Dragon
e00b18bf40 Commander 2017 Oracle Update 2017-11-06 12:07:58 +00:00
Indigo Dragon
77869fd273 Disable some AI-Unusable artifacts. Check for AI changes.
Also disabled some parasitic XLN cards, cards that are completely useless without their tribe.
2017-11-06 11:55:45 +00:00
Indigo Dragon
1f4de4af80 Duel Decks Merfolk vs Goblins oracle updates, rarity changes, proper numbers 2017-11-06 10:46:47 +00:00
Agetian
6d34e04138 - Fixed the type line for Bloodmad Vampire. 2017-11-06 04:40:43 +00:00
Hanmac
1761ccffd0 Nahiri the Lithomancer: updated DeckHints and Stoneblade keywords 2017-11-04 11:26:17 +00:00
Hanmac
4de53b29f0 Bestow: if SpellAbilityRestriction do not copy if card is already a copy and bestowed
make SpellAbility clone check for the hostcard so when ActivationPlayer is set, it already knows about the new host
2017-11-04 10:28:09 +00:00
Hanmac
08c02b7473 TokenInfo: fixed that Token get extra Keyword abilities twice 2017-11-04 09:35:07 +00:00
Indigo Dragon
a648e888c5 Capitalisation 2017-11-03 07:10:50 +00:00
Agetian
af94789b7f - The cast in AbilityUtils.java:1038 is unsafe despite the comment saying otherwise. The game could crash under certain circumstances with a class cast exception (e.g. the AI attacking with Wings of the Guard into a planeswalker like Kaya, Ghost Assassin). 2017-11-03 06:40:52 +00:00
Hanmac
c4520a0ac2 CardPredicates: fixed containsKeyword 2017-11-02 05:38:16 +00:00
Hanmac
75bec0a132 AbilityManaPart: update SourceCard if it got updated inside of SpellAbility 2017-10-31 13:27:51 +00:00
Hanmac
b680878558 CardFactoryUtil: fixed multiple problems with Dredge 2017-10-30 19:25:50 +00:00
Hanmac
3f95ca2869 CardFactory: fixed etbCounter init twice for Planeswalker 2017-10-30 18:37:41 +00:00
Hanmac
003d7ac606 CardState & Keyword when copying the keywords and cardtraits, update the hostcard for them
for Keyword, update them when the Keyword get's copied
2017-10-30 10:17:18 +00:00
Hanmac
b61267d3bd CardFactoryUtil: hide ETB Tapped Replacement Effects, already got the keyword text 2017-10-28 07:42:48 +00:00
Hanmac
a6728853db CardFactoryUtil: fixed ETB tapped 2017-10-28 07:01:49 +00:00
Hanmac
d95c46e1b8 Keyword VII: Make KeywordInterface copyable for reasons
fixed CardFactoryUtil and etbCounter
2017-10-27 18:22:05 +00:00
Hanmac
d3a18c55d3 Try to fix Keyword Creation on CardState#copy 2017-10-27 06:16:08 +00:00
Hanmac
8bffadeb14 Keyword VI : the last of the changes 2017-10-27 02:45:12 +00:00
Hanmac
4abb037081 Keyword V: Rise of the intrinsic 2017-10-26 18:28:24 +00:00
Indigo Dragon
07d6cebba4 Fixed some mana costs. 2017-10-26 12:14:44 +00:00
Hanmac
abd929070e Keyword IV : a new Hope to finish 2017-10-25 20:31:42 +00:00
Hanmac
ea937a410b CloneEffect: fixed for Keyword change 2017-10-25 19:33:37 +00:00
Hanmac
64159bab6f Keyword Change III: now CardTraits aren't added to Card/CardState anymore but they are added to Keywords only
CardState uses update functions to fill the list from unhiddenKeywords
2017-10-25 19:09:36 +00:00
Agetian
164e6656e8 - Pump AILogic ContinuousBonus: don't target opponent's creatures. 2017-10-25 04:28:37 +00:00
Hanmac
0bac699cbf KeywordUpdate: fixed more stuff 2017-10-23 20:13:42 +00:00
Hanmac
2030ffcea3 KeywordApocalypse: return KeywordInstance whenever possible 2017-10-23 19:54:12 +00:00
Agetian
6433eff8ec - FIXME: Introducing a temporary measure to check for TargetedPlayerCtrl/TargetedPlayerOwn via the CastSA chain when the standard check fails. This can happen, for example, when an opponent's card is activated in hand (e.g. Chandra's Fury via Sen Triplets). Please assist, if possible, in investigating the source of this issue and fixing it (this may manifest itself in other places too, and most likely does). Feel free to revert this commit if you know a good solution. 2017-10-23 06:55:20 +00:00
Hanmac
6c51f7c6bc CardFactoryUtil: removed parseKeywords, and moved the last parts to methods
remove the need of Keyword.getInstance in each method
2017-10-22 18:04:36 +00:00
Hanmac
0c82e0614c Keyword Change: bind CardTraits onto Keyword(Instance/Interface) instead of KeywordsChange
call CardFactoryUtil functions only over Keyword(Instance/Interface)
2017-10-22 07:44:05 +00:00
Hanmac
acd30aaf08 Keyword: add KeywordInterface to be used instead of KeywordInstance<?> 2017-10-22 06:31:30 +00:00
Hanmac
ce2f75d43d KeywordCollection: refactor to make it work without string Map
KeywordInstance now has Original Keyword inside if needed elsewhere
Cycling better split into normal KeywordWithCost and TypeCycling into KeywordWithCostAndType
2017-10-21 19:20:45 +00:00
Hanmac
3f3875cc0c CardState: use KeywordCollection internal 2017-10-21 15:47:43 +00:00
Hanmac
e939218a65 KeywordCollection: use MultiMap to build it 2017-10-21 15:46:35 +00:00
Hanmac
d929a8b140 Koth & Elspeth: fixed EffectKeyword as Description 2017-10-21 15:38:14 +00:00
Hanmac
3e1aef4a58 CardFactoryUtil: shorted setupKeywordedAbilities and use the other functions 2017-10-20 06:16:14 +00:00
Hanmac
93dad0bf44 CostAdjustment: don't need Delve on SpellAbility 2017-10-20 06:09:58 +00:00
Agetian
d5259e8bfb - Added "CARDNAME can't phase out" to the list of non-stacking keywords (fixes AI using Ertai's Familiar). 2017-10-20 04:51:17 +00:00
Hanmac
440d7fe2b8 CardFactoryUtil: reworked ETB Replacement Keywords 2017-10-18 07:16:07 +00:00
Hanmac
0e666f07e9 CardFactoryUtil: moved Dredge to ReplacementEffect 2017-10-18 06:24:50 +00:00
Hanmac
1b542e936b CardTraitBase: moved sVars from SpellAbility 2017-10-18 06:16:23 +00:00
Hanmac
13487bbeed CardFactoryUtil: moved Amplify to ReplacementEffect 2017-10-18 05:43:34 +00:00
Hanmac
7a71716c7f cards: removed extra param from Champion 2017-10-17 05:38:27 +00:00
Hanmac
e72baa9dd4 CardFactoryUtil: moved Champion to addTrigger 2017-10-17 05:36:57 +00:00
Agetian
4c9f188b0c - A tweak to the previous method 2017-10-17 03:54:32 +00:00
Agetian
e78f90bc62 - Attempting to fix IndexOutOfBoundsError in CostRemoveAnyCounter. Couldn't trace it to the root of the problem yet though. 2017-10-17 03:53:44 +00:00
Hanmac
19d5e8457f Aura Barbs: use RelativeTarget 2017-10-16 17:58:10 +00:00
Hanmac
0fb0837561 DamageDealEffect: add RelativeTarget for to be relative to Damage Source 2017-10-16 17:54:57 +00:00
Hanmac
6cff21f47b AbilityUtils: add CardController for getDefinedPlayers 2017-10-16 17:52:05 +00:00
Hanmac
477408676d UntapAI: fixed non-final problems 2017-10-16 17:24:41 +00:00
Indigo Dragon
97b675bc9f THIRD RUN WITH DDT 2017-10-16 14:18:59 +00:00
Indigo Dragon
65dab56ad0 Second run with DDT 2017-10-16 14:18:10 +00:00
Indigo Dragon
faba97a6f5 First Run at DDT, based on leaked lists. 2017-10-16 14:11:21 +00:00
Agetian
c10a2e1133 - Minor improvement in Volrath's Shapeshifter AI logic. 2017-10-16 08:33:37 +00:00
Agetian
83d13cc153 - Fixed Wormfang Drake (does not use the Champion keyword). 2017-10-16 06:43:51 +00:00
Agetian
bdbdd990a7 - UntapAi: use the Tap to Untap Land logic for permanents only for now, to be improved later for sorceries. 2017-10-16 06:37:32 +00:00
Agetian
70e4d80965 - A more advanced untap logic for cards like Voyaging Satyr that allows the AI to pool mana and untap lands for more in order to cast a bigger spell. 2017-10-16 06:21:29 +00:00
Agetian
6ec8b15a34 - Added some AI logic flags to Deathrite Shaman. 2017-10-15 15:55:26 +00:00
Agetian
ee21afee61 - Preparing Forge for Android publish 1.6.4.003 [incremental]. 2017-10-15 15:43:30 +00:00
Agetian
08a08855aa - One more tweak to the previous commit. 2017-10-15 14:46:19 +00:00
Agetian
95ee7ba2f8 - Further logic update for Voyaging Satyr and similar cards. 2017-10-15 14:45:19 +00:00
Agetian
cde55f37f3 - Somewhat less risky logic for Voyaging Satyr and friends. 2017-10-15 14:40:40 +00:00
Agetian
5b147d4ab2 - Marking more cards with {T}: Untap target land as AI-playable (similar to Voyaging Satyr). 2017-10-15 14:25:46 +00:00
Agetian
058ef0c4c5 - Marking Arbor Elf as AI-playable (similar to Voyaging Satyr which is marked as such). 2017-10-15 14:18:08 +00:00
Agetian
bb48bd22a3 - Slight further improvement to PlayAi for Hideaway (might also consider improving for untargeted sorceries or sorceries with available legal targets, but that's iffy). 2017-10-15 14:05:43 +00:00
Agetian
0aecd7068f - Documenting changes in CHANGES.txt. 2017-10-15 13:39:57 +00:00
Agetian
0d4a837be6 - Patched up PlayAi to enable the AI to play Hideaway lands. Marking the relevant cards as playable.
- Some improvement to Volrath's Shapeshifter AI.
2017-10-15 13:38:17 +00:00
Agetian
ac70e6504a - Fixed the Ability$Counters deck hint in Proliferate. 2017-10-15 09:56:36 +00:00
Hanmac
a64f19a686 cards: update Reinforce cards 2017-10-15 08:27:27 +00:00
Agetian
9a12f8ecab - Fixed targeting for One with the Wind. 2017-10-15 08:18:04 +00:00
Agetian
37d6e5aa3d - Preparing Forge for Android publish 1.6.4.002 [incremental]. 2017-10-15 08:12:45 +00:00
Agetian
7cbf5ff74e - Added an implementation comment. 2017-10-15 08:11:05 +00:00
Hanmac
b6ec9728d8 CardFactoryUtil: add Reinforce as Keyword 2017-10-15 08:10:44 +00:00
Agetian
b5a167df05 - Unify most AITgts filtering calls in the AI code (except a couple which work differently). 2017-10-15 08:09:23 +00:00
Agetian
f01409ab2c - Documenting changes in CHANGES.txt. 2017-10-14 15:36:38 +00:00
Agetian
a96778a94d - Integrating Lorwyn quest world by Erazmus. 2017-10-14 15:34:11 +00:00
Agetian
e9e898da79 - Fix empty lines in scripts: part 3 2017-10-14 14:30:28 +00:00
Agetian
a8d73f6172 - Fix empty lines in scripts: part 2 2017-10-14 14:29:23 +00:00
Agetian
84a1d9997b - Fix empty lines in scripts: part 1 2017-10-14 14:17:43 +00:00
Hanmac
5aa489d769 Quicksilver Gargantuan: replaced ChooseCard with internal Choices for Clone 2017-10-14 11:31:43 +00:00
Agetian
fd520f2ea8 - Fix zero cost AB/DB on triggers: letters W through Z 2017-10-14 11:26:47 +00:00
Agetian
a1a7cb747b - Fix zero cost AB/DB on triggers: letters U and V 2017-10-14 11:25:49 +00:00
Agetian
3d79e77f47 - Fix zero cost AB/DB on triggers: letter T 2017-10-14 11:24:18 +00:00
Agetian
f6c6ecd494 - Fix zero cost AB/DB on triggers: letter S 2017-10-14 11:23:05 +00:00
Agetian
52cca9532b - Fix zero cost AB/DB on triggers: letters Q and R 2017-10-14 11:19:28 +00:00
Agetian
d412bcc718 - Fix zero cost AB/DB on triggers: letter P 2017-10-14 11:18:27 +00:00
Agetian
6cb93e51fa - Fix zero cost AB/DB on triggers: letters N and O 2017-10-14 11:17:12 +00:00
Hanmac
84bc9205a9 Gigantoplasm: replaced ChooseCard with internal Choices for Clone 2017-10-14 11:16:38 +00:00
Agetian
92aea19abd - Fix zero cost AB/DB on triggers: letter M 2017-10-14 11:16:08 +00:00
Agetian
5dc94fdf0e - Fix zero cost AB/DB on triggers: letter L 2017-10-14 11:15:04 +00:00
Agetian
2089450a1d - Fix zero cost AB/DB on triggers: letters J and K 2017-10-14 11:14:23 +00:00
Agetian
eb92fe944c - Fix zero cost AB/DB on triggers: letter I 2017-10-14 11:13:28 +00:00
Agetian
3f426f63a1 - Fix zero cost AB/DB on triggers: letter H 2017-10-14 11:12:51 +00:00
Agetian
8c3a96db7f - Fix zero cost AB/DB on triggers: letter G 2017-10-14 11:12:00 +00:00
Agetian
edd9142f64 - Fix zero cost AB/DB on triggers: letter F 2017-10-14 11:10:45 +00:00
Agetian
424b83ddeb - Fix zero cost AB/DB on triggers: letter E 2017-10-14 11:10:02 +00:00
Agetian
610e844747 - Fix zero cost AB/DB on triggers: letter D 2017-10-14 11:09:19 +00:00
Agetian
a6fbe153b5 - Fix zero cost AB/DB on triggers: letter C 2017-10-14 11:08:15 +00:00
Agetian
0c1108b92d - Fix zero cost AB/DB on triggers: letter B 2017-10-14 11:06:47 +00:00
Agetian
684b84690c - An inadvertent commit to forge-gui-mobile-dev: revert 2017-10-14 11:05:36 +00:00
Agetian
df808f5690 - Fix zero cost AB/DB on triggers: letter A 2017-10-14 11:04:04 +00:00
Agetian
d960623dac - Do not count unreachable planes in Conquered Events statistics for all planes. 2017-10-14 06:15:14 +00:00
Agetian
d30c95c58c - Fixed Phthisis. 2017-10-14 04:51:15 +00:00
austinio7116
8c1139c151 Update to card-based deck generator data to include XLN 2017-10-13 20:56:26 +00:00
Agetian
3a6adc5503 - Marked Vindictive Lich as RemAIDeck for the time being. 2017-10-13 09:47:32 +00:00
Agetian
dbc1556381 - Documenting changes in CHANGES.txt. 2017-10-13 07:49:27 +00:00
Agetian
bd85ed3577 - RemAIDeck update: deck hints for Proliferate and Sunburst. 2017-10-13 07:44:51 +00:00
Agetian
1340e43f02 - RemAIDeck update: next iteration (letter R, the rest). 2017-10-13 07:33:41 +00:00
Agetian
aee891cd7e - Updated AI flags for Ixalli's Keeper. 2017-10-12 20:24:07 +00:00
Agetian
9f39c1d305 - RemAIDeck update: next iteration (letter R, part 1). 2017-10-12 14:18:45 +00:00
Agetian
43c23059ba - RemAIDeck update: next iteration (letter J). 2017-10-12 13:10:01 +00:00
Agetian
12c1caf54d - RemAIDeck update: next iteration (letter I). 2017-10-12 05:40:27 +00:00
Agetian
3848ba311e - RemAIDeck update: next iteration (letter O). 2017-10-11 16:56:53 +00:00
Agetian
dcb6cbf5fa - AB$ Cost 0 -> DB$ in Contagion Engine. 2017-10-11 15:17:48 +00:00
Agetian
f70e33a3ea - CostAdjustment: account for cases when subability uses targeting and the parent SA doesn't (e.g. Spellwild Ouphe targeted with an AF Charm instant). 2017-10-11 15:00:54 +00:00
Hanmac
857d6f87a0 CardFactoryUtil: moved Suspend to addSpellAbility 2017-10-11 06:20:51 +00:00
Hanmac
d3444621b9 CardFactoryUtil: move Fortify 2017-10-11 05:38:17 +00:00
Agetian
05bfc51a20 - RemAIDeck update: next iteration (the rest of letter A). 2017-10-11 05:33:46 +00:00
Agetian
851c593695 - Capitalization fix. 2017-10-10 14:49:33 +00:00
Agetian
8ed711ad34 - Added puzzles PS_XLN1, PS_XLN2, renamed the preview Ixalan possibility storm puzzles. 2017-10-10 14:48:47 +00:00
Agetian
e8eaf60c2c - RemAIDeck update: next iteration (half of the letter A). 2017-10-10 14:33:40 +00:00
Agetian
df480b67c0 - RemAIDeck update: next iteration (the rest of letter N). 2017-10-10 13:55:45 +00:00
Indigo Dragon
31e7316854 Fixed Tamiyo the moon Sage Emblem Image 2017-10-10 13:09:12 +00:00
Agetian
b183588046 - RemAIDeck update: next iteration (more letter N). 2017-10-10 05:07:47 +00:00
Agetian
2620769b19 - RemAIDeck update: next iteration (the rest of letter F). 2017-10-10 04:50:03 +00:00
Sol
9f4184974e Extract TokenInfo from CardFactory 2017-10-10 00:52:32 +00:00
Agetian
e586debb58 - RemAIDeck update: next iteration (more letter F). 2017-10-09 19:07:52 +00:00
Agetian
eccaf83e7d - Removed a superfluous check from Extraplanar Lens. 2017-10-09 15:57:54 +00:00
Agetian
a9a6227b8f - RemAIDeck update: next iteration (letter E, some F). 2017-10-09 15:20:19 +00:00
Agetian
f16251d046 - A bit more Extraplanar Lens logic. 2017-10-09 09:35:35 +00:00
Agetian
27c508caa0 - RemAIDeck update: next iteration (a couple E cards). 2017-10-09 06:12:47 +00:00
Agetian
aa10845ef0 - RemAIDeck update: next iteration (letter H). 2017-10-09 05:42:12 +00:00
Agetian
fe4c836cd2 - CostAdjustment: check subabilities for valid targets (fixes Skulduggery targeting opponent's Kopala). 2017-10-09 03:34:57 +00:00
Agetian
a34afb1a81 - Removed a comment that doesn't apply. 2017-10-08 14:18:00 +00:00
Agetian
9ee58451b5 - RemAIDeck update: next iteration (Last Rites, mostly for Reanimator). 2017-10-08 14:16:41 +00:00
Hanmac
faa8ca0b34 DelayedTriggerAI: use getAdditionalAbility if able 2017-10-08 13:38:38 +00:00
Agetian
e084f66354 - RemAIDeck update: next iteration (letter L finished, beginning of letter H). 2017-10-08 13:35:54 +00:00
Agetian
c68887f5f5 - RemAIDeck update: next iteration (Sunburst). 2017-10-08 12:33:19 +00:00
Agetian
43862a4b7b - Better check for Sunburst. 2017-10-08 10:55:19 +00:00
Agetian
036d672e7c - Better AI check for Clearwater Goblet. 2017-10-08 10:42:47 +00:00
Agetian
abbbae011f - Fixed Rebound for the AI. 2017-10-08 10:10:30 +00:00
Agetian
bbab6a0d68 - Minor typo fix. 2017-10-08 09:54:34 +00:00
Agetian
2e492dfc39 - RemAIDeck update: next iteration (letters Y and Z, some L). 2017-10-08 09:43:59 +00:00
Agetian
3d5606cc7b - AI: reset the paid hash for newly played abilities similar to how it's done for PlayerControllerHuman. 2017-10-08 08:51:25 +00:00
Agetian
553d059113 - RemAIDeck update: next iteration (letter C). 2017-10-08 06:58:55 +00:00
Agetian
990345cda0 - Fixed keyword text generation for Morph. 2017-10-07 19:40:47 +00:00
Agetian
1cbf075036 - RemAIDeck update: next iteration. 2017-10-07 14:50:51 +00:00
Agetian
6e518df398 - RemAIDeck update: next iteration (the rest of letter K). 2017-10-07 14:21:11 +00:00
Agetian
8e1af41938 - Fixed a potential concurrent modification error. 2017-10-07 13:52:48 +00:00
Hanmac
da2faaeff4 Card: add addIntrinsicKeywords and fixed it in CardState
use it for CardFactory too
2017-10-07 12:55:36 +00:00
Agetian
66af4ef831 - Fixed a logic error in the previous commit. 2017-10-07 05:13:47 +00:00
Agetian
cc0fdb302b - RemAIDeck update: next iteration. 2017-10-07 05:04:05 +00:00
Agetian
fd1f686469 - RemAIDeck update: next iteration ("when CARDNAME enters the battlefield, return a creature you control to its owner's hand"). 2017-10-06 17:16:17 +00:00
Agetian
a45a8a6011 - RemAIDeck update: next iteration (the rest of letter G + letter X). 2017-10-06 14:16:42 +00:00
Agetian
a40c362764 - Fixed getTriggeringAbility not finding triggering abilities in the middle of a subability chain, which can happen when e.g. a delayed trigger is generated in the middle of a chain (fixes Goblin Kites). 2017-10-06 12:44:55 +00:00
Agetian
b3c372a803 - Fixed Aftermath/Flashback as REs. 2017-10-06 10:48:48 +00:00
Hanmac
0ffe6051b6 Flashback and Aftermath as Replacement Effetcs 2017-10-06 06:39:03 +00:00
Agetian
3613cb704e - RemAIDeck update: next iteration. 2017-10-06 05:54:29 +00:00
Hanmac
0733f7a69a ReplaceMoved: add missing part for Buyback 2017-10-05 16:56:06 +00:00
Agetian
d514944657 - PlayerControllerAi: fall out of Tap/Untap preference in case an invalid preference was specified, to get to the default return value. 2017-10-05 16:21:22 +00:00
Agetian
5172aaafdb - RemAIDeck update: next iteration (letters P and Q, some playable Graft). 2017-10-05 13:05:36 +00:00
Agetian
d8ec34aa6f - RemAIDeck update: next iteration. 2017-10-05 06:35:39 +00:00
Agetian
0257acce1d - RemAIDeck update: next iteration (Ashnod's Battle Gear and Flowstone Armor) 2017-10-05 05:04:15 +00:00
Agetian
f7746a0da6 - RemAIDeck update: next iteration (cards that grant continuous bonuses until untapped). 2017-10-05 04:45:22 +00:00
Agetian
52605f6a4a - Simple logic for Tawnos's Weaponry and potentially other similar cards. 2017-10-05 04:26:11 +00:00
Agetian
d865a8ba0c - Some Ixalan card logic update. 2017-10-05 03:48:01 +00:00
Agetian
2869337f52 - Fixed Broodmate Dragon. 2017-10-05 03:36:20 +00:00
Agetian
083f28c89d - Fixed the generated stack description for Thieves' Auction. 2017-10-04 19:29:24 +00:00
Agetian
bd78dff68f - RemAIDeck update: next iteration (letter T). 2017-10-04 16:26:53 +00:00
Agetian
db291eb9c4 - Some improvements for the Aristocrats AI logic. 2017-10-04 14:58:06 +00:00
Agetian
f155244997 - A little logic correction for cases where the AIPreference list would have an override. 2017-10-04 12:13:55 +00:00
Agetian
fa8d2f0a25 - AIPreference: obey the order in which the items are listed. 2017-10-04 12:11:15 +00:00
Agetian
f3b0259884 - RemAIDeck update: next iteration (letter U). 2017-10-04 10:15:41 +00:00
Agetian
258a9c046e - Updated PlayMain1:ALWAYS to work for non-permanent spells. Updated Decree of Justice to avoid a different mechanism for the same purpose. 2017-10-04 06:28:00 +00:00
Agetian
97bda7a949 - Formatting fix. 2017-10-04 06:08:38 +00:00
Agetian
6b306860ec - RemAIDeck update: next iteration (the rest of letter D). 2017-10-04 06:07:59 +00:00
Agetian
697c41b0d0 - TriggerTapsForMana: check the root ability for the tap cost, fixes interaction between e.g. Nykthos, Shrine to Nyx and Burning Earth. 2017-10-04 03:52:30 +00:00
Agetian
ee8ec490d7 - Corrected Wasitora, Nekoru Queen token name according to the preferred naming scheme. 2017-10-03 17:27:43 +00:00
Agetian
c1674b568a - RemAIDeck update: next iteration. 2017-10-03 16:12:47 +00:00
Agetian
2c7d75996e - Marked Phyrexian Unlife as having a non-stacking effect. 2017-10-03 15:02:31 +00:00
Agetian
579c08a9e8 - RemAIDeck update: next iteration (finishing the letter M). 2017-10-03 14:13:08 +00:00
Agetian
2ba6e616af - RemAIDeck update: Medicine Runner. 2017-10-03 13:56:18 +00:00
Agetian
5d32321aa2 - RemAIDeck update: next iteration.
- An option not to hold land drops if there are no permanents in play, so there's little reason and extra confusion.
- Some improvements to CountersRemoveAi and PhasesAi.
2017-10-03 13:53:34 +00:00
swordshine
ccd50fa98b - Updated Dueling Grounds 2017-10-03 13:14:56 +00:00
Agetian
69c9cb1244 - Improved AI for Mimic Vat. 2017-10-03 12:32:03 +00:00
Agetian
35e1fca22d - Fixed the Oracle name of Tishana's Wayfinder further. 2017-10-03 12:25:47 +00:00
Hanmac
039dfb63ea Buyback as ReplacementEffect
Soulfire Grand Master as Effects without Keyword
2017-10-03 11:17:07 +00:00
Indigo Dragon
cf53d03104 Renamed Tishana's "Wayfarer" 2017-10-03 11:09:21 +00:00
Agetian
d4e72f07f9 - RemAIDeck update: next iteration. 2017-10-03 11:09:10 +00:00
Agetian
08a6af547c - Fixed a logic error. 2017-10-03 09:59:35 +00:00
Agetian
dd8a526a30 - Fixed compile. 2017-10-03 09:17:34 +00:00
Agetian
298a6b48ad - A more conservative logic for chump blocking stuff equipped with Swords of X and Y. 2017-10-03 09:17:02 +00:00
Agetian
08d305ebfa - RemAIDeck update: next iteration. 2017-10-03 05:31:14 +00:00
Agetian
e4f0463299 - RemAIDeck update: next iteration. 2017-10-02 19:11:32 +00:00
Agetian
b586182160 - RemAIDeck update: next iteration. 2017-10-02 16:54:18 +00:00
Agetian
4051da7ee1 - Minor typo correction in a couple method names. 2017-10-02 14:11:07 +00:00
Agetian
1705cc21b4 - RemAIDeck update (Voltaic Key) 2017-10-02 14:06:58 +00:00
Hanmac
4a3e0b244c SpellAbility: add hasAdditonalAbility to be used in DelayedTrigger 2017-10-02 13:50:53 +00:00
Agetian
3855fa3568 - Relic Crush RemAIDeck status update. 2017-10-02 13:43:19 +00:00
Hanmac
70b0e7d6c0 Rebound: make it a ReplacementEffect as it should be
check for Fizzle in ReplaceMoved, so it only works when it resolved from Stack
2017-10-02 13:42:14 +00:00
Agetian
e40f3cb34d - RemAIDeck update: next iteration. 2017-10-02 13:40:54 +00:00
Agetian
434deb92f8 - AB -> DB in Vesuvan Doppelganger. 2017-10-02 13:39:47 +00:00
Agetian
d962905799 - Fixed Vesuvan Doppelganger not staying blue when cloning (note that .addColor doesn't work for some reason from CloneEffect, even though a similar call works in AF Animate; no other cards currently use this and require additional colors in DB Clone, but if some ever do, then this code will require an update). 2017-10-02 13:39:26 +00:00
Agetian
bb10ce78a0 - RemAIDeck update: next iteration. 2017-10-02 09:36:41 +00:00
Agetian
0670847700 - RemAIDeck update: next iteration 2017-10-02 08:43:45 +00:00
Agetian
c539acb823 - RemAIDeck update: next iteration (Scry with no drawback) 2017-10-02 07:40:36 +00:00
Agetian
f233c2683e - RemAIDeck update: next iteration 2017-10-02 07:30:41 +00:00
Agetian
e5a7f5844c - RemAIDeck update: next iteration 2017-10-02 06:53:14 +00:00
Agetian
db1839c402 - A less invasive Thought Lash hack for the AI. 2017-10-02 04:50:46 +00:00
Agetian
24b54a0937 - Removed an empty line. 2017-10-01 18:10:44 +00:00
Agetian
c3f7640c4d - A [hacky] fix to avoid the AI cheating with Thought Lash (otherwise it keeps exiling 1 card to it, no matter how many age counters are on it, essentially by "exiling" (not) the same card multiple times). A better solution is needed, feel free to improve. 2017-10-01 18:10:12 +00:00
Agetian
dab74b7bba - Documenting changes in CHANGES.txt. 2017-10-01 17:18:45 +00:00
Agetian
c0e9bb223e - RemAIDeck update: Everflowing Chalice 2017-10-01 17:05:40 +00:00
Agetian
0630658d4d - Massive RemAIDeck update, next iteration. 2017-10-01 16:56:59 +00:00
Agetian
3094850579 - Massive RemAIDeck revision - next iteration. 2017-10-01 15:41:28 +00:00
Agetian
7b29e2e603 - RepeatAi: Do not miss mandatory activations even if the repeat subability is set up in some kind of a substandard way (e.g. Sphinx's Tutelage) 2017-10-01 14:02:35 +00:00
Agetian
53784e154d - Dev mode: do not ask about summoning sickness for creatures with inherent Haste. 2017-10-01 13:40:15 +00:00
Agetian
20e3bbf288 - More RemAIDeck reevaluations. 2017-10-01 11:13:29 +00:00
Agetian
43d016c288 - Hunt for obscure RemAIDecks, part 3. 2017-10-01 10:26:49 +00:00
Agetian
320cc45fc8 - Hunt for obscure RemAIDecks, part 2. 2017-10-01 09:25:34 +00:00
Agetian
a1831ab338 - Hunt for obscure RemAIDecks: removing RemAIDeck in cards that are currently AI playable. Part 1. 2017-10-01 08:16:29 +00:00
Agetian
6f57f56d1d - Ixalan Oracle update: attacks/blocks each combat if able [please revise if possible, a bit of a many-sided modification]. 2017-10-01 07:22:26 +00:00
Agetian
41062dfc47 - Ixalan oracle update: Behemoth Sledge, Carpet of Flowers, Celestial Dawn, Conspiracy, Drafna's Restoration, Thran Turbine, Titanic Ultimatum. 2017-10-01 06:47:59 +00:00
Agetian
e6628d4569 - Use the new concat method. 2017-10-01 06:18:16 +00:00
Agetian
7c389dbf8e - Dev mode: Add Card to Battlefield allows to specify whether a creature should have summoning sickness or not, Repeat Last Add Card honors that choice. 2017-10-01 05:56:24 +00:00
Agetian
651f7cc7cd - PumpAi: if a pumped creature will not attack anyway (even with the pumped keywords), do not consider keyword pumps. Fixes the AI being trigger-happy with Glorifier of Dusk when it doesn't attack. 2017-10-01 04:51:07 +00:00
Agetian
bd70662314 - Implemented simple AI for Spires of Orazca. 2017-10-01 04:24:42 +00:00
Agetian
9a45a84663 - Fixed the AI crewing an already animated vehicle. 2017-10-01 04:07:06 +00:00
Agetian
5b12d0e3f6 - Fixed Divine Intervention triggering from the wrong zones. 2017-10-01 03:57:52 +00:00
Agetian
d9e1121796 - Fixed Celestial Convergence triggering from the wrong zones. 2017-10-01 03:56:01 +00:00
Hanmac
b0f37ca217 ComuterUtilAbility: some tweak to find with checking api first before iterate 2017-09-30 14:06:13 +00:00
Agetian
7459f7a9fa - AI: Now knows how to instantly reequip Cranial Plating to an unblocked attacker who would deal lethal damage. 2017-09-30 13:50:26 +00:00
Agetian
3f3f2f2c18 - Refactored the tap/untap AI detection to avoid code duplication. 2017-09-30 11:37:12 +00:00
Agetian
42f2b0a8e3 - AI: Improvements to tap/untap logic in order to try not to target something twice for tapping/untapping. 2017-09-30 11:26:01 +00:00
Agetian
8326dc1dc7 - AI: Try not to target cards for tapping that are already targeted for tapping by something on the stack. 2017-09-30 10:05:55 +00:00
Agetian
cc68c5cfcb - Fixed AI logic declaration for Vanquisher's Banner. 2017-09-30 09:11:48 +00:00
Agetian
9e46cc2b0b - Further improvements to the experimental prioritize dangerous threats for removal logic, hooked it up to Pump AI targeting opposing creatures for CARDNAME can't attack. 2017-09-30 09:05:11 +00:00
Agetian
2fc827fcd7 - Hooked the experimental priority removal code to ChangeZoneAi for bounce/exile opponent stuff as well (disabled by default, in testing). 2017-09-30 07:13:50 +00:00
Agetian
8108bdc91b - AI: added an experimental option to actively prioritize destroying creatures that are not immediately blockable and thus pose a recurring threat (currently in testing, disabled in all default profiles). 2017-09-30 06:57:17 +00:00
Agetian
345f6fc2af - Fixed a logic error in AiBlockController. 2017-09-30 06:02:45 +00:00
Sol
af06cb5cdd Fixed Oracle 2017-09-30 02:36:47 +00:00
Hanmac
ba74b333cd GameAction: add params hash for changeZone game actions
add old functions as overload
MagicStack: add Fizzle and StackInfomation to the params when Card is removed from stack
2017-09-29 19:58:01 +00:00
Agetian
895d282cc8 - A somewhat more detailed AI evaluation modifier for Master of Waves, which is more fair (25 for +1/+1 on all elementals + 15 per each Elemental token which may potentially be debuffed or even destroyed by getting rid of Master of Waves). 2017-09-29 18:35:32 +00:00
Agetian
33831ee7cc - Lowering the eval mod for Master of Waves a little 2017-09-29 18:22:43 +00:00
Agetian
8aaea65a72 - Added an experimental way to add a card-specific creature evaluation modifier for the AI (adding to Master of Waves for testing). 2017-09-29 18:13:38 +00:00
Agetian
e20ba2c0a0 - Removing several previously commented lines, they are confirmed to be superfluous. 2017-09-29 16:51:25 +00:00
Agetian
e276950caa - Removing triggers CombatDamageDoneOnce/DealtCombatDamageOnce (no longer needed, superseded by DamageDoneOnce/DamageDealtOnce). 2017-09-29 16:40:40 +00:00
Agetian
a17663655b - Added an option to decrease the AI chance to randomly trade vs. an Embalm/Eternalize creature that will come back later.
- Enabling the option to hold land drops for main 2 from time to time when safe (tested by now, should work well).
2017-09-29 16:34:38 +00:00
Agetian
9bb5a69b56 - Preparing Forge for Android publish v1.6.4.001 [incremental/new release]. 2017-09-29 16:22:05 +00:00
Blacksmith
b9afd98189 Clear out release files in preparation for next release 2017-09-29 16:20:22 +00:00
Blacksmith
89da789a99 [maven-release-plugin] prepare for next development iteration 2017-09-29 16:14:05 +00:00
Blacksmith
f78f8006d6 [maven-release-plugin] prepare release forge-1.6.4 2017-09-29 16:13:56 +00:00
Blacksmith
46c79b4213 Update README.txt for release 2017-09-29 16:12:26 +00:00
Agetian
e4fb8c20ac - Added a missing reference to Nest of Scarabs. 2017-09-29 15:28:10 +00:00
Agetian
5a8762edb1 - Do not rotate the foil effect on the card if it has no picture (it's then drawn vertically). 2017-09-29 15:00:35 +00:00
Agetian
6285c76935 - Fixed Oracle text for Master of Waves. 2017-09-29 14:33:38 +00:00
Agetian
77942b632f - A better way to detect whether a player can look at the card for the purpose of identifying valid split rotation. 2017-09-29 11:33:19 +00:00
Agetian
29261c34d5 - Attempt to avoid spoiling that the face down card is a split card if it's face down and can't legally be seen by the player.
- Rotate Aftermath split cards correctly when they're in the graveyard.
2017-09-29 11:24:00 +00:00
Agetian
2152e5f731 - Do not try to rotate the foil for the non-current zoomed card since they're shown non-rotated and will break the foil effect. 2017-09-29 11:01:41 +00:00
Agetian
b659833f71 - Documenting changes in CHANGES.txt. 2017-09-29 10:57:26 +00:00
Agetian
f7d626d8c6 - Fixed split cards not being foiled correctly in all cases because the game assumed the foil effect to be stored on one of the halves instead of on the original card state.
- A more comprehensive fix for rotating split cards with foil in mobile Forge that does not break them in hand/graveyard/whatever. Also, turned it into an option since it doesn't look good in portrait mode, especially on smaller cellphones and in single card zoom mode.
2017-09-29 10:54:56 +00:00
Agetian
f1c8ace081 - Some updates for the PS_XLN* puzzles. 2017-09-29 08:30:27 +00:00
Agetian
655015d33b - Some updates for the PS_XLN* puzzles. 2017-09-29 08:29:22 +00:00
Agetian
ec24a92987 - Added a way to visually rotate split cards in card zoomer in Desktop Forge. 2017-09-29 08:20:51 +00:00
Agetian
04237c6118 - Updating draft rankings. 2017-09-29 07:49:18 +00:00
Agetian
86f13e05d2 - Formatting fix. 2017-09-29 05:34:51 +00:00
Agetian
9a6146e1ba - One more tweak. 2017-09-28 18:22:17 +00:00
Agetian
0a8ce34252 - A more generic implementation for the previous commit. 2017-09-28 18:21:48 +00:00
Agetian
18529f47e7 - Special case for Bone Dancer and ordering graveyards in "With Relevant Cards" mode. 2017-09-28 18:19:33 +00:00
Agetian
98215be0fc - A couple Raid description tweaks and fixes. 2017-09-28 18:10:38 +00:00
Agetian
f2698ef38d - etbCounter keyword unification in Sekki, Seasons' Guide 2017-09-28 17:36:31 +00:00
Agetian
215ee66a02 - Comment tweak. 2017-09-28 17:33:50 +00:00
Agetian
e055657d13 - Added a SpellApiToAi assignment for AF GameDrawn. 2017-09-28 17:31:47 +00:00
Agetian
ec7f47dbe7 - Added Celestial Convergence.
- Added new effect AF GameDrawn that creates an intentional draw situation by game effect.
- Divine Intervention now uses this effect.
2017-09-28 17:31:04 +00:00
Agetian
e3e7e4d26a - I guess Divine Intervention needs to be RemAIDeck, since the AI will slab it senselessly (if it's even possible for a senseless card like that) 2017-09-28 16:36:42 +00:00
Agetian
118d7d735a - Added Divine Intervention (another silly old card that no one is probably going to play with, but someone had to script it, I guess). 2017-09-28 16:35:22 +00:00
Agetian
d7a8534354 - Fixed Snapping Sailback. 2017-09-28 16:11:20 +00:00
Agetian
9fe86bf72a - Vampire Nocturnus Avatar: ensure that its static ability only starts working when the game actually begins. 2017-09-28 16:08:38 +00:00
Agetian
1d76f89428 - Added puzzles PS_XLN1 and PS_XLN2. 2017-09-28 15:54:40 +00:00
Agetian
fc26af5a89 - Fixed Gonti, Lord of Luxury generated effect description. 2017-09-28 15:43:58 +00:00
Agetian
7f85a8f2e1 - A shorter name for the option to allow ordering cards in graveyard in mobile Forge (due to visual space constraints). 2017-09-28 13:40:47 +00:00
Agetian
e3ff8029de - Preparing Forge for Android publish 1.6.3.003 [hotfix]. 2017-09-28 13:23:52 +00:00
Agetian
70f5bdd339 - A couple fixes for the Kamigawa quest world. 2017-09-28 06:36:18 +00:00
Agetian
2ecc36ab12 - AI should not be so reckless with triggered pumps that result in losing the card at end of turn (e.g. Hazoret's Favor) 2017-09-28 06:24:44 +00:00
Agetian
a4c14c6be1 - Some improvements to the Splice AI: do not reconsider the SA unless at least something was chosen for splice to save processing time; reset the targets on the main SA because it'll need to be retargeted anyway. 2017-09-28 04:41:38 +00:00
Agetian
6cbda005e8 - Fixed Vampire Nocturnus Avatar. 2017-09-28 04:19:29 +00:00
kevlahnota
8ea99648f0 Try to fix rotated split card with foil overlay 2017-09-28 01:52:09 +00:00
Agetian
58a5d9b0e1 - Attempting to fix Splice onto Arcane AI: when adding splice effects by the AI, actually reconsider the entire SA (with spliced subs) via the canPlay routine (and set targets while at it) before deciding whether to play it or not. Might not be optimal, but at least it seems to stop the AI from wasting splice cards and making them disappear from the game into the void. Improvements are welcome. 2017-09-27 18:53:25 +00:00
Agetian
b969f2eac6 - Fixed a NPE in DiscardEffect. 2017-09-27 17:02:23 +00:00
Agetian
5c295e9080 - Turned CheckCondition into a generic top-level AILogic, used it for both Repeating Barrage and Sasaya, Orochi Ascendant at the same time. 2017-09-27 15:02:36 +00:00
Agetian
64a6c3c5bb - Fixed the AI cheating with Repeated Barrage Raid ability. 2017-09-27 14:59:07 +00:00
Agetian
22cc4c635a - Minor fix in CHANGES.txt. 2017-09-27 14:55:03 +00:00
Agetian
b5b96f1155 - Fixed preference capitalization. 2017-09-27 14:41:36 +00:00
Agetian
06b887cd93 - A somewhat more fine-grained and less spoiler-y option to order graveyards, now with three states (Never / With Relevant Cards / Always). 2017-09-27 14:40:48 +00:00
Agetian
c6ef376d15 - Fixed generated description for Uba Mask. 2017-09-27 13:24:09 +00:00
Agetian
6ef249195e - Minor clarification in CHANGES.txt. 2017-09-27 08:09:32 +00:00
Agetian
f6e99cf748 - Preparing Forge for Android publish 1.6.3.002 [incremental/bug fixes]. 2017-09-27 08:05:13 +00:00
Agetian
6d39088777 - Added NeedsOrderedGraveyard to Alms and Death Spark. 2017-09-27 08:04:28 +00:00
Agetian
e5cb026608 - Bushido AI: attempt to avoid accounting for it twice when predicting P/T bonuses. 2017-09-27 07:39:18 +00:00
Agetian
ce9dbc2b5f - Restoring support for Extended for the time being, part 2 2017-09-27 06:36:53 +00:00
Agetian
bfef677e93 - Restored support for Extended format (removing it from blocks.txt breaks Quest Mode completely). 2017-09-27 06:35:42 +00:00
Agetian
0d18a1d19a - PlayerControllerAi: when playing with ordered graveyards and there's a Volrath's Shapeshifter in the game, try to place the best creature on top of the graveyard for the most value if Volrath's Shapeshifter hits the battlefield. 2017-09-27 06:20:25 +00:00
Agetian
91b3b7194d - Updated ISSUES.txt. 2017-09-27 04:26:42 +00:00
Agetian
306d515e7f - Documenting changes in CHANGES.txt. 2017-09-27 04:21:05 +00:00
Agetian
0a21e03eac - Added Bosium Strip (currently with an implementation similar to Kess, Dissident Mage, which doesn't interact correctly in corner cases where another card also lets you cast cards from graveyard but allows you not to exile them; need a better way to check "a card cast this way" (by checking that it was cast from an effect of a particular source card). Improvements in this area are welcome). 2017-09-27 04:20:49 +00:00
Agetian
e112704a63 - Fixed Nissa's Judgment. 2017-09-27 03:51:50 +00:00
Agetian
c0bbf107c6 - Fixed an occasionally broken orderMoveToZoneList (fixes Sensei's Divining Top). 2017-09-27 03:51:37 +00:00
Agetian
84a6876265 - Added an experimental option to allow ordering cards going to graveyard when playing with cards that care about graveyard order (Volrath's Shapeshifter and others). Disabled by default. 2017-09-26 19:40:44 +00:00
Agetian
add9ffe5d9 - Boros Charm: fixed an ability description. 2017-09-26 18:22:09 +00:00
Agetian
c71f0b7e39 - Deploy the Gatewatch: look at the cards even if there are no valid choices. 2017-09-26 15:11:26 +00:00
Agetian
e934071716 - Volrath's Shapeshifter: switched to a less aggressive update schedule (no update unless necessary), which fixes interaction with composite triggers that consist of several related parts (e.g. Undying, Persist).
- Volrath's Shapeshifter: QoL update: do not show the same text and discard ability twice if Volrath's Shapeshifter is attempting to copy the text of another Volrath's Shapeshifter that is on top of the graveyard.
2017-09-26 13:55:28 +00:00
Agetian
5693cddc3a - Some refactoring in AiBlockController related to random trades.
- Enabling random trades for favorable gang double and triple blocks.
2017-09-26 12:48:22 +00:00
Agetian
561d27be0a - Comment style fix. 2017-09-26 10:20:04 +00:00
Agetian
2e19a2a99c - Fixed Mindbreak Trap. 2017-09-26 10:15:52 +00:00
Agetian
4055e421bc - Minor formatting tweak. 2017-09-26 10:14:00 +00:00
Indigo Dragon
792255b676 Adding a Commander banned list a la Tiny Leaders (Literally a la. Involved many copying and pasting)
Adding a Commander Format, so that decks can now be checked in the original deck editor. Don't know how to implement highlander rules though, (Aside from the obviously stupid way of Restricting EVERY CARD EVER MADE).

Retiring the Extended Format. This one's dead Jim, dead Jim, dead Jim. It's as dead as Frontier. Maybe. Yes. If anyone complains they can just remove the \\s.
2017-09-26 08:46:36 +00:00
Hanmac
0ddb8d9644 ExploreEffect: fixed trigger and counter part 2017-09-26 05:22:00 +00:00
Agetian
5c29555ae7 - Fixed a typo. 2017-09-26 03:49:59 +00:00
Agetian
cf5e6bde9a - Documenting changes in CHANGES.txt. 2017-09-26 03:43:48 +00:00
Agetian
515ddbb28d - Removed one more portion of the leftover DamageDone|OnlyOnce code, I believe this is the last one. 2017-09-26 03:28:13 +00:00
Agetian
18720e3693 - Some additional NPE protection in applyPotentialAttackCloneTriggers. 2017-09-25 13:28:19 +00:00
Agetian
6b21664dff - Documenting changes in CHANGES.txt. 2017-09-25 13:17:40 +00:00
Agetian
ca92f90f6d - Integrating Personal Ratings patch by Seravy. 2017-09-25 13:14:23 +00:00
Agetian
8a1ab40f3c - AF Explore: apparently there's no need for a special SpellDescription on it when used as an Execute target for a trigger. 2017-09-25 13:06:56 +00:00
Agetian
f738822cce - A more appropriate solution for the manland animation AI problem. 2017-09-25 11:21:48 +00:00
Agetian
2ef900443b - Fizzle DamageDoneOnce for cards returning to battlefield from graveyard 2017-09-25 11:14:54 +00:00
Agetian
917c6b7c54 - Removed one more portion of the now-unused DamageDone|OnlyOnce code which would crash Forge. 2017-09-25 11:13:30 +00:00
Agetian
966db8af9f - Improved the animate manland AI such that it doesn't try to animate manlands that are already tapped. 2017-09-25 11:03:54 +00:00
Indigo Dragon
07b26f03a7 Fixed some broken Conquest Decks 2017-09-25 08:22:25 +00:00
Agetian
d685997040 - ExploreAi: honor the DoNotDiscardIfAble SVar. 2017-09-25 08:06:14 +00:00
Agetian
fce6807a3b - Simple AI support for Explore (feel free to expand). 2017-09-25 08:02:08 +00:00
Agetian
e91b428bd5 - Removed the now-unused Explore hack from AF Dig. 2017-09-25 07:31:54 +00:00
Agetian
6581466239 - Fixed trigger name in Brazen Buccaneers. 2017-09-25 07:29:36 +00:00
Agetian
380a5bbadd - Script update: AF Explore (better AI support coming soon). 2017-09-25 07:28:24 +00:00
Agetian
4da83ff5f8 - Unbanning Partner commanders in Planar Conquest. 2017-09-25 07:21:39 +00:00
Agetian
d5cf8848fa - Some fixes for AF Explore. 2017-09-25 07:18:37 +00:00
Agetian
4ea6f9dd6a - Scripts update: use DamageDealtOnce for cards that say "whenever X deals damage" 2017-09-25 07:10:21 +00:00
Agetian
d8027b002d - Script update: DealtCombatDamageOnce -> DamageDealtOnce|CombatDamage$True 2017-09-25 06:58:33 +00:00
Agetian
623cda83d5 - Script update: CombatDamageDoneOnce -> DamageDoneOnce|CombatDamage$True 2017-09-25 06:46:19 +00:00
Agetian
99b3e4493b - Documenting changes in CHANGES.txt. 2017-09-25 06:42:12 +00:00
Agetian
025a201a7d - Convert DamageDone|OnlyOnce to the new trigger DamageDoneOnce. Remove code for DamageDone|OnlyOnce (no longer needed). 2017-09-25 06:41:13 +00:00
Agetian
3243555181 - Partner commander UI support for mobile Forge (both Constructed and Planar Conquest). 2017-09-25 06:29:47 +00:00
Agetian
867eae442b - Fix compile. 2017-09-25 05:40:49 +00:00
Hanmac
e8e80a7ac8 replace lifelink with generic damage trigger, and do lifelink there 2017-09-25 05:21:06 +00:00
Sol
480c88a73e Tempest Caller only targets opponents 2017-09-24 22:38:45 +00:00
Agetian
6f34a42034 - A somewhat less confusing Boneyard Parley AI. 2017-09-24 15:01:58 +00:00
Agetian
312421ed28 - ReplaceProduceMana: check the root ability for tap cost (in case the mana ability is a subability), fixes interaction of mana replacement effects (e.g. Mana Reflection) with cards that tap in the root ability (e.g. Nykthos, Shrine to Nyx). 2017-09-24 14:57:28 +00:00
Indigo Dragon
93e81fdc01 Gave a custom Energy icon to Journeyman Skin 2017-09-24 14:27:23 +00:00
Agetian
2d7f0f907b - Added StackDescription to Grim Captain's Call. 2017-09-24 14:13:54 +00:00
Agetian
6aca67efa6 - Made Boneyard Parley AI playable. 2017-09-24 14:07:06 +00:00
Indigo Dragon
bab2b9f528 Changed "CARDNAME can block an additional creature." to CARDNAME can block an additional creature each combat."
Notes: Possible weird interactions when giving a multiblock creature an additional block eg. Equipping a Night Market Guard with echo circlet. Further study required.
2017-09-24 12:33:45 +00:00
Indigo Dragon
07886140fb Several Ixalan changes, as well as adding Scry reminder texts to those that need them.
Notes: Grim Captain's Call is... weird. Needs fixing for the stack panel when cast (Largely because it doesn't target the creatures on cast, only returns them on resolution)

Also: Boneyard Parley works when the Human uses it, but AI absolutely butches the execution I can't explain. Added SVar:RemAIDeck:True just in case. Pls fix.
2017-09-24 11:55:39 +00:00
Agetian
90341ee27a - Some more ID cleanup in Ravnica. 2017-09-24 04:50:54 +00:00
Agetian
f78da4f637 - Some improvements to DoNotDiscardIfAble discard AI for corner cases, to avoid (very rare) situations where the AI would not discard anything or crash. 2017-09-24 04:48:07 +00:00
Agetian
d3b8ffe328 - Fixed Heartless Pillage. 2017-09-24 04:47:11 +00:00
Agetian
e0b25527b3 - Fixed a deck ID in the Ravnica quest world. 2017-09-24 04:32:22 +00:00
Agetian
56798a76c9 - Fixed generated text for Volrath's Shapeshifter. 2017-09-23 16:07:28 +00:00
Agetian
2faab75bd8 - Changed comment type. 2017-09-23 15:44:08 +00:00
Agetian
d4d7c5b35e - Removed the issue note for As Foretold from ISSUES.txt, it's an implementation issue that does not have a functional side effect for the end-user. There's a TODO entry in the relevant part of the code. 2017-09-23 15:43:18 +00:00
Agetian
bf07df8f7b - Fixed Oracle text of Terror of Kruin Pass. 2017-09-23 15:40:00 +00:00
Agetian
3622103a90 - Cavern of Souls AI: do not try to pay with the SA the card for which was already tapped, for this cost or for something else. 2017-09-23 14:12:48 +00:00
Agetian
31680b3849 - Preparing Forge for Android publish 1.6.3.001 [incremental/new release]. 2017-09-23 13:52:31 +00:00
Blacksmith
aa7611fceb Clear out release files in preparation for next release 2017-09-23 13:51:19 +00:00
Blacksmith
9f0a34455b [maven-release-plugin] prepare for next development iteration 2017-09-23 13:45:20 +00:00
Blacksmith
da51f8af37 [maven-release-plugin] prepare release forge-1.6.3 2017-09-23 13:45:13 +00:00
Blacksmith
170853f2cc Update README.txt for release 2017-09-23 13:43:19 +00:00
Agetian
df4b625ac4 - Adapted the DigEffect implementation of Explore until the effect is fully converted and it can be removed. 2017-09-23 11:58:47 +00:00
Hanmac
2d6ff3b74c basic Explore Effect 2017-09-23 11:47:57 +00:00
Agetian
a5b3b61052 - Fixed Scry AI scrying away basic lands thinking that they do not produce mana since they do not use a mana-producing SA as such and rely on the basic land type instead. 2017-09-23 11:16:58 +00:00
Agetian
1b1a56e77c - Improved support for Illusions-Donate, added deck The Great and Powerful Trixie 2, changed the deck The Great and Powerful Trixie 3 to be a more standard Legacy-legal Trix. 2017-09-23 09:04:16 +00:00
Agetian
e18dd07491 - Fixed Axis of Mortality. 2017-09-23 05:21:27 +00:00
Agetian
f94771730e - AI: Improved logic for Capsize. 2017-09-23 05:09:16 +00:00
Sol
cb24df8890 Fix Bloodcrazed text 2017-09-23 03:14:27 +00:00
Sol
499d72d5d6 - Fix SpellDescription for Deadeye Tracker 2017-09-23 03:10:42 +00:00
Sol
1bab2617b7 W16 isn't in Standard 2017-09-22 23:47:57 +00:00
Agetian
b5ed2daa81 - Some changes for the experimental Intuition logic as support for Illusions-Donate. 2017-09-22 19:36:48 +00:00
Agetian
c32cd456b6 - Improved AI logic for Firecannon Blast. 2017-09-22 14:55:17 +00:00
Agetian
0f9a71f07d - Sword of X and Y artifact cycle: added MustBeBlocked:AttackingPlayer since otherwise the AI generally ignores these powerful effects, typically losing to them or to the card advantage that they generate in a matter of few turns. 2017-09-22 09:06:48 +00:00
Agetian
a1711daead - Some improvements in ComputerUtilCombat regarding predicting attack clone effects and MustBeBlocked. 2017-09-22 09:04:47 +00:00
Indigo Dragon
5b6031f41d Policy: If a card was printed without a reminder text in a booster expansion or preconstructed deck (eg Commander), it no longer requires reminder text. IMA removes basic reminder texts for serval cards, like the mythic rares archangel_of_thune.txt and thundermaw_hellkite.txt 2017-09-22 08:29:03 +00:00
Agetian
c3787ab02f - A little improvement to the previous commit. 2017-09-22 05:55:17 +00:00
Agetian
9d1a216a20 - AI: Predict clone on attack effects like Tilonalli's Skinshifter when deciding which creatures to leave for blocking. 2017-09-22 05:53:49 +00:00
Hanmac
2603d08aa4 add more Damage Once Triggers 2017-09-22 05:36:33 +00:00
Agetian
990c0afee2 - Updated the Protection effects to use the timestamp-based changed keywords mechanism, this fixes interactions like Lignify + Reverent Mantra choosing Protection from green. 2017-09-22 05:00:54 +00:00
Sol
1bfd401ed7 Fix description for Verdant Sun's Avatar 2017-09-22 01:11:22 +00:00
Sol
22414bab7c Remove Defender from Lightning Rig Crew 2017-09-22 00:31:39 +00:00
Agetian
08222b0d5c - Moved the code fragment a bit. 2017-09-21 18:17:36 +00:00
Agetian
d599d29514 - ReplaceDamage: according to 119.8, if something would deal 0 damage, it deals no damage at all, and thus there is no event to replace (please double check). 2017-09-21 18:08:33 +00:00
Agetian
e5120c7074 - Updated RankingScraper.py to use the draftsim ranking scraper instead of the defunct bestiaire ranking scraper. 2017-09-21 17:54:51 +00:00
kevlahnota
68f36bf172 Rotate split cards when zoomed-in, text detail for effect and emblem instead of token 2017-09-21 14:29:08 +00:00
Agetian
ee025f9a13 - Asset file size correction. 2017-09-21 11:58:17 +00:00
Agetian
68891d18f4 - Some improvement to the experimental and currently disabled "hold land drops" AI logic. 2017-09-21 04:38:54 +00:00
Agetian
be4b7e7232 - A somewhat better implementation of "show another card in prompt" code that potentially allows extension later on for things that may need it. 2017-09-21 03:50:42 +00:00
Agetian
c3e03c17e8 - Deadeye Tormentor: Raid description format unification (em-dash style). 2017-09-21 03:38:05 +00:00
Sol
1dc63294b4 Missing Raid in description of Deadeye Tormentor 2017-09-21 03:12:50 +00:00
Sol
63191515d3 Catch much wider exceptions in buildCardGenDeck based on key card 2017-09-21 01:28:48 +00:00
Agetian
f8b072f14a - Added a (hacky) way to display the remembered card for a SA in the prompt panel, currently used by the Explore workaround implementation, but may be used for more (in cases where the wrong thing is displayed on mouse-over in complex SAs). 2017-09-20 19:37:59 +00:00
Agetian
d09862522b - Fixed capitalization in Iconic Masters definition file. 2017-09-20 17:54:59 +00:00
Agetian
ce5240223b - Updated quest opponent deck Guybrush Threepwood 2. 2017-09-20 17:46:49 +00:00
Agetian
5b8d2cb36a - AI: For Vraska, the Relic Seeker, play a little more conservatively to avoid losing the planeswalker by activating its -3 ability two times in a row 2017-09-20 17:43:52 +00:00
Agetian
d9b35ca1ee - Added XLN planeswalker decks to quest precons. 2017-09-20 15:24:21 +00:00
Agetian
e8433a1d80 - Fixed AI params for Makeshift Munitions. 2017-09-20 11:52:43 +00:00
Agetian
092aac82ea - SetStateAi: allow AILogic$ Always on SetState transform triggers (set this on Vance's Blasting Cannons). 2017-09-20 11:51:16 +00:00
Agetian
9039178927 - AI: Look in all graveyards for potential targets of Deathgorge Scavenger, starting with the opponents' graveyards and then ending with the AI's own. 2017-09-20 09:51:27 +00:00
Agetian
a8b2a627f8 - Added an AI deck hint to Deadeye Quartermaster. 2017-09-20 09:34:14 +00:00
Agetian
da8b85decd - AI: try to proc Raid in case an attack is likely instead of casting the creature early in main 1 2017-09-20 09:19:04 +00:00
Agetian
73786bfd94 - Do not use the old AE ligature conversion in column names of the item manager. 2017-09-20 05:36:30 +00:00
Agetian
e06ea82f62 - Some improvements to AnimateAi.
- Fixed Myth Realized ability text. Also, it shouldn't be a characteristic-defining ability since it's an ability granted to itself (point 4 in rule 604.3a), otherwise it doesn't interact correctly, for example, with Starfield of Nyx in presence of five enchantments.
2017-09-19 17:37:57 +00:00
Agetian
085732868c - Minor improvement to the experimental "hold land drops" AI option (currently disabled by default). 2017-09-19 16:42:59 +00:00
Agetian
3f7c512c63 - Improved AI cast params for Fleetwheel Cruiser. 2017-09-19 16:42:26 +00:00
Agetian
28d8b49de7 - Minot tweak to previous commit. 2017-09-19 15:16:27 +00:00
Agetian
c79d04f29a - Added an experimental logic for Intuition (currently disabled by default, pending testing and fine-tuning). 2017-09-19 15:15:58 +00:00
Agetian
d1ba022ce9 - Tweaked the deck Morkus Rex 3 a bit. 2017-09-19 12:37:07 +00:00
Agetian
d36fb16b12 - Migrating XLN cards from upcoming to the real folders. 2017-09-19 12:04:06 +00:00
Agetian
26e94d3ba6 - Minor tweak to quest opponent descriptions. 2017-09-19 03:24:45 +00:00
Agetian
d2cd5e7202 - ScryAi: in the general case, avoid activating before the end of opponent's turn before own turn if it requires tapping the source (especially if it's on a creature) and has a mana cost. 2017-09-19 03:22:45 +00:00
Agetian
0bfd5cc292 - Added quest opponents Guybrush Threepwood 1, Guybrush Threepwood 2, Morkus Rex 2, Morkus Rex 3 with Ixalan cards (Pirate and Dino themed, respectively). 2017-09-18 19:05:02 +00:00
Agetian
deb25f8299 - Added a reference to Gishath, Sun's Avatar. 2017-09-18 18:51:22 +00:00
Agetian
aab28fd3fd - [XLN] Fixed ability description for Captain Lannery Storm. 2017-09-18 17:03:41 +00:00
Agetian
d9759305a3 - Do not calculate damage to planeswalkers for the purpose of chump saving in case the AI profile specifies to always consider them threatened if something is attacking them. 2017-09-18 15:49:08 +00:00
Agetian
e015e57dda - Try to detect cases where the actual damage to planeswalkers will be zero after prevention. 2017-09-18 15:29:14 +00:00
Agetian
44a2f1880d - Some improvements to the "protect planeswalkers with weak chumps" logic. Enabling it in a conservative version by default.
- Several additional experimental toggles for ChangeZoneAllAi, will be used to fine-tune "bounce all" type spells in generic cases.
2017-09-18 15:26:15 +00:00
Agetian
2e3617ad1c - Storm Seeker: added a missing SVar reference. 2017-09-18 12:51:51 +00:00
Agetian
ae5e7d1e60 - One more tweak to the previous commit. 2017-09-18 12:47:56 +00:00
Agetian
a31c3dc611 - Readded a part of the reanimator-specific Survival of the Fittest code. 2017-09-18 12:47:17 +00:00
Agetian
2ee3ec303d - Fixed Survival of the Fittest AI, which was accidentally made to grab discard targets from the library, lol 2017-09-18 12:46:11 +00:00
Agetian
3d8a85a145 - A tweak to Skyshroud War Beast NeedsToPlay (may still not work reliably in multiplayer, depending on who the AI chooses; ideally could use its own AI logic or something). 2017-09-18 12:20:54 +00:00
Agetian
fc18153f02 - A tweak to DigUntilAi DontMillSelf. 2017-09-18 12:19:02 +00:00
Agetian
77c1875b6b - [XLN] Fixed River Herald's Boon mana cost. 2017-09-18 09:29:45 +00:00
Agetian
4388a84787 - Gaze of Adamaro: marked as AI-playable. 2017-09-18 06:30:32 +00:00
Agetian
0d3a9c8b16 - Some logic for cards like Sudden Impact that deal damage to the player by the number of cards in his hand. 2017-09-18 06:19:50 +00:00
Hanmac
2ca05b5634 add TriggerDamageDealOnce 2017-09-18 05:28:02 +00:00
Agetian
4569bca39d - ChangeZoneAllAi: for things that return creatures from the battlefield to wherever en masse (e.g. Evacuation), cast is as a last resort if the opponent is about to deal lethal damage and win.
- Skyshroud War Beast: added NoZeroToughnessAI param.
2017-09-18 04:35:14 +00:00
Agetian
c401a609a4 - Survival of the Fittest, Treasure Trove: added an AI cast preference parameter to avoid having a duplicate on the battlefield.
- Expanded AI cast preferences to potentially support cards the duplicate for which can be cast in case the opponent debuffed the original (currently not used by any cards, looking for good candidates).
2017-09-18 04:15:41 +00:00
Agetian
07a71f1059 - Survival of the Fittest AI: avoid mana lock by casting it at the end of opponent's turn. 2017-09-18 03:40:03 +00:00
Agetian
82f6f7d4d5 - [XLN] Assorted fixes. 2017-09-18 03:32:26 +00:00
Agetian
97f68a8247 - Removed a hard limit on playing Survival on the Fittest (needs a better solution, currently too restrictive and the AI will not cast another SotF even if the first one becomes locked in some way on board, e.g. Imprisoned on the Moon). 2017-09-17 20:06:21 +00:00
Agetian
1d9f867c75 - Added an implementation comment. 2017-09-17 19:50:53 +00:00
Agetian
ebd3c33051 - Added some simple SVar-based prediction of Reanimator decks, currently used by the Survival of the Fittest AI code.
- Added a worlds.txt entry for Kamigawa quest world.
2017-09-17 19:50:03 +00:00
Agetian
00cec4faa0 - Documenting changes in CHANGES.txt. 2017-09-17 18:42:25 +00:00
Agetian
690fa7bf78 - Added Kamigawa quest world by daitokujibiko. 2017-09-17 18:40:19 +00:00
Agetian
ace6474157 - Survival of the Fittest: no point in casting the second copy while the first one is active and in play. 2017-09-17 18:33:03 +00:00
Agetian
974a017044 - [Request] Improved AI logic for Spike Weaver. 2017-09-17 18:23:34 +00:00
Indigo Dragon
89917d4f75 Added CostDesc$ {5}{R}{R}{R} to mizzixs_mastery.txt
Removed some double spaces "  " for the rest.
2017-09-17 16:05:18 +00:00
Agetian
f651364e00 - [XLN] A couple fixes. 2017-09-17 12:35:52 +00:00
Agetian
2a8b43b7a3 - Comment fix. 2017-09-17 10:46:01 +00:00
Agetian
aff991690d - Improved DigUntil logic for Hermit Druid. 2017-09-17 10:43:55 +00:00
Agetian
7f095947ab - ShouldPumpCard: when testing for Infect, ensure that the opponent can actually receive poison counters. 2017-09-17 08:29:43 +00:00
Agetian
b18b2cff44 - PumpAi (Aristocrats logic): only check Infect in case the target can receive Poison counters. 2017-09-17 08:23:14 +00:00
Agetian
befd16238b - Arcane Adaptation: should not affect Sideboard. 2017-09-17 08:16:11 +00:00
Agetian
20d3e540b0 - One more tweak to the previous commit. 2017-09-17 08:09:37 +00:00
Agetian
cede2927c5 - Made the new experimental AI option chance-based (currently disabled by default). 2017-09-17 08:07:56 +00:00
Agetian
543aae0893 - Some tweaks and improvements in the experimental AI code. 2017-09-17 08:02:43 +00:00
Agetian
e9c55345b8 - Fixed Heartless Pillage.
- Fixed some non-UTF-8 symbols in scripts.
2017-09-17 07:45:21 +00:00
Agetian
8c7dc08844 - Added an experimental option to hold unused land drops until main 2 (disabled by default). 2017-09-17 06:22:30 +00:00
Agetian
3ae20885c4 - Removed and defaulted the experimental AI option to avoid counting static attack bonus effects in declare blockers twice. 2017-09-17 04:47:27 +00:00
Agetian
09042f1dbf - Minor code reorganization in ComputerUtilCard. 2017-09-17 04:44:07 +00:00
Agetian
6b5c52d2c8 - Fixed the AI ignoring the non-stacking KW list and repeatedly pumping cards with non-stacking keywords without any other benefit when attacking for lethal. 2017-09-17 04:17:28 +00:00
Agetian
e02e2c462b - Added Menace to non-stacking keywords list (fixes multiple AI activations). 2017-09-17 04:07:50 +00:00
Agetian
30a1ea7a4f - [XLN] Some fixes. 2017-09-17 03:56:45 +00:00
austinio7116
51a2383574 Fixed fathom fleet cutthroat typo 2017-09-16 20:39:18 +00:00
Agetian
7fbbb9b030 - A somewhat better variable name. 2017-09-16 16:24:10 +00:00
Agetian
f2d88796ed - A somewhat better timing for Thundering Wurm for the AI. 2017-09-16 15:55:34 +00:00
Agetian
1659ca88ca - Added AI logic for Mox Diamond. 2017-09-16 15:48:16 +00:00
Agetian
fd7ba65203 - Improved the AI detecting whether the attacking creature would be destroyed by blockers when it has first strike or double strike (fixes e.g. a useless power pump vs. a first striker). 2017-09-16 15:29:42 +00:00
Agetian
ae66502fd5 - Fixed the em-dashes in CardFactoryUtil code. 2017-09-16 15:28:55 +00:00
Agetian
cc06fb6b40 - Fixed a failing test. 2017-09-16 14:53:17 +00:00
Agetian
a60c6af30e - [XLN] Fixed Gishath, Sun's Avatar and Ranging Raptors. 2017-09-16 14:32:43 +00:00
Agetian
91e7cd6576 - [XLN] A couple fixes. 2017-09-16 11:46:51 +00:00
Agetian
d717a68445 - Documenting changes in CHANGES.txt. 2017-09-16 11:40:24 +00:00
Agetian
7f4dcf54a7 - AiBlockController: shifted priority for non-lethal gang blocks below necessary chump blockers to avoid cheating or dying accidentally to something. 2017-09-16 11:35:46 +00:00
Agetian
613238e0f9 - Fixed the interaction of Tribute with effects like Solemnity. 2017-09-16 11:04:53 +00:00
Agetian
72f7189aeb - Added a comment. 2017-09-16 10:46:06 +00:00
Agetian
ea2616434c - No need to choose the best possible creature for a non-lethal Menace block. 2017-09-16 10:45:19 +00:00
Agetian
0261f25996 - AiBlockController: added a routine to try to block a Menace creature with two creatures that don't kill it but neither of which get killed as well. 2017-09-16 10:41:37 +00:00
Agetian
f5db79ce69 - Added a patch to the Starter world by Seravy. 2017-09-16 10:25:06 +00:00
Agetian
236a7c91d5 - Comment fix. 2017-09-16 10:18:05 +00:00
Agetian
c6bae2116a - Added an extra mode to DamageDone trigger (OnlyOnce$ True) that tries to count the damage only once. Currently will do it in combat, but will not yet do it for noncombat simultaneous damage like Aura Barbs (feel free to improve).
- Effectively this replaces the double trigger setup for Enrage and other cards that require such a count (e.g. Fungusaur and friends).
2017-09-16 10:17:14 +00:00
Indigo Dragon
05d42d9518 Replace many " - " with "—" 2017-09-16 06:56:28 +00:00
austinio7116
19a6236fa9 Readding card based deck gen .dat files post rotation 2017-09-16 06:21:15 +00:00
austinio7116
115dbc8b12 Trying to update card based deck generation dat files 2017-09-16 06:17:23 +00:00
Agetian
03084c3ce3 - Moving IMA rankings before XLN rankings in order to maintain the historical order of sets that the file is arranged in. 2017-09-16 05:48:52 +00:00
Agetian
0260afa068 - Changed underscores to spaces in Ixalan draft rankings (hopefully it wasn't intentional that way?...) 2017-09-16 05:47:15 +00:00
Agetian
2f9044f53f - Added a missing reference. 2017-09-16 05:18:12 +00:00
Agetian
f195e85fb8 - Improved the cleanup for Siren's Ruse. 2017-09-16 05:17:57 +00:00
Agetian
65065343f9 - [XLN] Added Siren's Ruse. 2017-09-16 05:14:46 +00:00
Agetian
50c8014977 - Hostage Taker: added Artifact.Other to ChangeZone targeting constraints. 2017-09-16 04:21:18 +00:00
Agetian
911d0a4fae - Vance's Blasting Cannons: the trigger is optional 2017-09-16 04:18:40 +00:00
Agetian
d1bb81e404 - Arcane Adaptation: set it to affect Sideboard too for situations with cards you own outside the game (http://magicjudge.tumblr.com/post/165378548299/the-locust-god-official) 2017-09-16 04:17:06 +00:00
Sol
76526a0b2d No need for duplicating creature types 2017-09-16 03:19:33 +00:00
Sol
a9020d92ca Updated XLN for Blocks and Formats 2017-09-16 01:35:14 +00:00
Sol
74be6e6c14 Adding remaining XLN cards from Marek (P-Z) 2017-09-16 01:33:44 +00:00
Sol
f203168542 Adding remaining XLN cards from Marek (A-O) 2017-09-16 01:33:01 +00:00
Sol
3c03f5fd71 Adding Trilobite type 2017-09-16 01:30:17 +00:00
Sol
8cfc9d7793 Fixing Ixalan editions file 2017-09-16 00:17:48 +00:00
kevlahnota
ec5c500b8f Fix lag I introduced. Just learned that we should never create an instance of a new object inside the render call, because it will create a new instance every draw call. 2017-09-15 20:53:46 +00:00
austinio7116
8f7cbeb4ab First draftsim rankings added for XLN 2017-09-15 20:32:46 +00:00
Agetian
fb32273477 - Corrected a token name. 2017-09-15 16:42:45 +00:00
Agetian
1be49e8d8a - ComputerUtilCombat: attempt to prevent the combat AI from counting the Flanking debuff twice when predicting the power bonus of blocker. 2017-09-15 16:39:20 +00:00
Agetian
b7edc01952 - Working out some TODO items in Ixalan card scripts (treasure token images, previously unconfirmed P/T). 2017-09-15 16:12:37 +00:00
Agetian
0470878ddf - KLD+ Fat packs should be named Bundle. 2017-09-15 16:08:21 +00:00
Agetian
d07a65d553 - Bundle and Booster Box info for Ixalan. 2017-09-15 16:00:18 +00:00
Agetian
58218f10da - Added booster generation info to Ixalan.txt. 2017-09-15 15:57:59 +00:00
Agetian
690eebb6a1 - Added Trilobite creature type. 2017-09-15 15:52:58 +00:00
Agetian
9bd9936781 - Fixed capitalization in Ixalan.txt. 2017-09-15 15:40:01 +00:00
Indigo Dragon
bf62325329 Added Ixalan.txt Edition File 2017-09-15 15:38:08 +00:00
Agetian
a3775e0b57 - Fixed Deathgorge Scavenger and improved AI logic for it. 2017-09-15 15:38:02 +00:00
Agetian
03c0794b48 - Some improvements to the Aristocrats and Electrostatic Pummeler AI logic. 2017-09-15 15:08:31 +00:00
Agetian
b5edcaf5ac - Added a missing reference to Liliana, Defiant Necromancer. 2017-09-15 14:54:37 +00:00
kevlahnota
3723a4e656 Update fastReplace (return null if source string is null) 2017-09-15 14:46:29 +00:00
Agetian
b332038722 - Fixed the AI trying to flip Sasaya, Orochi Ascendant endlessly without satisfying its condition.
- Several script fixes from Marek.
2017-09-15 14:08:27 +00:00
Agetian
33df8dd5eb - PermanentAi: commented out the check of Planeswalker uniqueness by subtype (no longer relevant past Ixalan). 2017-09-15 09:48:29 +00:00
kevlahnota
7e982b327b Refactor some String.replace to use TextUtil.fastReplace 2017-09-15 09:01:58 +00:00
Agetian
91585464bd - [XLN] Added 4 cards by Marek. 2017-09-15 06:35:52 +00:00
Agetian
3c3f494034 - Simultaneous combat damage pass 2: "X is dealt combat damage" card update 2017-09-15 06:34:44 +00:00
Agetian
87cbc6229a - Fixed Soul Link. 2017-09-15 05:59:45 +00:00
Agetian
bd10364d27 - Simultaneous combat damage pass 1: "deals combat damage to X" card update 2017-09-15 05:52:08 +00:00
Agetian
36721dde56 - A tweak to the previous commit. 2017-09-15 05:14:05 +00:00
Agetian
6a74bd841a - Improved TriggerCombatDamageDoneOnce to propagate the amount of damage dealt to targets.
- Corrected Armadillo Cloak and Fungusaur as implementation examples for simultaneous combat damage (simultaneous noncombat damage like Aura Barbs is still impossible as of yet, feel free to improve if you know how).
2017-09-15 05:12:55 +00:00
Agetian
093b5451c3 - Some XLN fixes. 2017-09-15 04:12:13 +00:00
Agetian
896dff3fdc - [XLN] Added 15/09 cards by Marek. 2017-09-15 04:09:12 +00:00
kevlahnota
e8e23603c3 Rotate Plane/Phenomenon on FOptionPane 2017-09-14 22:47:56 +00:00
Agetian
426fe0fe40 - Scavenging Ooze doesn't need remember/cleanup to operate.
- Animation Module: set AILogic to AlwaysAtOppEOT to ensure the AI doesn't manalock itself by spamming it.
2017-09-14 19:12:02 +00:00
Agetian
3e2ef43a0a - [XLN] Added 7 cards by Marek.
- Some card script corrections by Marek.
2017-09-14 18:59:51 +00:00
Agetian
a73b480b1f - [XLN] Updated Enrage cards such that the trigger fires only once in case of simultaneous combat damage. 2017-09-14 13:43:21 +00:00
Agetian
4d374dd587 - Fixed a miswrite in laneswalker achievements, 2017-09-14 13:26:00 +00:00
Agetian
3b97f8c396 - Mobile Forge: fixed a long-standing bug which caused a match (e.g. Planar Conquest) to restart even after a victory when using Space or Enter shortcut keys (when running on PC or when using buttons on a mobile device that are bound to Space and/or Enter). 2017-09-14 09:42:17 +00:00
Agetian
e7a559327c - A tweak in CHANGES.txt. 2017-09-14 08:28:32 +00:00
Agetian
ede35abe1a - A tweak in CHANGES.txt. 2017-09-14 06:25:05 +00:00
Agetian
edc36f915d - Documenting changes in CHANGES.txt. 2017-09-14 06:24:42 +00:00
Agetian
05a9d457aa - Improvements to Counter AI. 2017-09-14 06:18:05 +00:00
Agetian
cc7ce6bae9 - Removed a debug print line in Scry AI. 2017-09-14 05:51:15 +00:00
Agetian
57e5135346 - Improvements to Scry AI. Also, made Scry AI configurable using several AI profile preferences. 2017-09-14 05:35:35 +00:00
Agetian
74980f84d5 - A more generic implementation of AF MustAttack. 2017-09-14 04:19:03 +00:00
Agetian
fa7f1cc21a - [XLN] Added Axis of Mortality, Brazen Buccaneers, Desperate Castaways, Dire Fleet Hoarder, Imperial Lancer, Skulduggery. Added some deck hints and technical info to some XLN scripts. 2017-09-14 03:56:05 +00:00
kevlahnota
8c90fb3c15 Planchase Mod for mobile Forge. Uses BG art of current planes when a player planeswalk. 2017-09-14 00:45:52 +00:00
kevlahnota
021a48c070 The string replacement for achievement collection is not needed. 2017-09-14 00:42:39 +00:00
Agetian
8be583083e - Added XLN planeswalker achievements. 2017-09-13 18:45:28 +00:00
Agetian
8d15a7249a - A fix in planeswalker achievement file. 2017-09-13 18:41:59 +00:00
Agetian
6259793f39 - Fixing a mistype in achievement file names. 2017-09-13 18:41:07 +00:00
Agetian
772faf8cd2 - Updated rankings for AKH and HOU. 2017-09-13 18:25:52 +00:00
Agetian
dd7141aeaa - Adding initial rankings for Iconic Masters. 2017-09-13 18:21:59 +00:00
Agetian
521a3f9341 - Adding Iconic Masters to blocks.txt.
- Adding Ixalan to blocks.txt (currently disabled until all the relevant information about the set is revealed).
2017-09-13 18:15:44 +00:00
Agetian
452bdd7b4f - NPE prevention in ControlGainAi. 2017-09-13 16:41:10 +00:00
Agetian
37ebb5731d - Added Ydwen Efreet.
- Forge is now at 100 unsupported cards total.
2017-09-13 16:35:11 +00:00
Agetian
933ce64cce - Fixed a NPE when trying to repeat last add card before anything has been actually added at least once. 2017-09-13 15:41:12 +00:00
Agetian
b8d0019ece - Added Dulcet Sirens. 2017-09-13 15:37:33 +00:00
Agetian
4df3da0856 - [XLN] Added Charging Monstrosaur, Kinjalli's Caller, Tilonalli's Knight. 2017-09-13 15:22:44 +00:00
Agetian
59f482e52e - Fixed one more logical error resulting in suboptimal/aggressive random trades. 2017-09-13 15:13:03 +00:00
Agetian
538ea82899 - AiBlockController: fixed a logic error in random trade code that led to overly aggressive trades 2017-09-13 15:09:12 +00:00
Agetian
0b7fc67c3f - Experimental: for Dingus Egg, do not check the time stamp of the card that changed zone (fixes interaction with Sacred Ground). Should this be the default behavior for ChangesZone triggers that do not seem to care for how many times the card had changed zones before the trigger resolves? 2017-09-13 14:52:09 +00:00
Agetian
7a92712f0b - As Foretold: allow to cast spells from command zone via its ability. 2017-09-13 14:48:50 +00:00
Agetian
6ed9a8b336 - A little tweak to the previous commit. 2017-09-13 14:25:44 +00:00
Agetian
24df4e78c7 - Random favorable trades on block: when evaluating face-down Morph of Manifested creature, evaluate it based on its original face, not the face down 2/2 one. 2017-09-13 14:12:32 +00:00
Agetian
a0abaf62b4 - [XLN] Added Trove of Temptation. This card is ugly, so certain side effects in corner cases are probably still possible. Currently implemented as a keyword-like ability similar to "no more than X creatures can attack each turn" etc., but maybe is better as a global rule, I'm not sure (and not sure how to properly convert it to a global rule either...). Assistance and improvements are welcome. 2017-09-13 08:59:35 +00:00
Agetian
85ece1ec63 - [XLN] Added Ruthless Knave. 2017-09-13 08:42:10 +00:00
Agetian
ba284aafe3 - [XLN] Added Snapping Sailback by azcotic. 2017-09-13 08:35:25 +00:00
Agetian
f25ab2f892 - [XLN] Added Lightning-Rig Crew, Raiders' Wake, Sword-Point Diplomacy 2017-09-13 08:32:30 +00:00
Agetian
b026111ef8 - Attempting to fix generation of keyword text with long descriptions. 2017-09-13 06:46:18 +00:00
Agetian
9850f2e242 - [XLN] Added Sky Terror. 2017-09-12 17:02:59 +00:00
Agetian
9313fa9193 - [XLN] Added Adanto Vanguard, Captivating Crew, Dire Fleet Ravager, River Sneak, Spell Swindle 2017-09-12 16:58:50 +00:00
Agetian
f19c9183f0 - Decouple MustAttackEntity from MustAttackEntityThisTurn for Alluring Siren. 2017-09-12 16:34:37 +00:00
Agetian
5af3384b02 - Improved implementation for Alluring Siren. 2017-09-12 11:07:46 +00:00
Agetian
46a5512209 - Fixed mana cost for Conqueror's Galleon. 2017-09-12 10:51:41 +00:00
Agetian
63c83e97c4 - [XLN] Added Makeshift Munitions and Vicious Conquistador. 2017-09-12 09:00:24 +00:00
Agetian
cf311fdeb1 - Fixed Alluring Siren implementation. 2017-09-12 08:16:54 +00:00
Agetian
04ef82bc70 - [XLN] Added Legion Conquistador. 2017-09-12 03:26:04 +00:00
Agetian
7182ad2e9c - Some more NPE prevention in getSpellAbilityPriority. 2017-09-12 02:56:34 +00:00
Agetian
072508e1c1 - Added a TODO comment. 2017-09-11 19:12:47 +00:00
Agetian
91101a7c40 - Added a TODO comment 2017-09-11 19:12:33 +00:00
Agetian
d34fa71797 - [XLN] Added Dowsing Dagger / Lost Vale, Legion's Landing / Adanto, the First Fort. 2017-09-11 18:04:42 +00:00
Agetian
bee7bccc12 - A couple XLN card fixes / updates. 2017-09-11 17:48:44 +00:00
Agetian
74eea096b1 - Added some more experimental combat AI options, currently disabled by default.
- Enabling some of the previously experimental, now tested combat AI options (random favorable trades, holding combat tricks until block, trading to save a planeswalker, attempting to avoid attacking into certain blocks).
2017-09-11 17:37:43 +00:00
Indigo Dragon
02c028584b Added Iconic Masters.txt 2017-09-11 15:17:04 +00:00
Agetian
2a87d338b4 - Removed a superfluous comment. 2017-09-11 14:17:19 +00:00
Agetian
8759532964 - Experimental: in combat AI, try to avoid counting static abilities that grant power bonuses twice in case the creature has already attacked and the relevant bonus is already accounted for in getNetPower/getNetToughness (aims to fix AI prediction of creature power in presence of cards such as War Horn). 2017-09-11 14:16:02 +00:00
Agetian
f332db93ad - Added a couple final declarations in PumpAi. 2017-09-11 11:08:21 +00:00
Agetian
6ffc687174 - Some improvements to Aristocrats PumpAi and Electrostatic Pummeler AI.
- Added some final declarations in SpecialCardAi.
2017-09-11 11:06:39 +00:00
Agetian
ba6079164c - Attempting to fix a concurrent exception on an accidental quick reentry of addAttackingBand. 2017-09-11 09:55:26 +00:00
Agetian
372ee945de - Added puzzle PC_122215 coded by Xitax. 2017-09-11 04:32:41 +00:00
Agetian
0f0eed3de6 - A minor tweak/fix in As Foretold script code. 2017-09-10 16:54:26 +00:00
Agetian
9eddb37c3e - As Foretold: a simpler check for split half CMCs. 2017-09-10 16:50:19 +00:00
Agetian
6a262ea604 - A hacky workaround for the interaction between As Foretold and split cards. Seems to work in general cases, for both non-Aftermath and Aftermath splits, but a better solution is most certainly needed and welcome. 2017-09-10 16:25:32 +00:00
Agetian
94693f530e - Documenting changes in CHANGES.txt. 2017-09-10 15:11:33 +00:00
Agetian
ee9eced602 - Integrating PTK Quest world by Xyx. 2017-09-10 15:09:05 +00:00
Agetian
58fa9b8182 - Added a known issue note to As Foretold card text. 2017-09-10 14:40:05 +00:00
Agetian
89b377ab8f - Added a difficult to resolve known issue about As Foretold to ISSUES.txt. 2017-09-10 14:36:50 +00:00
Agetian
1d93fccbb3 - As Foretold: simplified implementation of copyWithDefinedMana 2017-09-10 13:42:16 +00:00
Agetian
f8786bcd47 - Ancestral Vision and similar cards should also be castable without paying their mana cost (117.6a). 2017-09-10 11:46:34 +00:00
Agetian
8adf2043f7 - Added puzzle PS_HOU8 coded by Nigol. 2017-09-10 11:35:46 +00:00
Agetian
8af3fe3db8 - Attempting to fix an issue with fastlands and slowlands ETBing in the wrong state when entering the battlefield together with other lands at the same time.
- Fixed an issue with LastStateBattlefield/LastStateGraveyard not returning anything unless at least some ability has been played.
2017-09-10 11:32:42 +00:00
Agetian
09c1db9afe - As Foretold: allow interaction with spells that initially have no mana cost (e.g. Ancestral Vision). 2017-09-10 11:28:07 +00:00
Indigo Dragon
2f738ff2b7 Updated Rarity corrections 2017-09-10 08:07:16 +00:00
Agetian
4429e36c3f - Improved copyWithDefinedMana such that the defined mana cost is added to spells that initially have no mana cost.
- TODO: it's still impossible to cast e.g. Ancestral Vision via As Foretold, even though it should be possible according to a ruling. Not sure how to fix, help is welcome.
2017-09-10 07:53:27 +00:00
Agetian
0b8a3cfcea - Emblems should be colorless. 2017-09-10 06:19:07 +00:00
Agetian
c3d43f6021 - Use CARDNAME in the desc of As Foretold. 2017-09-10 06:02:28 +00:00
Agetian
2a5badbc7c - Added As Foretold. 2017-09-10 05:54:43 +00:00
Agetian
3c5f24f99d - Fixed Shefet Monitor text. 2017-09-10 03:23:18 +00:00
Agetian
105212a667 - Fixed interaction between Animate Dead and Worldgorger Dragon. 2017-09-10 03:21:49 +00:00
Agetian
f5decd2221 - Improvement to the PumpAI Aristocrat logic. 2017-09-09 17:15:41 +00:00
Agetian
48bd65cd3b - Do not double the Infect damage when predicting it (already accounted for later) 2017-09-09 16:07:29 +00:00
Agetian
90046b11af - Card name fix. 2017-09-09 15:51:23 +00:00
Agetian
6eede614f8 - [XLN] Added Lurking Chupacabra, Wildgrowth Walker. 2017-09-09 15:51:07 +00:00
Agetian
8cd9c5e8a3 - Minor formatting fix. 2017-09-09 15:35:46 +00:00
Agetian
0ef1019d1c - Implemented a simple logic for Aristocrats (Vampire Aristocrat, Bloodthrone Vampire, Nantuko Husk and friends).
- Improved prediction of Infect damage for the AI in shouldPumpCard.
2017-09-09 15:34:35 +00:00
kevlahnota
f2a55e525b Enhanced rotated display of Planes/Phenomenon 2017-09-09 13:35:37 +00:00
kevlahnota
0f9eecd821 Added UI Setting (Mobile Forge) for rotated zoomed image display for Planes and Phenomenon cards. 2017-09-09 10:20:06 +00:00
Indigo Dragon
a45848cbe3 Added reminder text to chief_engineer.txt and maelstrom_nexus.txt.
Also changed modular so that it now has the correct "dies" wording on trigger.
2017-09-09 10:05:35 +00:00
Agetian
07af7d7f97 - [XLN] Renamed Shapers of the Nature -> Shapers of Nature 2017-09-09 04:53:56 +00:00
Agetian
87186ca940 - Territorial Hellkite: fixed Oracle text. 2017-09-09 03:35:29 +00:00
Agetian
990bd7e291 - AiController: attempting to fix a "Comparison.sort violates general contract" error which is likely caused by an internal NPE inside the sort method (difficult to prove if this really fixes the issue since I can't reproduce the problem yet, though it had been reported twice already). 2017-09-09 03:14:34 +00:00
Agetian
c39aa35d36 - Territorial Hellkite: further tweaks to the implementation for the corner cases where it can't attack or attacks someone else. 2017-09-09 03:00:15 +00:00
Agetian
3b187d75bb - Territorial Hellkite: improve interaction when it can't legally attack. 2017-09-08 20:06:30 +00:00
Agetian
84694773a2 - Added Territorial Hellkite. 2017-09-08 19:55:51 +00:00
Agetian
e8d9083f05 - [XLN] Added Bishop of the Bloodstained, Merfolk Branchwalker.
- Added some deck hints to XLN cards.
- Minor corrections in a couple XLN cards.
2017-09-08 18:49:56 +00:00
Agetian
25ccebe617 - [XLN] Added Rile. 2017-09-08 16:55:45 +00:00
Agetian
c6d3d07b3c - [XLN] Added Vona, Butcher of Magan. 2017-09-08 16:34:51 +00:00
Agetian
c6078f9314 - [XLN] Fixed the -3 ability for Vraska, Relic Seeker. 2017-09-08 16:26:34 +00:00
Agetian
db5462b79f - [XLN] Added Vraska, Relic Seeker. 2017-09-08 16:26:08 +00:00
Agetian
3b8e6a2c3a - [XLN] Added Dinosaur Stampede, Rampaging Ferocidon, Raptor Hatchling. 2017-09-08 16:18:07 +00:00
Agetian
eae7e79ecf - Added SpellDescription to an ability in Search for Azcanta / Azcanta, the Sunken Ruin. 2017-09-08 16:04:51 +00:00
Agetian
5264873645 - [XLN] Added Search for Azcanta / Azcanta, the Sunken Ruin.
- Minor fix in Welcome to the Fold.
2017-09-08 16:03:21 +00:00
Indigo Dragon
6009f097cd Fixed some Preconstructed Intro decks 2017-09-08 15:49:01 +00:00
Agetian
96265e5ac1 - Added a couple cards to the AI's library in Pauper Puzzle #03 to avoid a possibility of decking the opponent. 2017-09-08 12:41:01 +00:00
Agetian
5ee33a35fc - Lazav, Dimir Mastermind: copy the non-LKI card (fixes interaction with cards dying to something like Nameless Inversion; however, I'm not sure if LKI was intentional here or not) 2017-09-08 12:40:11 +00:00
Agetian
55f3c484f2 - [XLN] Added Lookout's Dispersal, Ranging Raptors, Ravenous Daggertooth, Storm Fleet Spy 2017-09-08 12:37:33 +00:00
Agetian
0bd678318c - Fixed Otepec Huntmaster. 2017-09-08 11:58:42 +00:00
Indigo Dragon
89ab049391 Changed some keyword reminder texts so that they are more dynamic with {%d:numbers).
Also updated suspend reminder text in CardFactoryUtil. It used to have this weird stock "Three Time Counters". Now it's fixed. Except it has Suspend counters in "1 counters" instead of "a counter"/"3 counters" instead of "three counters". Any improvements are welcome.
2017-09-08 11:07:58 +00:00
Indigo Dragon
aa6e4c5b53 Added reminder texts for Delve, Dredge, Split second, Devoid, Totem armor, Afflict, Bushido, Poisonous, Rampage, Cascade, Conspire, Dredge (again), Flashback*.
*Flashback required changes to the actual Flashback code. Now it works with an em-Dash. I'll possibly apply similar changes to other keywords with em-Dash cast mode.
2017-09-08 08:24:46 +00:00
Agetian
ec8a75be52 - Fixed Burning Sun's Avatar Oracle text. 2017-09-08 04:42:05 +00:00
Agetian
3ae7fe7f04 - Added Arguel's Blood Fast / Temple of Aclazotz, Chart a Course, Commune with Dinosaurs, Fell Flagship, Grazing Whiptail, Growing Rites of Itlimoc / Itlimoc, Cradle of the Sun, Otepec Huntmaster, Skittering Heartstopper, Thundering Spineback.
- Temporary implementation of an Explores trigger linked to AB Dig (until AB Explore is implemented).
2017-09-08 04:41:35 +00:00
kevlahnota
3e4b5830be Fixes Warning in Log - unmappable character for encoding UTF-8 2017-09-07 22:43:28 +00:00
Agetian
8ea28dad68 - [XLN] Added Duskborne Skymarcher. 2017-09-07 18:20:56 +00:00
Agetian
17c1fc79e1 - Fixed spells with Bestow not getting "unbestowed" when they are countered and go to graveyard. 2017-09-07 18:08:51 +00:00
Agetian
801eaaaf37 - A couple minor fixes. 2017-09-07 13:10:56 +00:00
Indigo Dragon
bfd72d7540 Added capital letters to the Protection cards with unique protections 2017-09-07 11:04:59 +00:00
Agetian
1341ef0c3e - Updated token-images.txt 2017-09-07 05:41:21 +00:00
Agetian
95bda0d4bb - Preparing Forge for Android publish 1.6.2.007 [hotfix]. 2017-09-07 05:34:09 +00:00
Agetian
adf412ea74 - Removed SacMe from Puzzleknot cards, doesn't work exactly as was expected. 2017-09-07 05:32:08 +00:00
Agetian
a00a6734b3 - Further tweaks to surprise pump experimental feature. 2017-09-07 05:27:33 +00:00
Agetian
e410eab336 - Fixed Priest of the Wakening Sun, improved default prompt for UnlessCost that is switched. 2017-09-07 03:50:28 +00:00
Agetian
1367357e68 - Updated puzzle PC_120815. 2017-09-06 19:10:03 +00:00
Agetian
4cb4b3bb19 - Preparing Forge for Android publish 1.6.2.006 [incremental]. 2017-09-06 18:04:00 +00:00
Agetian
ce92ab77ec - Enable a simple AI discard cost preference for Heir of Falkenrath. 2017-09-06 18:02:34 +00:00
Agetian
e365fc60bc - Removed Favorable Winds from upcoming (reprinted card). 2017-09-06 17:43:56 +00:00
Agetian
edb1343676 - For the time being, hiding the latest change to attack controller behind an experimental option, enabled in the experimental profile (may be defaulted and removed as a profile option later after extensive testing). 2017-09-06 16:51:32 +00:00
Agetian
f1426103ff - An important tweak to the previous commit. 2017-09-06 16:43:50 +00:00
Agetian
7a767327c0 - AiAttackController: don't attack into a guaranteed block unless the attacker has some kind of an attack/combat effect. 2017-09-06 16:21:49 +00:00
Agetian
e2f9139aa9 - One more tweak to the dev menu (mobile Forge). 2017-09-06 15:40:46 +00:00
Agetian
a80b504379 - A couple tweaks to dev panel. 2017-09-06 15:40:07 +00:00
Agetian
d73b3c44e3 - More work and parameter tweaking for attack/block trade experimental AI. 2017-09-06 15:32:24 +00:00
Agetian
c05f54c105 - Fixed non-UTF-8 encoding in CardFactoryUtil. 2017-09-06 15:25:20 +00:00
Agetian
c917bafde5 - [XLN] Added Regisaur Alpha. 2017-09-06 15:18:53 +00:00
Agetian
b349106f08 - Ixalan creature type update (Dinosaur subtype according to Sep 6 notes) 2017-09-06 15:16:14 +00:00
Indigo Dragon
1c91f345fc Added em-Dash for Suspend 2017-09-06 15:03:49 +00:00
Agetian
2b11afbb2d - More tweaks to the attack/block trading experimental options. 2017-09-06 14:30:24 +00:00
Agetian
e9479dd24f - Using em-dash for Awaken generated description. 2017-09-06 14:24:29 +00:00
Agetian
d676412291 - Fixed description generation for KW Devour. 2017-09-06 14:19:49 +00:00
Indigo Dragon
5fd5d032ef Updates to Keywords again 2017-09-06 13:56:27 +00:00
Agetian
66ee09f656 - Added NeedsToPlayVar to Explore. 2017-09-06 13:50:29 +00:00
Indigo Dragon
8f57a55286 Updates to keywords
So it's not the End of the World
2017-09-06 12:47:46 +00:00
Agetian
6498250114 - NPE prevention in CardZoom (still need to figure out why sometimes [seemingly randomly] the card on stack will become "castable" in mobile Forge in the first place). 2017-09-06 12:06:12 +00:00
Indigo Dragon
bf7b9a7057 CHANGES TO KEYWORDS !!!DANGER!!!
I'm messing with powers I don't understand. Here I go.

Following changes to menace that removed reminder text by removing the keyword.equals("Menace"), I conclude that you can add reminder text by inserting the keyword.equals("Keyword"). This is part one if it works, as it is for all the simple keywords that don't rely on numbers or costs (Compare Devoid with Awaken)

If this doesn't work, and everything breaks, burn it.
2017-09-06 12:06:01 +00:00
Agetian
8de7099c0f - A little tweak to the "attack to trade" experimental code. 2017-09-06 11:36:02 +00:00
Agetian
c2b3c4919d - [XLN] Added Favorable Winds, Storm Fleet Aerialist, Storm Fleet Arsonist. 2017-09-06 11:26:55 +00:00
Indigo Dragon
90b5531041 Updated Keyword Reminder Texts
Notes: Technically, all the reminder texts here were the texts as described by Magic Comprehensive Rules 702. Keyword Abilities. However nobody actually follows the rules when making simple reminder text for actual cards. If people are confused over advanced situations where creatures become noncreature permanents but the reminder text specifies "creature", they should consult the overriding Comprehensive rules. Therefore; I feel justified in simplifying these 'reminder' texts.
2017-09-06 10:47:33 +00:00
Indigo Dragon
e57de3268f illusionists_stratagem.txt Removed double "Draw a Card."
street_spasm.txt Added a full stop.
2017-09-06 09:46:35 +00:00
Agetian
b9e68834de - A little improvement in Suggest basic land count feature. 2017-09-06 08:50:46 +00:00
Agetian
5352514c2b - KeepTapped Attach AI logic: try not to activate on things that can't tap. 2017-09-06 05:07:49 +00:00
Agetian
aa58b3df35 - [XLN] Added a couple deck hints. 2017-09-06 04:37:42 +00:00
Agetian
dfe5a90b06 - [XLN] Added Savage Stomp and Wily Goblin. 2017-09-06 04:36:06 +00:00
Agetian
893486eb93 - Reorganized addCardToZone a little bit. 2017-09-06 04:35:38 +00:00
Agetian
bdc684d2d1 - Fixed Dev mode Add Card to X functions. 2017-09-06 04:14:24 +00:00
Agetian
80bc435df6 - Added Dinosaur creature subtype to lists/TypeLists.txt 2017-09-06 03:34:44 +00:00
kevlahnota
00cbfa45d7 Minor tweak in InputSelectTargets and some string refactoring 2017-09-05 20:53:54 +00:00
Agetian
5c18270826 - ComputerUtilCost: sac costs (Sac<...>) use ";" as a delimiter and not "," (fixes e.g. the AI never sacrificing anything to Defiant Salvager).
- Added SacMe to Puzzleknot cards.
2017-09-05 19:35:35 +00:00
Agetian
aa86ef631b - DeckGenUtil: some improvements to the suggest basic lands feature. 2017-09-05 19:09:06 +00:00
Agetian
c67a2bd458 - Added an Explores trigger (not used anywhere yet, can be used in the upcoming Explore effect later). 2017-09-05 18:05:33 +00:00
Agetian
f796ec32a7 - [XLN] Added Deadeye Quartermaster, Kitesail Freebooter, Overflowing Insight, Pirate's Cutlass. 2017-09-05 17:55:13 +00:00
Agetian
9ce43ea7a6 - [XLN] Added 5 cards. 2017-09-05 16:19:42 +00:00
Agetian
19702794e4 - Volcano Hellion: tweak the script such that it allows to choose any number. 2017-09-05 15:25:30 +00:00
Agetian
9015bfcac3 - Minor dev panel button movement. 2017-09-05 12:12:18 +00:00
Agetian
ad13ef9187 - Dev Mode: split the "Add Card to Play" functionality into two buttons: "Add Card to Battlefield", which acts like other Add Card to X buttons and adds the card directly to the battlefield, without using the stack and without firing ETB triggers; and "Cast Spell/Play Land", which acts like the old "Add Card to Play" button and uses the stack when necessary and fires all triggers. 2017-09-05 12:06:37 +00:00
Agetian
4a1b147a25 - A little improvement in script execution code in GameState. 2017-09-05 03:37:33 +00:00
Agetian
5970908a3f - GameState: added a way to precast from a custom script line for the needs of Puzzle Mode. 2017-09-05 03:35:52 +00:00
Agetian
e3d37ca831 - Reverted an inadvertent experimental commit. 2017-09-05 03:27:29 +00:00
Agetian
4c9afb8c80 - Fixed puzzle PP18. 2017-09-05 03:27:08 +00:00
Agetian
253049ec5a - [XLN] Added Shapers of the Nature. 2017-09-05 03:11:45 +00:00
Agetian
c1d7f86542 - [XLN] Added Drover of the Mighty. 2017-09-05 03:04:56 +00:00
Agetian
aa44fba1e5 - Added 2 puzzles coded by Xitax, 9 puzzles coded by Nigol. 2017-09-05 02:53:28 +00:00
kevlahnota
5dbf2b0ff5 Fix font display in landscape mode (instead of vertical names, it will display names horizontall) Edited 2017-09-05 02:47:55 +00:00
kevlahnota
8fcbaef064 Refactor some strings 2017-09-05 02:44:36 +00:00
Agetian
08c3509823 - [XLN] Added some more cards. 2017-09-04 18:55:56 +00:00
Agetian
d9961bc1a0 - [XLN] Added some more cards + patched up a couple cards a bit. 2017-09-04 18:55:14 +00:00
Agetian
9fd8c1f546 - Basic Survival of the Fittest logic (in addition to it already accounting for DiscardMe cards), most likely needs tweaking. Promoted Survival of the Fittest to RemRandomDeck from RemAIDeck. 2017-09-04 17:32:46 +00:00
Agetian
d265102f31 - [XLN] Added Wakening Sun's Avatar. 2017-09-04 16:20:34 +00:00
Agetian
063a50b14a - Some modification of chance variables in the AI profiles related to the experimental attack/block trade options. 2017-09-04 13:24:56 +00:00
Agetian
ebb06b34b0 - Some more work on attack/block trades [experimental]. 2017-09-04 12:18:06 +00:00
Agetian
bbc3a75e4a - A NPE guard in the experimental pump code. 2017-09-04 09:59:07 +00:00
Agetian
86c5ef363e - A tweak in the lure pump experimental code. 2017-09-04 09:00:23 +00:00
Agetian
daefcab8f5 - A little modification for the previous commit. 2017-09-04 05:42:41 +00:00
Agetian
3d5f9beac5 - ChangeZoneAi: implemented AILogic SacAndRetFromGrave, added it to Recurring Nightmare. 2017-09-04 05:40:27 +00:00
Agetian
0b01855bf4 - Maniacal Rage: promoted to RemRandomDeck. 2017-09-04 04:58:59 +00:00
Agetian
cc78904582 - GameState: support for targeting scripted abilities that use a Defined$ parameter originally (for Puzzle Mode needs). 2017-09-04 04:32:25 +00:00
Agetian
306b4652eb - Fixing a potential crash in the experimental holdCombatTricks code. 2017-09-04 04:10:41 +00:00
Agetian
721a629ba8 - LifeInDanger AI: account for special cases with Worship and Elderscale Wurm 2017-09-03 18:58:51 +00:00
Agetian
4f00aeeed7 - Fixed a quest opponent deck file. 2017-09-03 15:57:32 +00:00
Agetian
88ca671965 - Some more work on surprise attacks/trades [experimental, disabled by default]. 2017-09-03 15:26:28 +00:00
Indigo Dragon
7c3cfe1326 Updated all the Overload Reminder Texts
Some now use ValidDescription$
2017-09-03 15:05:02 +00:00
Agetian
735f1007cf - AB$ Cost 0 -> DB$ in Festering Mummy. 2017-09-03 14:44:57 +00:00
Agetian
66df063e2a - Added ValidDescription to Street Spasm. 2017-09-03 14:44:35 +00:00
Indigo Dragon
e7547905a3 Magus of the Wheel had a weird Name:Meteor Blast in its oracle text 2017-09-03 13:59:08 +00:00
Agetian
206b01376d - Added unfinished and inoperable Online Play mode to ISSUES.txt (known issues). 2017-09-03 13:04:03 +00:00
Agetian
e50ef893e8 - [XLN] Added Huatli, Warrior Poet. 2017-09-03 12:55:47 +00:00
Indigo Dragon
496cc470e2 Update all the Prowl and Reinforce cards from MOR.
They now pretend to be keywords better.
2017-09-03 11:54:55 +00:00
Agetian
b82516ba4d - Minor improvement related to my previous commit. 2017-09-03 11:19:23 +00:00
Agetian
bbe7ff3c9b - Further work on surprise pump spells on attack [experimental, disabled by default, may still cause issues when enabled]. 2017-09-03 11:12:48 +00:00
Indigo Dragon
d33770f107 Update Convoke Reminder text to include the "(Your creatures can help cast this spell. ", similar to Improvise.
Also updated Frenzy Sliver and Virulent Sliver. Frenzy Sliver is done, while Virulent sliver needs a few more tweaks in an upcoming Keyword update.
2017-09-03 09:50:04 +00:00
Indigo Dragon
6523500d09 Update arcanum_wings.txt so that it now acts more like a keyword.
PrecostDesc$ -> Costdesc$, Added forward brackets and costs to Spelldescription$
2017-09-03 09:29:13 +00:00
Agetian
1a7a5fe6a8 - Fixed some AB$ Cost 0 -> DB$ declarations in card scripts.
- Fixed Nova Pentacle (the card needs some additional combat AI support though, or the AI will suicide its own creatures if the opponent has nothing on the battlefield).
2017-09-03 08:55:26 +00:00
kevlahnota
9426c531e3 More Refactoring of String.format 2017-09-03 08:11:28 +00:00
Indigo Dragon
35a6977df8 Gave seeds_of_renewal.txt the Undaunted Keyword in the Oracle text 2017-09-03 08:05:10 +00:00
Agetian
c06280a1ea - [XLN] Added 3 cards. 2017-09-03 04:59:10 +00:00
kevlahnota
8b3ff137d1 Refactor strings enclosed in parentheses, transform P/T to strings 2017-09-03 02:01:34 +00:00
Agetian
0fa826f926 - Minor formatting tweak. 2017-09-02 18:26:10 +00:00
Agetian
5c7b40248c - A more generic solution for concatWithSpace / concatNoSpace. 2017-09-02 18:24:30 +00:00
kevlahnota
7a3a8b0490 Refactor some "String.format" to use StringBuilder 2017-09-02 17:35:13 +00:00
Agetian
78d13749d5 - AbilityUtils: fixed compilation (please check, replaced CardUtil.getPluralType with CardType.getPluralType) 2017-09-02 17:06:12 +00:00
Agetian
1143a43d30 - Attempting to improve LifeGain AI for creatures with negative SA activation costs like Spike Feeder. 2017-09-02 17:00:10 +00:00
Hanmac
3cdf553142 moved hardcoded type plural into text file and moved the getPlural and getSingular functions into CardType class 2017-09-02 16:55:11 +00:00
Agetian
f9569895b4 - Hermit Druid: added AILogic$ DontMillSelf 2017-09-02 16:31:07 +00:00
Indigo Dragon
905b469515 Updated Eternalize keyword so now it's similar to Embalm, as well as specifying that it gains the Zombie type, not replaces 2017-09-02 14:53:15 +00:00
Indigo Dragon
aac3443b78 Updated Madness Reminder Text 2017-09-02 14:46:44 +00:00
Indigo Dragon
bd9b05463e Changing the mana cost 2 to {2} for the [[Rout]] ability
K:You may cast CARDNAME as though it had flash if you pay 2 more to cast it. -> K:You may cast CARDNAME as though it had flash if you pay {2} more to cast it.

This may break something. If so, whoops
2017-09-02 14:27:29 +00:00
Agetian
bb82c6fa02 - Further work on trick/lure attacks with held pump spell. 2017-09-02 14:19:34 +00:00
Indigo Dragon
7232f9446a Replaced all double spaces __ with single spaces _ 2017-09-02 14:17:43 +00:00
Agetian
639f2b8e02 - [XLN] Fixed Fathom Fleet Captain 2017-09-02 13:50:21 +00:00
Agetian
7d860542b1 - [XLN] Added Bellowing Aegisaur. 2017-09-02 12:55:17 +00:00
Agetian
7593dad6c8 - Some more improvements for block-baiting into a pump. 2017-09-02 11:32:52 +00:00
Agetian
ecc4834110 - Adding hyphenated emblem names to the rest of the planeswalker files. 2017-09-02 11:11:57 +00:00
Agetian
2e1adc6f9b - Documenting changes in CHANGES.txt. 2017-09-02 11:08:12 +00:00
Agetian
18a0866735 - Code support for hyphens in Planeswalker emblem names. 2017-09-02 11:05:51 +00:00
Indigo Dragon
4036fc44e3 More brackets [] and colons : for planeswalkers
That should be it for now.
2017-09-02 11:05:25 +00:00
Indigo Dragon
9f7bbd6efc Upgrade Tamiyo, the Moon Sage ai emblem name 2017-09-02 10:41:45 +00:00
Indigo Dragon
1ff11a09ed Added Colons to Planeswalkers
Added dashes to some Emblem Names
Added Brackets for some select walkers
2017-09-02 10:39:51 +00:00
Hanmac
be3d4723ef Emblem fixed startwith 2017-09-02 10:28:07 +00:00
Agetian
190703d74b - Some changes in PumpAi related to the in-dev experimental features. 2017-09-02 10:05:17 +00:00
Indigo Dragon
eac361d892 Gave Colons to kytheon_hero_of_akros.txt 2017-09-02 06:32:10 +00:00
Indigo Dragon
a772cf9910 Changes to Emblems
Emblems now read "Emblem Planeswalker" instead of "Planeswalker emblem"
Image name now is "emblem_planeswalker"

If this breaks anything please revert.

Also added some colons to oracle texts for some planeswalkers.
2017-09-02 05:52:02 +00:00
Indigo Dragon
77eab9e6f8 Changed vessel_of_malignity.txt 2017-09-02 04:44:30 +00:00
Agetian
c4fc168369 - Minor comment fix. 2017-09-02 04:00:29 +00:00
Agetian
41409fb5c1 - An AI option to hold combat tricks until block, experimental and disabled by default (more work to follow soon). 2017-09-02 03:57:06 +00:00
Agetian
71eb88eb7b - Fixed Claim // Fame. 2017-09-02 03:03:27 +00:00
Agetian
dcbde94d78 - [XLN] Added 8 cards from Planeswalker decks. 2017-09-01 17:09:38 +00:00
Agetian
11bbcf5b42 - More work on "surprise trade on block" project (experimental, disabled by default). 2017-09-01 15:45:17 +00:00
Agetian
badf68b80a - Further work on random trades (experimental, disabled by default.) 2017-09-01 14:53:44 +00:00
Agetian
01e1c2ab0a - Added Prowess, Outlast and Afflict to CreatureEvaluator. 2017-09-01 14:02:55 +00:00
Agetian
bef51732e0 - Fixed an inverted clause in the experimental "random combat trades" code. 2017-09-01 13:42:12 +00:00
Agetian
77046cf38a - Fogwalker: removed empty lines, AB with cost 0 -> DB 2017-09-01 13:35:24 +00:00
Agetian
2a623957c3 - A little tweak to the previous commit. 2017-09-01 08:49:30 +00:00
Agetian
65322925a4 - Pump effects: consider beneficial combat pump effects when checking if the AI should pump the card. Also, use "gains flying until EOT" defensively if there's a chance to kill the opponent's creature or block the opposing flyer with an indestructible flying creature. 2017-09-01 08:31:50 +00:00
Agetian
346c4db3d9 - Whispers of the Muse, Treasure Trove: added AILogic$ AlwaysAtOppEOT as it's a more optimal default timing for this effect. 2017-09-01 07:56:42 +00:00
Agetian
7212698863 - Fabrication Module: added AILogic. 2017-09-01 07:29:06 +00:00
Agetian
1779544d70 - Further work on experimental attack/block trade feature (disabled by default). 2017-09-01 05:54:01 +00:00
Agetian
0270420da8 - Some minor refactoring in AiBlockController related to the previous commit. 2017-09-01 03:22:11 +00:00
Agetian
a1461851ee - Some further work on the experimental attack/block trading options (disabled by default in all profiles except Experimental). 2017-09-01 03:19:24 +00:00
Agetian
eaabad923e - Reverted a change to Edgar Markov that breaks it for tribal Vampire spells. 2017-09-01 03:10:17 +00:00
Agetian
a9e12f5aca - Added final to several vars in PlayerControllerHuman. 2017-08-31 19:14:55 +00:00
Agetian
0637d5511d - Some experimental attacking and blocking changes related to surprise trade attacks and blocks, currently disabled by default in all profiles except Experimental. 2017-08-31 19:11:04 +00:00
Agetian
27682b2d07 - Electrostatic Pummeler AI: predict static damage prevention 2017-08-31 18:05:30 +00:00
Agetian
0982852563 - Fixed Nazahn, Revered Bladesmith. 2017-08-31 12:51:08 +00:00
Agetian
8147a315c2 - Added rudimentary AI to requested cards Erratic Portal and Null Brooch. Helm of Possession appears to be AI playable already after testing, so marking it as such. 2017-08-31 12:41:54 +00:00
Agetian
fdf787e9b4 - Integrating latest Oracle updates by Indigo Dragon. 2017-08-31 09:52:40 +00:00
Agetian
01d2338388 - [XLN] Added Queen's Bay Soldier. 2017-08-31 08:46:45 +00:00
Agetian
1dfec40f49 - [XLN] Added Hostage Taker, Sorcerous Spyglass and Tishana, Voice of Thunder. 2017-08-31 05:08:08 +00:00
Agetian
a82602faae - [XLN] Added Star of Extinction and Vanquisher's Banner. Fixed the card name in Shapers' Sanctuary. 2017-08-31 04:22:03 +00:00
Agetian
c2aac371ae - Cleaned up imports. 2017-08-30 19:28:08 +00:00
Agetian
9aa6e0d39a - CloneAi: improved a bit for Tilonalli's Skinshifter. 2017-08-30 19:27:12 +00:00
Agetian
3c177c4ebf - [XLN] Added Angrath's Marauders, Captain Lannery Storm, Sunbird's Invocation, Tilonalli's Skinshifter. 2017-08-30 19:13:46 +00:00
Agetian
d8b090bae2 - Added quest opponents Jafar 2 (mono B zombies with some Afflict) and Heinz Doofenshmirtz 2 (URG Electrostatic Pummeler). 2017-08-30 18:29:20 +00:00
Agetian
928792bea7 - Some method renaming. 2017-08-30 17:17:10 +00:00
Agetian
99775194fd - Electrostatic Pummeler AI: teach the AI to pump the Pummeler to save it from dying to direct damage spells. 2017-08-30 17:16:00 +00:00
Agetian
beb73828e0 - LifeSetAi: Do not use this ability in case the amount the life is set to is the same as the AI's current life (e.g. Oketra's Last Mercy while the AI is already at the starting 20 life). 2017-08-30 16:52:20 +00:00
Agetian
87dc72b874 - [XLN] Added Bloodcrazed Paladin, Boneyard Parley, Fathom Fleet Captain, Ruin Raider, Vraska's Contempt. 2017-08-30 16:12:27 +00:00
Agetian
528ae68282 - Preparing Forge for Android publish 1.6.2.005 [incremental]. 2017-08-30 15:18:49 +00:00
Agetian
a44031cd39 - [XLN] Added Old-Growth Dryads, Shaper's Sanctuary coded by azcotic 2017-08-30 15:14:55 +00:00
Agetian
af922d5171 - Added Deeproot Champion and Waker of the Wilds coded by azcotic [fixed versions]. 2017-08-30 15:06:43 +00:00
Agetian
bd6599a309 - Better Electrostatic Pummeler AI. 2017-08-30 14:55:01 +00:00
Agetian
2e062b1ad6 - [XLN] Added Kopala, Warden of Waves and River's Rebuke. 2017-08-30 05:45:48 +00:00
Agetian
5fc6654045 - [XLN] Added Arcane Adaptation, Daring Saboteur, Dreamcaller Siren, Entrancing Melody, Herald of Secret Streams. 2017-08-30 05:30:59 +00:00
Agetian
32c3494098 - Added Know Evil. 2017-08-30 04:49:13 +00:00
Agetian
379461820b - Adhering to Java 7 feature set for the purpose of Android compatibility. 2017-08-30 03:19:23 +00:00
Agetian
424cb7a9f2 - [XLN] Fixed Admiral Beckett Brass card name. 2017-08-30 03:17:19 +00:00
Agetian
b41e2b6f51 - Electrostatic Pummeler AI: don't overpump when using it defensively. 2017-08-29 16:56:42 +00:00
Agetian
84e73f6f52 - Fixed the AI cheating with Plague Belcher by ignoring its triggered ETB ability. 2017-08-29 16:18:09 +00:00
Agetian
39fb42db10 - Enabling evasion prediction for assault and attrition attack declarations in default AI profiles after testing. 2017-08-29 16:05:20 +00:00
Agetian
85c18ce07b - Somewhat better RememberedWithSharedCardTypes, hopefully would work more reliably in case of 3+ cards tested at the same time for shared card type [not currently seen on any card]. 2017-08-29 15:57:30 +00:00
Agetian
3fe548d8b7 - [XLN] Added Rowdy Crew. 2017-08-29 15:49:30 +00:00
Agetian
eb32222d39 - [XLN] Added Ashes of the Abhorrent, Mavren Fein Dusk Apostle, Sanguine Sacrament, Settle the Wreckage, Tocatli Honor Guard.
- [XLN] Added some AI flags to cards.
- Fixed Hymn of the Wilds description.
2017-08-29 14:32:22 +00:00
Agetian
e70d7ab5c1 - [XLN] Added Deadeye Tormentor, Prosperous Pirates, Sun-Crowned Hunters. 2017-08-29 09:30:05 +00:00
Agetian
a3da735087 - [XLN] Revel in Riches: the effect is not optional. 2017-08-29 09:18:04 +00:00
Agetian
8c12b5a47e - Removed a debug print line. 2017-08-29 09:10:30 +00:00
Agetian
65c27c6c93 - Fixed an issue with non-creature tokens being added twice to different rows, resulting in odd Z order when mousing over them. 2017-08-29 09:03:36 +00:00
Agetian
4c31e1a4b5 - Minor counter abbreviation tweak. 2017-08-29 08:33:25 +00:00
Agetian
7be776d417 - Added spell description to Treasure Map. 2017-08-29 05:56:29 +00:00
Agetian
1a93e8f331 - [XLN] Added Revel in Riches, Sleek Schooner, Treasure Map // Treasure Cove.
- Added Picture SVars to card in Upcoming.
- Fixed Emperor's Vanguard (should work well enough until Hanmac finishes the code for Explore as a separate effect).
2017-08-29 05:46:08 +00:00
Sol
b6107f79dd - Fix Xenagos not having it's Legendary PW applied properly 2017-08-29 02:19:25 +00:00
Agetian
fb0acb6a8b - [XLN] Jace, Cunning Castaway: the clones should be immediately activatable as soon as they hit the battlefield. 2017-08-28 19:26:54 +00:00
Agetian
240a898fe5 - Added a TODO entry for Emperor's Vanguard (needs Explore to be updated for the double clause). 2017-08-28 18:49:59 +00:00
Agetian
3aad5916f5 - [XLN] Added Bishop of Rebirth and Walk the Plank. 2017-08-28 18:44:50 +00:00
Agetian
c2a7f19d38 - [XLN] Added Jace, Cunning Castaway. 2017-08-28 18:35:31 +00:00
Agetian
0a5fe2e2af - Some implementation clarifications. 2017-08-28 18:32:05 +00:00
Agetian
f6e5256ae4 - Planeswalker rule: restore the "go to graveyard on 0 loyalty" functionality. 2017-08-28 18:30:25 +00:00
Agetian
46aefe6b8a - [XLN] For now, commenting out the Planeswalker Rule code since it won't apply post-Ixalan. 2017-08-28 17:52:17 +00:00
Agetian
af7ef111b4 - [XLN] Planeswalker uniqueness no longer matters ( http://magic.wizards.com/en/articles/archive/feature/ixalan-mechanics ), planeswalkers are Legendary instead. 2017-08-28 17:39:45 +00:00
Agetian
c918743187 - [XLN] Fixed Admiral Becket Brass. 2017-08-28 17:37:58 +00:00
Agetian
817a691248 - [XLN] Integrating Oracle updates by Indigo Dragon: Planeswalkers now have the Legendary supertype. 2017-08-28 17:35:53 +00:00
Agetian
04e33448e0 - [XLN] Added Admiral Becket Brass. 2017-08-28 17:30:17 +00:00
Agetian
aa4624e344 - [XLN] fixed a card file name. 2017-08-28 15:52:52 +00:00
Agetian
1b7a819a2b - [XLN] fixed a card file name. 2017-08-28 15:52:15 +00:00
Agetian
096036f2a4 - [XLN] Added 10 cards. 2017-08-28 15:50:49 +00:00
Agetian
b488ff053a - Fixed RevealEffect crashing for cards like Vizkopa Confessor. 2017-08-28 15:21:45 +00:00
Agetian
04f24faf32 - Experimental: attempting to fix card flickering (power/toughness, jumping between rows) by selectively updating the view for P/T and types after all static effects for all cards have been processed instead of aggressively updating the entire state view during each static effect operation (might also make the game run a bit faster on mobile).
- Volrath's Shapeshifter: do not copy the target's set code and rarity.
2017-08-28 14:06:28 +00:00
kevlahnota
c180343853 Remove redundant import statement, also refactor addMissingItems method. -kev 2017-08-28 09:44:18 +00:00
kevlahnota
da0739ab21 Refactored decoding URL. This is much better than using regex/replace method. -kev 2017-08-28 09:23:36 +00:00
kevlahnota
aa1d2a1879 Fixed filenames that contains comma and apostrophe when parsed (as seen on achievement resource when downloaded, "%27s" will be replaced by "'s" and %2C" will be replaced by ","), so they can be viewable on achievement page. 2017-08-28 07:54:15 +00:00
Agetian
9d9ef0069a - Adding an empty edition file for the upcoming set Ixalan. 2017-08-28 06:22:57 +00:00
Agetian
50790b94a3 - Fixed Herald Horn. 2017-08-28 05:50:35 +00:00
Agetian
59b7f9c775 - Somewhat better AI for Exhaustion. 2017-08-28 04:25:19 +00:00
Agetian
0f83f23052 - Preparing Forge for Android v1.6.2.004 [hotfix/incremental]. 2017-08-27 19:03:15 +00:00
Agetian
1da95433ae - Fixed the AI sacrificing everything to Westvale Abbey without honoring AIPreference:SacCost (should also fix other similar cards with sac cost that requires the AI to sacrifice several cards). 2017-08-27 19:00:23 +00:00
Agetian
d0579b5f75 - ChangeCombatantsEffect: attempt to account for the new rule for Ulamog, the Ceaseless Hunger + Portal Mage interaction in multiplayer games. Currently achieved by rigging the triggering info on the stack instance, which may not be optimal. Feel free to propose a better solution. 2017-08-27 18:17:21 +00:00
Agetian
1d19f56de8 - Experimental: do not reset the paid hash in resetOnceResolved since it appears to be cleared in other SA operations when needed, and aggressively clearing it breaks transient payment info (e.g. Orator of Ojutai + revealed Dragon card). 2017-08-27 18:15:19 +00:00
Agetian
3688e13137 - Add Basic Lands dialog: make it show only the sets with actual basic lands in them.
- Minor cleanup in addCardToZone in PlayerControllerHuman.
2017-08-27 18:12:32 +00:00
Agetian
45d71d0c5f - AI improvements: restored playability of Exhaustion, made Cursed Scroll AI-playable, added some additional code support for programmable Exert logic (Ahn-Crop Champion is an example), added a bit of threshold to Living Death AI, moved Momir Vig Avatar logic to SpecialCardAi. 2017-08-27 18:11:06 +00:00
Agetian
d8be84b617 - Added quest world "The Gates of Magic" by Seravy. 2017-08-27 18:07:15 +00:00
Agetian
f7c4fe8e91 - Fixed an issue with launching Forge on mobile for some users. 2017-08-27 17:59:15 +00:00
Goblin Hero
9005598f90 Revert previous commit 2017-08-27 17:53:47 +00:00
Goblin Hero
5e508770ef Readme added for server testing purposes 2017-08-27 17:32:46 +00:00
Agetian
8331f92775 - GameState: added support for counters in exile zone (e.g. via Mairsil) and for face-down cards in exile (e.g. via Bomat Courier). 2017-08-27 04:12:19 +00:00
Agetian
4c3c7e3807 - GameState: use setCounters to clear the player/planeswalker counter count 2017-08-27 03:57:40 +00:00
Agetian
1e39e3e815 - Preparing Forge for Android publish 1.6.2.003 [hotfix]. 2017-08-27 03:15:58 +00:00
Agetian
5f6519d4c6 - Fixed a crash in mobile Forge when pausing application. 2017-08-27 03:15:15 +00:00
Agetian
e93c35bcae - Added 3 puzzles coded by Xitax. 2017-08-27 03:14:51 +00:00
Agetian
a9d522d1d9 - Added 2 puzzles coded by Xitax. 2017-08-26 19:34:03 +00:00
Agetian
44ac42a4b5 - Puzzle Mode: A better solution for precasting Awaken in GameState (allows both Awaken and AwakenOnly). 2017-08-26 19:08:35 +00:00
Agetian
78a60c750a - GameState: when processing a precast effect solely for KW Awaken, only precast the Awaken part, not the parent ability. 2017-08-26 18:54:39 +00:00
Agetian
6012b06a38 - Added 3 puzzles coded by Xitax. 2017-08-26 18:39:50 +00:00
Agetian
3ff370a903 - Fixed a missing reference in Magus of the Mind (matters for Mairsil, the Pretender - fixes a crash when activating a Mairsil'ed copy of the Magus's ability). 2017-08-26 18:30:06 +00:00
Agetian
6147d64a74 - Preparing Forge for Android publish 1.6.2.002. 2017-08-26 18:19:14 +00:00
Agetian
91b839dd26 - Fixed a NPE in ComputerUtil. 2017-08-26 18:17:31 +00:00
Agetian
cdb6d10519 - Genju of the X cycle of cards AI: attempt to avoid tapping the targeted card for mana if there's another source like that available (might be further improved later by detecting the actual mana type and the sources of that type that are open, after which the special AI parameter SVar might no longer be necessary). 2017-08-26 18:01:03 +00:00
Agetian
586abb5466 - Use updateAbilityTextForView as a limited form of updating the text part of the view in order to update changed card text (e.g. lands affected by Blood Moon, creatures affected by Humility) while avoiding flickering side effects.
- Volrath's Shapeshifter: fixed a concurrent modification when removing temporary triggers.
2017-08-26 17:12:08 +00:00
Agetian
710ac14202 - Fixed Neko-Te. 2017-08-26 17:01:46 +00:00
Agetian
a8735d1b4c - Restored a separator space in SettingsPage. 2017-08-26 15:15:07 +00:00
Agetian
f9ede752f2 - Added a new option to mobile Forge which might help deal with the texture issues after locking/unlocking the screen (suggested by kevlahnota). 2017-08-26 15:13:46 +00:00
Agetian
5bdb205168 - Mobile Forge: new game installations enable battlefield texture filtering by default. 2017-08-26 14:58:01 +00:00
Agetian
b606b939a6 - Fixed AI logic name in Oracle's Vault. 2017-08-26 14:53:59 +00:00
Agetian
0e0b12dcc0 - Fixed keyword name capitalization in AiAttackController. 2017-08-26 14:49:03 +00:00
Agetian
b9e7b1f29b - Attack AI: Afflict should be considered as a combat effect for the purpose of attacking into non-lethal blockers. 2017-08-26 14:46:50 +00:00
Agetian
f930f2aa80 - Minor comment clarification. 2017-08-26 06:22:15 +00:00
Agetian
8698f7e4ab - Bomat Courier AI improvement: teach the AI to sac Courier when threatened in case sacrificing it would provide hand card advantage 2017-08-26 06:17:56 +00:00
Agetian
40b62c09f7 - Fixed references in Soul Burn and Drain Life.
- Promoted Wildfire and Burning of Xinye from RemAIDeck to RemRandomDeck.
2017-08-26 04:14:27 +00:00
Agetian
8ddc3ae172 - Fixed Jeskai Charm. 2017-08-25 20:27:26 +00:00
Agetian
b3e2fb4046 - Documenting changes in CHANGES.txt. 2017-08-25 19:28:43 +00:00
Agetian
42558f2bd4 - A better, theme-oriented planeswalker attacker targeting arrows with the default orange-ish color.
- Removed the unused "darker PW arrows" option.
2017-08-25 19:26:13 +00:00
Agetian
1e23b0a17e - Documenting changes in CHANGES.txt. 2017-08-25 17:12:35 +00:00
Agetian
5b6e0d5c10 - CounterAi: a more generic solution for Mental Misstep exclusion, part 2 2017-08-25 15:55:28 +00:00
Agetian
a53de75873 - CounterAi: a more generic solution for counterspells only targeting CMC X vs. CMC X spells. 2017-08-25 15:52:52 +00:00
Agetian
b3dc4671d0 - Fixed the attack AI overevaluating board position because unblocked attackers with evasion were not removed from remainingAttackers before further evaluation. 2017-08-25 15:35:29 +00:00
Agetian
ef4dd57032 - NPE prevention in ComputerUtil. 2017-08-25 14:59:22 +00:00
Agetian
ad1e17f329 - Fixed a NPE in ComputerUtilCost, part 2. 2017-08-25 11:01:48 +00:00
Agetian
2ba53e2dab - Fixed a NPE in ComputerUtilCost. 2017-08-25 10:59:29 +00:00
Agetian
909b8e7127 - Bristling Hydra AI: teach the AI to use a ping activation to save the hydra from death. 2017-08-25 10:57:12 +00:00
Agetian
8280401e10 - A better algorithm for detecting available mana for the purpose of CounterAi. Should be more precise and less cheat-y. 2017-08-25 09:21:02 +00:00
Agetian
6096fc1c92 - Documenting changes in CHANGES.txt. 2017-08-25 06:10:14 +00:00
Agetian
0378d54acc - Added implementation comment. 2017-08-25 05:51:54 +00:00
Agetian
d33b642b8e - A more universal CounterAi fix, accounting for sources producing multiple mana. 2017-08-25 05:49:00 +00:00
Agetian
27d68bcf45 - Fixed CounterAi in the trigger portion as well. 2017-08-25 05:28:06 +00:00
Agetian
b0122a8e38 - Renamed a method to be more self-explanatory. 2017-08-25 05:26:50 +00:00
Agetian
96cbb63c84 - CounterAi: fixed the AI not accounting for the mana in the mana pool of the SA activator; fixed the AI looking at the mana of the wrong opponent in multiplayer matches. 2017-08-25 05:23:27 +00:00
Agetian
bd16899c56 - Reorganized the dev mode panel to make a bit more sense (grouped the buttons by function, more or less).
- Added "Repeat Last Add Card" functionality to dev mode panel.
2017-08-25 04:53:31 +00:00
Agetian
b874a2b76d - Added a fix by Seravy to prevent the large quest shop pools from hanging the game because statistics were updated for them during selling. 2017-08-25 04:11:14 +00:00
Agetian
aaf16273a9 - Minor code style unification. 2017-08-24 17:46:01 +00:00
Agetian
f83e03e775 - Fixed a comment. 2017-08-24 17:45:01 +00:00
Agetian
5328e443db - Fixed the AI tapping a creature for mana to cast a pump instant/sorcery spell on that creature. 2017-08-24 17:44:03 +00:00
Agetian
ed49943039 - Further improvements to AI handling Electrostatic Pummeler. 2017-08-24 17:27:14 +00:00
Agetian
220fdcdc75 - Added an overriding implementation of doTriggerAINoCost to BondAi, fixes the AI randomly ignoring a chance to soulbond creatures. 2017-08-24 16:21:23 +00:00
Agetian
a1b2a5149d - Volrath's Shapeshifter: run a limited update for ability and keyword text such that the changed text is always visualized (e.g. things like Rally triggers). 2017-08-24 15:09:18 +00:00
Agetian
3090a991a6 - Fixed Scalelord Reckoner triggering for cards not on the battlefield. 2017-08-24 13:31:41 +00:00
Agetian
e0cae27f2f - Reverting an inadvertent change. 2017-08-24 13:30:58 +00:00
Agetian
21c7c74b31 - Attempting to fix Dragon Presence cards, part 1: "dragon presence" apparently cares about the current battlefield state, not the LKI (from Gatherer: "you must control a Dragon as you are finished casting the spell to get the bonus. For example, if you lose control of your only Dragon while casting the spell (because, for example, you sacrificed it to activate a mana ability), you won’t get the bonus"). Also fixes Orator Ojutai not drawing a card at all when a Dragon is present on the battlefield. 2017-08-24 13:29:46 +00:00
Agetian
441693ac36 - Added a couple break statements. 2017-08-24 11:49:08 +00:00
Agetian
77910d82fc - Improved AI spending counters for Skullmane Baku. 2017-08-24 11:47:59 +00:00
Agetian
05258a5b48 - Some improvement to the AI for "remove X counters": made the Baku cards that are marked as RemRandomDeck (but not RemAIDeck) playable by the AI again, albeit some of them rather suboptimally. Quillmane Baku is not supported (but was already marked RemAIDeck). 2017-08-24 10:28:43 +00:00
Agetian
387abd1606 - Clarification for the new setting. 2017-08-24 05:51:16 +00:00
Agetian
3e4efc22a6 - Added an option to make planeswalker attacker targeting arrows somewhat darker to make them easier to see on the battlefield.
- Added code support to differentiate stack targeting arrows in color as well (currently not used).
2017-08-24 05:48:17 +00:00
Agetian
2851e51af8 - Fixed Izzet Chemister not having Haste. 2017-08-23 19:38:40 +00:00
Agetian
ad8ad35c03 - One more fix. 2017-08-23 19:37:21 +00:00
Agetian
20d27bb9b3 - Removed an unused parameter. 2017-08-23 19:37:00 +00:00
Agetian
30e878cbf9 - Fixed the previous commit. 2017-08-23 19:36:29 +00:00
Agetian
374f6fcc1b - Improvements to the Electrostatic Pummeler AI logic. 2017-08-23 19:35:45 +00:00
Agetian
4ea7d68bff - Oviya Pashiri event in Kaladesh: added missing lands. 2017-08-23 17:32:41 +00:00
Agetian
88491f61e2 - Some more improvements for Electrostatic Pummeler AI 2017-08-23 17:20:33 +00:00
Agetian
abe710f3ab - Some more fine-grained control over AILogic PayEnergyConservatively. 2017-08-23 15:16:47 +00:00
Agetian
3e4e87db23 - GameState: clear counters on planeswalkers and players before applying new ones from the game state. 2017-08-23 15:01:04 +00:00
Agetian
e7ca1a13a6 - Renamed a method. 2017-08-23 14:47:54 +00:00
Agetian
aca78410f6 - Moved a comment. 2017-08-23 14:47:24 +00:00
Agetian
989331cbb4 - Some improvements for Pump AI related to pump spells with pure energy cost, makes Electrostatic Pummeler a little better in AI's hands. 2017-08-23 14:45:01 +00:00
Agetian
7a8267a772 - A less reckless default AILogic PayEnergyConservatively for Longtusk Cub and Bristling Hydra (gives the AI a chance to use the energy for something else when possible). 2017-08-23 12:53:44 +00:00
Agetian
37ca383360 - Formatting code in DamageAllAi. 2017-08-23 08:52:51 +00:00
Agetian
90eb55fbf8 - Made DamageAllAi more multiplayer friendly + improved the logic for seeing if both a player can be killed and some more creatures can be dealt with in multiplayer environment.
- Marking ComputerUtil.getOpponentFor as deprecated and adding a comment about what it should be replaced with over time. Also, simplified its implementation since at the moment it's a functional synonym of getWeakestOpponent.
2017-08-23 08:51:28 +00:00
Agetian
e96c503b11 - DamageAllAi: prioritize killing the player off, if possible (e.g. Earthquake for X=1 to kill creatures or X=3 to kill a player). 2017-08-23 04:58:29 +00:00
Agetian
99ce6cf29d - isValid: A player who lost the game leaves it and can't be a valid target of spells or abilities. 2017-08-22 06:59:59 +00:00
Agetian
e14952607d - Fixed Kilnspire District. 2017-08-22 06:55:17 +00:00
Agetian
de3efa0fe7 - Fixed a typo. 2017-08-22 06:09:50 +00:00
Agetian
9af123523a - Further improvement to Wand of Ith prompt. 2017-08-22 06:09:31 +00:00
Agetian
7bc5adbde2 - Fixed an extra character at the EOL in Wand of Ith. 2017-08-22 06:08:32 +00:00
Agetian
5287978e2f - Fixed Wand of Ith triggering the opponent's Sangromancer when the Wand's controller forces that opponent to discard a card. 2017-08-22 06:04:46 +00:00
Agetian
d364cc0f51 - Improved the experimental attack evasion prediction by considering creatures with evasion first (further tweaking and testing in progress). 2017-08-22 05:10:11 +00:00
Agetian
e7c30da23c - Improved prompt for Wand of Ith. 2017-08-22 04:33:56 +00:00
Agetian
1e6467cf80 - Experimental: attempting to improve the AI choice for attrition attack when predicting possible opponent's forces with evasion (e.g. Flying). Currently enabled only for the Experimental AI profile for the testing period. 2017-08-21 17:29:57 +00:00
Agetian
12452c9b2a - Fixed the AI profile files. 2017-08-21 17:23:10 +00:00
Agetian
92b985d24d - Experimental: attempting to improve the AI choice for all-in assault for battlefield situations where the defender will have several, but not enough, defenders with evasion (e.g. Flying).
- Currently only enabled for the Experimental AI profile for the testing period.
2017-08-21 17:07:46 +00:00
Agetian
a0f640c739 - Some code maintenance. 2017-08-21 16:10:48 +00:00
Agetian
46ecbc9c42 - Dev Mode: added a new function "Remove Card from Game", which allows to completely remove a card from the game in case it was added previously by mistake. 2017-08-21 16:09:20 +00:00
Agetian
96f97e41e1 - Create a Puzzle: allow to choose to start the game either with the Human or with the AI player taking the first turn.
- Improved the opening warning message for this mode.
2017-08-21 15:52:57 +00:00
Agetian
5726f05531 - Comment fix. 2017-08-21 15:19:00 +00:00
Agetian
b389209c05 - Added a simple Create Puzzle mode to desktop Forge (presents you with a clean battlefield, allows to dump the game state with a template for puzzle metadata).
- Enhanced the Dev Mode feature set with the "Add Card To Library/Graveyard/Exile" commands.
- Ported this Dev Mode functionality, as well as "Exile Card From Hand/Play", to mobile Forge.
2017-08-21 15:17:41 +00:00
Agetian
a82b3fd88a - Removed debug print lines. 2017-08-21 11:25:30 +00:00
Agetian
04a125d20f - A somewhat more conservative and fine-grained approach at improving the token-generation AI logic. 2017-08-21 11:24:47 +00:00
Agetian
fc2e93a57f - Converted token generation ability activation chance for the AI into a profile variable (currently defaults to 100% for all profiles, pending testing). 2017-08-21 10:29:30 +00:00
Agetian
cfe9c17b58 - Experimental: TokenAi: do not use a "80% chance to generate a token" chance when the token-generating ability is otherwise relevant. Prevents the AI from missing activations of planeswalker token generation abilities on casting a planeswalker, as well as indecisively creating tokens via The Hive and other similar cards before Declare Blockers when on defense. Will run some tests with this later, or may convert to an AI profile variable. 2017-08-21 10:19:48 +00:00
Agetian
b24f31f98c - Fixed an issue with the new quest card price format and cards with multiple art index (e.g. Arcane Denial from ALL or basic lands). 2017-08-21 10:04:36 +00:00
Agetian
5263edc3e2 - Minor restructuring/update in Puzzle code. 2017-08-21 09:44:45 +00:00
Agetian
99b80cccad - Unified puzzle description for INQ01. 2017-08-21 06:50:18 +00:00
Agetian
9794c5a188 - Added puzzle INQ03 (Dead Man's Hand #03). 2017-08-21 06:46:36 +00:00
Agetian
2bd19736f4 - Added puzzle INQ02 (Dead Man's Hand #02). 2017-08-21 06:06:55 +00:00
Agetian
13376d0ced - Improved handling of script execution in GameState to support subabilities and KW Awaken (other keywords with mana cost might need similar treatment later). 2017-08-21 04:50:49 +00:00
Agetian
1aa8475295 - Added a special turn ID correction for puzzles that begin right before the beginning of the human's turn (e.g. INQ01).
- Added support for "Gain Control of Specified Permanents" goal type to Puzzle Mode.
2017-08-20 18:55:12 +00:00
Agetian
4bffe22f68 - Added puzzle INQ01 (Inquest Gamer - Dead Man's Hand #01). 2017-08-20 18:36:58 +00:00
Agetian
094941ab8c - Added support for Imprinted cards to GameState. 2017-08-20 17:51:29 +00:00
Agetian
1a1bcc8d5c - Added support for "Play the Specified Permanent" type objective to Puzzle Mode (e.g. Inquest puzzles). 2017-08-20 17:37:54 +00:00
Agetian
e77eb8a563 - Added a new C17 card to Kaladesh plane in Planar Conquest. 2017-08-20 16:17:17 +00:00
swordshine
c063ccfa02 - C17: Added Portal Mage 2017-08-20 15:31:20 +00:00
Agetian
b1ccb5c3de - Fixed a couple weirdly auto-formulated stack/prompt descriptions. 2017-08-20 15:07:11 +00:00
Agetian
29b4704c4b - Reverted adding Shining Shoal (misread how the card works, need prevention from source, will see if I can update the script later). 2017-08-20 11:59:26 +00:00
Agetian
931d7d55dd - Fixed description for Shining Shoal. 2017-08-20 11:45:52 +00:00
Agetian
2df0403c94 - Added Shining Shoal (uses the same scripting strategy as Captain's Maneuver). 2017-08-20 11:45:35 +00:00
Agetian
9cd878bad1 - More Volrath's Shapeshifter QoL. 2017-08-20 05:12:17 +00:00
Agetian
4c816eabc1 - Reverting an accidental experimental test line commit. 2017-08-20 04:24:38 +00:00
Agetian
d28cbf3863 - Some Volrath's Shapeshifter fixes and QoL improvements. 2017-08-20 04:23:11 +00:00
swordshine
6269719b70 - Fixed last commit 2017-08-20 03:28:03 +00:00
swordshine
8a347e71ed - C17: Added Alms Collector 2017-08-20 03:26:18 +00:00
Agetian
9c44662f2e - Fixed a NPE in the new AiController code. 2017-08-20 03:24:25 +00:00
Agetian
884291a8a3 - Fixed a PO2 challenge deck title and description. 2017-08-20 03:23:15 +00:00
Agetian
97428909a4 - Minor code style fix. 2017-08-19 19:38:10 +00:00
Agetian
a0bb52ff5f - Added Volrath's Shapeshifter with rudimentary, simple AI support.
- Was tested in most typical circumstances, including cloning it. However, may not yet be perfect in some corner cases. Improvements are welcome.
2017-08-19 18:05:44 +00:00
Agetian
1a766c3ccc - Fixed Edgar Markov. 2017-08-19 13:06:39 +00:00
Agetian
19bea70dc0 - Added an implementation note. 2017-08-19 09:18:14 +00:00
Agetian
322a7020e3 - Better fix for Aluren: detect zone granting permissions from the MayPlay card options themselves, not by card name.
- Fixed Qasali Ambusher.
2017-08-19 09:15:09 +00:00
Agetian
242444ecc9 - Attempting to fix Aluren. 2017-08-19 07:31:42 +00:00
Agetian
4820ebba84 - Added AILogic$ ExileGraveyards to more cards. 2017-08-19 06:05:09 +00:00
Agetian
7658481db2 - Slightly improved AI for Scavenger Grounds activated ability. 2017-08-19 06:02:34 +00:00
Agetian
f41644bc97 - Fixed Crook of Condemnation mana cost. 2017-08-19 03:41:54 +00:00
Agetian
2163eb5910 - Fixed the AI playability of Bargain. 2017-08-18 19:26:09 +00:00
Agetian
ffbaf1e54f - Added Rock Hydra. 2017-08-18 19:02:16 +00:00
Agetian
76ac47bbc6 - Preparing Forge for Android publish 1.6.2.001 [incremental]. 2017-08-18 17:15:11 +00:00
Blacksmith
d499f1af65 Clear out release files in preparation for next release 2017-08-18 17:12:17 +00:00
Blacksmith
a249eeab22 [maven-release-plugin] prepare for next development iteration 2017-08-18 17:07:15 +00:00
Blacksmith
712e7dbeb8 [maven-release-plugin] prepare release forge-1.6.2 2017-08-18 17:07:05 +00:00
Blacksmith
22571acd0c Update README.txt for release 2017-08-18 17:05:06 +00:00
Agetian
eba8d0bd80 - Adding support for C17 cards to Planar Conquest [part 2]. 2017-08-18 17:03:07 +00:00
Agetian
4b52dea65a - Adding support for C17 cards to Planar Conquest. Some commanders can be moved to other planes later once they're implemented (e.g. Mirri to Dominaria, etc.). 2017-08-18 17:01:41 +00:00
Agetian
a5eeaae0d0 - Prevent a NPE when trying to zoom a card before a single card is selected. 2017-08-18 15:23:08 +00:00
Agetian
0d85eb6b90 - Documenting changes in CHANGES.txt. 2017-08-18 15:20:37 +00:00
Agetian
3abb226b5c - Added a keyboard shortcut to zoom in/out of the card in desktop Forge (default Z). 2017-08-18 14:53:20 +00:00
Agetian
d38fdfb291 - Documenting changes in CHANGES.txt. 2017-08-18 14:35:58 +00:00
Agetian
a63361302d - Migrating C17 from upcoming to named folders. 2017-08-18 14:34:54 +00:00
Agetian
069dbce000 - Removed a P/T assignment from Abandoned Sarcophagus. 2017-08-18 14:32:39 +00:00
Agetian
5970c575c8 - [C17] Added Mirri, Weatherlight Duelist.
- Not sure if oneBlockerPerOpponent is better off as a global rule or a keyword, feel free to change it to a keyworded implementation if appropriate.
2017-08-18 11:32:22 +00:00
Agetian
6ba659ff55 - Fixed the second, third, etc. AI never blocking anything in multiplayer when multiple players are attacked at the same time. 2017-08-18 06:22:55 +00:00
Agetian
2c9f0e3c7d - Fixed the AI incorrectly considering sorcery-speed tap abilities like Outlast, thus never using them. 2017-08-18 06:07:37 +00:00
Agetian
06359b9d06 - A clarification in CHANGES.txt. 2017-08-18 04:00:58 +00:00
Maxmtg
7f31fd5092 Split forge script handlign code 2017-08-17 21:10:06 +00:00
Agetian
01cdd82cc5 - Documenting changes in CHANGES.txt. 2017-08-17 17:13:59 +00:00
Agetian
c6094cf3ee - Documenting changes in CHANGES.txt. 2017-08-17 16:39:55 +00:00
Agetian
2ba7da0486 - Conspiracy: enabling Conspiracy draft sets in block definitions. 2017-08-17 16:33:28 +00:00
Agetian
dcc0295b4b - Conspiracy: adding CN2 rankings. 2017-08-17 16:28:58 +00:00
Agetian
8632b0ffec - Conspiracy: a little restructuring of chooseCardName in PlayerControllerAi. 2017-08-17 15:34:23 +00:00
Agetian
bc0b69857a - Conspiracy: The AI should not spam all the conspiracies with the same card name, instead choosing a new name every time. 2017-08-17 15:31:32 +00:00
Agetian
198d48fd84 - Conspiracy: allow the player to look at his own face-down conspiracies. Properly hide the opponent's conspiracies (including the chosen name). Make the AI properly add drafted conspiracies to the [Conspiracy] section of the deck. 2017-08-17 14:52:36 +00:00
Agetian
e85d6bebd0 - Shuffle the zones after the initVariantZones call. 2017-08-17 12:37:54 +00:00
Agetian
0679d9a30f - Conspiracy: fixed the AI never putting any conspiracies into the command zone. Added some simple logic for the AI revealing conspiracies when a spell with the chosen name was cast during any given turn. 2017-08-17 12:31:27 +00:00
Agetian
b0584d4499 - Fixed Hidden Agenda conspiracy cards crashing the game and their reveal ability not working. 2017-08-17 11:50:21 +00:00
Agetian
51bfc37a27 - Updated description to puzzle PS_AKH4. 2017-08-17 07:01:55 +00:00
Agetian
c979b27653 - Added description to puzzle PS_AKH4. 2017-08-17 07:01:26 +00:00
Agetian
184f0fad99 - Added puzzle PS_AKH7 coded by Rooger. 2017-08-17 06:38:14 +00:00
Agetian
f9b88c2738 - Removed a comment that doesn't apply anymore. 2017-08-17 06:35:38 +00:00
Agetian
f47a679dda - Allow precasting specific SAs from cards by their ordinal number (allows e.g. precasting planeswalker abilities).
- Added puzzle PS_AKH0 scripted by Rooger.
2017-08-17 06:34:55 +00:00
Agetian
e5e56b5260 - Allow precasting specific SAs from cards when setting up game state (needed by Puzzle Mode game states). 2017-08-17 06:06:44 +00:00
Agetian
c62f6b41d2 - A more correct interpretation of 901.6+901.10: the next player in turn order should initPlane in a planechase game if the planar controller leaves the game. 2017-08-17 05:37:33 +00:00
Agetian
6b32c4997d - Fixed Selesnya Loft Gardens. 2017-08-17 04:56:27 +00:00
Agetian
cb89c96dac - Momir Basic: when auto-generating the deck, only update the original deck instead of fully overwriting it. Allows the Momir Basic variant to be used in conjunction with other variants, such as Planechase, without crashing Forge. 2017-08-17 04:51:43 +00:00
Agetian
b31ca263fd - Implemented rule 901.6 for Planechase games. Should fix an issue with the planar deck cards disappearing when a player loses the game on his or her own turn. 2017-08-17 04:13:32 +00:00
Agetian
a0451cfab0 - Added 2 puzzles coded by Xitax. 2017-08-17 03:45:11 +00:00
Maxmtg
4baecd9f79 hasProperty of SpellAbility moved to ForgeScript 2017-08-16 21:38:26 +00:00
Maxmtg
381851aba7 moved player's hasProperty to ForgeScript 2017-08-16 20:36:30 +00:00
Maxmtg
23d3d5973b Move hasProperty of Card to ForgeScript 2017-08-16 20:10:26 +00:00
Agetian
fcdf9cf2ec - Do not run the replacement handler query if defender damage is determined to be 0. 2017-08-16 13:34:49 +00:00
Agetian
9831236d79 - Combat AI: Query the replacement handler for possible damage prevention when trying to determine if a blocker can destroy the attacker (fixes e.g. the AI chump blocking an exerted Oketra's Avenger even though all damage is to be prevented). 2017-08-16 13:32:30 +00:00
Agetian
c644d6bf2f - Removed a duplicated comment. 2017-08-16 12:26:41 +00:00
Agetian
d82b008c33 - Removed a testing useless reference. 2017-08-16 12:25:58 +00:00
Agetian
d53f9e99af - Fixed a miscalculation and related NPE when trying to predict the bonus from Arahbo, Roar of the World.
- Some extra NPE prevention measures in related trigger processing code.
2017-08-16 12:25:23 +00:00
Agetian
870b168cea - Disposal Mummy trigger is not optional. 2017-08-16 08:54:25 +00:00
Agetian
094e2478f9 - C17 rule update: tokens can phase out and phase in now (August 11, 2017 release notes). 2017-08-16 06:40:06 +00:00
Agetian
110b9f5058 - Removing some extra spaces in Commander 2017 edition file. 2017-08-16 06:10:40 +00:00
Agetian
d959753641 - A more generic check for LKI in ChangesZone Battlefield->Graveyard triggers (e.g. Dross Scorpion). 2017-08-16 06:08:46 +00:00
Agetian
027ecf29ae - Experimental: check LKI for the ChangesZone trigger of Dross Scorpion (fixes interaction with cards equipped with cards providing the Artifact type, e.g. Firemaw Kavu + Silversilk Armor). Should this be the default behavior? 2017-08-16 05:08:56 +00:00
Agetian
d4392635bf - Added 2 puzzles coded by Xitax. 2017-08-16 04:53:38 +00:00
Agetian
c72370eff0 - Removed an unused line from a test. 2017-08-16 03:48:18 +00:00
Agetian
6b799be7dd - Added support for PhasedOut to GameState. 2017-08-16 03:47:54 +00:00
Maxmtg
244d5bba47 Moved hasProperty code (it's forge script parsing in fact) out of CardState object to keep the class clean. 2017-08-15 21:40:03 +00:00
Agetian
d539ddf018 - Documenting changes in CHANGES.txt. 2017-08-15 19:28:25 +00:00
Agetian
f279792273 - AI should not overprioritize Gavony Township, otherwise it locks itself on mana too much. 2017-08-15 19:19:10 +00:00
Agetian
aa4a793566 - Added AILogic$ Fight to Ambuscade. 2017-08-15 17:41:20 +00:00
Agetian
1aaa2340f8 - Menace: do not display reminder text in game (an evergreen keyword that has appeared with no reminder text for a while). 2017-08-15 16:29:41 +00:00
Agetian
329247391b - Integrating Oracle updates by Indigo Dragon. 2017-08-15 16:10:51 +00:00
Agetian
3fc5daef01 - Corrected descriptions for Embalm and Eternalize. 2017-08-15 16:07:41 +00:00
Agetian
e087d04c17 - Basic AI logic for Shadow of the Grave. 2017-08-15 14:45:53 +00:00
Agetian
a3a713b608 - Preparing Forge for Android publish 1.6.1.005 [incremental]. 2017-08-15 13:45:45 +00:00
Agetian
98251a8631 - Added puzzle PC_090115 coded by Xitax. 2017-08-15 13:40:16 +00:00
Agetian
b147a16487 - Simplified implementation of LastRemembered. 2017-08-15 11:06:54 +00:00
Agetian
411b86197a - RememberedLast->LastRemembered for consistency with FirstRemembered (+ move the code closer to FirstRemembered). 2017-08-15 11:05:25 +00:00
Agetian
8acab6b662 - Minor formatting fix. 2017-08-15 11:00:21 +00:00
Agetian
dba550550c - Shifting Shadow: use the last remembered object as a reattachment target for compatibility with cards that remember other things too (e.g. Myr Welder). 2017-08-15 10:59:48 +00:00
Agetian
74cfc733dd - Removed code from the previous implementation of Shifting Shadow which is no longer needed. 2017-08-15 10:35:40 +00:00
Agetian
23981accd1 - A cleaner and hopefully sturdier implementation of Shifting Shadow that avoids the need for an intermediate effect card. 2017-08-15 10:32:37 +00:00
Agetian
209f34124e - Fixed Grasp of the Hieromancer. 2017-08-15 07:14:11 +00:00
Agetian
14cff4facf - Fixed Kothophed, Soul Hoarder trigger description. 2017-08-15 07:08:10 +00:00
Agetian
dac089b0fb - Added puzzle PC_082515 coded by Xitax. 2017-08-15 06:54:24 +00:00
Agetian
52aeda7faf - Avoid using a dedicated special parameter for Shifting Shadow spell description override. 2017-08-15 06:49:10 +00:00
Agetian
5273f5c9b6 - NPE protection measures. 2017-08-15 06:40:18 +00:00
Agetian
d2a30ea049 - [C17] Added Shifting Shadow.
- One of the hackier/more complicated scripts, so may not be perfect, though was tested in most situations, including stealing the enchanted creature.
2017-08-15 06:35:08 +00:00
Agetian
716ba3eea8 - Fixed a miscalculation in DamageAllAi. 2017-08-15 04:42:59 +00:00
Agetian
5cece53e50 - Fixed Madcap Experiment and Heirloom Blade "...the rest on the bottom of your library in a random order" clause. 2017-08-14 14:53:24 +00:00
Agetian
ba73f8a323 - ChangeZoneAi: do not activate the AF if it'll try to put a creature on the battlefield that will end up with toughness below zero after it enters the battlefield (Reassembling Skeleton + Elesh Norn, Grand Cenobite). 2017-08-14 14:13:14 +00:00
Agetian
81379a49a7 - A better variable name for Magus of the Mind. 2017-08-14 11:14:07 +00:00
Agetian
77e4862b3e - Minor formatting fix. 2017-08-14 11:01:59 +00:00
Agetian
1a3bd2aa74 - [C17] Added Magus of the Mind. 2017-08-14 11:01:36 +00:00
Agetian
9997b4a2de - A somewhat more comprehensive anti-cheating solution for Cavern of Souls AI. 2017-08-14 05:15:30 +00:00
Agetian
74b12606ef - Prevent the AI from cheating with Cavern of Souls, paying an arbitrary amount of mana with it. 2017-08-14 04:50:22 +00:00
Hanmac
14d5034b8e make Worms of the Earth into a GlobalRuleChange 2017-08-13 18:35:10 +00:00
Agetian
8b282818e9 - Fixed a couple NPEs in mobile Forge when canceling a Sealed/Draft match with a specific opponent. 2017-08-13 15:47:27 +00:00
Agetian
48a4f8ba67 - [C17] Removed the TODO entries from Curses since they use RepeatEach now, which should theoretically work for multiple attackers when that is implemented. 2017-08-13 15:18:59 +00:00
Agetian
1dd048eed4 - A little update to the previous commit. 2017-08-13 15:15:18 +00:00
Agetian
e398d6af75 - [C17] updated Curses to work correctly for "you and the triggered attacking player". 2017-08-13 15:13:32 +00:00
Agetian
39b1c1f7e4 - Removed a couple empty lines in new scripts. 2017-08-13 14:21:37 +00:00
Agetian
ff78b384ac - [C17] Added Izzet Chemister. 2017-08-13 14:10:35 +00:00
Agetian
d45a6f94f5 - [C17] Added Galecaster Colossues, Kindred Boon, Kindred Dominance. 2017-08-13 10:37:50 +00:00
Agetian
48fe8d5762 - Fixed a mistype in the C17 edition definition file. 2017-08-13 10:10:45 +00:00
Agetian
36b493f03a - Puzzle Mode: don't award Challenge achievements in this mode (take two). 2017-08-13 09:46:51 +00:00
Agetian
670ccaf891 - [C17] Added the 5 Curse cards. Currently there is no way to ensure that they work correctly with multiple attackers since Forge doesn't support shared turns yet. If support for shared turns is introduced, this should work correctly if TriggeredAttackingPlayer is expanded to return multiple attackers or if a RepeatEach construct is introduced iterating over an array of all attackers. 2017-08-13 09:40:18 +00:00
Maxmtg
d16a48a1a2 Move booster generation code to a separate package 2017-08-13 09:01:45 +00:00
Maxmtg
3f4eedbeab clean up more warnings about unused fields 2017-08-13 08:29:54 +00:00
Maxmtg
ef3dd4a833 Remove unused imports - to decrease number of warning from IDE. 2017-08-13 08:26:42 +00:00
Agetian
fee074db42 - Added a basic NeedsToPlayVar to other Pacts. 2017-08-13 07:19:57 +00:00
Agetian
5463af7f60 - Added a basic NeedsToPlayVar to Pact of the Titan. 2017-08-13 07:17:03 +00:00
Agetian
b776cd4a91 - Added a basic NeedsToPlayVar to Pact of Negation. 2017-08-13 03:55:33 +00:00
Maxmtg
45945e839f fix more warnings 2017-08-13 02:25:48 +00:00
Maxmtg
043ad7e3aa simplify ConquestAwardPool 2017-08-13 02:19:15 +00:00
Maxmtg
d04e186dea more unused methods and imports removal 2017-08-13 01:44:36 +00:00
Maxmtg
4253365e03 Moved AIOption to ai package, where it belongs 2017-08-13 00:53:26 +00:00
Maxmtg
07437b7880 Clean up unused imports that popped up in eclipse warnings List 2017-08-13 00:40:48 +00:00
Maxmtg
5ddd007f67 Remove player.getOpponent method, route former calls from AI through ComputerUtil.getOpponentFor(player) 2017-08-13 00:27:26 +00:00
Agetian
814978a178 - Fixed a NPE related to one of the previous commits. 2017-08-12 16:15:30 +00:00
Agetian
5350e77125 - When a permanent leaves the battlefield, remove all changed keywords on it (fixes e.g. the results of Magical Hack on Leviathan still partially persisting after it dies and is reanimated by something). 2017-08-12 14:56:22 +00:00
Agetian
22e2e32377 - Some subtype corrections. 2017-08-12 14:13:29 +00:00
Agetian
58b2c36498 - Added a comprehensive map of plural card subtypes to their singular counterparts, to the best of my knowledge of how the plural forms are formed (please take a look and update if necessary). Needed for the correct function of text change effects with any type (e.g. Homing Sliver + New Blood).
- Added an exception for the card text generation for the compound subtype "Eldrazi Scion" (e.g. Kor Castigator).
2017-08-12 13:58:26 +00:00
Agetian
0e4af7dbcf - Kess, Dissident Mage: don't remember the instant/sorcery card in case it was bounced from stack to a zone other than graveyard (e.g. to hand via Remand). 2017-08-12 12:37:52 +00:00
Agetian
3aba1c5ccf - Added NeedsToPlay AI var to Vizier of Many Faces. 2017-08-12 10:56:51 +00:00
Agetian
44af80f336 - [C17] Added O-Kagachi, Vengeful Kami. 2017-08-12 09:53:55 +00:00
Agetian
4591f5b372 - Updated Commander 2017 edition file. 2017-08-12 09:30:22 +00:00
Agetian
2270b2a224 - Mairsil AI: do not cage the same card twice. 2017-08-12 05:42:07 +00:00
Agetian
4eb68aae77 - [C17] Added Kess, Dissident Mage.
- May not be perfect in some corner cases (not sure), feel free to improve.
2017-08-12 05:34:16 +00:00
Agetian
c92e3cca6b - Fixed Watchers of the Dead exiling everything from its activator's graveyard. 2017-08-12 04:22:40 +00:00
Agetian
13ba0121d7 - Use isEmpty() to test an empty string. 2017-08-11 17:31:46 +00:00
Agetian
be4943a9d6 - Added rudimentary AI logic for Mairsil, the Pretender. 2017-08-11 17:23:58 +00:00
Agetian
9484e3b52d - Initial Commander 2017 edition file by Indigo Dragon. 2017-08-11 16:51:07 +00:00
Agetian
ef731703e8 - [C17] Added Fortunate Few. 2017-08-11 16:49:19 +00:00
Agetian
11b86806de - [C17] Added Taigam, Sidisi's Hand. 2017-08-11 15:35:24 +00:00
Agetian
b872f59a01 - Improved text for Path of Ancestry. 2017-08-11 14:24:01 +00:00
Agetian
b2fc1cc1f2 - [C17] Added Path of Ancestry.
- Fixed Command Tower and Path of Ancestry generating 2 colorless mana in non-EDH matches.
2017-08-11 14:14:57 +00:00
Agetian
6907c9c550 - Keeping num final in CharmEffect. 2017-08-11 09:46:13 +00:00
Agetian
93701585f8 - Somewhat improved Vindictive Lich (still doesn't play ball with hexproofed opponents though). 2017-08-11 09:40:59 +00:00
Agetian
50e596e63a - Mairsil, the Pretender: made the activations per turn limit parameter more generic. 2017-08-11 08:24:09 +00:00
Agetian
51ece30c34 - [C17] added Vindictive Lich.
- Might need an additional CharmEffect update in case the fact that you can choose multiple modes even with one opponent (but in which case the triggered ability fails and fizzles) is incorrect behavior [not sure].
2017-08-11 08:17:31 +00:00
Agetian
110a078074 - Cleaned up Mairsil a bit more. 2017-08-10 17:15:22 +00:00
Agetian
85b222d9e2 - Cosmetic reorder of target types in Mairsil. 2017-08-10 17:14:47 +00:00
Agetian
c974d4f30a - [C17] Added Mairsil, the Pretender. 2017-08-10 17:10:40 +00:00
Agetian
75916a21a6 - Removed an unused reference. 2017-08-10 16:24:03 +00:00
Agetian
8e2fc40105 - Updated Mathas, Fiend Seeker. 2017-08-10 16:23:01 +00:00
Agetian
f81bd857ed - Updated the text for Kindred Summons. 2017-08-10 16:04:19 +00:00
Agetian
e7ac05db75 - [C17] added 12 cards coded by Marek. 2017-08-10 16:03:20 +00:00
Agetian
eb3f526a96 - Fixed ChangeTextEffect with specific new text. 2017-08-10 15:47:04 +00:00
Agetian
371b0bdce1 - Committing card script corrections by Marek. 2017-08-10 13:48:11 +00:00
Maxmtg
06e70e7476 clean up some unused imports, add final modifier to parameter used in a closure 2017-08-10 13:05:41 +00:00
Agetian
a748fe6610 - Fixed Arahbo, Roar of the World. 2017-08-10 09:35:08 +00:00
Agetian
f43dd4d3dc - Some fixes for puzzle PC_072115 [part 3]. 2017-08-10 05:44:11 +00:00
Agetian
9c01b18922 - Some fixes for puzzle PC_072115 [part 2]. 2017-08-10 05:43:30 +00:00
Agetian
932fd032e8 - Some fixes for puzzle PC_072115. 2017-08-10 05:43:02 +00:00
Hanmac
c392deaf38 GameAction: checkStaticAbilities do CDA first 2017-08-10 04:59:07 +00:00
Hanmac
c575c1bea3 game state: counters are enum map, using hash map might break something 2017-08-10 04:34:22 +00:00
Agetian
38ec5efa32 - Puzzle PC_072115: marked Rhox Maulers as Renowned. 2017-08-10 04:12:31 +00:00
Agetian
70764e73c3 - Added three puzzles coded by Xitax. 2017-08-10 04:07:47 +00:00
Agetian
03fd7fba79 - [C17] added Fractured Identity. 2017-08-09 13:17:38 +00:00
Agetian
33d56a287b - Do not show an empty "Remembered:" tag on cards on which ClearRemembered was run. 2017-08-09 13:16:41 +00:00
Agetian
c3523f93aa - Reverted an occasional commit. 2017-08-09 12:52:01 +00:00
Agetian
26f08c7a30 - [C17] added 7 cards coded by Marek. 2017-08-09 12:51:21 +00:00
Agetian
a3266cda45 - Committing card script corrections from Marek. 2017-08-09 12:49:59 +00:00
Agetian
80052fabe8 - Minor formatting fix. 2017-08-09 10:20:43 +00:00
Agetian
3819a845f0 - Improved token pictures for tokens generated by Fabricate. 2017-08-09 10:12:34 +00:00
Agetian
d66c0f2d61 - Fixed AF DestroyAll destroying cards that can't be destroyed in case those cards were granted indestructibility by another card that is destroyed first (e.g. Crested Sunmare + horse tokens and an attempted removal via a Wrath of God type effect). 2017-08-09 09:55:25 +00:00
Agetian
0bf9da71ab - Fixed Traverse the Outlands casting cost. 2017-08-08 14:59:16 +00:00
Agetian
a07ff51c68 - [C17] Added 9 cards implemented by Marek (all tested ingame). 2017-08-08 12:23:56 +00:00
Agetian
48faabee49 - Committing card script corrections by Marek. 2017-08-08 11:38:27 +00:00
Agetian
d2f9eeab12 - Rudimentary prediction for Insult // Injury double damage effect for the AI (currently done in a way similar to how several other effects are predicted, which is (a) suboptimal - needs to be figured out from the replacement effect itself; (b) needs to be moved out from the Card and Player classes into the AI class, probably ComputerUtilCombat). Feel free to improve. 2017-08-08 10:00:04 +00:00
Agetian
c8ba4f0379 - Added AI logic parameter to Duskmantle, House of Shadow 2017-08-08 09:29:56 +00:00
Agetian
fba0fe1866 - Preparing Forge for Android publish 1.6.1.004 [incremental/fixes]. 2017-08-08 05:16:16 +00:00
Agetian
9685b92bc9 - Fixed a NPE in QuestDuelReader. 2017-08-08 04:46:48 +00:00
Agetian
3ae9779eec - Removed a debug print line. 2017-08-08 04:45:12 +00:00
Agetian
ebbdc46305 - Fix imports. 2017-08-08 04:44:37 +00:00
Agetian
4fb1c866da - AI: Avoid infinitely activating AF Untap on another permanent that will then be used to untap the first one (e.g. 2x Kiora's Follower) 2017-08-08 04:44:05 +00:00
Agetian
431d5ef8a8 - Added support for Renowned and Monstrous X properties to GameState. 2017-08-08 04:12:49 +00:00
Agetian
174d1f7838 - Puzzle mode improvements: no triggers will now run when the game state is set up; triggers will run in combat if attackers are declared. 2017-08-08 04:07:18 +00:00
Hanmac
b57ecea305 kefnet should cleanup choosen card 2017-08-07 16:28:23 +00:00
Agetian
64f39dcb79 - Fixed Glarecaster and Mirrorwood Treefolk. 2017-08-07 08:01:14 +00:00
Agetian
86149145f6 - Extended support for single target precast spells in Puzzle Mode. 2017-08-07 07:42:33 +00:00
Agetian
f3c41e9a66 - Use the ";" delimiter for precast spell declarations. 2017-08-07 05:00:42 +00:00
Agetian
2a6723f8db - Fixed an occasional change. 2017-08-07 04:50:12 +00:00
Agetian
2bb8d8b52a - Some puzzle mode improvements. Added support for precasting simple (untargeted) spells at the beginning of the game via AIPrecast/HumanPrecast parameters. Added support for Flipped and Meld card states. 2017-08-07 04:49:24 +00:00
Agetian
ac86cf19a0 - Added puzzles PC_080415 and PC_081115 coded by Xitax. 2017-08-07 03:59:08 +00:00
Agetian
ae29fef6d4 - Solution attempt #2 for the delayed trigger activator bug: store the original delayed trigger activator and restore it before running the trigger if a stored value was found, in case it was previously overwritten by the AI routines (fixes e.g. Rainbow Vale). 2017-08-07 03:43:38 +00:00
Agetian
54486cb5be - Reverting 34942 for now, causes weird, hard to track side effects. Better solution needed. 2017-08-06 18:17:56 +00:00
Agetian
22e41df8ea - Fixed a NPE in HostedMatch. 2017-08-06 18:03:45 +00:00
Agetian
d6dfc2ffb6 - Attempting to fix a long-standing bug with the delayed triggers getting the wrong activator set at their resolution time (the AI was aggressively overwriting the activator via its SpellAbility simulation routines).
- Ensured that all callers of getOriginalAndAltCostAbilities both call setActivatingPlayer and then reset it to its original value if there was one after the simulation completes. Thus, an aggressive setActivatingPlayer inside getOriginalAndAltCostAbilities should not be necessary.
2017-08-06 11:52:03 +00:00
Agetian
cb9d0ce3ed - Rebalanced Vanellope von Schweetz 1 quest opponent.
- Added Ice King 1 quest opponent by tojammot.
2017-08-06 11:43:11 +00:00
Agetian
cef5117e29 - Fixed Guan Yu, Sainted Warrior [fixing an occasionally missed | ]. 2017-08-06 07:43:56 +00:00
Agetian
466af94499 - Fixed Guan Yu, Sainted Warrior. 2017-08-06 07:43:17 +00:00
Agetian
ab9dea6930 - Fixed Challenge achievements being awarded in Puzzle Mode. 2017-08-05 11:50:54 +00:00
Agetian
cc2c585a55 - Added missing break statement. 2017-08-05 10:18:51 +00:00
Agetian
f9b1a59368 - Minor goal specification according to description. 2017-08-05 10:17:04 +00:00
Agetian
23cbe917c2 - Improvements and fixes for the new puzzle goal. 2017-08-05 10:09:04 +00:00
Hanmac
971f9694da ForgeConstants: add missing Constants 2017-08-05 10:01:05 +00:00
Agetian
32f057fa26 - Added support for "Destroy Permanents" goal in puzzle mode.
- Added puzzle PC_042815 implemented by Xitax.
2017-08-05 09:58:27 +00:00
Agetian
8c7edaaca4 - Added support for "Destroy Permanents"/"Kill Creatures" goal in puzzle mode.
- Added puzzle PC_042815 implemented by Xitax.
2017-08-05 09:54:27 +00:00
Hanmac
205323200a PlaneswalkerArchivements and AltWinArchivements are not make in res/lists 2017-08-05 09:45:33 +00:00
Agetian
9b880eb669 - Fixed AI for Jace, Telepath Unbound -3 ability. 2017-08-05 03:53:16 +00:00
austinio7116
3ce53cedc8 Something funny happened when I committed this file - so trying again 2017-08-04 19:15:23 +00:00
austinio7116
37e44968dc Update to card-based random deck data to include post HOU Pro Tour decks 2017-08-04 19:13:28 +00:00
Agetian
4fb58bc005 - All Hallow's Eve trigger should act as an intervening if clause. 2017-08-04 17:29:51 +00:00
Agetian
b24832dd84 - All Hallow's Eve must return the creatures to the battlefield once the last counter is removed (without necessarily waiting till the next upkeep). 2017-08-04 17:20:41 +00:00
Agetian
57aa32f0c1 - Added Bow to My Command.
- Currently probably one of the most complicated scripts, utilizing a couple hacks to simulate the "tap creatures with power 8 or greater" triggered ability. Most likely needs, at least, an UnlessCost update to support the tapXType cost with total creature power, and also potentially another update when/if shared turns and shared decisions are implemented.
2017-08-04 16:15:28 +00:00
Agetian
60c20cc628 - Added Choose Your Demise. 2017-08-04 15:57:05 +00:00
Agetian
eaae999878 - Fixed Jace, Architect of Thought -2 ability not allowing to order the cards going to the bottom of the library. 2017-08-04 15:54:31 +00:00
Agetian
f0af71d8c0 - Removed an experimental test line.
- Fixed Hazduhr the Abbot out of sight trigger definition.
2017-08-04 10:39:05 +00:00
Agetian
b65fed7a0d - Minor fix in description generation. 2017-08-04 10:23:45 +00:00
Agetian
364205cd9b - Added Hazduhr the Abbot. 2017-08-04 10:22:41 +00:00
Agetian
081ea769a1 - Removed an unused variable. 2017-08-04 08:46:48 +00:00
Agetian
7fef69635f - Chain of Acid doesn't need a special AITgts specification. 2017-08-04 08:46:01 +00:00
Agetian
e3c3315873 - Improved the AI logic for Chain of Acid. 2017-08-04 08:43:47 +00:00
Agetian
bb0218d3c6 - Fixed the AI cheat-activating AF PutCounter with a sac cost without sacrificing anything (e.g. Extruder). 2017-08-04 07:27:41 +00:00
Agetian
4e3e721c5a - Fixed Imaginary Threats. 2017-08-04 04:27:10 +00:00
Agetian
79321a0ffb - AlwaysPlayAi: implement an overriding confirmAction (set to return always true since AlwaysPlay is meant to do exactly that). 2017-08-03 19:52:48 +00:00
Agetian
230644141a - Removed a debug print line. 2017-08-03 19:40:29 +00:00
Agetian
480fa113b7 - Account for "schemes can't be set in motion this turn" when trying to set the scheme in motion again. 2017-08-03 19:39:44 +00:00
Agetian
9016d937a3 - Added My Laughter Echoes.
- Some improvements to AF SetInMotion which may be necessary to support Bow To My Command (seems almost scriptable, but the tap unless cost won't work).
2017-08-03 19:38:40 +00:00
Agetian
a361576f8a - Added A Reckoning Approaches. 2017-08-03 17:44:48 +00:00
Agetian
bee695afd4 - Removed unnecessary cleanup from My Forces Are Innumerable. 2017-08-03 16:36:41 +00:00
Agetian
f3fcdf808f - Added My Forces Are Innumerable (may need extension if E01 shared turns and shared opponent decisions are ever implemented in Forge). 2017-08-03 16:36:05 +00:00
Agetian
8e469493ac - Added Liege of the Hollows. 2017-08-03 16:03:38 +00:00
Agetian
872df9ee70 - Added Make Yourself Useful. 2017-08-03 15:05:34 +00:00
Agetian
69806f1260 - Added Errant Minion. 2017-08-03 14:35:50 +00:00
Agetian
0a24feab13 - Corrected Chain of Silence picture SVar. 2017-08-03 14:30:21 +00:00
Agetian
e40766583e - Added Every Dream a Nightmare. 2017-08-03 14:29:54 +00:00
Agetian
fd3fb5041b - Added Chain of Silence. 2017-08-03 13:56:30 +00:00
Agetian
8ffcaf328e - Added Delight in the Hunt. 2017-08-03 13:38:59 +00:00
Agetian
5381e54469 - Corrected Chain of Acid oracle text and picture SVar. 2017-08-03 13:32:45 +00:00
Agetian
f571685648 - Chain of Smog should be optional.
- Added Chain of Acid.
2017-08-03 13:29:14 +00:00
Agetian
701d363e3c - FIXME: correct the host card of a RepeatSubAbility since sometimes it's set incorrectly after an interaction, such as after a copy effect has been applied to a SA with Repeat/RepeatEach (e.g. the original Clone Legion not resolving correctly after its copy from Swarm Intelligence resolves). Couldn't figure out why this issue is happening, please assist if possible in determining the source of the problem and fixing it such that this workaround hack is unnecessary. 2017-08-03 13:00:06 +00:00
Agetian
afa697031c - A more comprehensive set of origin zones for Worms of the Earth replacement effect (probably superfluous, but accounts for potentially possible weird interactions). 2017-08-03 12:55:39 +00:00
Agetian
7239c98a4c - Worms of the Earth ruling: if a permanent spell tries to ETB (from stack) as a land, it goes into its owner's graveyard instead. 2017-08-03 12:54:09 +00:00
Agetian
48c0297fe7 - Fixed Abandoned Sarcophagus activating from zones other than the battlefield. 2017-08-02 19:14:41 +00:00
Agetian
a02be14f1a - Preparing Forge for Android publish 1.6.1.003 [incremental/fixes]. 2017-08-02 07:35:57 +00:00
Agetian
a0b8c758b4 - Fixed a crash in mobile Forge when trying to display the deck conformance error message outside of the Edt thread. 2017-08-02 07:31:52 +00:00
Agetian
97a8029f74 - Formatting fix. 2017-08-02 04:33:49 +00:00
Agetian
4d6781b26b - Added two new puzzles by Xitax and updated/fixed another one. 2017-08-02 04:33:23 +00:00
Agetian
b2d24725de - Simplify Worms of the Earth code. 2017-08-02 04:20:24 +00:00
Krazy
b04ac67860 Make booster quest pool generation respect starting pool set selections 2017-08-02 01:42:01 +00:00
Agetian
61784fd48d - Documenting changes in CHANGES.txt. 2017-08-01 18:22:59 +00:00
Agetian
f29738a96b - Added For Each of You, a Gift. 2017-08-01 17:36:15 +00:00
Agetian
cb313ed513 - Some text update in Worms of the Earth. 2017-08-01 17:22:25 +00:00
Agetian
e23656a2cd - Added Worms of the Earth. 2017-08-01 17:20:50 +00:00
Agetian
8a39ff469f - Added Power Leak (for now, needs a special exclusion in the AI code to properly determine who the paying player is, otherwise the AI believes that it's the opponent who owns Power Leak in case it's cast by the opponent). 2017-08-01 16:52:26 +00:00
Agetian
89c369189a - Added two puzzles by Rooger that are now scriptable. 2017-08-01 10:29:37 +00:00
Agetian
1108c92beb - Fixed the timing of the puzzle description popup in desktop Forge. 2017-08-01 10:25:09 +00:00
Agetian
e43cfce016 - Improved and fixed the handling of game states inside combat phases (DA, DB), added a way to mark cards that are attacking in saved game states. 2017-08-01 10:10:15 +00:00
Agetian
5931b53896 - Removed an unused variable. 2017-08-01 08:26:35 +00:00
Agetian
020b31cb6f - Added goal type "Survive" to puzzle mode.
- Added two new puzzles from Rooger that are now scriptable.
2017-08-01 06:37:05 +00:00
Agetian
8fc41c4c45 - Added several puzzles by Rooger that are now scriptable. 2017-08-01 06:21:44 +00:00
Agetian
d9b3c2c15c - Added a comment. 2017-08-01 06:17:44 +00:00
Agetian
10a9825f82 - Fixed a bug that caused multiple attachments on the same permanent not to work in game states.
- Improved the game state support to handle remembered cards and ExiledWith.
2017-08-01 06:16:46 +00:00
Agetian
2bbe168200 - Script execution in GameState: look for other scripts to execute if one of the SVars was not found. 2017-07-31 12:01:53 +00:00
Agetian
d6e8a96b19 - Script execution in GameState: do not iterate over all SVars, just grab the necessary SVar directly. 2017-07-31 12:00:02 +00:00
Agetian
c34fae302e - Added a way to force execution of a portion of card script when setting up game state (needed for some puzzles that utilize cards that dynamically set up effects when they ETB, e.g. Suspension Field).
- Added PC_041415 puzzle by Xitax.
2017-07-31 05:27:15 +00:00
Agetian
7957135979 - Some description fixes in puzzles. 2017-07-31 04:57:14 +00:00
Agetian
c9330d0b7f - Added Portal Second Age quest world by Xyx. 2017-07-31 04:01:59 +00:00
Agetian
9df5fc12cd Added PC_063015 puzzle by Xitax. 2017-07-31 03:43:37 +00:00
Sol
dd64685049 Fix typo in Oasis Ritualist 2017-07-30 23:58:06 +00:00
Hanmac
eb54b90001 blade of the bloodchief: add missing References 2017-07-30 20:04:04 +00:00
Agetian
b1ba5790cc - Added some puzzles implemented by Xitax. Updated the naming scheme for puzzles from GatheringMagic.com. 2017-07-30 15:02:49 +00:00
Agetian
56d79f36dc - Fixed a crash when loading a game state with a misspelled card name (will now report the card name in the console instead of hard-crashing). 2017-07-30 11:14:32 +00:00
Agetian
bbcf7b638f - Added a TODO entry to GameState. 2017-07-30 10:47:27 +00:00
Agetian
94cc314738 - Preserve ChosenColors and ChosenType in game states. 2017-07-30 10:40:32 +00:00
Agetian
39eb6482e3 - Handle marked damage before the triggers are unsuppressed when applying game states. 2017-07-30 10:19:46 +00:00
Agetian
85e66ebd8a - Fixed marking damage in puzzle mode and game states.
- Fixed card attachment in puzzle mode not working correctly when attaching a card to a card belonging to a different player.
2017-07-30 08:27:16 +00:00
Agetian
322b7084ea - Use calculateAmount in AttachAi instead of a custom method. 2017-07-30 06:53:52 +00:00
Agetian
8ac2c0462a - Fixed a NPE in AttachAi related to processing negative count for X (e.g. -X in Quag Sickness). 2017-07-30 06:40:17 +00:00
Hanmac
24e2e29894 CardFactoryUtil: fixed Eternalize and nonManaCost 2017-07-30 06:07:43 +00:00
Sol
e00aeb39e5 Fix Manalith rarity 2017-07-29 23:41:10 +00:00
Hanmac
6ec2849bd5 fixed god pharaoh's gift, the haste is only until end of turm 2017-07-29 19:56:18 +00:00
Hanmac
698c9d2923 PlayAi: fixed non-final error 2017-07-29 19:53:28 +00:00
Hanmac
82f379ecbe fixed gate to the afterlife 2017-07-29 17:23:14 +00:00
Agetian
a502ceea53 - Added a way to preserve marked damage in game states and puzzles. 2017-07-29 17:04:26 +00:00
Agetian
53e4b39066 - Prevent a NPE in booster foil generation when the template does not contain any slots. 2017-07-29 13:47:50 +00:00
Agetian
fceea79323 - Fixed interaction between put/remove counter as a part of cost payment and cards that trigger on things dying from counters (e.g. Necroskitter + a creature dying to a -1/-1 counter placed as a part of cost payment). 2017-07-29 13:36:09 +00:00
Agetian
6adf49de45 Fixed AILogic$ Evasion for EffectAi causing the AI to play the relevant cards out of context (e.g. Gruul Charm with the "can't block" mode on an empty battlefield). 2017-07-29 11:42:46 +00:00
Hanmac
0b85346ac4 TriggerHandler: try to fix Splendid Reclamation and Valakut 2017-07-29 05:11:22 +00:00
Agetian
53f0544da8 - Alternative Cost for spells should be added to all spells on the card, not only the first spell ability (fixes interaction with split cards, among possibly other things). 2017-07-28 13:45:14 +00:00
Agetian
839ced1b32 - Use a separate AI logic for "Detain target nonland permanent". 2017-07-28 07:44:02 +00:00
Agetian
b6fcbba57d - Preparing Forge for Android publish 1.6.1.002 [incremental/bug fixes]. 2017-07-28 04:24:43 +00:00
Agetian
b7f220d02b - Formatting fix. 2017-07-28 04:20:19 +00:00
Agetian
398ae8946c - Fixed the AI targeting nonland permanents with no activated abilities with effects like Detain. 2017-07-28 04:19:06 +00:00
Agetian
65357e1441 - Added PC_07 puzzle by Xitax. Differentiated between early and late Perplexing Chimera puzzles in their naming scheme. 2017-07-28 03:26:03 +00:00
Agetian
0a7f579bd8 - Fixed split cards having transform arrows in deck editor. 2017-07-27 19:23:50 +00:00
Agetian
2e0d2bb5e5 - Minor formatting fix. 2017-07-27 18:31:51 +00:00
Agetian
0612d447dc - Fixed generation of Wastes in OGW fat packs and an associated crash when trying to foil a non-existent Wastes in such a fat pack. 2017-07-27 18:28:37 +00:00
Agetian
fd7e19d339 - Fixed the unfoiling of cards displayed in booster boxes, fat packs, etc. (take two) 2017-07-27 17:54:59 +00:00
Agetian
7f8dec161d - Minor clarification for Puzzle Mode on mobile. 2017-07-27 05:55:38 +00:00
Agetian
26f50d109a - Show the puzzle description in a pop-up dialog window when the puzzle starts. 2017-07-27 04:29:28 +00:00
Agetian
acfdf23c22 - Fixed the player's max hand size in Puzzle Mode being equal to 0 by default (now set to 7 per the default MTG rules).
- Fixed the "Turns:X" parameter not working correctly in Puzzle Mode.
2017-07-26 12:58:04 +00:00
Agetian
a15588120b - Attempting to fix IndexOutOfBounds exception in GauntletWinLose 2017-07-26 04:18:13 +00:00
Agetian
da28816967 - Updating cards with AddPower/AddToughness$ -X 2017-07-25 19:17:44 +00:00
Agetian
53bf9922ca - Added several new puzzles by Xitax. 2017-07-25 16:06:01 +00:00
Agetian
363ff9610d - Some comment update. 2017-07-25 16:02:12 +00:00
Agetian
772c9bc77d - Updated the test case for Death's Shadow. 2017-07-25 15:51:47 +00:00
Agetian
c1f10c32c0 - Optimized SVars in Death's Shadow. 2017-07-25 15:49:54 +00:00
Agetian
0a8c36e086 - Fixed Death's Shadow implementation to work correctly with the new StaticAbilityContinuous modification. 2017-07-25 15:48:54 +00:00
Agetian
ae35e4b589 - Added a test case for Death's Shadow on negative life under the new rules.
- Some clarifications in recent tests.
2017-07-25 15:32:10 +00:00
Agetian
92a760541b - Fixed StaticAbilityContinuous applying negative P/T bonuses for cards like Death's Shadow when player's life was negative (incorrect under the new rules). 2017-07-25 15:13:14 +00:00
Agetian
3c67546f4a - Fixed Desert's Hold AI prioritizing wrong targets. 2017-07-25 14:57:55 +00:00
Agetian
695670cc96 - Fixed Wall of Forgotten Pharaohs generated description. 2017-07-25 14:43:08 +00:00
Agetian
0f42aa4ec7 - Fixed Mechanized Production AI targeting legendary artifacts to no value. 2017-07-25 11:54:01 +00:00
Agetian
8aca69f845 - Fixed the foil effect in boosters not "unfoiling" itself for multiple cards with the same name in the same card set (e.g. in a booster box). 2017-07-25 03:28:51 +00:00
Agetian
63be38a3c3 - Added an ability to show puzzle descriptions on the puzzle goal card. 2017-07-25 03:14:40 +00:00
Agetian
e7f6e5c740 - Fixed Hour of Devastation number of booster pictures. 2017-07-25 03:13:45 +00:00
Agetian
2ae8d49ec8 - Fixed "Auto Yield: Always No" in mobile Forge. 2017-07-25 03:13:11 +00:00
Agetian
f9e987e933 - Reverted several Java 8 functions to their Java 7 counterparts for Android compatibility. 2017-07-25 03:12:04 +00:00
Agetian
8e9c76a9e8 - Fixed Mummy Paramount (non-optional). 2017-07-25 03:10:17 +00:00
Agetian
ad52b60798 - Preparing Forge for Android publish 1.6.1.001 [incremental]. 2017-07-22 03:44:09 +00:00
Blacksmith
012cc28f8a Clear out release files in preparation for next release 2017-07-22 00:51:42 +00:00
Blacksmith
1668717cf8 [maven-release-plugin] prepare for next development iteration 2017-07-22 00:46:25 +00:00
12946 changed files with 422595 additions and 403696 deletions

21682
.gitattributes vendored

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
<parent>
<artifactId>forge</artifactId>
<groupId>forge</groupId>
<version>1.6.1</version>
<version>1.6.7</version>
</parent>
<artifactId>forge-ai</artifactId>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>forge</artifactId>
<groupId>forge</groupId>
<version>1.6.7-SNAPSHOT</version>
</parent>
<artifactId>forge-ai</artifactId>
<name>Forge AI</name>
<dependencies>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-game</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,4 +1,4 @@
package forge;
package forge.ai;
public enum AIOption {
USE_SIMULATION;

View File

@@ -35,11 +35,13 @@ import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.combat.GlobalAttackRestrictions;
import forge.game.keyword.KeywordInterface;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.zone.ZoneType;
import forge.util.Expressions;
import forge.util.MyRandom;
import forge.util.collect.FCollectionView;
@@ -243,6 +245,19 @@ public class AiAttackController {
return false;
}
public final static Card getCardCanBlockAnAttacker(final Card c, final List<Card> attackers, final boolean nextTurn) {
final List<Card> attackerList = new ArrayList<Card>(attackers);
if (!c.isCreature()) {
return null;
}
for (final Card attacker : attackerList) {
if (CombatUtil.canBlock(attacker, c, nextTurn)) {
return attacker;
}
}
return null;
}
// this checks to make sure that the computer player doesn't lose when the human player attacks
// this method is used by getAttackers()
public final List<Card> notNeededAsBlockers(final Player ai, final List<Card> attackers) {
@@ -362,8 +377,12 @@ public class AiAttackController {
blockersLeft--;
continue;
}
totalAttack += ComputerUtilCombat.damageIfUnblocked(attacker, ai, null, false);
totalPoison += ComputerUtilCombat.poisonIfUnblocked(attacker, ai);
// Test for some special triggers that can change the creature in combat
Card effectiveAttacker = ComputerUtilCombat.applyPotentialAttackCloneTriggers(attacker);
totalAttack += ComputerUtilCombat.damageIfUnblocked(effectiveAttacker, ai, null, false);
totalPoison += ComputerUtilCombat.poisonIfUnblocked(effectiveAttacker, ai);
}
if (totalAttack > 0 && ai.getLife() <= totalAttack && !ai.cantLoseForZeroOrLessLife()) {
@@ -424,16 +443,45 @@ public class AiAttackController {
final Player opp = this.defendingOpponent;
for (Card attacker : attackers) {
if (!CombatUtil.canBeBlocked(attacker, this.blockers, null)
|| attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
unblockedAttackers.add(attacker);
// if true, the AI will attempt to identify which blockers will already be taken,
// thus attempting to predict how many creatures with evasion can actively block
boolean predictEvasion = false;
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
if (aic.getBooleanProperty(AiProps.COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION)) {
predictEvasion = true;
}
}
CardCollection accountedBlockers = new CardCollection(this.blockers);
CardCollection categorizedAttackers = new CardCollection();
if (predictEvasion) {
// split categorizedAttackers such that the ones with evasion come first and
// can be properly accounted for. Note that at this point the attackers need
// to be sorted by power already (see the Collections.sort call above).
categorizedAttackers.addAll(ComputerUtilCombat.categorizeAttackersByEvasion(this.attackers));
} else {
categorizedAttackers.addAll(this.attackers);
}
for (Card attacker : categorizedAttackers) {
if (!CombatUtil.canBeBlocked(attacker, accountedBlockers, null)
|| attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")) {
unblockedAttackers.add(attacker);
} else {
if (predictEvasion) {
List<Card> potentialBestBlockers = CombatUtil.getPotentialBestBlockers(attacker, accountedBlockers, null);
accountedBlockers.removeAll(potentialBestBlockers);
}
}
}
remainingAttackers.removeAll(unblockedAttackers);
for (Card blocker : this.blockers) {
if (blocker.hasKeyword("CARDNAME can block any number of creatures.")
|| blocker.hasKeyword("CARDNAME can block an additional ninety-nine creatures.")) {
|| blocker.hasKeyword("CARDNAME can block an additional ninety-nine creatures each combat.")) {
for (Card attacker : this.attackers) {
if (CombatUtil.canBlock(attacker, blocker)) {
remainingAttackers.remove(attacker);
@@ -449,7 +497,7 @@ public class AiAttackController {
if (remainingAttackers.isEmpty() || maxBlockersAfterCrew == 0) {
break;
}
if (blocker.hasKeyword("CARDNAME can block an additional creature.")) {
if (blocker.hasKeyword("CARDNAME can block an additional creature each combat.")) {
blockedAttackers.add(remainingAttackers.get(0));
remainingAttackers.remove(0);
maxBlockersAfterCrew--;
@@ -498,11 +546,16 @@ public class AiAttackController {
}
Player prefDefender = (Player) (defs.contains(this.defendingOpponent) ? this.defendingOpponent : defs.get(0));
final GameEntity entity = ai.getMustAttackEntity();
// Attempt to see if there's a defined entity that must be attacked strictly this turn...
GameEntity entity = ai.getMustAttackEntityThisTurn();
if (entity == null) {
// ...or during the attacking creature controller's turn
entity = ai.getMustAttackEntity();
}
if (null != entity) {
int n = defs.indexOf(entity);
if (-1 == n) {
System.out.println("getMustAttackEntity() returned something not in defenders.");
System.out.println("getMustAttackEntity() or getMustAttackEntityThisTurn() returned something not in defenders.");
return prefDefender;
} else {
return entity;
@@ -544,10 +597,21 @@ public class AiAttackController {
return;
}
// Aggro options
boolean playAggro = false;
int chanceToAttackToTrade = 0;
boolean tradeIfTappedOut = false;
int extraChanceIfOppHasMana = 0;
boolean tradeIfLowerLifePressure = false;
if (ai.getController().isAI()) {
playAggro = ((PlayerControllerAi) ai.getController()).getAi().getProperty(AiProps.PLAY_AGGRO).equals("true");
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
playAggro = aic.getBooleanProperty(AiProps.PLAY_AGGRO);
chanceToAttackToTrade = aic.getIntProperty(AiProps.CHANCE_TO_ATTACK_INTO_TRADE);
tradeIfTappedOut = aic.getBooleanProperty(AiProps.ATTACK_INTO_TRADE_WHEN_TAPPED_OUT);
extraChanceIfOppHasMana = aic.getIntProperty(AiProps.CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA);
tradeIfLowerLifePressure = aic.getBooleanProperty(AiProps.RANDOMLY_ATKTRADE_ONLY_ON_LOWER_LIFE_PRESSURE);
}
final boolean bAssault = this.doAssault(ai);
// TODO: detect Lightmine Field by presence of a card with a specific trigger
final boolean lightmineField = ComputerUtilCard.isPresentOnBattlefield(ai.getGame(), "Lightmine Field");
@@ -558,7 +622,11 @@ public class AiAttackController {
// TODO probably use AttackConstraints instead of only GlobalAttackRestrictions?
GlobalAttackRestrictions restrict = GlobalAttackRestrictions.getGlobalRestrictions(ai, combat.getDefenders());
final int attackMax = restrict.getMax();
int attackMax = restrict.getMax();
if (attackMax == -1) {
// check with the local limitations vs. the chosen defender
attackMax = ComputerUtilCombat.getMaxAttackersFor(defender);
}
if (attackMax == 0) {
// can't attack anymore
@@ -581,7 +649,8 @@ public class AiAttackController {
&& isEffectiveAttacker(ai, attacker, combat)) {
mustAttack = true;
} else {
for (String s : attacker.getKeywords()) {
for (KeywordInterface inst : attacker.getKeywords()) {
String s = inst.getOriginal();
if (s.equals("CARDNAME attacks each turn if able.")
|| s.startsWith("CARDNAME attacks specific player each combat if able")
|| s.equals("CARDNAME attacks each combat if able.")) {
@@ -590,7 +659,7 @@ public class AiAttackController {
}
}
}
if (mustAttack || attacker.getController().getMustAttackEntity() != null) {
if (mustAttack || attacker.getController().getMustAttackEntity() != null || attacker.getController().getMustAttackEntityThisTurn() != null) {
combat.addAttacker(attacker, defender);
attackersLeft.remove(attacker);
numForcedAttackers++;
@@ -711,7 +780,20 @@ public class AiAttackController {
}
}
for (final Card pCard : this.oppList) {
boolean predictEvasion = (ai.getController().isAI()
&& ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION));
CardCollection categorizedOppList = new CardCollection();
if (predictEvasion) {
// If predicting evasion, make sure that attackers with evasion are considered first
// (to avoid situations where the AI would predict his non-flyers to be blocked with
// flying creatures and then believe that flyers will necessarily be left unblocked)
categorizedOppList.addAll(ComputerUtilCombat.categorizeAttackersByEvasion(this.oppList));
} else {
categorizedOppList.addAll(this.oppList);
}
for (final Card pCard : categorizedOppList) {
// if the creature can attack next turn add it to counter attackers list
if (ComputerUtilCombat.canAttackNextTurn(pCard) && pCard.getNetCombatDamage() > 0) {
nextTurnAttackers.add(pCard);
@@ -719,8 +801,13 @@ public class AiAttackController {
humanForces += 1; // player forces they might use to attack
}
// increment player forces that are relevant to an attritional attack - includes walls
if (canBlockAnAttacker(pCard, candidateAttackers, true)) {
Card potentialOppBlocker = getCardCanBlockAnAttacker(pCard, candidateAttackers, true);
if (potentialOppBlocker != null) {
humanForcesForAttritionalAttack += 1;
if (predictEvasion) {
candidateAttackers.remove(potentialOppBlocker);
}
}
}
@@ -847,8 +934,18 @@ public class AiAttackController {
if (ratioDiff > 0 && doAttritionalAttack) {
this.aiAggression = 5; // attack at all costs
} else if ((ratioDiff >= 1 && this.attackers.size() > 1 && (humanLifeToDamageRatio < 2 || outNumber > 0))
|| (playAggro && humanLifeToDamageRatio > 1)) {
|| (playAggro && MyRandom.percentTrue(chanceToAttackToTrade) && humanLifeToDamageRatio > 1)) {
this.aiAggression = 4; // attack expecting to trade or damage player.
} else if (MyRandom.percentTrue(chanceToAttackToTrade) && humanLifeToDamageRatio > 1
&& defendingOpponent != null
&& ComputerUtil.countUsefulCreatures(ai) > ComputerUtil.countUsefulCreatures(defendingOpponent)
&& ai.getLife() > defendingOpponent.getLife()
&& !ComputerUtilCombat.lifeInDanger(ai, combat)
&& (ComputerUtilMana.getAvailableManaEstimate(ai) > 0) || tradeIfTappedOut
&& (ComputerUtilMana.getAvailableManaEstimate(defendingOpponent) == 0) || MyRandom.percentTrue(extraChanceIfOppHasMana)
&& (!tradeIfLowerLifePressure || (ai.getLifeLostLastTurn() + ai.getLifeLostThisTurn() <
defendingOpponent.getLifeLostThisTurn() + defendingOpponent.getLifeLostThisTurn()))) {
this.aiAggression = 4; // random (chance-based) attack expecting to trade or damage player.
} else if (ratioDiff >= 0 && this.attackers.size() > 1) {
this.aiAggression = 3; // attack expecting to make good trades or damage player.
} else if (ratioDiff + outNumber >= -1 || aiLifeToPlayerDamageRatio > 1
@@ -986,6 +1083,28 @@ public class AiAttackController {
boolean canBeBlocked = false;
int numberOfPossibleBlockers = 0;
// Is it a creature that has a more valuable ability with a tap cost than what it can do by attacking?
if ((attacker.hasSVar("NonCombatPriority"))
&& (!attacker.hasKeyword("Vigilance"))) {
// For each level of priority, enemy has to have life as much as the creature's power
// so a priority of 4 means the creature will not attack unless it can defeat that player in 4 successful attacks.
// the lower the priroity, the less willing the AI is to use the creature for attacking.
// TODO Somehow subtract expected damage of other attacking creatures from enemy life total (how? other attackers not yet declared? Can the AI guesstimate which of their creatures will not get blocked?)
if (attacker.getCurrentPower() * Integer.parseInt(attacker.getSVar("NonCombatPriority")) < ai.getOpponentsSmallestLifeTotal()) {
// Check if the card actually has an ability the AI can and wants to play, if not, attacking is fine!
boolean wantability = false;
for (SpellAbility sa : attacker.getSpellAbilities()) {
// Do not attack if we can afford using the ability.
if (sa.isAbility()) {
if (ComputerUtilCost.canPayCost(sa, ai)) {
return false;
}
// TODO Eventually The Ai will need to learn to predict if they have any use for the ability before next untap or not.
// TODO abilities that tap enemy creatures should probably only be saved if the enemy has nonzero creatures? Haste can be a threat though...
}
}
}
}
if (!this.isEffectiveAttacker(ai, attacker, combat)) {
return false;
@@ -995,8 +1114,10 @@ public class AiAttackController {
boolean hasCombatEffect = attacker.getSVar("HasCombatEffect").equals("TRUE")
|| "Blocked".equals(attacker.getSVar("HasAttackEffect"));
if (!hasCombatEffect) {
for (String keyword : attacker.getKeywords()) {
if (keyword.equals("Wither") || keyword.equals("Infect") || keyword.equals("Lifelink")) {
for (KeywordInterface inst : attacker.getKeywords()) {
String keyword = inst.getOriginal();
if (keyword.equals("Wither") || keyword.equals("Infect")
|| keyword.equals("Lifelink") || keyword.startsWith("Afflict")) {
hasCombatEffect = true;
break;
}
@@ -1029,7 +1150,8 @@ public class AiAttackController {
if (defender.getSVar("HasCombatEffect").equals("TRUE") || defender.getSVar("HasBlockEffect").equals("TRUE")) {
canKillAllDangerous = false;
} else {
for (String keyword : defender.getKeywords()) {
for (KeywordInterface inst : defender.getKeywords()) {
String keyword = inst.getOriginal();
if (keyword.equals("Wither") || keyword.equals("Infect") || keyword.equals("Lifelink")) {
canKillAllDangerous = false;
break;
@@ -1037,12 +1159,28 @@ public class AiAttackController {
// and combat will have negative effects
}
}
if (canKillAllDangerous
&& !hasAttackEffect && !hasCombatEffect
&& (this.attackers.size() <= defenders.size() || attacker.getNetPower() <= 0)) {
if (ai.getController().isAI()) {
if (((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.TRY_TO_AVOID_ATTACKING_INTO_CERTAIN_BLOCK)) {
// We can't kill a blocker, there is no reason to attack unless we can cripple a
// blocker or gain life from attacking or we have some kind of another attack/combat effect,
// or if we can deal damage to the opponent via the sheer number of potential attackers
// (note that the AI will sometimes still miscount here, and thus attack into a block,
// because there is no way to check which attackers are actually guaranteed to attack at this point)
canKillAllDangerous = false;
}
}
}
}
}
}
}
if (!attacker.hasKeyword("vigilance") && ComputerUtilCard.canBeKilledByRoyalAssassin(ai, attacker)) {
if (!attacker.hasKeyword("Vigilance") && ComputerUtilCard.canBeKilledByRoyalAssassin(ai, attacker)) {
canKillAllDangerous = false;
canBeKilled = true;
canBeKilledByOne = true;
@@ -1147,18 +1285,51 @@ public class AiAttackController {
}
if (sa.usesTargeting()) {
sa.setActivatingPlayer(c.getController());
if (CardUtil.getValidCardsToTarget(sa.getTargetRestrictions(), sa).isEmpty()) {
List<Card> validTargets = CardUtil.getValidCardsToTarget(sa.getTargetRestrictions(), sa);
if (validTargets.isEmpty()) {
missTarget = true;
break;
} else if (sa.isCurse() && CardLists.filter(validTargets,
CardPredicates.isControlledByAnyOf(c.getController().getOpponents())).isEmpty()) {
// e.g. Ahn-Crop Crasher - the effect is only good when aimed at opponent's creatures
missTarget = true;
break;
}
}
}
if (missTarget) {
continue;
}
if (random.nextBoolean()) {
// A specific AI condition for Exert: if specified on the card, the AI will always
// exert creatures that meet this condition
if (c.hasSVar("AIExertCondition")) {
if (!c.getSVar("AIExertCondition").isEmpty()) {
final String needsToExert = c.getSVar("AIExertCondition");
int x = 0;
int y = 0;
String sVar = needsToExert.split(" ")[0];
String comparator = needsToExert.split(" ")[1];
String compareTo = comparator.substring(2);
try {
x = Integer.parseInt(sVar);
} catch (final NumberFormatException e) {
x = CardFactoryUtil.xCount(c, c.getSVar(sVar));
}
try {
y = Integer.parseInt(compareTo);
} catch (final NumberFormatException e) {
y = CardFactoryUtil.xCount(c, c.getSVar(compareTo));
}
if (Expressions.compare(x, comparator, y)) {
shouldExert = true;
}
}
}
if (!shouldExert && random.nextBoolean()) {
// TODO Improve when the AI wants to use Exert powers
shouldExert = true;
}

View File

@@ -19,26 +19,20 @@ package forge.ai;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import forge.card.CardStateName;
import forge.game.CardTraitBase;
import forge.game.GameEntity;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.player.Player;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.collect.FCollectionView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
@@ -89,8 +83,10 @@ public class AiBlockController {
private List<Card> getSafeBlockers(final Combat combat, final Card attacker, final List<Card> blockersLeft) {
final List<Card> blockers = new ArrayList<>();
// We don't check attacker static abilities at this point since the attackers have already attacked and, thus,
// their P/T modifiers are active and are counted as a part of getNetPower/getNetToughness
for (final Card b : blockersLeft) {
if (!ComputerUtilCombat.canDestroyBlocker(ai, b, attacker, combat, false)) {
if (!ComputerUtilCombat.canDestroyBlocker(ai, b, attacker, combat, false, true)) {
blockers.add(b);
}
}
@@ -102,8 +98,10 @@ public class AiBlockController {
private List<Card> getKillingBlockers(final Combat combat, final Card attacker, final List<Card> blockersLeft) {
final List<Card> blockers = new ArrayList<>();
// We don't check attacker static abilities at this point since the attackers have already attacked and, thus,
// their P/T modifiers are active and are counted as a part of getNetPower/getNetToughness
for (final Card b : blockersLeft) {
if (ComputerUtilCombat.canDestroyAttacker(ai, attacker, b, combat, false)) {
if (ComputerUtilCombat.canDestroyAttacker(ai, attacker, b, combat, false, true)) {
blockers.add(b);
}
}
@@ -151,7 +149,7 @@ public class AiBlockController {
for (final Card c : attackers) {
sortedAttackers.add(c);
}
} else {
} else if (defender instanceof Player && defender.equals(ai)){
firstAttacker = combat.getAttackersOf(defender);
}
}
@@ -417,7 +415,8 @@ public class AiBlockController {
&& !ComputerUtilCombat.dealsFirstStrikeDamage(c, false, combat)) {
return false;
}
return lifeInDanger || ComputerUtilCard.evaluateCreature(c) + diff < ComputerUtilCard.evaluateCreature(attacker);
final boolean randomTrade = wouldLikeToRandomlyTrade(attacker, c, combat);
return lifeInDanger || ComputerUtilCard.evaluateCreature(c) + diff < ComputerUtilCard.evaluateCreature(attacker) || randomTrade;
}
});
if (usableBlockers.size() < 2) {
@@ -526,7 +525,56 @@ public class AiBlockController {
attackersLeft = (new ArrayList<>(currentAttackers));
}
private void makeGangNonLethalBlocks(final Combat combat) {
List<Card> currentAttackers = new ArrayList<>(attackersLeft);
List<Card> blockers;
// Try to block a Menace attacker with two blockers, neither of which will die
for (final Card attacker : attackersLeft) {
if (!attacker.hasKeyword("Menace") && !attacker.hasStartOfKeyword("CantBeBlockedByAmount LT2")) {
continue;
}
blockers = getPossibleBlockers(combat, attacker, blockersLeft, false);
List<Card> usableBlockers;
final List<Card> blockGang = new ArrayList<>();
int absorbedDamage; // The amount of damage needed to kill the first blocker
usableBlockers = CardLists.filter(blockers, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return c.getNetToughness() > attacker.getNetCombatDamage();
}
});
if (usableBlockers.size() < 2) {
return;
}
final Card leader = ComputerUtilCard.getWorstCreatureAI(usableBlockers);
blockGang.add(leader);
usableBlockers.remove(leader);
absorbedDamage = ComputerUtilCombat.getEnoughDamageToKill(leader, attacker.getNetCombatDamage(), attacker, true);
// consider a double block
for (final Card blocker : usableBlockers) {
final int absorbedDamage2 = ComputerUtilCombat.getEnoughDamageToKill(blocker, attacker.getNetCombatDamage(), attacker, true);
// only do it if neither blocking creature will die
if (absorbedDamage > attacker.getNetCombatDamage() && absorbedDamage2 > attacker.getNetCombatDamage()) {
currentAttackers.remove(attacker);
combat.addBlocker(attacker, blocker);
if (CombatUtil.canBlock(attacker, leader, combat)) {
combat.addBlocker(attacker, leader);
}
break;
}
}
}
attackersLeft = (new ArrayList<>(currentAttackers));
}
// Bad Trade Blocks (should only be made if life is in danger)
// Random Trade Blocks (performed randomly if enabled in profile and only when in favorable conditions)
/**
* <p>
* makeTradeBlocks.
@@ -546,18 +594,31 @@ public class AiBlockController {
|| attacker.hasKeyword("CARDNAME can't be blocked unless all creatures defending player controls block it.")) {
continue;
}
List<Card> possibleBlockers = getPossibleBlockers(combat, attacker, blockersLeft, true);
killingBlockers = getKillingBlockers(combat, attacker, possibleBlockers);
if (!killingBlockers.isEmpty() && ComputerUtilCombat.lifeInDanger(ai, combat)) {
if (ComputerUtilCombat.attackerHasThreateningAfflict(attacker, ai)) {
continue;
}
List<Card> possibleBlockers = getPossibleBlockers(combat, attacker, blockersLeft, true);
killingBlockers = getKillingBlockers(combat, attacker, possibleBlockers);
if (!killingBlockers.isEmpty()) {
final Card blocker = ComputerUtilCard.getWorstCreatureAI(killingBlockers);
boolean doTrade = false;
if (ComputerUtilCombat.lifeInDanger(ai, combat)) {
// Always trade when life in danger
doTrade = true;
} else {
// Randomly trade creatures with lower power and [hopefully] worse abilities, if enabled in profile
doTrade = wouldLikeToRandomlyTrade(attacker, blocker, combat);
}
if (doTrade) {
combat.addBlocker(attacker, blocker);
currentAttackers.remove(attacker);
}
}
}
attackersLeft = (new ArrayList<>(currentAttackers));
}
@@ -760,6 +821,105 @@ public class AiBlockController {
}
}
private void makeChumpBlocksToSavePW(Combat combat) {
if (ComputerUtilCombat.lifeInDanger(ai, combat) || ai.getLife() <= ai.getStartingLife() / 5) {
// most likely not worth trying to protect planeswalkers when at threateningly low life or in
// dangerous combat which threatens lethal or severe damage to face
return;
}
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
final int evalThresholdToken = aic.getIntProperty(AiProps.THRESHOLD_TOKEN_CHUMP_TO_SAVE_PLANESWALKER);
final int evalThresholdNonToken = aic.getIntProperty(AiProps.THRESHOLD_TOKEN_CHUMP_TO_SAVE_PLANESWALKER);
final boolean onlyIfLethal = aic.getBooleanProperty(AiProps.CHUMP_TO_SAVE_PLANESWALKER_ONLY_ON_LETHAL);
if (evalThresholdToken > 0 || evalThresholdNonToken > 0) {
// detect how much damage is threatened to each of the planeswalkers, see which ones would be
// worth protecting according to the AI profile properties
CardCollection threatenedPWs = new CardCollection();
for (final Card attacker : attackers) {
GameEntity def = combat.getDefenderByAttacker(attacker);
if (def instanceof Card) {
if (!onlyIfLethal) {
threatenedPWs.add((Card) def);
} else {
int damageToPW = 0;
for (final Card pwatkr : combat.getAttackersOf(def)) {
if (!combat.isBlocked(pwatkr)) {
damageToPW += ComputerUtilCombat.predictDamageTo((Card) def, pwatkr.getNetCombatDamage(), pwatkr, true);
}
}
if ((!onlyIfLethal && damageToPW > 0) || damageToPW >= ((Card) def).getCounters(CounterType.LOYALTY)) {
threatenedPWs.add((Card) def);
}
}
}
}
CardCollection pwsWithChumpBlocks = new CardCollection();
CardCollection chosenChumpBlockers = new CardCollection();
CardCollection chumpPWDefenders = CardLists.filter(new CardCollection(this.blockersLeft), new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.evaluateCreature(card) <= (card.isToken() ? evalThresholdToken
: evalThresholdNonToken);
}
});
CardLists.sortByPowerAsc(chumpPWDefenders);
if (!chumpPWDefenders.isEmpty()) {
for (final Card attacker : attackers) {
GameEntity def = combat.getDefenderByAttacker(attacker);
if (def instanceof Card && threatenedPWs.contains((Card) def)) {
if (attacker.hasKeyword("Trample")) {
// don't bother trying to chump a trampling creature
continue;
}
if (!combat.getBlockers(attacker).isEmpty()) {
// already blocked by something, no need to chump
continue;
}
Card blockerDecided = null;
for (final Card blocker : chumpPWDefenders) {
if (CombatUtil.canBlock(attacker, blocker, combat)) {
combat.addBlocker(attacker, blocker);
pwsWithChumpBlocks.add((Card) combat.getDefenderByAttacker(attacker));
chosenChumpBlockers.add(blocker);
blockerDecided = blocker;
blockersLeft.remove(blocker);
break;
}
}
chumpPWDefenders.remove(blockerDecided);
}
}
// check to see if we managed to cover all the blockers of the planeswalker; if not, bail
for (final Card pw : pwsWithChumpBlocks) {
CardCollection pwAttackers = combat.getAttackersOf(pw);
CardCollection pwDefenders = new CardCollection();
boolean isFullyBlocked = true;
if (!pwAttackers.isEmpty()) {
int damageToPW = 0;
for (Card pwAtk : pwAttackers) {
if (!combat.getBlockers(pwAtk).isEmpty()) {
pwDefenders.addAll(combat.getBlockers(pwAtk));
} else {
isFullyBlocked = false;
damageToPW += ComputerUtilCombat.predictDamageTo((Card) pw, pwAtk.getNetCombatDamage(), pwAtk, true);
}
}
if (!isFullyBlocked && damageToPW >= pw.getCounters(CounterType.LOYALTY)) {
for (Card chump : pwDefenders) {
if (chosenChumpBlockers.contains(chump)) {
combat.removeFromCombat(chump);
}
}
}
}
}
}
}
}
private void clearBlockers(final Combat combat, final List<Card> possibleBlockers) {
final List<Card> oldBlockers = combat.getAllBlockers();
@@ -824,7 +984,7 @@ public class AiBlockController {
List<Card> chumpBlockers;
diff = (ai.getLife() * 2) - 5; // This is the minimal gain for an unnecessary trade
if (ai.getController().isAI() && diff > 0 && ((PlayerControllerAi) ai.getController()).getAi().getProperty(AiProps.PLAY_AGGRO).equals("true")) {
if (ai.getController().isAI() && diff > 0 && ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.PLAY_AGGRO)) {
diff = 0;
}
@@ -856,9 +1016,8 @@ public class AiBlockController {
// When the AI holds some Fog effect, don't bother about lifeInDanger
if (!ComputerUtil.hasAFogEffect(ai)) {
lifeInDanger = ComputerUtilCombat.lifeInDanger(ai, combat);
if (lifeInDanger) {
makeTradeBlocks(combat); // choose necessary trade blocks
}
// if life is still in danger
if (lifeInDanger && ComputerUtilCombat.lifeInDanger(ai, combat)) {
makeChumpBlocks(combat); // choose necessary chump blocks
@@ -927,6 +1086,7 @@ public class AiBlockController {
// assign blockers that have to block
chumpBlockers = CardLists.getKeyword(blockersLeft, "CARDNAME blocks each turn if able.");
chumpBlockers.addAll(CardLists.getKeyword(blockersLeft, "CARDNAME blocks each combat if able."));
// if an attacker with lure attacks - all that can block
for (final Card blocker : blockersLeft) {
if (CombatUtil.mustBlockAnAttacker(blocker, combat)) {
@@ -940,7 +1100,8 @@ public class AiBlockController {
for (final Card blocker : blockers) {
if (CombatUtil.canBlock(attacker, blocker, combat) && blockersLeft.contains(blocker)
&& (CombatUtil.mustBlockAnAttacker(blocker, combat)
|| blocker.hasKeyword("CARDNAME blocks each turn if able."))) {
|| blocker.hasKeyword("CARDNAME blocks each turn if able.")
|| blocker.hasKeyword("CARDNAME blocks each combat if able."))) {
combat.addBlocker(attacker, blocker);
if (blocker.getMustBlockCards() != null) {
int mustBlockAmt = blocker.getMustBlockCards().size();
@@ -956,6 +1117,18 @@ public class AiBlockController {
}
}
}
// check to see if it's possible to defend a Planeswalker under attack with a chump block,
// unless life is low enough to be more worried about saving preserving the life total
if (ai.getController().isAI() && !ComputerUtilCombat.lifeInDanger(ai, combat)) {
makeChumpBlocksToSavePW(combat);
}
// if there are still blockers left, see if it's possible to block Menace creatures with
// non-lethal blockers that won't kill the attacker but won't die to it as well
makeGangNonLethalBlocks(combat);
//Check for validity of blocks in case something slipped through
for (Card attacker : attackers) {
if (!CombatUtil.canAttackerBeBlockedWithAmount(attacker, combat.getBlockers(attacker).size(), combat)) {
@@ -1056,4 +1229,91 @@ public class AiBlockController {
return first;
}
private boolean wouldLikeToRandomlyTrade(Card attacker, Card blocker, Combat combat) {
// Determines if the AI would like to randomly trade its blocker for the attacker in given combat
boolean enableRandomTrades = false;
boolean randomTradeIfBehindOnBoard = false;
boolean randomTradeIfCreatInHand = false;
int chanceModForEmbalm = 0;
int chanceToTradeToSaveWalker = 0;
int chanceToTradeDownToSaveWalker = 0;
int minRandomTradeChance = 0;
int maxRandomTradeChance = 0;
int maxCreatDiff = 0;
int maxCreatDiffWithRepl = 0;
int aiCreatureCount = 0;
int oppCreatureCount = 0;
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
enableRandomTrades = aic.getBooleanProperty(AiProps.ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK);
randomTradeIfBehindOnBoard = aic.getBooleanProperty(AiProps.RANDOMLY_TRADE_EVEN_WHEN_HAVE_LESS_CREATS);
randomTradeIfCreatInHand = aic.getBooleanProperty(AiProps.ALSO_TRADE_WHEN_HAVE_A_REPLACEMENT_CREAT);
minRandomTradeChance = aic.getIntProperty(AiProps.MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK);
maxRandomTradeChance = aic.getIntProperty(AiProps.MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK);
chanceModForEmbalm = aic.getIntProperty(AiProps.CHANCE_DECREASE_TO_TRADE_VS_EMBALM);
maxCreatDiff = aic.getIntProperty(AiProps.MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE);
maxCreatDiffWithRepl = aic.getIntProperty(AiProps.MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL);
chanceToTradeToSaveWalker = aic.getIntProperty(AiProps.CHANCE_TO_TRADE_TO_SAVE_PLANESWALKER);
chanceToTradeDownToSaveWalker = aic.getIntProperty(AiProps.CHANCE_TO_TRADE_DOWN_TO_SAVE_PLANESWALKER);
}
if (!enableRandomTrades) {
return false;
}
aiCreatureCount = ComputerUtil.countUsefulCreatures(ai);
if (!attackersLeft.isEmpty()) {
oppCreatureCount = ComputerUtil.countUsefulCreatures(attackersLeft.get(0).getController());
}
if (attacker.getOwner().equals(ai) && "6".equals(attacker.getSVar("SacMe"))) {
// Temporarily controlled object - don't trade with it
// TODO: find a more reliable way to figure out that control will be reestablished next turn
return false;
}
int numSteps = ai.getStartingLife() - 5; // e.g. 15 steps between 5 life and 20 life
float chanceStep = (maxRandomTradeChance - minRandomTradeChance) / numSteps;
int chance = (int)Math.max(minRandomTradeChance, (maxRandomTradeChance - (Math.max(5, ai.getLife() - 5)) * chanceStep));
if (chance > maxRandomTradeChance) {
chance = maxRandomTradeChance;
}
int evalAtk = ComputerUtilCard.evaluateCreature(attacker, true, false);
int evalBlk = ComputerUtilCard.evaluateCreature(blocker, true, false);
boolean atkEmbalm = (attacker.hasStartOfKeyword("Embalm") || attacker.hasStartOfKeyword("Eternalize")) && !attacker.isToken();
boolean blkEmbalm = (blocker.hasStartOfKeyword("Embalm") || blocker.hasStartOfKeyword("Eternalize")) && !blocker.isToken();
if (atkEmbalm && !blkEmbalm) {
// The opponent will eventually get his creature back, while the AI won't
chance = Math.max(0, chance - chanceModForEmbalm);
}
if (blocker.isFaceDown() && blocker.getState(CardStateName.Original).getType().isCreature()) {
// if the blocker is a face-down creature (e.g. cast via Morph, Manifest), evaluate it
// in relation to the original state, not to the Morph state
evalBlk = ComputerUtilCard.evaluateCreature(Card.fromPaperCard(blocker.getPaperCard(), ai), false, true);
}
int chanceToSavePW = chanceToTradeDownToSaveWalker > 0 && evalAtk + 1 < evalBlk ? chanceToTradeDownToSaveWalker : chanceToTradeToSaveWalker;
boolean powerParityOrHigher = blocker.getNetPower() <= attacker.getNetPower();
boolean creatureParityOrAllowedDiff = aiCreatureCount
+ (randomTradeIfBehindOnBoard ? maxCreatDiff : 0) >= oppCreatureCount;
boolean wantToTradeWithCreatInHand = randomTradeIfCreatInHand
&& !CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.Presets.CREATURES).isEmpty()
&& aiCreatureCount + maxCreatDiffWithRepl >= oppCreatureCount;
boolean wantToSavePlaneswalker = MyRandom.percentTrue(chanceToSavePW)
&& combat.getDefenderByAttacker(attacker) instanceof Card
&& ((Card) combat.getDefenderByAttacker(attacker)).isPlaneswalker();
boolean wantToTradeDownToSavePW = chanceToTradeDownToSaveWalker > 0;
if (((evalBlk <= evalAtk + 1) || (wantToSavePlaneswalker && wantToTradeDownToSavePW)) // "1" accounts for tapped.
&& powerParityOrHigher
&& (creatureParityOrAllowedDiff || wantToTradeWithCreatInHand)
&& (MyRandom.percentTrue(chance) || wantToSavePlaneswalker)) {
return true;
}
return false;
}
}

View File

@@ -41,17 +41,23 @@ import java.util.Set;
public class AiCardMemory {
private final Set<Card> memMandatoryAttackers;
private final Set<Card> memTrickAttackers;
private final Set<Card> memHeldManaSources;
private final Set<Card> memHeldManaSourcesForCombat;
private final Set<Card> memAttachedThisTurn;
private final Set<Card> memAnimatedThisTurn;
private final Set<Card> memBouncedThisTurn;
private final Set<Card> memActivatedThisTurn;
public AiCardMemory() {
this.memMandatoryAttackers = new HashSet<>();
this.memHeldManaSources = new HashSet<>();
this.memHeldManaSourcesForCombat = new HashSet<>();
this.memAttachedThisTurn = new HashSet<>();
this.memAnimatedThisTurn = new HashSet<>();
this.memBouncedThisTurn = new HashSet<>();
this.memActivatedThisTurn = new HashSet<>();
this.memTrickAttackers = new HashSet<>();
}
/**
@@ -61,10 +67,13 @@ public class AiCardMemory {
*/
public enum MemorySet {
MANDATORY_ATTACKERS,
HELD_MANA_SOURCES,
TRICK_ATTACKERS,
HELD_MANA_SOURCES_FOR_MAIN2,
HELD_MANA_SOURCES_FOR_DECLBLK,
ATTACHED_THIS_TURN,
ANIMATED_THIS_TURN,
BOUNCED_THIS_TURN,
ACTIVATED_THIS_TURN,
//REVEALED_CARDS // stub, not linked to AI code yet
}
@@ -72,14 +81,20 @@ public class AiCardMemory {
switch (set) {
case MANDATORY_ATTACKERS:
return memMandatoryAttackers;
case HELD_MANA_SOURCES:
case TRICK_ATTACKERS:
return memTrickAttackers;
case HELD_MANA_SOURCES_FOR_MAIN2:
return memHeldManaSources;
case HELD_MANA_SOURCES_FOR_DECLBLK:
return memHeldManaSourcesForCombat;
case ATTACHED_THIS_TURN:
return memAttachedThisTurn;
case ANIMATED_THIS_TURN:
return memAnimatedThisTurn;
case BOUNCED_THIS_TURN:
return memBouncedThisTurn;
case ACTIVATED_THIS_TURN:
return memActivatedThisTurn;
//case REVEALED_CARDS:
// return memRevealedCards;
default:
@@ -249,10 +264,13 @@ public class AiCardMemory {
*/
public void clearAllRemembered() {
clearMemorySet(MemorySet.MANDATORY_ATTACKERS);
clearMemorySet(MemorySet.HELD_MANA_SOURCES);
clearMemorySet(MemorySet.TRICK_ATTACKERS);
clearMemorySet(MemorySet.HELD_MANA_SOURCES_FOR_MAIN2);
clearMemorySet(MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK);
clearMemorySet(MemorySet.ATTACHED_THIS_TURN);
clearMemorySet(MemorySet.ANIMATED_THIS_TURN);
clearMemorySet(MemorySet.BOUNCED_THIS_TURN);
clearMemorySet(MemorySet.ACTIVATED_THIS_TURN);
}
// Static functions to simplify access to AI card memory of a given AI player.
@@ -265,6 +283,9 @@ public class AiCardMemory {
public static boolean isRememberedCard(Player ai, Card c, MemorySet set) {
return ((PlayerControllerAi)ai.getController()).getAi().getCardMemory().isRememberedCard(c, set);
}
public static boolean isRememberedCardByName(Player ai, String name, MemorySet set) {
return ((PlayerControllerAi)ai.getController()).getAi().getCardMemory().isRememberedCardByName(name, set);
}
public static void clearMemorySet(Player ai, MemorySet set) {
((PlayerControllerAi)ai.getController()).getAi().getCardMemory().clearMemorySet(set);
}

View File

@@ -17,14 +17,6 @@
*/
package forge.ai;
import java.security.InvalidParameterException;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.esotericsoftware.minlog.Log;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@@ -32,52 +24,31 @@ import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.ai.ability.ChangeZoneAi;
import forge.ai.ability.ExploreAi;
import forge.ai.simulation.SpellAbilityPicker;
import forge.card.MagicColor;
import forge.card.mana.ManaCost;
import forge.deck.CardPool;
import forge.deck.Deck;
import forge.deck.DeckSection;
import forge.game.CardTraitBase;
import forge.game.CardTraitPredicates;
import forge.game.Direction;
import forge.game.Game;
import forge.game.GameEntity;
import forge.game.GlobalRuleChange;
import forge.game.*;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.ability.SpellApiBased;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardFactoryUtil;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.card.CounterType;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostDiscard;
import forge.game.cost.CostPart;
import forge.game.cost.CostPutCounter;
import forge.game.cost.CostRemoveCounter;
import forge.game.cost.*;
import forge.game.mana.ManaCostBeingPaid;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.replacement.ReplaceMoved;
import forge.game.replacement.ReplacementEffect;
import forge.game.spellability.AbilityManaPart;
import forge.game.spellability.AbilitySub;
import forge.game.spellability.OptionalCost;
import forge.game.spellability.Spell;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityCondition;
import forge.game.spellability.SpellAbilityPredicates;
import forge.game.spellability.SpellPermanent;
import forge.game.spellability.*;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.trigger.WrappedAbility;
@@ -88,6 +59,10 @@ import forge.util.Expressions;
import forge.util.MyRandom;
import forge.util.collect.FCollectionView;
import java.security.InvalidParameterException;
import java.util.*;
import java.util.Map.Entry;
/**
* <p>
* AiController class.
@@ -605,11 +580,32 @@ public class AiController {
return null;
}
public void reserveManaSourcesForMain2(SpellAbility sa) {
public void reserveManaSources(SpellAbility sa) {
reserveManaSources(sa, PhaseType.MAIN2);
}
public void reserveManaSources(SpellAbility sa, PhaseType phaseType) {
ManaCostBeingPaid cost = ComputerUtilMana.calculateManaCost(sa, true, 0);
CardCollection manaSources = ComputerUtilMana.getManaSourcesToPayCost(cost, sa, player);
AiCardMemory.MemorySet memSet;
switch (phaseType) {
case MAIN2:
memSet = AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2;
break;
case COMBAT_DECLARE_BLOCKERS:
memSet = AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK;
break;
default:
System.out.println("Warning: unsupported mana reservation phase specified for reserveManaSources: "
+ phaseType.name() + ", reserving until Main 2 instead. Consider adding support for the phase if needed.");
memSet = AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2;
break;
}
for (Card c : manaSources) {
AiCardMemory.rememberCard(player, c, AiCardMemory.MemorySet.HELD_MANA_SOURCES);
AiCardMemory.rememberCard(player, c, memSet);
}
}
@@ -666,6 +662,11 @@ public class AiController {
if (sa instanceof SpellPermanent) {
return canPlayFromEffectAI((SpellPermanent)sa, false, true);
}
if (sa.usesTargeting() && !sa.isTargetNumberValid()) {
if (!sa.getTargetRestrictions().hasCandidates(sa, true)) {
return AiPlayDecision.TargetingFailed;
}
}
if (sa instanceof Spell) {
if (ComputerUtil.getDamageForPlaying(player, sa) >= player.getLife()
&& !player.cantLoseForZeroOrLessLife() && player.canLoseLife()) {
@@ -676,42 +677,34 @@ public class AiController {
return AiPlayDecision.WillPlay;
}
public boolean isNonDisabledCardInPlay(final String cardName) {
for (Card card : player.getCardsIn(ZoneType.Battlefield)) {
if (card.getName().equals(cardName)) {
// TODO - Better logic to detemine if a permanent is disabled by local effects
// currently assuming any permanent enchanted by another player
// is disabled and a second copy is necessary
// will need actual logic that determines if the enchantment is able
// to disable the permanent or it's still functional and a duplicate is unneeded.
boolean disabledByEnemy = false;
for (Card card2 : card.getEnchantedBy(false)) {
if (card2.getOwner() != player) {
disabledByEnemy = true;
}
}
if (!disabledByEnemy) {
return true;
}
}
}
return false;
}
private AiPlayDecision canPlaySpellBasic(final Card card, final SpellAbility sa) {
boolean isRightSplit = sa != null && sa.isRightSplit();
String needsToPlayName = isRightSplit ? "SplitNeedsToPlay" : "NeedsToPlay";
String needsToPlayVarName = isRightSplit ? "SplitNeedsToPlayVar": "NeedsToPlayVar";
if (card.hasSVar(needsToPlayName)) {
final String needsToPlay = card.getSVar(needsToPlayName);
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, needsToPlay.split(","), card.getController(), card, null);
if (list.isEmpty()) {
return AiPlayDecision.MissingNeededCards;
}
}
if (card.getSVar(needsToPlayVarName).length() > 0) {
final String needsToPlay = card.getSVar(needsToPlayVarName);
int x = 0;
int y = 0;
String sVar = needsToPlay.split(" ")[0];
String comparator = needsToPlay.split(" ")[1];
String compareTo = comparator.substring(2);
try {
x = Integer.parseInt(sVar);
} catch (final NumberFormatException e) {
x = CardFactoryUtil.xCount(card, card.getSVar(sVar));
}
try {
y = Integer.parseInt(compareTo);
} catch (final NumberFormatException e) {
y = CardFactoryUtil.xCount(card, card.getSVar(compareTo));
}
if (!Expressions.compare(x, comparator, y)) {
if ("True".equals(card.getSVar("NonStackingEffect")) && isNonDisabledCardInPlay(card.getName())) {
return AiPlayDecision.NeedsToPlayCriteriaNotMet;
}
}
return AiPlayDecision.WillPlay;
// add any other necessary logic to play a basic spell here
return ComputerUtilCard.checkNeedsToPlayReqs(card, sa);
}
// not sure "playing biggest spell" matters?
@@ -724,12 +717,31 @@ public class AiController {
int b1 = b.getPayCosts() == null ? 0 : b.getPayCosts().getTotalMana().getCMC();
// deprioritize planar die roll marked with AIRollPlanarDieParams:LowPriority$ True
if (ApiType.RollPlanarDice == a.getApi() && a.getHostCard().hasSVar("AIRollPlanarDieParams") && a.getHostCard().getSVar("AIRollPlanarDieParams").toLowerCase().matches(".*lowpriority\\$\\s*true.*")) {
if (ApiType.RollPlanarDice == a.getApi() && a.getHostCard() != null && a.getHostCard().hasSVar("AIRollPlanarDieParams") && a.getHostCard().getSVar("AIRollPlanarDieParams").toLowerCase().matches(".*lowpriority\\$\\s*true.*")) {
return 1;
} else if (ApiType.RollPlanarDice == b.getApi() && b.getHostCard().hasSVar("AIRollPlanarDieParams") && b.getHostCard().getSVar("AIRollPlanarDieParams").toLowerCase().matches(".*lowpriority\\$\\s*true.*")) {
} else if (ApiType.RollPlanarDice == b.getApi() && b.getHostCard() != null && b.getHostCard().hasSVar("AIRollPlanarDieParams") && b.getHostCard().getSVar("AIRollPlanarDieParams").toLowerCase().matches(".*lowpriority\\$\\s*true.*")) {
return -1;
}
// deprioritize pump spells with pure energy cost (can be activated last,
// since energy is generally scarce, plus can benefit e.g. Electrostatic Pummeler)
int a2 = 0, b2 = 0;
if (a.getApi() == ApiType.Pump && a.getPayCosts() != null && a.getPayCosts().getCostEnergy() != null) {
if (a.getPayCosts().hasOnlySpecificCostType(CostPayEnergy.class)) {
a2 = a.getPayCosts().getCostEnergy().convertAmount();
}
}
if (b.getApi() == ApiType.Pump && b.getPayCosts() != null && b.getPayCosts().getCostEnergy() != null) {
if (b.getPayCosts().hasOnlySpecificCostType(CostPayEnergy.class)) {
b2 = b.getPayCosts().getCostEnergy().convertAmount();
}
}
if (a2 == 0 && b2 > 0) {
return -1;
} else if (b2 == 0 && a2 > 0) {
return 1;
}
// cast 0 mana cost spells first (might be a Mox)
if (a1 == 0 && b1 > 0 && ApiType.Mana != a.getApi()) {
return -1;
@@ -737,9 +749,9 @@ public class AiController {
return 1;
}
if (a.getHostCard().hasSVar("FreeSpellAI")) {
if (a.getHostCard() != null && a.getHostCard().hasSVar("FreeSpellAI")) {
return -1;
} else if (b.getHostCard().hasSVar("FreeSpellAI")) {
} else if (b.getHostCard() != null && b.getHostCard().hasSVar("FreeSpellAI")) {
return 1;
}
@@ -752,8 +764,14 @@ public class AiController {
private int getSpellAbilityPriority(SpellAbility sa) {
int p = 0;
Card source = sa.getHostCard();
final Player ai = source.getController();
final Player ai = source == null ? sa.getActivatingPlayer() : source.getController();
if (ai == null) {
System.err.println("Error: couldn't figure out the activating player and host card for SA: " + sa);
return 0;
}
final boolean noCreatures = ai.getCreaturesInPlay().isEmpty();
if (source != null) {
// puts creatures in front of spells
if (source.isCreature()) {
p += 1;
@@ -762,25 +780,27 @@ public class AiController {
if (source.isEquipment() && noCreatures) {
p -= 9;
}
// use Surge and Prowl costs when able to
if (sa.isSurged() ||
(sa.getRestrictions().getProwlTypes() != null && !sa.getRestrictions().getProwlTypes().isEmpty())) {
p += 9;
}
// 1. increase chance of using Surge effects
// 2. non-surged versions are usually inefficient
if (sa.getHostCard().getOracleText().contains("surge cost") && !sa.isSurged()) {
if (source.getOracleText().contains("surge cost") && !sa.isSurged()) {
p -= 9;
}
// move snap-casted spells to front
if (source.isInZone(ZoneType.Graveyard)) {
if(sa.getMayPlay() != null && source.mayPlay(sa.getMayPlay()) != null) {
if (sa.getMayPlay() != null && source.mayPlay(sa.getMayPlay()) != null) {
p += 50;
}
}
// artifacts and enchantments with effects that do not stack
if ("True".equals(source.getSVar("NonStackingEffect")) && ai.isCardInPlay(source.getName())) {
p -= 9;
// if the profile specifies it, deprioritize Storm spells in an attempt to build up storm count
if (source.hasKeyword("Storm") && ai.getController() instanceof PlayerControllerAi) {
p -= (((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.PRIORITY_REDUCTION_FOR_STORM_SPELLS));
}
}
// use Surge and Prowl costs when able to
if (sa.isSurged() ||
(sa.getRestrictions().getProwlTypes() != null && !sa.getRestrictions().getProwlTypes().isEmpty())) {
p += 9;
}
// sort planeswalker abilities with most costly first
if (sa.getRestrictions().isPwAbility()) {
@@ -801,11 +821,6 @@ public class AiController {
p -= 9;
}
// if the profile specifies it, deprioritize Storm spells in an attempt to build up storm count
if (source.hasKeyword("Storm") && ai.getController() instanceof PlayerControllerAi) {
p -= (((PlayerControllerAi)ai.getController()).getAi().getIntProperty(AiProps.PRIORITY_REDUCTION_FOR_STORM_SPELLS));
}
// try to cast mana ritual spells before casting spells to maximize potential mana
if ("ManaRitual".equals(sa.getParam("AILogic"))) {
p += 9;
@@ -840,7 +855,36 @@ public class AiController {
sourceCard = sa.getHostCard();
if ("Always".equals(sa.getParam("AILogic")) && !validCards.isEmpty()) {
min = 1;
} else if ("VolrathsShapeshifter".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.VolrathsShapeshifter.targetBestCreature(player, sa);
}
if (sa.hasParam("AnyNumber")) {
if ("DiscardUncastableAndExcess".equals(sa.getParam("AILogic"))) {
CardCollection discards = new CardCollection();
final CardCollectionView inHand = player.getCardsIn(ZoneType.Hand);
final int numLandsOTB = CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS).size();
int numOppInHand = 0;
for (Player p : player.getGame().getPlayers()) {
if (p.getCardsIn(ZoneType.Hand).size() > numOppInHand) {
numOppInHand = p.getCardsIn(ZoneType.Hand).size();
}
}
for (Card c : inHand) {
if (c.hasSVar("DoNotDiscardIfAble") || c.hasSVar("IsReanimatorCard")) { continue; }
if (c.isCreature() && !ComputerUtilMana.hasEnoughManaSourcesToCast(c.getSpellPermanent(), player)) {
discards.add(c);
}
if ((c.isLand() && numLandsOTB >= 5) || (c.getFirstSpellAbility() != null && !ComputerUtilMana.hasEnoughManaSourcesToCast(c.getFirstSpellAbility(), player))) {
if (discards.size() + 1 <= numOppInHand) {
discards.add(c);
}
}
}
return discards;
}
}
}
// look for good discards
@@ -858,6 +902,9 @@ public class AiController {
}
if (prefCard == null) {
prefCard = ComputerUtil.getCardPreference(player, sourceCard, "DiscardCost", validCards);
if (prefCard != null && prefCard.hasSVar("DoNotDiscardIfAble")) {
prefCard = null;
}
}
if (prefCard != null) {
discardList.add(prefCard);
@@ -894,13 +941,52 @@ public class AiController {
if (numLandsInHand > 0) {
numLandsAvailable++;
}
//Discard unplayable card
if (validCards.get(0).getCMC() > numLandsAvailable) {
discardList.add(validCards.get(0));
validCards.remove(validCards.get(0));
boolean discardedUnplayable = false;
for (int j = 0; j < validCards.size(); j++) {
if (validCards.get(j).getCMC() > numLandsAvailable && !validCards.get(j).hasSVar("DoNotDiscardIfAble")) {
discardList.add(validCards.get(j));
validCards.remove(validCards.get(j));
discardedUnplayable = true;
break;
} else if (validCards.get(j).getCMC() <= numLandsAvailable) {
// cut short to avoid looping over cards which are guaranteed not to fit the criteria
break;
}
else { //Discard worst card
}
if (!discardedUnplayable) {
// discard worst card
Card worst = ComputerUtilCard.getWorstAI(validCards);
if (worst == null) {
// there were only instants and sorceries, and maybe cards that are not good to discard, so look
// for more discard options
worst = ComputerUtilCard.getCheapestSpellAI(validCards);
}
if (worst == null && !validCards.isEmpty()) {
// still nothing chosen, so choose the first thing that works, trying not to make DoNotDiscardIfAble
// discards
for (Card c : validCards) {
if (!c.hasSVar("DoNotDiscardIfAble")) {
worst = c;
break;
}
}
// Only DoNotDiscardIfAble cards? If we have a duplicate for something, discard it
if (worst == null) {
for (Card c : validCards) {
if (CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.nameEquals(c.getName())).size() > 1) {
worst = c;
break;
}
}
if (worst == null) {
// Otherwise just grab a random card and discard it
worst = Aggregates.random(validCards);
}
}
}
discardList.add(worst);
validCards.remove(worst);
}
@@ -1059,6 +1145,20 @@ public class AiController {
}
CardCollection landsWannaPlay = ComputerUtilAbility.getAvailableLandsToPlay(game, player);
CardCollection playBeforeLand = CardLists.filter(player.getCardsIn(ZoneType.Hand), new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return "true".equalsIgnoreCase(card.getSVar("PlayBeforeLandDrop"));
}
});
if (!playBeforeLand.isEmpty()) {
SpellAbility wantToPlayBeforeLand = chooseSpellAbilityToPlayFromList(ComputerUtilAbility.getSpellAbilities(playBeforeLand, player), false);
if (wantToPlayBeforeLand != null) {
return singleSpellAbilityList(wantToPlayBeforeLand);
}
}
if (landsWannaPlay != null) {
landsWannaPlay = filterLandsToPlay(landsWannaPlay);
Log.debug("Computer " + game.getPhaseHandler().getPhase().nameForUi);
@@ -1066,6 +1166,7 @@ public class AiController {
Card land = chooseBestLandToPlay(landsWannaPlay);
if (ComputerUtil.getDamageFromETB(player, land) < player.getLife() || !player.canLoseLife()
|| player.cantLoseForZeroOrLessLife() ) {
if (!game.getPhaseHandler().is(PhaseType.MAIN1) || !isSafeToHoldLandDropForMain2(land)) {
game.PLAY_LAND_SURROGATE.setHostCard(land);
final List<SpellAbility> abilities = Lists.newArrayList();
abilities.add(game.PLAY_LAND_SURROGATE);
@@ -1073,10 +1174,114 @@ public class AiController {
}
}
}
}
return singleSpellAbilityList(getSpellAbilityToPlay());
}
private boolean isSafeToHoldLandDropForMain2(Card landToPlay) {
if (!MyRandom.percentTrue(getIntProperty(AiProps.HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED))) {
// check against the chance specified in the profile
return false;
}
if (game.getPhaseHandler().getTurn() <= 2) {
// too obvious when doing it on the very first turn of the game
return false;
}
CardCollection inHand = CardLists.filter(player.getCardsIn(ZoneType.Hand),
Predicates.not(CardPredicates.Presets.LANDS));
CardCollectionView otb = player.getCardsIn(ZoneType.Battlefield);
if (getBooleanProperty(AiProps.HOLD_LAND_DROP_ONLY_IF_HAVE_OTHER_PERMS)) {
if (CardLists.filter(otb, Predicates.not(CardPredicates.Presets.LANDS)).isEmpty()) {
return false;
}
}
// TODO: improve the detection of taplands
boolean isTapLand = false;
for (ReplacementEffect repl : landToPlay.getReplacementEffects()) {
if (repl.getParamOrDefault("Description", "").equals("CARDNAME enters the battlefield tapped.")) {
isTapLand = true;
}
}
int totalCMCInHand = Aggregates.sum(inHand, CardPredicates.Accessors.fnGetCmc);
int minCMCInHand = Aggregates.min(inHand, CardPredicates.Accessors.fnGetCmc);
int predictedMana = ComputerUtilMana.getAvailableManaEstimate(player, true);
boolean canCastWithLandDrop = (predictedMana + 1 >= minCMCInHand) && !isTapLand;
boolean cantCastAnythingNow = predictedMana < minCMCInHand;
boolean hasRelevantAbsOTB = !CardLists.filter(otb, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
boolean isTapLand = false;
for (ReplacementEffect repl : card.getReplacementEffects()) {
// TODO: improve the detection of taplands
if (repl.getParamOrDefault("Description", "").equals("CARDNAME enters the battlefield tapped.")) {
isTapLand = true;
}
}
for (SpellAbility sa : card.getSpellAbilities()) {
if (sa.getPayCosts() != null && sa.isAbility()
&& sa.getPayCosts().getCostMana() != null
&& sa.getPayCosts().getCostMana().getMana().getCMC() > 0
&& (!sa.getPayCosts().hasTapCost() || !isTapLand)
&& (!sa.hasParam("ActivationZone") || sa.getParam("ActivationZone").contains("Battlefield"))) {
return true;
}
}
return false;
}
}).isEmpty();
boolean hasLandBasedEffect = !CardLists.filter(otb, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
for (Trigger t : card.getTriggers()) {
Map<String, String> params = t.getMapParams();
if ("ChangesZone".equals(params.get("Mode"))
&& params.containsKey("ValidCard")
&& !params.get("ValidCard").contains("nonLand")
&& ((params.get("ValidCard").contains("Land")) || (params.get("ValidCard").contains("Permanent")))
&& "Battlefield".equals(params.get("Destination"))) {
// Landfall and other similar triggers
return true;
}
}
for (String sv : card.getSVars().keySet()) {
String varValue = card.getSVar(sv);
if (varValue.startsWith("Count$Valid") || sv.equals("BuffedBy")) {
if (varValue.contains("Land") || varValue.contains("Plains") || varValue.contains("Forest")
|| varValue.contains("Mountain") || varValue.contains("Island") || varValue.contains("Swamp")
|| varValue.contains("Wastes")) {
// In presence of various cards that get buffs like "equal to the number of lands you control",
// safer for our AI model to just play the land earlier rather than make a blunder
return true;
}
}
}
return false;
}
}).isEmpty();
// TODO: add prediction for effects that will untap a tapland as it enters the battlefield
if (!canCastWithLandDrop && cantCastAnythingNow && !hasLandBasedEffect && (!hasRelevantAbsOTB || isTapLand)) {
// Hopefully there's not much to do with the extra mana immediately, can wait for Main 2
return true;
}
if ((predictedMana <= totalCMCInHand && canCastWithLandDrop) || (hasRelevantAbsOTB && !isTapLand) || hasLandBasedEffect) {
// Might need an extra land to cast something, or for some kind of an ETB ability with a cost or an
// alternative cost (if we cast it in Main 1), or to use an activated ability on the battlefield
return false;
}
return true;
}
private final SpellAbility getSpellAbilityToPlay() {
// if top of stack is owned by me
if (!game.getStack().isEmpty() && game.getStack().peekAbility().getActivatingPlayer().equals(player)) {
@@ -1306,7 +1511,7 @@ public class AiController {
+ MyRandom.getRandom().nextInt(3);
return Math.max(remaining, min) / 2;
} else if ("LowestLoseLife".equals(logic)) {
return MyRandom.getRandom().nextInt(Math.min(player.getLife() / 3, player.getOpponent().getLife())) + 1;
return MyRandom.getRandom().nextInt(Math.min(player.getLife() / 3, ComputerUtil.getOpponentFor(player).getLife())) + 1;
} else if ("HighestGetCounter".equals(logic)) {
return MyRandom.getRandom().nextInt(3);
} else if (source.hasSVar("EnergyToPay")) {
@@ -1428,6 +1633,24 @@ public class AiController {
} else {
break;
}
// Special case for Bow to My Command which simulates a complex tap cost via ChooseCard
// TODO: consider enhancing support for tapXType<Any/...> in UnlessCost to get rid of this hack
if ("BowToMyCommand".equals(sa.getParam("AILogic"))) {
if (!sa.getHostCard().getZone().is(ZoneType.Command)) {
// Make sure that other opponents do not tap for an already abandoned scheme
result.clear();
break;
}
int totPower = 0;
for (Card p : result) {
totPower += p.getNetPower();
}
if (totPower >= 8) {
break;
}
}
}
}
@@ -1553,8 +1776,12 @@ public class AiController {
if (useSimulation) {
return simPicker.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider);
}
if (sa.getApi() == ApiType.Explore) {
return ExploreAi.shouldPutInGraveyard(fetchList, decider);
} else {
return ChangeZoneAi.chooseCardToHiddenOriginChangeZone(destination, origin, sa, fetchList, player2, decider);
}
}
public List<SpellAbility> orderPlaySa(List<SpellAbility> activePlayerSAs) {
// list is only one or empty, no need to filter
@@ -1575,6 +1802,10 @@ public class AiController {
List<SpellAbility> evolve = filterList(putCounter, SpellAbilityPredicates.hasParam("Evolve"));
List<SpellAbility> token = filterListByApi(activePlayerSAs, ApiType.Token);
List<SpellAbility> pump = filterListByApi(activePlayerSAs, ApiType.Pump);
List<SpellAbility> pumpAll = filterListByApi(activePlayerSAs, ApiType.PumpAll);
// do mandatory discard early if hand is empty or has DiscardMe card
boolean discardEarly = false;
CardCollectionView playerHand = player.getCardsIn(ZoneType.Hand);
@@ -1583,6 +1814,11 @@ public class AiController {
result.addAll(mandatoryDiscard);
}
// token should be added first so they might get the pump bonus
result.addAll(token);
result.addAll(pump);
result.addAll(pumpAll);
// do Evolve Trigger before other PutCounter SpellAbilities
// do putCounter before Draw/Discard because it can cause a Draw Trigger
result.addAll(evolve);
@@ -1598,6 +1834,9 @@ public class AiController {
}
result.addAll(activePlayerSAs);
//need to reverse because of magic stack
Collections.reverse(result);
return result;
}

View File

@@ -63,8 +63,8 @@ public class AiCostDecision extends CostDecisionMakerBase {
@Override
public PaymentDecision visit(CostDiscard cost) {
final String type = cost.getType();
CardCollectionView hand = player.getCardsIn(ZoneType.Hand);
final CardCollectionView hand = player.getCardsIn(ZoneType.Hand);
if (type.equals("LastDrawn")) {
if (!hand.contains(player.getLastDrawnCard())) {
return null;
@@ -79,6 +79,9 @@ public class AiCostDecision extends CostDecisionMakerBase {
return PaymentDecision.card(source);
}
else if (type.equals("Hand")) {
if (hand.size() > 1 && ability.getActivatingPlayer() != null) {
hand = ability.getActivatingPlayer().getController().orderMoveToZoneList(hand, ZoneType.Graveyard);
}
return PaymentDecision.card(hand);
}
@@ -95,7 +98,11 @@ public class AiCostDecision extends CostDecisionMakerBase {
}
if (type.equals("Random")) {
return PaymentDecision.card(CardLists.getRandomSubList(new CardCollection(hand), c));
CardCollectionView randomSubset = CardLists.getRandomSubList(new CardCollection(hand), c);
if (randomSubset.size() > 1 && ability.getActivatingPlayer() != null) {
randomSubset = ability.getActivatingPlayer().getController().orderMoveToZoneList(randomSubset, ZoneType.Graveyard);
}
return PaymentDecision.card(randomSubset);
}
else {
final AiController aic = ((PlayerControllerAi)player.getController()).getAi();
@@ -340,6 +347,9 @@ public class AiCostDecision extends CostDecisionMakerBase {
if (source.getName().equals("Maralen of the Mornsong Avatar")) {
return PaymentDecision.number(2);
}
if (source.getName().equals("Necrologia")) {
return PaymentDecision.number(Integer.parseInt(ability.getSVar("ChosenX")));
}
return null;
} else {
c = AbilityUtils.calculateAmount(source, cost.getAmount(), ability);
@@ -373,6 +383,9 @@ public class AiCostDecision extends CostDecisionMakerBase {
@Override
public PaymentDecision visit(CostPutCardToLib cost) {
if (cost.payCostFromSource()) {
return PaymentDecision.card(source);
}
Integer c = cost.convertAmount();
final Game game = player.getGame();
CardCollection chosen = new CardCollection();
@@ -469,7 +482,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
CardCollectionView totap;
if (isVehicle) {
totalP = type.split("withTotalPowerGE")[1];
type = type.replace("+withTotalPowerGE" + totalP, "");
type = TextUtil.fastReplace(type, "+withTotalPowerGE", "");
totap = ComputerUtil.chooseTapTypeAccumulatePower(player, type, ability, !cost.canTapSource, Integer.parseInt(totalP), tapped);
} else {
totap = ComputerUtil.chooseTapType(player, type, source, !cost.canTapSource, c, tapped);

View File

@@ -21,6 +21,7 @@ import forge.LobbyPlayer;
import forge.util.Aggregates;
import forge.util.FileUtil;
import forge.util.TextUtil;
import org.apache.commons.lang3.ArrayUtils;
import java.io.File;
@@ -52,7 +53,7 @@ public class AiProfileUtil {
* @return the full relative path and file name for the given profile.
*/
private static String buildFileName(final String profileName) {
return String.format("%s/%s%s", AI_PROFILE_DIR, profileName, AI_PROFILE_EXT);
return TextUtil.concatNoSpace(AI_PROFILE_DIR, "/", profileName, AI_PROFILE_EXT);
}
/**

View File

@@ -29,20 +29,51 @@ public enum AiProps { /** */
DEFAULT_PLANAR_DIE_ROLL_CHANCE ("50"), /** */
MULLIGAN_THRESHOLD ("5"), /** */
PLANAR_DIE_ROLL_HESITATION_CHANCE ("10"),
HOLD_LAND_DROP_FOR_MAIN2_IF_UNUSED ("0"), /** */
HOLD_LAND_DROP_ONLY_IF_HAVE_OTHER_PERMS ("true"), /** */
CHEAT_WITH_MANA_ON_SHUFFLE ("false"),
MOVE_EQUIPMENT_TO_BETTER_CREATURES ("from_useless_only"),
MOVE_EQUIPMENT_CREATURE_EVAL_THRESHOLD ("60"),
PRIORITIZE_MOVE_EQUIPMENT_IF_USELESS ("true"),
PREDICT_SPELLS_FOR_MAIN2 ("true"), /** */
RESERVE_MANA_FOR_MAIN2_CHANCE ("0"), /** */
PLAY_AGGRO ("false"), /** */
MIN_SPELL_CMC_TO_COUNTER ("0"),
PLAY_AGGRO ("false"),
CHANCE_TO_ATTACK_INTO_TRADE ("40"), /** */
RANDOMLY_ATKTRADE_ONLY_ON_LOWER_LIFE_PRESSURE ("true"), /** */
ATTACK_INTO_TRADE_WHEN_TAPPED_OUT ("false"), /** */
CHANCE_TO_ATKTRADE_WHEN_OPP_HAS_MANA ("0"), /** */
TRY_TO_AVOID_ATTACKING_INTO_CERTAIN_BLOCK ("true"), /** */
TRY_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK ("false"), /** */
CHANCE_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK ("30"), /** */
ENABLE_RANDOM_FAVORABLE_TRADES_ON_BLOCK ("true"), /** */
RANDOMLY_TRADE_EVEN_WHEN_HAVE_LESS_CREATS ("false"), /** */
MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE ("1"), /** */
ALSO_TRADE_WHEN_HAVE_A_REPLACEMENT_CREAT ("true"), /** */
MAX_DIFF_IN_CREATURE_COUNT_TO_TRADE_WITH_REPL ("1"), /** */
MIN_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK ("30"), /** */
MAX_CHANCE_TO_RANDOMLY_TRADE_ON_BLOCK ("70"), /** */
CHANCE_DECREASE_TO_TRADE_VS_EMBALM ("30"), /** */
CHANCE_TO_TRADE_TO_SAVE_PLANESWALKER ("70"), /** */
CHANCE_TO_TRADE_DOWN_TO_SAVE_PLANESWALKER ("0"), /** */
THRESHOLD_TOKEN_CHUMP_TO_SAVE_PLANESWALKER ("135"), /** */
THRESHOLD_NONTOKEN_CHUMP_TO_SAVE_PLANESWALKER ("110"), /** */
CHUMP_TO_SAVE_PLANESWALKER_ONLY_ON_LETHAL ("true"), /** */
MIN_SPELL_CMC_TO_COUNTER ("0"), /** */
CHANCE_TO_COUNTER_CMC_1 ("50"), /** */
CHANCE_TO_COUNTER_CMC_2 ("75"), /** */
CHANCE_TO_COUNTER_CMC_3 ("100"), /** */
ALWAYS_COUNTER_OTHER_COUNTERSPELLS ("true"), /** */
ALWAYS_COUNTER_DAMAGE_SPELLS ("true"), /** */
ALWAYS_COUNTER_CMC_0_MANA_MAKING_PERMS ("true"), /** */
ALWAYS_COUNTER_REMOVAL_SPELLS ("true"), /** */
ALWAYS_COUNTER_PUMP_SPELLS ("true"), /** */
ALWAYS_COUNTER_AURAS ("true"), /** */
ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS (""), /** */
ACTIVELY_DESTROY_ARTS_AND_NONAURA_ENCHS ("false"), /** */
ACTIVELY_DESTROY_ARTS_AND_NONAURA_ENCHS ("true"), /** */
ACTIVELY_DESTROY_IMMEDIATELY_UNBLOCKABLE ("false"), /** */
DESTROY_IMMEDIATELY_UNBLOCKABLE_THRESHOLD ("2"), /** */
DESTROY_IMMEDIATELY_UNBLOCKABLE_ONLY_IN_DNGR ("true"), /** */
DESTROY_IMMEDIATELY_UNBLOCKABLE_LIFE_IN_DNGR ("5"), /** */
PRIORITY_REDUCTION_FOR_STORM_SPELLS ("0"), /** */
USE_BERSERK_AGGRESSIVELY ("false"), /** */
MIN_COUNT_FOR_STORM_SPELLS ("0"), /** */
@@ -50,7 +81,34 @@ public enum AiProps { /** */
STRIPMINE_MIN_LANDS_FOR_NO_TIMING_CHECK ("3"), /** */
STRIPMINE_MIN_LANDS_OTB_FOR_NO_TEMPO_CHECK ("6"), /** */
STRIPMINE_MAX_LANDS_TO_ATTEMPT_MANALOCKING ("3"), /** */
STRIPMINE_HIGH_PRIORITY_ON_SKIPPED_LANDDROP ("false"); /** */
STRIPMINE_HIGH_PRIORITY_ON_SKIPPED_LANDDROP ("false"),
TOKEN_GENERATION_ABILITY_CHANCE ("80"), /** */
TOKEN_GENERATION_ALWAYS_IF_FROM_PLANESWALKER ("true"), /** */
TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS ("true"), /** */
SCRY_NUM_LANDS_TO_STILL_NEED_MORE ("4"), /** */
SCRY_NUM_LANDS_TO_NOT_NEED_MORE ("7"), /** */
SCRY_NUM_CREATURES_TO_NOT_NEED_SUBPAR_ONES ("4"), /** */
SCRY_EVALTHR_CREATCOUNT_TO_SCRY_AWAY_LOWCMC ("3"), /** */
SCRY_EVALTHR_TO_SCRY_AWAY_LOWCMC_CREATURE ("160"), /** */
SCRY_EVALTHR_CMC_THRESHOLD ("3"), /** */
SCRY_IMMEDIATELY_UNCASTABLE_TO_BOTTOM ("false"), /** */
SCRY_IMMEDIATELY_UNCASTABLE_CMC_DIFF ("1"), /** */
COMBAT_ASSAULT_ATTACK_EVASION_PREDICTION ("true"), /** */
COMBAT_ATTRITION_ATTACK_EVASION_PREDICTION ("true"), /** */
CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT ("true"), /** */
CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY ("true"), /** */
BOUNCE_ALL_TO_HAND_CREAT_EVAL_DIFF ("200"), /** */
BOUNCE_ALL_ELSEWHERE_CREAT_EVAL_DIFF ("200"), /** */
BOUNCE_ALL_TO_HAND_NONCREAT_EVAL_DIFF ("3"), /** */
BOUNCE_ALL_ELSEWHERE_NONCREAT_EVAL_DIFF ("3"), /** */
INTUITION_ALTERNATIVE_LOGIC ("false"), /** */
EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD ("2"),
EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE("2"), /** */
// Experimental features, must be removed after extensive testing and, ideally, defaulting
// <-- There are no experimental options here -->
AI_IN_DANGER_THRESHOLD("4"),
AI_IN_DANGER_MAX_THRESHOLD("4");
private final String strDefaultVal;

View File

@@ -17,23 +17,9 @@
*/
package forge.ai;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.*;
import forge.ai.ability.ProtectAi;
import forge.ai.ability.TokenAi;
import forge.card.CardType;
@@ -46,32 +32,17 @@ import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.ability.effects.CharmEffect;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostDiscard;
import forge.game.cost.CostPart;
import forge.game.cost.CostPayment;
import forge.game.cost.CostPutCounter;
import forge.game.cost.CostSacrifice;
import forge.game.cost.*;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.replacement.ReplacementEffect;
import forge.game.replacement.ReplacementLayer;
import forge.game.spellability.AbilityManaPart;
import forge.game.spellability.AbilitySub;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.spellability.TargetRestrictions;
import forge.game.spellability.*;
import forge.game.staticability.StaticAbility;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
@@ -79,7 +50,11 @@ import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import forge.util.MyRandom;
import forge.util.TextUtil;
import forge.util.collect.FCollection;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
/**
@@ -99,15 +74,27 @@ public class ComputerUtil {
final Card source = sa.getHostCard();
if (sa.isSpell() && !source.isCopiedSpell()) {
if (source.getType().hasStringType("Arcane")) {
sa = AbilityUtils.addSpliceEffects(sa);
if (sa.getSplicedCards() != null && !sa.getSplicedCards().isEmpty() && ai.getController().isAI()) {
// we need to reconsider and retarget the SA after additional SAs have been added onto it via splice,
// otherwise the AI will fail to add the card to stack and that'll knock it out of the game
sa.resetTargets();
if (((PlayerControllerAi) ai.getController()).getAi().canPlaySa(sa) != AiPlayDecision.WillPlay) {
// for whatever reason the AI doesn't want to play the thing with the spliced subs anymore,
// proceeding past this point may result in an illegal play
return false;
}
}
}
source.setCastSA(sa);
sa.setLastStateBattlefield(game.getLastStateBattlefield());
sa.setLastStateGraveyard(game.getLastStateGraveyard());
sa.setHostCard(game.getAction().moveToStack(source, sa));
}
if (source.getType().hasStringType("Arcane")) {
sa = AbilityUtils.addSpliceEffects(sa);
}
}
sa.resetPaidHash();
if (sa.getApi() == ApiType.Charm && !sa.isWrapper()) {
CharmEffect.makeChoices(sa);
@@ -192,7 +179,7 @@ public class ComputerUtil {
if (unless != null && !unless.endsWith(">")) {
final int amount = AbilityUtils.calculateAmount(source, unless, sa);
final int usableManaSources = ComputerUtilMana.getAvailableMana(ai.getOpponent(), true).size();
final int usableManaSources = ComputerUtilMana.getAvailableManaSources(ComputerUtil.getOpponentFor(ai), true).size();
// If the Unless isn't enough, this should be less likely to be used
if (amount > usableManaSources) {
@@ -310,18 +297,20 @@ public class ComputerUtil {
public static Card getCardPreference(final Player ai, final Card activate, final String pref, final CardCollection typeList) {
final Game game = ai.getGame();
String prefDef = "";
if (activate != null) {
prefDef = activate.getSVar("AIPreference");
final String[] prefGroups = activate.getSVar("AIPreference").split("\\|");
for (String prefGroup : prefGroups) {
final String[] prefValid = prefGroup.trim().split("\\$");
if (prefValid[0].equals(pref)) {
final CardCollection prefList = CardLists.getValidCards(typeList, prefValid[1].split(","), activate.getController(), activate, null);
if (prefValid[0].equals(pref) && !prefValid[1].startsWith("Special:")) {
CardCollection overrideList = null;
if (activate.hasSVar("AIPreferenceOverride")) {
overrideList = CardLists.getValidCards(typeList, activate.getSVar("AIPreferenceOverride"), activate.getController(), activate, null);
}
for (String validItem : prefValid[1].split(",")) {
final CardCollection prefList = CardLists.getValidCards(typeList, validItem, activate.getController(), activate, null);
int threshold = getAIPreferenceParameter(activate, "CreatureEvalThreshold");
int minNeeded = getAIPreferenceParameter(activate, "MinCreaturesBelowThreshold");
@@ -345,12 +334,13 @@ public class ComputerUtil {
}
}
if (!prefList.isEmpty()) {
if (!prefList.isEmpty() || (overrideList != null && !overrideList.isEmpty())) {
return ComputerUtilCard.getWorstAI(overrideList == null ? prefList : overrideList);
}
}
}
}
}
if (pref.contains("SacCost")) {
// search for permanents with SacMe. priority 1 is the lowest, priority 5 the highest
for (int ip = 0; ip < 6; ip++) {
@@ -411,6 +401,11 @@ public class ComputerUtil {
}
}
// Survival of the Fittest logic
if (prefDef.contains("DiscardCost$Special:SurvivalOfTheFittest")) {
return SpecialCardAi.SurvivalOfTheFittest.considerDiscardTarget(ai);
}
// Discard lands
final CardCollection landsInHand = CardLists.getType(typeList, "Land");
if (!landsInHand.isEmpty()) {
@@ -707,6 +702,8 @@ public class ComputerUtil {
return sacrificed; // sacrifice none
}
}
boolean exceptSelf = "ExceptSelf".equals(source.getParam("AILogic"));
boolean removedSelf = false;
if (isOptional && source.hasParam("Devour") || source.hasParam("Exploit") || considerSacLogic) {
if (source.hasParam("Exploit")) {
@@ -764,11 +761,22 @@ public class ComputerUtil {
final int max = Math.min(remaining.size(), amount);
if (exceptSelf) {
removedSelf = remaining.remove(source.getHostCard());
}
for (int i = 0; i < max; i++) {
Card c = chooseCardToSacrifice(remaining, ai, destroy);
remaining.remove(c);
if (c != null) {
sacrificed.add(c);
}
}
if (sacrificed.isEmpty() && removedSelf) {
sacrificed.add(source.getHostCard());
}
return sacrificed;
}
@@ -848,11 +856,11 @@ public class ComputerUtil {
continue; // Won't play ability
}
if (!ComputerUtilCost.checkSacrificeCost(controller, abCost, c)) {
if (!ComputerUtilCost.checkSacrificeCost(controller, abCost, c, sa)) {
continue; // Won't play ability
}
if (!ComputerUtilCost.checkCreatureSacrificeCost(controller, abCost, c)) {
if (!ComputerUtilCost.checkCreatureSacrificeCost(controller, abCost, c, sa)) {
continue; // Won't play ability
}
}
@@ -868,7 +876,7 @@ public class ComputerUtil {
}
} catch (final Exception ex) {
throw new RuntimeException(String.format("There is an error in the card code for %s:%s", c.getName(), ex.getMessage()), ex);
throw new RuntimeException(TextUtil.concatNoSpace("There is an error in the card code for ", c.getName(), ":", ex.getMessage()), ex);
}
}
}
@@ -907,7 +915,7 @@ public class ComputerUtil {
}
}
} catch (final Exception ex) {
throw new RuntimeException(String.format("There is an error in the card code for %s:%s", c.getName(), ex.getMessage()), ex);
throw new RuntimeException(TextUtil.concatNoSpace("There is an error in the card code for ", c.getName(), ":", ex.getMessage()), ex);
}
}
}
@@ -917,16 +925,12 @@ public class ComputerUtil {
public static boolean castPermanentInMain1(final Player ai, final SpellAbility sa) {
final Card card = sa.getHostCard();
if ("True".equals(card.getSVar("NonStackingEffect")) && card.getController().isCardInPlay(card.getName())) {
return false;
}
if (card.hasSVar("PlayMain1")) {
if (card.getSVar("PlayMain1").equals("ALWAYS") || sa.getPayCosts().hasNoManaCost()) {
return true;
} else if (card.getSVar("PlayMain1").equals("OPPONENTCREATURES")) {
//Only play these main1 when the opponent has creatures (stealing and giving them haste)
if (!card.getController().getOpponent().getCreaturesInPlay().isEmpty()) {
if (!ai.getOpponents().getCreaturesInPlay().isEmpty()) {
return true;
}
} else if (!card.getController().getCreaturesInPlay().isEmpty()) {
@@ -934,6 +938,15 @@ public class ComputerUtil {
}
}
// try not to cast Raid creatures in main 1 if an attack is likely
if ("Count$AttackersDeclared".equals(card.getSVar("RaidTest")) && !card.hasKeyword("Haste")) {
for (Card potentialAtkr: ai.getCreaturesInPlay()) {
if (ComputerUtilCard.doesCreatureAttackAI(ai, potentialAtkr)) {
return false;
}
}
}
if (card.getManaCost().isZero()) {
return true;
}
@@ -973,7 +986,7 @@ public class ComputerUtil {
return true;
}
}
if (card.isEquipment() && buffedcard.isCreature() && CombatUtil.canAttack(buffedcard, ai.getOpponent())) {
if (card.isEquipment() && buffedcard.isCreature() && CombatUtil.canAttack(buffedcard, ComputerUtil.getOpponentFor(ai))) {
return true;
}
if (card.isCreature()) {
@@ -993,7 +1006,7 @@ public class ComputerUtil {
} // BuffedBy
// get all cards the human controls with AntiBuffedBy
final CardCollectionView antibuffed = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
final CardCollectionView antibuffed = ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield);
for (Card buffedcard : antibuffed) {
if (buffedcard.hasSVar("AntiBuffedBy")) {
final String buffedby = buffedcard.getSVar("AntiBuffedBy");
@@ -1033,11 +1046,11 @@ public class ComputerUtil {
return ret;
} else {
// Otherwise, if life is possibly in danger, then this is fine.
Combat combat = new Combat(ai.getOpponent());
CardCollectionView attackers = ai.getOpponent().getCreaturesInPlay();
Combat combat = new Combat(ComputerUtil.getOpponentFor(ai));
CardCollectionView attackers = ComputerUtil.getOpponentFor(ai).getCreaturesInPlay();
for (Card att : attackers) {
if (ComputerUtilCombat.canAttackNextTurn(att, ai)) {
combat.addAttacker(att, att.getController().getOpponent());
combat.addAttacker(att, ComputerUtil.getOpponentFor(att.getController()));
}
}
AiBlockController aiBlock = new AiBlockController(ai);
@@ -1101,7 +1114,7 @@ public class ComputerUtil {
return (sa.getHostCard().isCreature()
&& sa.getPayCosts().hasTapCost()
&& (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
|| !ph.getNextTurn().equals(sa.getActivatingPlayer()))
&& !ph.getNextTurn().equals(sa.getActivatingPlayer()))
&& !sa.getHostCard().hasSVar("EndOfTurnLeavePlay")
&& !sa.hasParam("ActivationPhases"));
}
@@ -1111,6 +1124,10 @@ public class ComputerUtil {
final Card source = sa.getHostCard();
final SpellAbility sub = sa.getSubAbility();
if (source != null && "ALWAYS".equals(source.getSVar("PlayMain1"))) {
return true;
}
// Cipher spells
if (sub != null) {
final ApiType api = sub.getApi();
@@ -1145,7 +1162,7 @@ public class ComputerUtil {
}
// get all cards the human controls with AntiBuffedBy
final CardCollectionView antibuffed = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
final CardCollectionView antibuffed = ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield);
for (Card buffedcard : antibuffed) {
if (buffedcard.hasSVar("AntiBuffedBy")) {
final String buffedby = buffedcard.getSVar("AntiBuffedBy");
@@ -1331,7 +1348,7 @@ public class ComputerUtil {
if (tgt == null) {
continue;
}
final Player enemy = ai.getOpponent();
final Player enemy = ComputerUtil.getOpponentFor(ai);
if (!sa.canTarget(enemy)) {
continue;
}
@@ -1436,17 +1453,26 @@ public class ComputerUtil {
objects = canBeTargeted;
}
if (saviourApi == ApiType.Pump || saviourApi == ApiType.PumpAll) {
toughness = saviour.hasParam("NumDef") ?
AbilityUtils.calculateAmount(saviour.getHostCard(), saviour.getParam("NumDef"), saviour) : 0;
final List<String> keywords = saviour.hasParam("KW") ?
Arrays.asList(saviour.getParam("KW").split(" & ")) : new ArrayList<String>();
SpellAbility saviorWithSubs = saviour;
ApiType saviorWithSubsApi = saviorWithSubs == null ? null : saviorWithSubs.getApi();
while (saviorWithSubs != null) {
ApiType curApi = saviorWithSubs.getApi();
if (curApi == ApiType.Pump || curApi == ApiType.PumpAll) {
toughness = saviorWithSubs.hasParam("NumDef") ?
AbilityUtils.calculateAmount(saviorWithSubs.getHostCard(), saviorWithSubs.getParam("NumDef"), saviour) : 0;
final List<String> keywords = saviorWithSubs.hasParam("KW") ?
Arrays.asList(saviorWithSubs.getParam("KW").split(" & ")) : new ArrayList<String>();
if (keywords.contains("Indestructible")) {
grantIndestructible = true;
}
if (keywords.contains("Hexproof") || keywords.contains("Shroud")) {
grantShroud = true;
}
break;
}
// Consider pump in subabilities, e.g. Bristling Hydra hexproof subability
saviorWithSubs = saviorWithSubs.getSubAbility();
}
if (saviourApi == ApiType.PutCounter || saviourApi == ApiType.PutCounterAll) {
@@ -1590,7 +1616,8 @@ public class ComputerUtil {
&& (((saviourApi == ApiType.Regenerate || saviourApi == ApiType.RegenerateAll)
&& !topStack.hasParam("NoRegen")) || saviourApi == ApiType.ChangeZone
|| saviourApi == ApiType.Pump || saviourApi == ApiType.PumpAll
|| saviourApi == ApiType.Protection || saviourApi == null)) {
|| saviourApi == ApiType.Protection || saviourApi == null
|| saviorWithSubsApi == ApiType.Pump || saviorWithSubsApi == ApiType.PumpAll)) {
for (final Object o : objects) {
if (o instanceof Card) {
final Card c = (Card) o;
@@ -1604,7 +1631,9 @@ public class ComputerUtil {
continue;
}
if (saviourApi == ApiType.Pump || saviourApi == ApiType.PumpAll) {
if (saviourApi == ApiType.Pump || saviourApi == ApiType.PumpAll
|| saviorWithSubsApi == ApiType.Pump
|| saviorWithSubsApi == ApiType.PumpAll) {
if ((tgt == null && !grantIndestructible)
|| (!grantShroud && !grantIndestructible)) {
continue;
@@ -1857,6 +1886,27 @@ public class ComputerUtil {
public static boolean scryWillMoveCardToBottomOfLibrary(Player player, Card c) {
boolean bottom = false;
// AI profile-based toggles
int maxLandsToScryLandsToTop = 3;
int minLandsToScryLandsAway = 8;
int minCreatsToScryCreatsAway = 5;
int minCreatEvalThreshold = 160; // just a bit higher than a baseline 2/2 creature or a 1/1 mana dork
int lowCMCThreshold = 3;
int maxCreatsToScryLowCMCAway = 3;
boolean uncastablesToBottom = false;
int uncastableCMCThreshold = 1;
if (player.getController().isAI()) {
AiController aic = ((PlayerControllerAi)player.getController()).getAi();
maxLandsToScryLandsToTop = aic.getIntProperty(AiProps.SCRY_NUM_LANDS_TO_STILL_NEED_MORE);
minLandsToScryLandsAway = aic.getIntProperty(AiProps.SCRY_NUM_LANDS_TO_NOT_NEED_MORE);
minCreatsToScryCreatsAway = aic.getIntProperty(AiProps.SCRY_NUM_CREATURES_TO_NOT_NEED_SUBPAR_ONES);
minCreatEvalThreshold = aic.getIntProperty(AiProps.SCRY_EVALTHR_TO_SCRY_AWAY_LOWCMC_CREATURE);
lowCMCThreshold = aic.getIntProperty(AiProps.SCRY_EVALTHR_CMC_THRESHOLD);
maxCreatsToScryLowCMCAway = aic.getIntProperty(AiProps.SCRY_EVALTHR_CREATCOUNT_TO_SCRY_AWAY_LOWCMC);
uncastablesToBottom = aic.getBooleanProperty(AiProps.SCRY_IMMEDIATELY_UNCASTABLE_TO_BOTTOM);
uncastableCMCThreshold = aic.getIntProperty(AiProps.SCRY_IMMEDIATELY_UNCASTABLE_CMC_DIFF);
}
CardCollectionView allCards = player.getAllCards();
CardCollectionView cardsInHand = player.getCardsIn(ZoneType.Hand);
CardCollectionView cardsOTB = player.getCardsIn(ZoneType.Battlefield);
@@ -1871,8 +1921,9 @@ public class ComputerUtil {
CardCollectionView allCreatures = CardLists.filter(allCards, Predicates.and(CardPredicates.Presets.CREATURES, CardPredicates.isOwner(player)));
int numCards = allCreatures.size();
if (landsOTB.size() < 3 && landsInHand.isEmpty()) {
if ((!c.isLand() && !manaArts.contains(c.getName())) || c.getManaAbilities().isEmpty()) {
if (landsOTB.size() < maxLandsToScryLandsToTop && landsInHand.isEmpty()) {
if ((!c.isLand() && !manaArts.contains(c.getName()))
|| (c.getManaAbilities().isEmpty() && !c.hasABasicLandType())) {
// scry away non-lands and non-manaproducing lands in situations when the land count
// on the battlefield is low, to try to improve the mana base early
bottom = true;
@@ -1880,7 +1931,7 @@ public class ComputerUtil {
}
if (c.isLand()) {
if (landsOTB.size() >= 8) {
if (landsOTB.size() >= minLandsToScryLandsAway) {
// probably enough lands not to urgently need another one, so look for more gas instead
bottom = true;
} else if (landsInHand.size() >= Math.max(cardsInHand.size() / 2, 2)) {
@@ -1898,16 +1949,15 @@ public class ComputerUtil {
} else if (c.isCreature()) {
CardCollection creaturesOTB = CardLists.filter(cardsOTB, CardPredicates.Presets.CREATURES);
int avgCreatureValue = numCards != 0 ? ComputerUtilCard.evaluateCreatureList(allCreatures) / numCards : 0;
int minCreatEvalThreshold = 160; // just a bit higher than a baseline 2/2 creature or a 1/1 mana dork
int maxControlledCMC = Aggregates.max(creaturesOTB, CardPredicates.Accessors.fnGetCmc);
if (ComputerUtilCard.evaluateCreature(c) < avgCreatureValue) {
if (creaturesOTB.size() > 5) {
if (creaturesOTB.size() > minCreatsToScryCreatsAway) {
// if there are more than five creatures and the creature is question is below average for
// the deck, scry it to the bottom
bottom = true;
} else if (creaturesOTB.size() > 3 && c.getCMC() <= 3
&& maxControlledCMC >= 4 && ComputerUtilCard.evaluateCreature(c) <= minCreatEvalThreshold) {
} else if (creaturesOTB.size() > maxCreatsToScryLowCMCAway && c.getCMC() <= lowCMCThreshold
&& maxControlledCMC >= lowCMCThreshold + 1 && ComputerUtilCard.evaluateCreature(c) <= minCreatEvalThreshold) {
// if we are already at a stage when we have 4+ CMC creatures on the battlefield,
// probably worth it to scry away very low value creatures with low CMC
bottom = true;
@@ -1915,6 +1965,15 @@ public class ComputerUtil {
}
}
if (uncastablesToBottom && !c.isLand()) {
int cmc = c.isSplitCard() ? Math.min(c.getCMC(Card.SplitCMCMode.LeftSplitCMC), c.getCMC(Card.SplitCMCMode.RightSplitCMC))
: c.getCMC();
int maxCastable = ComputerUtilMana.getAvailableManaEstimate(player, false) + landsInHand.size();
if (cmc - maxCastable >= uncastableCMCThreshold) {
bottom = true;
}
}
return bottom;
}
@@ -2047,7 +2106,7 @@ public class ComputerUtil {
}
}
else if (logic.equals("ChosenLandwalk")) {
for (Card c : ai.getOpponent().getLandsInPlay()) {
for (Card c : ComputerUtil.getOpponentFor(ai).getLandsInPlay()) {
for (String t : c.getType()) {
if (!invalidTypes.contains(t) && CardType.isABasicLandType(t)) {
chosen = t;
@@ -2065,7 +2124,7 @@ public class ComputerUtil {
else if (kindOfType.equals("Land")) {
if (logic != null) {
if (logic.equals("ChosenLandwalk")) {
for (Card c : ai.getOpponent().getLandsInPlay()) {
for (Card c : ComputerUtil.getOpponentFor(ai).getLandsInPlay()) {
for (String t : c.getType().getLandTypes()) {
if (!invalidTypes.contains(t)) {
chosen = t;
@@ -2098,7 +2157,7 @@ public class ComputerUtil {
case "Torture":
return "Torture";
case "GraceOrCondemnation":
return ai.getCreaturesInPlay().size() > ai.getOpponent().getCreaturesInPlay().size() ? "Grace"
return ai.getCreaturesInPlay().size() > ComputerUtil.getOpponentFor(ai).getCreaturesInPlay().size() ? "Grace"
: "Condemnation";
case "CarnageOrHomage":
CardCollection cardsInPlay = CardLists
@@ -2683,4 +2742,124 @@ public class ComputerUtil {
}
return true;
}
@Deprecated
public static final Player getOpponentFor(final Player player) {
// This method is deprecated and currently functions as a synonym for player.getWeakestOpponent
// until it can be replaced everywhere in the code.
// Consider replacing calls to this method either with a multiplayer-friendly determination of
// opponent that contextually makes the most sense, or with a direct call to player.getWeakestOpponent
// where that is applicable and makes sense from the point of view of multiplayer AI logic.
Player opponent = player.getWeakestOpponent();
if (opponent != null) {
return opponent;
}
throw new IllegalStateException("No opponents left ingame for " + player);
}
public static int countUsefulCreatures(Player p) {
CardCollection creats = p.getCreaturesInPlay();
int count = 0;
for (Card c : creats) {
if (!ComputerUtilCard.isUselessCreature(p, c)) {
count ++;
}
}
return count;
}
public static boolean isPlayingReanimator(final Player ai) {
// TODO: either add SVars to other reanimator cards, or improve the prediction so that it avoids using a SVar
// at all but detects this effect from SA parameters (preferred, but difficult)
CardCollectionView inHand = ai.getCardsIn(ZoneType.Hand);
CardCollectionView inDeck = ai.getCardsIn(new ZoneType[] {ZoneType.Hand, ZoneType.Library});
Predicate<Card> markedAsReanimator = new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return "true".equalsIgnoreCase(card.getSVar("IsReanimatorCard"));
}
};
int numInHand = CardLists.filter(inHand, markedAsReanimator).size();
int numInDeck = CardLists.filter(inDeck, markedAsReanimator).size();
return numInHand > 0 || numInDeck >= 3;
}
public static CardCollection filterAITgts(SpellAbility sa, Player ai, CardCollection srcList, boolean alwaysStrict) {
final Card source = sa.getHostCard();
if (source == null) { return srcList; }
if (sa.hasParam("AITgts")) {
CardCollection list;
if (sa.getParam("AITgts").equals("BetterThanSource")) {
int value = ComputerUtilCard.evaluateCreature(source);
if (source.isEnchanted()) {
for (Card enc : source.getEnchantedBy(false)) {
if (enc.getController().equals(ai)) {
value += 100; // is 100 per AI's own aura enough?
}
}
}
final int totalValue = value;
list = CardLists.filter(srcList, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return ComputerUtilCard.evaluateCreature(c) > totalValue + 30;
}
});
} else {
list = CardLists.getValidCards(srcList, sa.getParam("AITgts"), sa.getActivatingPlayer(), source);
}
if (!list.isEmpty() || sa.hasParam("AITgtsStrict") || alwaysStrict) {
return list;
} else {
return srcList;
}
}
return srcList;
}
// Check if AI life is in danger/serious danger based on next expected combat
// assuming a loss of "payment" life
// call this to determine if it's safe to use a life payment spell
// or trigger "emergency" strategies such as holding mana for Spike Weaver of Counterspell.
public static boolean aiLifeInDanger(Player ai, boolean serious, int payment) {
Player opponent = ComputerUtil.getOpponentFor(ai);
// test whether the human can kill the ai next turn
Combat combat = new Combat(opponent);
boolean containsAttacker = false;
for (Card att : opponent.getCreaturesInPlay()) {
if (ComputerUtilCombat.canAttackNextTurn(att, ai)) {
combat.addAttacker(att, ai);
containsAttacker = true;
}
}
if (!containsAttacker) {
return false;
}
AiBlockController block = new AiBlockController(ai);
block.assignBlockersForCombat(combat);
// TODO predict other, noncombat sources of damage and add them to the "payment" variable.
// examples : Black Vise, The Rack, known direct damage spells in enemy hand, etc
// If added, might need a parameter to define whether we want to check all threats or combat threats.
if ((serious) && (ComputerUtilCombat.lifeInSeriousDanger(ai, combat, payment))) {
return true;
}
if ((!serious) && (ComputerUtilCombat.lifeInDanger(ai, combat, payment))) {
return true;
}
return false;
}
}

View File

@@ -1,13 +1,15 @@
package forge.ai;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import forge.card.CardStateName;
import forge.game.Game;
import forge.game.GameActionUtil;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
@@ -17,7 +19,6 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.zone.ZoneType;
import java.util.Iterator;
public class ComputerUtilAbility {
public static CardCollection getAvailableLandsToPlay(final Game game, final Player player) {
@@ -78,7 +79,7 @@ public class ComputerUtilAbility {
}
public static List<SpellAbility> getSpellAbilities(final CardCollectionView l, final Player player) {
final List<SpellAbility> spellAbilities = new ArrayList<SpellAbility>();
final List<SpellAbility> spellAbilities = Lists.newArrayList();
for (final Card c : l) {
for (final SpellAbility sa : c.getSpellAbilities()) {
spellAbilities.add(sa);
@@ -93,7 +94,7 @@ public class ComputerUtilAbility {
}
public static List<SpellAbility> getOriginalAndAltCostAbilities(final List<SpellAbility> originList, final Player player) {
final List<SpellAbility> newAbilities = new ArrayList<SpellAbility>();
final List<SpellAbility> newAbilities = Lists.newArrayList();
for (SpellAbility sa : originList) {
sa.setActivatingPlayer(player);
//add alternative costs as additional spell abilities
@@ -101,7 +102,7 @@ public class ComputerUtilAbility {
newAbilities.addAll(GameActionUtil.getAlternativeCosts(sa, player));
}
final List<SpellAbility> result = new ArrayList<SpellAbility>();
final List<SpellAbility> result = Lists.newArrayList();
for (SpellAbility sa : newAbilities) {
sa.setActivatingPlayer(player);
result.addAll(GameActionUtil.getOptionalCosts(sa));
@@ -132,6 +133,42 @@ public class ComputerUtilAbility {
}
public static String getAbilitySourceName(SpellAbility sa) {
return sa.getOriginalHost() != null ? sa.getOriginalHost().getName() : sa.getHostCard() != null ? sa.getHostCard().getName() : "";
final Card c = getAbilitySource(sa);
return c != null ? c.getName() : "";
}
public static CardCollection getCardsTargetedWithApi(Player ai, CardCollection cardList, SpellAbility sa, ApiType api) {
// Returns a collection of cards which have already been targeted with the given API either in the parent ability,
// in the sub ability, or by something on stack. If "sa" is specified, the parent and sub abilities of this SA will
// be checked for targets. If "sa" is null, only the stack instances will be checked.
CardCollection targeted = new CardCollection();
if (sa != null) {
SpellAbility saSub = sa.getRootAbility();
while (saSub != null) {
if (saSub.getApi() == api && saSub.getTargets() != null) {
for (Card c : cardList) {
if (saSub.getTargets().getTargetCards().contains(c)) {
// Was already targeted with this API in a parent or sub SA
targeted.add(c);
}
}
}
saSub = saSub.getSubAbility();
}
}
for (SpellAbilityStackInstance si : ai.getGame().getStack()) {
SpellAbility ab = si.getSpellAbility(false);
if (ab != null && ab.getApi() == api && si.getTargetChoices() != null) {
for (Card c : cardList) {
// TODO: somehow ensure that the detected SA won't be countered
if (si.getTargetChoices().getTargetCards().contains(c)) {
// Was already targeted by a spell ability instance on stack
targeted.add(c);
}
}
}
}
return targeted;
}
}

View File

@@ -1,20 +1,9 @@
package forge.ai;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.card.CardType;
@@ -29,19 +18,13 @@ import forge.game.GameObject;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardFactory;
import forge.game.card.CardFactoryUtil;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.cost.CostPayEnergy;
import forge.game.keyword.Keyword;
import forge.game.keyword.KeywordCollection;
import forge.game.keyword.KeywordInterface;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -54,8 +37,14 @@ import forge.game.zone.MagicStack;
import forge.game.zone.ZoneType;
import forge.item.PaperCard;
import forge.util.Aggregates;
import forge.util.Expressions;
import forge.util.MyRandom;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.*;
import java.util.Map.Entry;
public class ComputerUtilCard {
public static Card getMostExpensivePermanentAI(final CardCollectionView list, final SpellAbility spell, final boolean targeted) {
@@ -364,7 +353,12 @@ public class ComputerUtilCard {
}
if (hasEnchantmants || hasArtifacts) {
final List<Card> ae = CardLists.filter(list, Predicates.<Card>or(CardPredicates.Presets.ARTIFACTS, CardPredicates.Presets.ENCHANTMENTS));
final List<Card> ae = CardLists.filter(list, Predicates.and(Predicates.<Card>or(CardPredicates.Presets.ARTIFACTS, CardPredicates.Presets.ENCHANTMENTS), new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return !card.hasSVar("DoNotDiscardIfAble");
}
}));
return getCheapestPermanentAI(ae, null, false);
}
@@ -377,6 +371,32 @@ public class ComputerUtilCard {
return getCheapestPermanentAI(list, null, false);
}
public static final Card getCheapestSpellAI(final Iterable<Card> list) {
if (!Iterables.isEmpty(list)) {
CardCollection cc = CardLists.filter(new CardCollection(list),
Predicates.or(CardPredicates.isType("Instant"), CardPredicates.isType("Sorcery")));
Collections.sort(cc, CardLists.CmcComparatorInv);
if (cc.isEmpty()) {
return null;
}
Card cheapest = cc.getLast();
if (cheapest.hasSVar("DoNotDiscardIfAble")) {
for (int i = cc.size() - 1; i >= 0; i--) {
if (!cc.get(i).hasSVar("DoNotDiscardIfAble")) {
cheapest = cc.get(i);
break;
}
}
}
return cheapest;
}
return null;
}
public static final Comparator<Card> EvaluateCreatureComparator = new Comparator<Card>() {
@Override
public int compare(final Card a, final Card b) {
@@ -399,6 +419,10 @@ public class ComputerUtilCard {
return creatureEvaluator.evaluateCreature(c);
}
public static int evaluateCreature(final Card c, final boolean considerPT, final boolean considerCMC) {
return creatureEvaluator.evaluateCreature(c, considerPT, considerCMC);
}
public static int evaluatePermanentList(final CardCollectionView list) {
int value = 0;
for (int i = 0; i < list.size(); i++) {
@@ -482,7 +506,7 @@ public class ComputerUtilCard {
*/
public static CardCollectionView getLikelyBlockers(final Player ai, final CardCollectionView blockers) {
AiBlockController aiBlk = new AiBlockController(ai);
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
Combat combat = new Combat(opp);
//Use actual attackers if available, else consider all possible attackers
Combat currentCombat = ai.getGame().getCombat();
@@ -845,9 +869,10 @@ public class ComputerUtilCard {
List<String> chosen = new ArrayList<String>();
Player ai = sa.getActivatingPlayer();
final Game game = ai.getGame();
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
if (sa.hasParam("AILogic")) {
final String logic = sa.getParam("AILogic");
if (logic.equals("MostProminentInHumanDeck")) {
chosen.add(ComputerUtilCard.getMostProminentColor(CardLists.filterControlledBy(game.getCardsInGame(), opp), colorChoices));
}
@@ -873,7 +898,7 @@ public class ComputerUtilCard {
chosen.add(ComputerUtilCard.getMostProminentColor(ai.getCardsIn(ZoneType.Battlefield), colorChoices));
}
else if (logic.equals("MostProminentHumanControls")) {
chosen.add(ComputerUtilCard.getMostProminentColor(ai.getOpponent().getCardsIn(ZoneType.Battlefield), colorChoices));
chosen.add(ComputerUtilCard.getMostProminentColor(opp.getCardsIn(ZoneType.Battlefield), colorChoices));
}
else if (logic.equals("MostProminentPermanent")) {
chosen.add(ComputerUtilCard.getMostProminentColor(game.getCardsIn(ZoneType.Battlefield), colorChoices));
@@ -897,7 +922,7 @@ public class ComputerUtilCard {
String bestColor = Constant.GREEN;
for (byte color : MagicColor.WUBRG) {
CardCollectionView ailist = ai.getCardsIn(ZoneType.Battlefield);
CardCollectionView opplist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
CardCollectionView opplist = opp.getCardsIn(ZoneType.Battlefield);
ailist = CardLists.filter(ailist, CardPredicates.isColor(color));
opplist = CardLists.filter(opplist, CardPredicates.isColor(color));
@@ -934,7 +959,7 @@ public class ComputerUtilCard {
public static boolean useRemovalNow(final SpellAbility sa, final Card c, final int dmg, ZoneType destination) {
final Player ai = sa.getActivatingPlayer();
final AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final Game game = ai.getGame();
final PhaseHandler ph = game.getPhaseHandler();
final PhaseType phaseType = ph.getPhase();
@@ -1174,6 +1199,18 @@ public class ComputerUtilCard {
final PhaseHandler phase = game.getPhaseHandler();
final Combat combat = phase.getCombat();
final boolean isBerserk = "Berserk".equals(sa.getParam("AILogic"));
final boolean loseCardAtEOT = "Sacrifice".equals(sa.getParam("AtEOT")) || "Exile".equals(sa.getParam("AtEOT"))
|| "Destroy".equals(sa.getParam("AtEOT")) || "ExileCombat".equals(sa.getParam("AtEOT"));
boolean combatTrick = false;
boolean holdCombatTricks = false;
int chanceToHoldCombatTricks = -1;
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
holdCombatTricks = aic.getBooleanProperty(AiProps.TRY_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK);
chanceToHoldCombatTricks = aic.getIntProperty(AiProps.CHANCE_TO_HOLD_COMBAT_TRICKS_UNTIL_BLOCK);
}
if (!c.canBeTargetedBy(sa)) {
return false;
@@ -1186,11 +1223,11 @@ public class ComputerUtilCard {
/* -- currently disabled until better conditions are devised and the spell prediction is made smarter --
// Determine if some mana sources need to be held for the future spell to cast in Main 2 before determining whether to pump.
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
if (aic.getCardMemory().isMemorySetEmpty(AiCardMemory.MemorySet.HELD_MANA_SOURCES)) {
if (aic.getCardMemory().isMemorySetEmpty(AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2)) {
// only hold mana sources once
SpellAbility futureSpell = aic.predictSpellToCastInMain2(ApiType.Pump);
if (futureSpell != null && futureSpell.getHostCard() != null) {
aic.reserveManaSourcesForMain2(futureSpell);
aic.reserveManaSources(futureSpell);
}
}
*/
@@ -1204,8 +1241,8 @@ public class ComputerUtilCard {
return true;
}
// buff attacker/blocker using triggered pump
if (immediately && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
// buff attacker/blocker using triggered pump (unless it's lethal and we don't want to be reckless)
if (immediately && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) && !loseCardAtEOT) {
if (phase.isPlayerTurn(ai)) {
if (CombatUtil.canAttack(c)) {
return true;
@@ -1217,7 +1254,7 @@ public class ComputerUtilCard {
}
}
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
Card pumped = getPumpedCreature(ai, sa, c, toughness, power, keywords);
List<Card> oppCreatures = opp.getCreaturesInPlay();
float chance = 0;
@@ -1234,6 +1271,28 @@ public class ComputerUtilCard {
threat *= 4; //over-value self +attack for 0 power creatures which may be pumped further after attacking
}
chance += threat;
// -- Hold combat trick (the AI will try to delay the pump until Declare Blockers) --
// Enable combat trick mode only in case it's a pure buff spell in hand with no keywords or with Trample,
// First Strike, or Double Strike, otherwise the AI is unlikely to cast it or it's too late to
// cast it during Declare Blockers, thus ruining its attacker
if (holdCombatTricks && sa.getApi() == ApiType.Pump
&& sa.hasParam("NumAtt") && sa.getHostCard() != null
&& sa.getHostCard().getZone() != null && sa.getHostCard().getZone().is(ZoneType.Hand)
&& c.getNetPower() > 0 // too obvious if attacking with a 0-power creature
&& sa.getHostCard().isInstant() // only do it for instant speed spells in hand
&& ComputerUtilMana.hasEnoughManaSourcesToCast(sa, ai)) {
combatTrick = true;
final List<String> kws = sa.hasParam("KW") ? Arrays.asList(sa.getParam("KW").split(" & "))
: Lists.<String>newArrayList();
for (String kw : kws) {
if (!kw.equals("Trample") && !kw.equals("First Strike") && !kw.equals("Double Strike")) {
combatTrick = false;
break;
}
}
}
}
//2. grant haste
@@ -1261,7 +1320,7 @@ public class ComputerUtilCard {
boolean pumpedWillDie = false;
final boolean isAttacking = combat.isAttacking(c);
if (isBerserk && isAttacking) { pumpedWillDie = true; }
if ((isBerserk && isAttacking) || loseCardAtEOT) { pumpedWillDie = true; }
if (isAttacking) {
pumpedCombat.addAttacker(pumped, opp);
@@ -1319,6 +1378,16 @@ public class ComputerUtilCard {
if (combat.isAttacking(c) && opp.getLife() > 0) {
int dmg = ComputerUtilCombat.damageIfUnblocked(c, opp, combat, true);
int pumpedDmg = ComputerUtilCombat.damageIfUnblocked(pumped, opp, pumpedCombat, true);
int poisonOrig = opp.canReceiveCounters(CounterType.POISON) ? ComputerUtilCombat.poisonIfUnblocked(c, ai) : 0;
int poisonPumped = opp.canReceiveCounters(CounterType.POISON) ? ComputerUtilCombat.poisonIfUnblocked(pumped, ai) : 0;
// predict Infect
if (pumpedDmg == 0 && c.hasKeyword("Infect")) {
if (poisonPumped > poisonOrig) {
pumpedDmg = poisonPumped;
}
}
if (combat.isBlocked(c)) {
if (!c.hasKeyword("Trample")) {
dmg = 0;
@@ -1331,9 +1400,12 @@ public class ComputerUtilCard {
pumpedDmg = 0;
}
}
if (pumpedDmg >= opp.getLife()) {
if (pumpedDmg > dmg) {
if ((!c.hasKeyword("Infect") && pumpedDmg >= opp.getLife())
|| (c.hasKeyword("Infect") && opp.canReceiveCounters(CounterType.POISON) && pumpedDmg >= opp.getPoisonCounters())) {
return true;
}
}
// try to determine if pumping a creature for more power will give lethal on board
// considering all unblocked creatures after the blockers are already declared
if (phase.is(PhaseType.COMBAT_DECLARE_BLOCKERS) && pumpedDmg > dmg) {
@@ -1395,14 +1467,47 @@ public class ComputerUtilCard {
if (isBerserk) {
// if we got here, Berserk will result in the pumped creature dying at EOT and the opponent will not lose
// (other similar cards with AILogic$ Berserk that do not die only when attacking are excluded from consideration)
if (ai.getController() instanceof PlayerControllerAi) {
boolean aggr = ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.USE_BERSERK_AGGRESSIVELY);
boolean aggr = ((PlayerControllerAi)ai.getController()).getAi().getBooleanProperty(AiProps.USE_BERSERK_AGGRESSIVELY)
|| sa.hasParam("AtEOT");
if (!aggr) {
return false;
}
}
}
boolean wantToHoldTrick = holdCombatTricks;
if (chanceToHoldCombatTricks >= 0) {
// Obey the chance specified in the AI profile for holding combat tricks
wantToHoldTrick &= MyRandom.percentTrue(chanceToHoldCombatTricks);
} else {
// Use standard considerations dependent solely on the buff chance determined above
wantToHoldTrick &= MyRandom.getRandom().nextFloat() < chance;
}
boolean isHeldCombatTrick = combatTrick && wantToHoldTrick;
if (isHeldCombatTrick) {
if (AiCardMemory.isMemorySetEmpty(ai, AiCardMemory.MemorySet.TRICK_ATTACKERS)) {
// Attempt to hold combat tricks until blockers are declared, and try to lure the opponent into blocking
// (The AI will only do it for one attacker at the moment, otherwise it risks running his attackers into
// an army of opposing blockers with only one combat trick in hand)
AiCardMemory.rememberCard(ai, c, AiCardMemory.MemorySet.MANDATORY_ATTACKERS);
AiCardMemory.rememberCard(ai, c, AiCardMemory.MemorySet.TRICK_ATTACKERS);
// Reserve the mana until Declare Blockers such that the AI doesn't tap out before having a chance to use
// the combat trick
if (ai.getController().isAI()) {
((PlayerControllerAi) ai.getController()).getAi().reserveManaSources(sa, PhaseType.COMBAT_DECLARE_BLOCKERS);
}
return false;
} else {
// Don't try to mix "lure" and "precast" paradigms for combat tricks, since that creates issues with
// the AI overextending the attack
return false;
}
}
return MyRandom.getRandom().nextFloat() < chance;
}
@@ -1417,8 +1522,7 @@ public class ComputerUtilCard {
* @return
*/
public static Card getPumpedCreature(final Player ai, final SpellAbility sa,
final Card c, final int toughness, final int power,
final List<String> keywords) {
final Card c, int toughness, int power, final List<String> keywords) {
Card pumped = CardFactory.copyCard(c, true);
pumped.setSickness(c.hasSickness());
final long timestamp = c.getGame().getNextTimestamp();
@@ -1431,8 +1535,25 @@ public class ComputerUtilCard {
}
}
// Berserk (and other similar cards)
final boolean isBerserk = "Berserk".equals(sa.getParam("AILogic"));
final int berserkPower = isBerserk ? c.getCurrentPower() : 0;
int berserkPower = 0;
if (isBerserk && sa.hasSVar("X")) {
if ("Targeted$CardPower".equals(sa.getSVar("X"))) {
berserkPower = c.getCurrentPower();
} else {
berserkPower = AbilityUtils.calculateAmount(sa.getHostCard(), "X", sa);
}
}
// Electrostatic Pummeler
for (SpellAbility ab : c.getSpellAbilities()) {
if ("Pummeler".equals(ab.getParam("AILogic"))) {
Pair<Integer, Integer> newPT = SpecialCardAi.ElectrostaticPummeler.getPumpedPT(ai, power, toughness);
power = newPT.getLeft();
toughness = newPT.getRight();
}
}
pumped.addNewPT(c.getCurrentPower(), c.getCurrentToughness(), timestamp);
pumped.addTempPowerBoost(c.getTempPowerBoost() + power + berserkPower);
@@ -1446,19 +1567,21 @@ public class ComputerUtilCard {
if (c.isTapped()) {
pumped.setTapped(true);
}
final List<String> copiedKeywords = pumped.getKeywords();
List<String> toCopy = new ArrayList<String>();
for (String kw : c.getKeywords()) {
if (!copiedKeywords.contains(kw)) {
if (kw.startsWith("HIDDEN")) {
pumped.addHiddenExtrinsicKeyword(kw);
KeywordCollection copiedKeywords = new KeywordCollection();
copiedKeywords.insertAll(pumped.getKeywords());
List<KeywordInterface> toCopy = Lists.newArrayList();
for (KeywordInterface k : c.getKeywords()) {
if (!copiedKeywords.contains(k.getOriginal())) {
if (k.getHidden()) {
pumped.addHiddenExtrinsicKeyword(k);
} else {
toCopy.add(kw);
toCopy.add(k);
}
}
}
final long timestamp2 = c.getGame().getNextTimestamp(); //is this necessary or can the timestamp be re-used?
pumped.addChangedCardKeywords(toCopy, new ArrayList<String>(), false, timestamp2);
pumped.addChangedCardKeywordsInternal(toCopy, Lists.<KeywordInterface>newArrayList(), false, timestamp2, true);
ComputerUtilCard.applyStaticContPT(ai.getGame(), pumped, new CardCollection(c));
return pumped;
}
@@ -1612,4 +1735,95 @@ public class ComputerUtilCard {
return maxEnergyCost;
}
public static CardCollection prioritizeCreaturesWorthRemovingNow(final Player ai, CardCollection oppCards, final boolean temporary) {
if (!CardLists.getNotType(oppCards, "Creature").isEmpty()) {
// non-creatures were passed, nothing to do here
return oppCards;
}
boolean enablePriorityRemoval = false;
boolean priorityRemovalOnlyInDanger = false;
int priorityRemovalThreshold = 0;
int lifeInDanger = 5;
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
enablePriorityRemoval = aic.getBooleanProperty(AiProps.ACTIVELY_DESTROY_IMMEDIATELY_UNBLOCKABLE);
priorityRemovalThreshold = aic.getIntProperty(AiProps.DESTROY_IMMEDIATELY_UNBLOCKABLE_THRESHOLD);
priorityRemovalOnlyInDanger = aic.getBooleanProperty(AiProps.DESTROY_IMMEDIATELY_UNBLOCKABLE_ONLY_IN_DNGR);
lifeInDanger = aic.getIntProperty(AiProps.DESTROY_IMMEDIATELY_UNBLOCKABLE_LIFE_IN_DNGR);
}
if (!enablePriorityRemoval) {
// Nothing to do here, the profile does not allow prioritizing
return oppCards;
}
CardCollection aiCreats = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
if (temporary) {
// Pump effects that add "CARDNAME can't attack" and similar things. Only do it if something is untapped.
oppCards = CardLists.filter(oppCards, CardPredicates.Presets.UNTAPPED);
}
CardCollection priorityCards = new CardCollection();
for (Card atk : oppCards) {
if (isUselessCreature(atk.getController(), atk)) {
continue;
}
for (Card blk : aiCreats) {
if (!CombatUtil.canBlock(atk, blk, true)) {
boolean threat = atk.getNetCombatDamage() >= ai.getLife() - lifeInDanger;
if (!priorityRemovalOnlyInDanger || threat) {
priorityCards.add(atk);
}
}
}
}
if (!priorityCards.isEmpty() && priorityCards.size() <= priorityRemovalThreshold) {
return priorityCards;
}
return oppCards;
}
public static AiPlayDecision checkNeedsToPlayReqs(final Card card, final SpellAbility sa) {
Game game = card.getGame();
boolean isRightSplit = sa != null && sa.isRightSplit();
String needsToPlayName = isRightSplit ? "SplitNeedsToPlay" : "NeedsToPlay";
String needsToPlayVarName = isRightSplit ? "SplitNeedsToPlayVar" : "NeedsToPlayVar";
if (card.hasSVar(needsToPlayName)) {
final String needsToPlay = card.getSVar(needsToPlayName);
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, needsToPlay.split(","), card.getController(), card, null);
if (list.isEmpty()) {
return AiPlayDecision.MissingNeededCards;
}
}
if (card.getSVar(needsToPlayVarName).length() > 0) {
final String needsToPlay = card.getSVar(needsToPlayVarName);
int x = 0;
int y = 0;
String sVar = needsToPlay.split(" ")[0];
String comparator = needsToPlay.split(" ")[1];
String compareTo = comparator.substring(2);
try {
x = Integer.parseInt(sVar);
} catch (final NumberFormatException e) {
x = CardFactoryUtil.xCount(card, card.getSVar(sVar));
}
try {
y = Integer.parseInt(compareTo);
} catch (final NumberFormatException e) {
y = CardFactoryUtil.xCount(card, card.getSVar(compareTo));
}
if (!Expressions.compare(x, comparator, y)) {
return AiPlayDecision.NeedsToPlayCriteriaNotMet;
}
}
return AiPlayDecision.WillPlay;
}
}

View File

@@ -19,6 +19,7 @@ package forge.ai;
import java.util.List;
import java.util.Map;
import java.util.Random;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
@@ -32,16 +33,11 @@ import forge.game.GlobalRuleChange;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardFactoryUtil;
import forge.game.card.CardLists;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.cost.CostPayment;
import forge.game.keyword.KeywordInterface;
import forge.game.phase.Untap;
import forge.game.player.Player;
import forge.game.replacement.ReplacementEffect;
@@ -53,6 +49,7 @@ import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerHandler;
import forge.game.trigger.TriggerType;
import forge.game.zone.ZoneType;
import forge.util.TextUtil;
import forge.util.collect.FCollection;
@@ -109,7 +106,8 @@ public class ComputerUtilCombat {
return false;
}
for (final String keyword : atacker.getKeywords()) {
for (final KeywordInterface inst : atacker.getKeywords()) {
final String keyword = inst.getOriginal();
if (keyword.startsWith("CARDNAME attacks specific player each combat if able")) {
final String defined = keyword.split(":")[1];
final Player player = AbilityUtils.getDefinedPlayers(atacker, defined, null).get(0);
@@ -385,11 +383,27 @@ public class ComputerUtilCombat {
* @return a boolean.
*/
public static boolean lifeInDanger(final Player ai, final Combat combat) {
return lifeInDanger(ai, combat, 0);
}
public static boolean lifeInDanger(final Player ai, final Combat combat, final int payment) {
// life in danger only cares about the player's life. Not Planeswalkers' life
if (ai.cantLose() || combat == null || combat.getAttackingPlayer() == ai) {
return false;
}
CardCollectionView otb = ai.getCardsIn(ZoneType.Battlefield);
// Special cases:
// AI can't lose in combat in presence of Worship (with creatures)
if (!CardLists.filter(otb, CardPredicates.nameEquals("Worship")).isEmpty() && !ai.getCreaturesInPlay().isEmpty()) {
return false;
}
// AI can't lose in combat in presence of Elderscale Wurm (at 7 life or more)
if (!CardLists.filter(otb, CardPredicates.nameEquals("Elderscale Wurm")).isEmpty() && ai.getLife() >= 7) {
return false;
}
// check for creatures that must be blocked
final List<Card> attackers = combat.getAttackersOf(ai);
@@ -401,15 +415,37 @@ public class ComputerUtilCombat {
if (blockers.isEmpty()) {
if (!attacker.getSVar("MustBeBlocked").equals("")) {
boolean cond = false;
String condVal = attacker.getSVar("MustBeBlocked");
boolean isAttackingPlayer = combat.getDefenderByAttacker(attacker) instanceof Player;
cond |= "true".equalsIgnoreCase(condVal);
cond |= "attackingplayer".equalsIgnoreCase(condVal) && isAttackingPlayer;
cond |= "attackingplayerconservative".equalsIgnoreCase(condVal) && isAttackingPlayer
&& ai.getCreaturesInPlay().size() >= 3 && ai.getCreaturesInPlay().size() > attacker.getController().getCreaturesInPlay().size();
if (cond) {
return true;
}
}
}
if (threateningCommanders.contains(attacker)) {
return true;
}
}
if (ComputerUtilCombat.lifeThatWouldRemain(ai, combat) < Math.min(4, ai.getLife())
int threshold = (((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.AI_IN_DANGER_THRESHOLD));
int maxTreshold = (((PlayerControllerAi) ai.getController()).getAi().getIntProperty(AiProps.AI_IN_DANGER_MAX_THRESHOLD)) - threshold;
Random rand = new Random();
int chance = rand.nextInt(80) + 5;
while (maxTreshold > 0) {
if (rand.nextInt(100) < chance) {
threshold++;
}
maxTreshold--;
}
if (ComputerUtilCombat.lifeThatWouldRemain(ai, combat) - payment < Math.min(threshold, ai.getLife())
&& !ai.cantLoseForZeroOrLessLife()) {
return true;
}
@@ -443,6 +479,10 @@ public class ComputerUtilCombat {
* @return a boolean.
*/
public static boolean lifeInSeriousDanger(final Player ai, final Combat combat) {
return lifeInSeriousDanger(ai, combat, 0);
}
public static boolean lifeInSeriousDanger(final Player ai, final Combat combat, final int payment) {
// life in danger only cares about the player's life. Not about a
// Planeswalkers life
if (ai.cantLose() || combat == null) {
@@ -468,7 +508,7 @@ public class ComputerUtilCombat {
}
}
if (ComputerUtilCombat.lifeThatWouldRemain(ai, combat) < 1 && !ai.cantLoseForZeroOrLessLife()) {
if (ComputerUtilCombat.lifeThatWouldRemain(ai, combat) - payment < 1 && !ai.cantLoseForZeroOrLessLife()) {
return true;
}
@@ -683,12 +723,21 @@ public class ComputerUtilCombat {
*/
public static boolean attackerWouldBeDestroyed(Player ai, final Card attacker, Combat combat) {
final List<Card> blockers = combat.getBlockers(attacker);
int firstStrikeBlockerDmg = 0;
for (final Card defender : blockers) {
if (ComputerUtilCombat.canDestroyAttacker(ai, attacker, defender, combat, true)
&& !(defender.hasKeyword("Wither") || defender.hasKeyword("Infect"))) {
return true;
}
if (defender.hasKeyword("First Strike") || defender.hasKeyword("Double Strike")) {
firstStrikeBlockerDmg += defender.getNetCombatDamage();
}
}
// Consider first strike and double strike
if (attacker.hasKeyword("First Strike") || attacker.hasKeyword("Double Strike")) {
return firstStrikeBlockerDmg >= ComputerUtilCombat.getDamageToKill(attacker);
}
return ComputerUtilCombat.totalDamageOfBlockers(attacker, blockers) >= ComputerUtilCombat.getDamageToKill(attacker);
@@ -781,7 +830,7 @@ public class ComputerUtilCombat {
if (validBlocked.contains(".withLesserPower")) {
// Have to check this restriction here as triggering objects aren't set yet, so
// ValidBlocked$Creature.powerLTX where X:TriggeredBlocker$CardPower crashes with NPE
validBlocked = validBlocked.replace(".withLesserPower", "");
validBlocked = TextUtil.fastReplace(validBlocked, ".withLesserPower", "");
if (defender.getCurrentPower() <= attacker.getCurrentPower()) {
return false;
}
@@ -795,7 +844,7 @@ public class ComputerUtilCombat {
if (validBlocker.contains(".withLesserPower")) {
// Have to check this restriction here as triggering objects aren't set yet, so
// ValidCard$Creature.powerLTX where X:TriggeredAttacker$CardPower crashes with NPE
validBlocker = validBlocker.replace(".withLesserPower", "");
validBlocker = TextUtil.fastReplace(validBlocker, ".withLesserPower", "");
if (defender.getCurrentPower() >= attacker.getCurrentPower()) {
return false;
}
@@ -854,9 +903,12 @@ public class ComputerUtilCombat {
public static int predictPowerBonusOfBlocker(final Card attacker, final Card blocker, boolean withoutAbilities) {
int power = 0;
// Apparently, Flanking is predicted below from a trigger, so using the code below results in double
// application of power bonus. A bit more testing may be needed though, so commenting out for now.
/*
if (attacker.hasKeyword("Flanking") && !blocker.hasKeyword("Flanking")) {
power -= attacker.getAmountOfKeyword("Flanking");
}
}*/
// Serene Master switches power with attacker
if (blocker.getName().equals("Serene Master")) {
@@ -874,8 +926,6 @@ public class ComputerUtilCombat {
power -= attacker.getNetCombatDamage();
}
power += blocker.getKeywordMagnitude("Bushido");
final Game game = attacker.getGame();
// look out for continuous static abilities that only care for blocking
// creatures
@@ -889,7 +939,7 @@ public class ComputerUtilCombat {
if (!params.containsKey("Affected") || !params.get("Affected").contains("blocking")) {
continue;
}
final String valid = params.get("Affected").replace("blocking", "Creature");
final String valid = TextUtil.fastReplace(params.get("Affected"), "blocking", "Creature");
if (!blocker.isValid(valid, card.getController(), card, null)) {
continue;
}
@@ -967,6 +1017,9 @@ public class ComputerUtilCombat {
if (ability.hasParam("ActivationPhases") || ability.hasParam("SorcerySpeed") || ability.hasParam("ActivationZone")) {
continue;
}
if (ability.usesTargeting() && !ability.canTarget(blocker)) {
continue;
}
if (ability.getApi() == ApiType.Pump) {
if (!ability.hasParam("NumAtt")) {
@@ -1024,7 +1077,6 @@ public class ComputerUtilCombat {
toughness += attacker.getNetToughness() - blocker.getNetToughness();
}
toughness += blocker.getKeywordMagnitude("Bushido");
final Game game = attacker.getGame();
final FCollection<Trigger> theTriggers = new FCollection<Trigger>();
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
@@ -1129,6 +1181,9 @@ public class ComputerUtilCombat {
if (ability.hasParam("ActivationPhases") || ability.hasParam("SorcerySpeed") || ability.hasParam("ActivationZone")) {
continue;
}
if (ability.usesTargeting() && !ability.canTarget(blocker)) {
continue;
}
if (ability.getApi() == ApiType.Pump) {
if (!ability.hasParam("NumDef")) {
@@ -1176,10 +1231,12 @@ public class ComputerUtilCombat {
* a {@link forge.game.combat.Combat} object.
* @return a int.
*/
public static int predictPowerBonusOfAttacker(final Card attacker, final Card blocker, final Combat combat , boolean withoutAbilities) {
public static int predictPowerBonusOfAttacker(final Card attacker, final Card blocker, final Combat combat, boolean withoutAbilities) {
return predictPowerBonusOfAttacker(attacker, blocker, combat, withoutAbilities, false);
}
public static int predictPowerBonusOfAttacker(final Card attacker, final Card blocker, final Combat combat, boolean withoutAbilities, boolean withoutCombatStaticAbilities) {
int power = 0;
power += attacker.getKeywordMagnitude("Bushido");
//check Exalted only for the first attacker
if (combat != null && combat.getAttackers().isEmpty()) {
for (Card card : attacker.getController().getCardsIn(ZoneType.Battlefield)) {
@@ -1216,6 +1273,7 @@ public class ComputerUtilCombat {
// look out for continuous static abilities that only care for attacking
// creatures
if (!withoutCombatStaticAbilities) {
final CardCollectionView cardList = CardCollection.combine(game.getCardsIn(ZoneType.Battlefield), game.getCardsIn(ZoneType.Command));
for (final Card card : cardList) {
for (final StaticAbility stAb : card.getStaticAbilities()) {
@@ -1226,7 +1284,7 @@ public class ComputerUtilCombat {
if (!params.containsKey("Affected") || !params.get("Affected").contains("attacking")) {
continue;
}
final String valid = params.get("Affected").replace("attacking", "Creature");
final String valid = TextUtil.fastReplace(params.get("Affected"), "attacking", "Creature");
if (!attacker.isValid(valid, card.getController(), card, null)) {
continue;
}
@@ -1241,6 +1299,7 @@ public class ComputerUtilCombat {
}
}
}
}
for (final Trigger trigger : theTriggers) {
final Map<String, String> trigParams = trigger.getMapParams();
@@ -1305,9 +1364,13 @@ public class ComputerUtilCombat {
} else {
String bonus = new String(source.getSVar(att));
if (bonus.contains("TriggerCount$NumBlockers")) {
bonus = bonus.replace("TriggerCount$NumBlockers", "Number$1");
bonus = TextUtil.fastReplace(bonus, "TriggerCount$NumBlockers", "Number$1");
} else if (bonus.contains("TriggeredPlayersDefenders$Amount")) { // for Melee
bonus = bonus.replace("TriggeredPlayersDefenders$Amount", "Number$1");
bonus = TextUtil.fastReplace(bonus, "TriggeredPlayersDefenders$Amount", "Number$1");
} else if (bonus.contains("TriggeredAttacker$CardPower")) { // e.g. Arahbo, Roar of the World
bonus = TextUtil.fastReplace(bonus, "TriggeredAttacker$CardPower", TextUtil.concatNoSpace("Number$", String.valueOf(attacker.getNetPower())));
} else if (bonus.contains("TriggeredAttacker$CardToughness")) {
bonus = TextUtil.fastReplace(bonus, "TriggeredAttacker$CardToughness", TextUtil.concatNoSpace("Number$", String.valueOf(attacker.getNetToughness())));
}
power += CardFactoryUtil.xCount(source, bonus);
@@ -1323,6 +1386,9 @@ public class ComputerUtilCombat {
if (ability.hasParam("ActivationPhases") || ability.hasParam("SorcerySpeed") || ability.hasParam("ActivationZone")) {
continue;
}
if (ability.usesTargeting() && !ability.canTarget(attacker)) {
continue;
}
if (ability.getApi() == ApiType.Pump) {
if (!ability.hasParam("NumAtt")) {
@@ -1372,6 +1438,10 @@ public class ComputerUtilCombat {
*/
public static int predictToughnessBonusOfAttacker(final Card attacker, final Card blocker, final Combat combat
, boolean withoutAbilities) {
return predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities, false);
}
public static int predictToughnessBonusOfAttacker(final Card attacker, final Card blocker, final Combat combat
, boolean withoutAbilities, boolean withoutCombatStaticAbilities) {
int toughness = 0;
//check Exalted only for the first attacker
@@ -1394,12 +1464,12 @@ public class ComputerUtilCombat {
theTriggers.addAll(card.getTriggers());
}
if (blocker != null) {
toughness += attacker.getKeywordMagnitude("Bushido");
theTriggers.addAll(blocker.getTriggers());
}
// look out for continuous static abilities that only care for attacking
// creatures
if (!withoutCombatStaticAbilities) {
final CardCollectionView cardList = game.getCardsIn(ZoneType.Battlefield);
for (final Card card : cardList) {
for (final StaticAbility stAb : card.getStaticAbilities()) {
@@ -1408,7 +1478,7 @@ public class ComputerUtilCombat {
continue;
}
if (params.containsKey("Affected") && params.get("Affected").contains("attacking")) {
final String valid = params.get("Affected").replace("attacking", "Creature");
final String valid = TextUtil.fastReplace(params.get("Affected"), "attacking", "Creature");
if (!attacker.isValid(valid, card.getController(), card, null)) {
continue;
}
@@ -1422,7 +1492,7 @@ public class ComputerUtilCombat {
}
}
} else if (params.containsKey("Affected") && params.get("Affected").contains("untapped")) {
final String valid = params.get("Affected").replace("untapped", "Creature");
final String valid = TextUtil.fastReplace(params.get("Affected"), "untapped", "Creature");
if (!attacker.isValid(valid, card.getController(), card, null)
|| attacker.hasKeyword("Vigilance")) {
continue;
@@ -1434,6 +1504,7 @@ public class ComputerUtilCombat {
}
}
}
}
for (final Trigger trigger : theTriggers) {
final Map<String, String> trigParams = trigger.getMapParams();
@@ -1517,9 +1588,9 @@ public class ComputerUtilCombat {
} else {
String bonus = new String(source.getSVar(def));
if (bonus.contains("TriggerCount$NumBlockers")) {
bonus = bonus.replace("TriggerCount$NumBlockers", "Number$1");
bonus = TextUtil.fastReplace(bonus, "TriggerCount$NumBlockers", "Number$1");
} else if (bonus.contains("TriggeredPlayersDefenders$Amount")) { // for Melee
bonus = bonus.replace("TriggeredPlayersDefenders$Amount", "Number$1");
bonus = TextUtil.fastReplace(bonus, "TriggeredPlayersDefenders$Amount", "Number$1");
}
toughness += CardFactoryUtil.xCount(source, bonus);
}
@@ -1535,6 +1606,9 @@ public class ComputerUtilCombat {
if (ability.hasParam("ActivationPhases") || ability.hasParam("SorcerySpeed") || ability.hasParam("ActivationZone")) {
continue;
}
if (ability.usesTargeting() && !ability.canTarget(attacker)) {
continue;
}
if (ability.getApi() == ApiType.Pump) {
if (!ability.hasParam("NumDef")) {
@@ -1674,6 +1748,10 @@ public class ComputerUtilCombat {
*/
public static boolean canDestroyAttacker(Player ai, Card attacker, Card blocker, final Combat combat,
final boolean withoutAbilities) {
return canDestroyAttacker(ai, attacker, blocker, combat, withoutAbilities, false);
}
public static boolean canDestroyAttacker(Player ai, Card attacker, Card blocker, final Combat combat,
final boolean withoutAbilities, final boolean withoutAttackerStaticAbilities) {
// Can activate transform ability
if (!withoutAbilities) {
attacker = canTransform(attacker);
@@ -1725,10 +1803,10 @@ public class ComputerUtilCombat {
}
if (attacker.toughnessAssignsDamage()) {
attackerDamage = attacker.getNetToughness()
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities);
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities, withoutAttackerStaticAbilities);
} else {
attackerDamage = attacker.getNetPower()
+ ComputerUtilCombat.predictPowerBonusOfAttacker(attacker, blocker, combat, withoutAbilities);
+ ComputerUtilCombat.predictPowerBonusOfAttacker(attacker, blocker, combat, withoutAbilities, withoutAttackerStaticAbilities);
}
int possibleDefenderPrevention = 0;
@@ -1741,11 +1819,16 @@ public class ComputerUtilCombat {
// consider Damage Prevention/Replacement
defenderDamage = predictDamageTo(attacker, defenderDamage, possibleAttackerPrevention, blocker, true);
attackerDamage = predictDamageTo(blocker, attackerDamage, possibleDefenderPrevention, attacker, true);
if (!attacker.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noPrevention)) {
if (defenderDamage > 0 && isCombatDamagePrevented(blocker, attacker, defenderDamage)) {
return false;
}
}
final int defenderLife = ComputerUtilCombat.getDamageToKill(blocker)
+ ComputerUtilCombat.predictToughnessBonusOfBlocker(attacker, blocker, withoutAbilities);
final int attackerLife = ComputerUtilCombat.getDamageToKill(attacker)
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities);
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities, withoutAttackerStaticAbilities);
if (blocker.hasKeyword("Double Strike")) {
if (defenderDamage > 0 && (hasKeyword(blocker, "Deathtouch", withoutAbilities, combat) || attacker.hasSVar("DestroyWhenDamaged"))) {
@@ -1914,6 +1997,10 @@ public class ComputerUtilCombat {
*/
public static boolean canDestroyBlocker(Player ai, Card blocker, Card attacker, final Combat combat,
final boolean withoutAbilities) {
return canDestroyBlocker(ai, blocker, attacker, combat, withoutAbilities, false);
}
public static boolean canDestroyBlocker(Player ai, Card blocker, Card attacker, final Combat combat,
final boolean withoutAbilities, final boolean withoutAttackerStaticAbilities) {
// Can activate transform ability
if (!withoutAbilities) {
attacker = canTransform(attacker);
@@ -1947,10 +2034,10 @@ public class ComputerUtilCombat {
}
if (attacker.toughnessAssignsDamage()) {
attackerDamage = attacker.getNetToughness()
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities);
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities, withoutAttackerStaticAbilities);
} else {
attackerDamage = attacker.getNetPower()
+ ComputerUtilCombat.predictPowerBonusOfAttacker(attacker, blocker, combat, withoutAbilities);
+ ComputerUtilCombat.predictPowerBonusOfAttacker(attacker, blocker, combat, withoutAbilities, withoutAttackerStaticAbilities);
}
int possibleDefenderPrevention = 0;
@@ -1975,7 +2062,7 @@ public class ComputerUtilCombat {
final int defenderLife = ComputerUtilCombat.getDamageToKill(blocker)
+ ComputerUtilCombat.predictToughnessBonusOfBlocker(attacker, blocker, withoutAbilities);
final int attackerLife = ComputerUtilCombat.getDamageToKill(attacker)
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities);
+ ComputerUtilCombat.predictToughnessBonusOfAttacker(attacker, blocker, combat, withoutAbilities, withoutAttackerStaticAbilities);
if (attacker.hasKeyword("Double Strike")) {
if (attackerDamage > 0 && (hasKeyword(attacker, "Deathtouch", withoutAbilities, combat) || blocker.hasSVar("DestroyWhenDamaged"))) {
@@ -2192,6 +2279,7 @@ public class ComputerUtilCombat {
*/
public final static int getDamageToKill(final Card c) {
int killDamage = c.getLethalDamage() + c.getPreventNextDamageTotalShields();
if ((killDamage > c.getPreventNextDamageTotalShields())
&& c.hasSVar("DestroyWhenDamaged")) {
killDamage = 1 + c.getPreventNextDamageTotalShields();
@@ -2398,7 +2486,7 @@ public class ComputerUtilCombat {
for (SpellAbility sa : original.getSpellAbilities()) {
if (sa.getApi() == ApiType.SetState && ComputerUtilCost.canPayCost(sa, original.getController())) {
Card transformed = CardUtil.getLKICopy(original);
transformed.getCurrentState().copyFrom(original, original.getAlternateState());
transformed.getCurrentState().copyFrom(original.getAlternateState(), true);
transformed.updateStateForView();
return transformed;
}
@@ -2431,6 +2519,95 @@ public class ComputerUtilCombat {
int afflictDmg = attacker.getKeywordMagnitude("Afflict");
return afflictDmg > attacker.getNetPower() || afflictDmg >= aiDefender.getLife();
}
public static int getMaxAttackersFor(final GameEntity defender) {
if (defender instanceof Player) {
for (final Card card : ((Player) defender).getCardsIn(ZoneType.Battlefield)) {
if (card.hasKeyword("No more than one creature can attack you each combat.")) {
return 1;
} else if (card.hasKeyword("No more than two creatures can attack you each combat.")) {
return 2;
}
}
}
return -1;
}
public static List<Card> categorizeAttackersByEvasion(List<Card> attackers) {
List<Card> categorizedAttackers = Lists.newArrayList();
CardCollection withEvasion = new CardCollection();
CardCollection withoutEvasion = new CardCollection();
for (Card atk : attackers) {
boolean hasProtection = false;
for (KeywordInterface inst : atk.getKeywords()) {
String kw = inst.getOriginal();
if (kw.startsWith("Protection")) {
hasProtection = true;
break;
}
}
if (atk.hasKeyword("Flying") || atk.hasKeyword("Shadow")
|| atk.hasKeyword("Horsemanship") || (atk.hasKeyword("Fear")
|| atk.hasKeyword("Intimidate") || atk.hasKeyword("Skulk") || hasProtection)) {
withEvasion.add(atk);
} else {
withoutEvasion.add(atk);
}
}
// attackers that can only be blocked by cards with specific keywords or color, etc.
// (maybe will need to split into 2 or 3 tiers depending on importance)
categorizedAttackers.addAll(withEvasion);
// all other attackers that have no evasion
// (Menace and other abilities that limit blocking by amount of blockers is likely handled
// elsewhere, but that needs testing and possibly fine-tuning).
categorizedAttackers.addAll(withoutEvasion);
return categorizedAttackers;
}
public static Card applyPotentialAttackCloneTriggers(Card attacker) {
// This method returns the potentially cloned card if the creature turns into something else during the attack
// (currently looks for the creature with maximum raw power since that's what the AI usually judges by when
// deciding whether the creature is worth blocking).
// If the creature doesn't change into anything, returns the original creature.
if (attacker == null) { return null; }
Card attackerAfterTrigs = attacker;
// Test for some special triggers that can change the creature in combat
for (Trigger t : attacker.getTriggers()) {
if (t.getMode() == TriggerType.Attacks && t.hasParam("Execute")) {
if (!attacker.hasSVar(t.getParam("Execute"))) {
continue;
}
SpellAbility exec = AbilityFactory.getAbility(attacker, t.getParam("Execute"));
if (exec != null) {
if (exec.getApi() == ApiType.Clone && "Self".equals(exec.getParam("CloneTarget"))
&& exec.hasParam("ValidTgts") && exec.getParam("ValidTgts").contains("Creature")
&& exec.getParam("ValidTgts").contains("attacking")) {
// Tilonalli's Skinshifter and potentially other similar cards that can clone other stuff
// while attacking
if (exec.getParam("ValidTgts").contains("nonLegendary") && attacker.getType().isLegendary()) {
continue;
}
int maxPwr = 0;
for (Card c : attacker.getController().getCreaturesInPlay()) {
if (c.getNetPower() > maxPwr || (c.getNetPower() == maxPwr && ComputerUtilCard.evaluateCreature(c) > ComputerUtilCard.evaluateCreature(attackerAfterTrigs))) {
maxPwr = c.getNetPower();
attackerAfterTrigs = c;
}
}
}
}
}
}
return attackerAfterTrigs;
}
}

View File

@@ -1,14 +1,8 @@
package forge.ai;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import forge.ai.ability.AnimateAi;
import forge.card.ColorSet;
import forge.game.GameActionUtil;
@@ -27,6 +21,10 @@ import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.TextUtil;
import forge.util.collect.FCollectionView;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Set;
public class ComputerUtilCost {
@@ -90,6 +88,15 @@ public class ComputerUtilCost {
return false;
}
// Remove X counters - set ChosenX to max possible value here, the SAs should correct that
// value later as the AI decides what to do (in checkApiLogic / checkAiLogic)
if (sa != null && sa.hasSVar(remCounter.getAmount())) {
final String sVar = sa.getSVar(remCounter.getAmount());
if (sVar.equals("XChoice")) {
sa.setSVar("ChosenX", String.valueOf(source.getCounters(type)));
}
}
// check the sa what the PaymentDecision is.
// ignore Loyality abilities with Zero as Cost
if (sa != null && !CounterType.LOYALTY.equals(type)) {
@@ -231,13 +238,15 @@ public class ComputerUtilCost {
* the source
* @return true, if successful
*/
public static boolean checkCreatureSacrificeCost(final Player ai, final Cost cost, final Card source) {
public static boolean checkCreatureSacrificeCost(final Player ai, final Cost cost, final Card source, final SpellAbility sourceAbility) {
if (cost == null) {
return true;
}
for (final CostPart part : cost.getCostParts()) {
if (part instanceof CostSacrifice) {
final CostSacrifice sac = (CostSacrifice) part;
final int amount = AbilityUtils.calculateAmount(source, sac.getAmount(), sourceAbility);
if (sac.payCostFromSource() && source.isCreature()) {
return false;
}
@@ -247,10 +256,19 @@ public class ComputerUtilCost {
continue;
}
final CardCollection typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), source.getController(), source, null);
if (ComputerUtil.getCardPreference(ai, source, "SacCost", typeList) == null) {
final CardCollection sacList = new CardCollection();
final CardCollection typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(";"), source.getController(), source, null);
int count = 0;
while (count < amount) {
Card prefCard = ComputerUtil.getCardPreference(ai, source, "SacCost", typeList);
if (prefCard == null) {
return false;
}
sacList.add(prefCard);
typeList.remove(prefCard);
count++;
}
}
}
return true;
@@ -267,13 +285,14 @@ public class ComputerUtilCost {
* is the gain important enough?
* @return true, if successful
*/
public static boolean checkSacrificeCost(final Player ai, final Cost cost, final Card source, final boolean important) {
public static boolean checkSacrificeCost(final Player ai, final Cost cost, final Card source, final SpellAbility sourceAbility, final boolean important) {
if (cost == null) {
return true;
}
for (final CostPart part : cost.getCostParts()) {
if (part instanceof CostSacrifice) {
final CostSacrifice sac = (CostSacrifice) part;
final int amount = AbilityUtils.calculateAmount(source, sac.getAmount(), sourceAbility);
final String type = sac.getType();
@@ -286,10 +305,20 @@ public class ComputerUtilCost {
}
continue;
}
final CardCollection sacList = new CardCollection();
final CardCollection typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(";"), source.getController(), source, null);
if (ComputerUtil.getCardPreference(ai, source, "SacCost", typeList) == null) {
int count = 0;
while (count < amount) {
Card prefCard = ComputerUtil.getCardPreference(ai, source, "SacCost", typeList);
if (prefCard == null) {
return false;
}
sacList.add(prefCard);
typeList.remove(prefCard);
count++;
}
}
}
return true;
@@ -336,7 +365,7 @@ public class ComputerUtilCost {
final int vehicleValue = ComputerUtilCard.evaluateCreature(vehicle);
String type = part.getType();
String totalP = type.split("withTotalPowerGE")[1];
type = type.replace("+withTotalPowerGE" + totalP, "");
type = TextUtil.fastReplace(type, TextUtil.concatNoSpace("+withTotalPowerGE", totalP), "");
CardCollection exclude = CardLists.getValidCards(
new CardCollection(ai.getCardsIn(ZoneType.Battlefield)), type.split(";"),
source.getController(), source, sa);
@@ -364,8 +393,8 @@ public class ComputerUtilCost {
* the source
* @return true, if successful
*/
public static boolean checkSacrificeCost(final Player ai, final Cost cost, final Card source) {
return checkSacrificeCost(ai, cost, source, true);
public static boolean checkSacrificeCost(final Player ai, final Cost cost, final Card source, final SpellAbility sourceAbility) {
return checkSacrificeCost(ai, cost, source, sourceAbility,true);
}
/**
@@ -561,12 +590,12 @@ public class ComputerUtilCost {
return checkLifeCost(payer, cost, source, 4, sa)
&& checkDamageCost(payer, cost, source, 4)
&& (isMine || checkSacrificeCost(payer, cost, source))
&& (isMine || checkSacrificeCost(payer, cost, source, sa))
&& (isMine || checkDiscardCost(payer, cost, source))
&& (!source.getName().equals("Tyrannize") || payer.getCardsIn(ZoneType.Hand).size() > 2)
&& (!source.getName().equals("Perplex") || payer.getCardsIn(ZoneType.Hand).size() < 2)
&& (!source.getName().equals("Breaking Point") || payer.getCreaturesInPlay().size() > 1)
&& (!source.getName().equals("Chain of Vapor") || (payer.getOpponent().getCreaturesInPlay().size() > 0 && payer.getLandsInPlay().size() > 3));
&& (!source.getName().equals("Chain of Vapor") || (ComputerUtil.getOpponentFor(payer).getCreaturesInPlay().size() > 0 && payer.getLandsInPlay().size() > 3));
}
public static Set<String> getAvailableManaColors(Player ai, Card additionalLand) {

View File

@@ -1,12 +1,8 @@
package forge.ai;
import com.google.common.base.Predicate;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.base.Predicates;
import com.google.common.collect.*;
import forge.ai.ability.AnimateAi;
import forge.card.ColorSet;
import forge.card.MagicColor;
@@ -18,11 +14,7 @@ import forge.game.Game;
import forge.game.GameActionUtil;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardUtil;
import forge.game.card.*;
import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostAdjustment;
@@ -41,7 +33,6 @@ import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.TextUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
@@ -203,7 +194,8 @@ public class ComputerUtilMana {
continue;
}
if (sa.getHostCard() != null && sa.getApi() == ApiType.Animate) {
if (sa.getHostCard() != null) {
if (sa.getApi() == ApiType.Animate) {
// For abilities like Genju of the Cedars, make sure that we're not activating the aura ability by tapping the enchanted card for mana
if (sa.getHostCard().isAura() && "Enchanted".equals(sa.getParam("Defined"))
&& ma.getHostCard() == sa.getHostCard().getEnchantingCard()
@@ -213,31 +205,61 @@ public class ComputerUtilMana {
// If a manland was previously animated this turn, do not tap it to animate another manland
if (sa.getHostCard().isLand() && ma.getHostCard().isLand()
&& ai.getController() instanceof PlayerControllerAi
&& ai.getController().isAI()
&& AnimateAi.isAnimatedThisTurn(ai, ma.getHostCard())) {
continue;
}
} else if (sa.getApi() == ApiType.Pump) {
if ((sa.getHostCard().isInstant() || sa.getHostCard().isSorcery())
&& ma.getHostCard().isCreature()
&& ai.getController().isAI()
&& ma.getPayCosts().hasTapCost()
&& sa.getTargets().getTargetCards().contains(ma.getHostCard())) {
// do not activate pump instants/sorceries targeting creatures by tapping targeted
// creatures for mana (for example, Servant of the Conduit)
continue;
}
} else if (sa.getApi() == ApiType.Attach
&& "AvoidPayingWithAttachTarget".equals(sa.getHostCard().getSVar("AIPaymentPreference"))) {
// For cards like Genju of the Cedars, make sure we're not attaching to the same land that will
// be tapped to pay its own cost if there's another untapped land like that available
if (ma.getHostCard().equals(sa.getTargetCard())) {
if (CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), Predicates.and(CardPredicates.nameEquals(ma.getHostCard().getName()), CardPredicates.Presets.UNTAPPED)).size() > 1) {
continue;
}
}
}
}
SpellAbility paymentChoice = ma;
// Exception: when paying generic mana with Cavern of Souls, prefer the colored mana producing ability
// to attempt to make the spell uncounterable when possible.
if ((toPay == ManaCostShard.GENERIC || toPay == ManaCostShard.X)
&& ComputerUtilAbility.getAbilitySourceName(ma).equals("Cavern of Souls")
if (ComputerUtilAbility.getAbilitySourceName(ma).equals("Cavern of Souls")
&& sa.getHostCard().getType().getCreatureTypes().contains(ma.getHostCard().getChosenType())) {
if (toPay == ManaCostShard.COLORLESS && cost.getUnpaidShards().contains(ManaCostShard.GENERIC)) {
// Deprioritize Cavern of Souls, try to pay generic mana with it instead to use the NoCounter ability
continue;
} else if (toPay == ManaCostShard.GENERIC || toPay == ManaCostShard.X) {
for (SpellAbility ab : saList) {
if (ab.isManaAbility() && ab.getManaPart().isAnyMana() && ab.hasParam("AddsNoCounter")) {
return ab;
if (!ab.getHostCard().isTapped()) {
paymentChoice = ab;
break;
}
}
}
}
}
final String typeRes = cost.getSourceRestriction();
if (StringUtils.isNotBlank(typeRes) && !ma.getHostCard().getType().hasStringType(typeRes)) {
if (StringUtils.isNotBlank(typeRes) && !paymentChoice.getHostCard().getType().hasStringType(typeRes)) {
continue;
}
if (canPayShardWithSpellAbility(toPay, ai, ma, sa, checkCosts)) {
return ma;
if (canPayShardWithSpellAbility(toPay, ai, paymentChoice, sa, checkCosts)) {
return paymentChoice;
}
}
return null;
@@ -491,6 +513,16 @@ public class ComputerUtilMana {
// extraMana, sa.getHostCard(), sa.toUnsuppressedString(), StringUtils.join(paymentPlan, "\n\t"));
// }
// See if it's possible to pay with something that was left in the mana pool in corner cases,
// e.g. Gemstone Caverns with a Luck counter on it generating colored mana (which fails to be
// processed correctly on a per-ability basis, leaving floating mana in the pool)
if (!cost.isPaid() && !manapool.isEmpty()) {
for (byte color : MagicColor.WUBRGC) {
manapool.tryPayCostWithColor(color, sa, cost);
}
}
// The cost is still unpaid, so refund the mana and report
if (!cost.isPaid()) {
refundMana(manaSpentToPay, ai, sa);
if (test) {
@@ -802,7 +834,7 @@ public class ComputerUtilMana {
}
// isManaSourceReserved returns true if sourceCard is reserved as a mana source for payment
// for the future spell to be cast in Mana 2. However, if "sa" (the spell ability that is
// for the future spell to be cast in another phase. However, if "sa" (the spell ability that is
// being considered for casting) is high priority, then mana source reservation will be
// ignored.
private static boolean isManaSourceReserved(Player ai, Card sourceCard, SpellAbility sa) {
@@ -816,8 +848,21 @@ public class ComputerUtilMana {
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
int chanceToReserve = aic.getIntProperty(AiProps.RESERVE_MANA_FOR_MAIN2_CHANCE);
PhaseType curPhase = ai.getGame().getPhaseHandler().getPhase();
// For combat tricks, always obey mana reservation
if (curPhase == PhaseType.COMBAT_DECLARE_BLOCKERS || curPhase == PhaseType.CLEANUP) {
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK);
}
else {
if (AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_DECLBLK)) {
// This mana source is held elsewhere for a combat trick.
return true;
}
}
// If it's a low priority spell (it's explicitly marked so elsewhere in the AI with a SVar), always
// obey mana reservations; otherwise, obey mana reservations depending on the "chance to reserve"
// obey mana reservations for Main 2; otherwise, obey mana reservations depending on the "chance to reserve"
// AI profile variable.
if (sa.getSVar("LowPriorityAI").equals("")) {
if (chanceToReserve == 0 || MyRandom.getRandom().nextInt(100) >= chanceToReserve) {
@@ -825,16 +870,16 @@ public class ComputerUtilMana {
}
}
PhaseType curPhase = ai.getGame().getPhaseHandler().getPhase();
if (curPhase == PhaseType.MAIN2 || curPhase == PhaseType.CLEANUP) {
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES);
AiCardMemory.clearMemorySet(ai, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2);
}
else {
if (AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES)) {
if (AiCardMemory.isRememberedCard(ai, sourceCard, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2)) {
// This mana source is held elsewhere for a Main Phase 2 spell.
return true;
}
}
return false;
}
@@ -1092,8 +1137,65 @@ public class ComputerUtilMana {
return cost;
}
// This method can be used to estimate the total amount of mana available to the player,
// including the mana available in that player's mana pool
public static int getAvailableManaEstimate(final Player p) {
return getAvailableManaEstimate(p, true);
}
public static int getAvailableManaEstimate(final Player p, final boolean checkPlayable) {
int availableMana = 0;
final CardCollectionView list = new CardCollection(p.getCardsIn(ZoneType.Battlefield));
final List<Card> srcs = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return !c.getManaAbilities().isEmpty();
}
});
int maxProduced = 0;
int producedWithCost = 0;
boolean hasSourcesWithNoManaCost = false;
for (Card src : srcs) {
maxProduced = 0;
for (SpellAbility ma : src.getManaAbilities()) {
ma.setActivatingPlayer(p);
if (!checkPlayable || ma.canPlay()) {
int costsToActivate = ma.getPayCosts() != null && ma.getPayCosts().getCostMana() != null ? ma.getPayCosts().getCostMana().convertAmount() : 0;
int producedMana = ma.getParamOrDefault("Produced", "").split(" ").length;
int producedAmount = AbilityUtils.calculateAmount(src, ma.getParamOrDefault("Amount", "1"), ma);
int producedTotal = producedMana * producedAmount - costsToActivate;
if (costsToActivate > 0) {
producedWithCost += producedTotal;
} else if (!hasSourcesWithNoManaCost) {
hasSourcesWithNoManaCost = true;
}
if (producedTotal > maxProduced) {
maxProduced = producedTotal;
}
}
}
availableMana += maxProduced;
}
availableMana += p.getManaPool().totalMana();
if (producedWithCost > 0 && !hasSourcesWithNoManaCost) {
availableMana -= producedWithCost; // probably can't activate them, no other mana available
}
return availableMana;
}
//This method is currently used by AI to estimate available mana
public static CardCollection getAvailableMana(final Player ai, final boolean checkPlayable) {
public static CardCollection getAvailableManaSources(final Player ai, final boolean checkPlayable) {
final CardCollectionView list = CardCollection.combine(ai.getCardsIn(ZoneType.Battlefield), ai.getCardsIn(ZoneType.Hand));
final List<Card> manaSources = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -1200,7 +1302,7 @@ public class ComputerUtilMana {
System.out.println("DEBUG_MANA_PAYMENT: sortedManaSources = " + sortedManaSources);
}
return sortedManaSources;
} // getAvailableMana()
} // getAvailableManaSources()
//This method is currently used by AI to estimate mana available
private static ListMultimap<Integer, SpellAbility> groupSourcesByManaColor(final Player ai, boolean checkPlayable) {
@@ -1221,7 +1323,7 @@ public class ComputerUtilMana {
}
// Loop over all current available mana sources
for (final Card sourceCard : getAvailableMana(ai, checkPlayable)) {
for (final Card sourceCard : getAvailableManaSources(ai, checkPlayable)) {
if (DEBUG_MANA_PAYMENT) {
System.out.println("DEBUG_MANA_PAYMENT: groupSourcesByManaColor sourceCard = " + sourceCard);
}
@@ -1264,7 +1366,7 @@ public class ComputerUtilMana {
Card crd = replacementEffect.getHostCard();
String repType = crd.getSVar(replacementEffect.getMapParams().get("ManaReplacement"));
if (repType.contains("Chosen")) {
repType = repType.replace("Chosen", MagicColor.toShortString(crd.getChosenColor()));
repType = TextUtil.fastReplace(repType, "Chosen", MagicColor.toShortString(crd.getChosenColor()));
}
mp.setManaReplaceType(repType);
}

View File

@@ -2,7 +2,12 @@ package forge.ai;
import com.google.common.base.Function;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CounterType;
import forge.game.cost.CostPayEnergy;
import forge.game.keyword.KeywordInterface;
import forge.game.spellability.SpellAbility;
public class CreatureEvaluator implements Function<Card, Integer> {
@@ -19,13 +24,18 @@ public class CreatureEvaluator implements Function<Card, Integer> {
}
public int evaluateCreature(final Card c) {
return evaluateCreature(c, true, true);
}
public int evaluateCreature(final Card c, final boolean considerPT, final boolean considerCMC) {
int value = 80;
if (!c.isToken()) {
value += addValue(20, "non-token"); // tokens should be worth less than actual cards
}
int power = getEffectivePower(c);
final int toughness = getEffectiveToughness(c);
for (String keyword : c.getKeywords()) {
for (KeywordInterface kw : c.getKeywords()) {
String keyword = kw.getOriginal();
if (keyword.equals("Prevent all combat damage that would be dealt by CARDNAME.")
|| keyword.equals("Prevent all damage that would be dealt by CARDNAME.")
|| keyword.equals("Prevent all combat damage that would be dealt to and dealt by CARDNAME.")
@@ -34,9 +44,13 @@ public class CreatureEvaluator implements Function<Card, Integer> {
break;
}
}
if (considerPT) {
value += addValue(power * 15, "power");
value += addValue(toughness * 10, "toughness: " + toughness);
}
if (considerCMC) {
value += addValue(c.getCMC() * 5, "cmc");
}
// Evasion keywords
if (c.hasKeyword("Flying")) {
@@ -91,6 +105,7 @@ public class CreatureEvaluator implements Function<Card, Integer> {
value += addValue(power * 15, "infect");
}
value += addValue(c.getKeywordMagnitude("Rampage"), "rampage");
value += addValue(c.getKeywordMagnitude("Afflict") * 5, "afflict");
}
value += addValue(c.getKeywordMagnitude("Bushido") * 16, "bushido");
@@ -99,6 +114,14 @@ public class CreatureEvaluator implements Function<Card, Integer> {
value += addValue(c.getKeywordMagnitude("Annihilator") * 50, "eldrazi");
value += addValue(c.getKeywordMagnitude("Absorb") * 11, "absorb");
// Keywords that may produce temporary or permanent buffs over time
if (c.hasKeyword("Prowess")) {
value += addValue(5, "prowess");
}
if (c.hasKeyword("Outlast")) {
value += addValue(10, "outlast");
}
// Defensive Keywords
if (c.hasKeyword("Reach") && !c.hasKeyword("Flying")) {
value += addValue(5, "reach");
@@ -184,7 +207,7 @@ public class CreatureEvaluator implements Function<Card, Integer> {
for (final SpellAbility sa : c.getSpellAbilities()) {
if (sa.isAbility()) {
value += addValue(10, "sa: " + sa);
value += addValue(evaluateSpellAbility(sa), "sa: " + sa);
}
}
if (!c.getManaAbilities().isEmpty()) {
@@ -203,9 +226,44 @@ public class CreatureEvaluator implements Function<Card, Integer> {
if (!c.getEncodedCards().isEmpty()) {
value += addValue(24, "encoded");
}
// card-specific evaluation modifier
if (c.hasSVar("AIEvaluationModifier")) {
int mod = AbilityUtils.calculateAmount(c, c.getSVar("AIEvaluationModifier"), null);
value += mod;
}
return value;
}
private int evaluateSpellAbility(SpellAbility sa) {
// Pump abilities
if (sa.getApi() == ApiType.Pump) {
// Pump abilities that grant +X/+X to the card
if ("+X".equals(sa.getParam("NumAtt"))
&& "+X".equals(sa.getParam("NumDef"))
&& !sa.usesTargeting()
&& (!sa.hasParam("Defined") || "Self".equals(sa.getParam("Defined")))) {
if (sa.getPayCosts() != null && sa.getPayCosts().hasOnlySpecificCostType(CostPayEnergy.class)) {
// Electrostatic Pummeler, can be expanded for similar cards
int initPower = getEffectivePower(sa.getHostCard());
int pumpedPower = initPower;
int energy = sa.getHostCard().getController().getCounters(CounterType.ENERGY);
if (energy > 0) {
int numActivations = energy / 3;
for (int i = 0; i < numActivations; i++) {
pumpedPower *= 2;
}
return (pumpedPower - initPower) * 15;
}
}
}
}
// default value
return 10;
}
protected int addValue(int value, String text) {
return value;
}

View File

@@ -1,18 +1,10 @@
package forge.ai;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import forge.StaticData;
import forge.card.CardStateName;
import forge.game.Game;
import forge.game.GameEntity;
@@ -21,16 +13,29 @@ import forge.game.ability.effects.DetachedCardEffect;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardFactory;
import forge.game.card.CounterType;
import forge.game.card.token.TokenInfo;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.event.GameEventAttackersDeclared;
import forge.game.event.GameEventCombatChanged;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.TriggerType;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.item.IPaperCard;
import forge.item.PaperCard;
import forge.util.TextUtil;
import forge.util.collect.FCollectionView;
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Map.Entry;
public abstract class GameState {
private static final Map<ZoneType, String> ZONES = new HashMap<ZoneType, String>();
@@ -48,17 +53,42 @@ public abstract class GameState {
private String humanCounters = "";
private String computerCounters = "";
private boolean puzzleCreatorState = false;
private final Map<ZoneType, String> humanCardTexts = new EnumMap<ZoneType, String>(ZoneType.class);
private final Map<ZoneType, String> aiCardTexts = new EnumMap<ZoneType, String>(ZoneType.class);
private final Map<Integer, Card> idToCard = new HashMap<>();
private final Map<Card, Integer> cardToAttachId = new HashMap<>();
private final Map<Card, Integer> markedDamage = new HashMap<>();
private final Map<Card, List<String>> cardToChosenClrs = new HashMap<>();
private final Map<Card, String> cardToChosenType = new HashMap<>();
private final Map<Card, List<String>> cardToRememberedId = new HashMap<>();
private final Map<Card, List<String>> cardToImprintedId = new HashMap<>();
private final Map<Card, String> cardToNamedCard = new HashMap<>();
private final Map<Card, String> cardToExiledWithId = new HashMap<>();
private final Map<Card, Card> cardAttackMap = new HashMap<>();
private final Map<Card, String> cardToScript = new HashMap<>();
private final Map<String, String> abilityString = new HashMap<>();
private final Set<Card> cardsReferencedByID = new HashSet<>();
private final Set<Card> cardsWithoutETBTrigs = new HashSet<>();
private String tChangePlayer = "NONE";
private String tChangePhase = "NONE";
private String precastHuman = null;
private String precastAI = null;
private int turn;
// Targeting for precast spells in a game state (mostly used by Puzzle Mode game states)
private final int TARGET_NONE = -1; // untargeted spell (e.g. Joraga Invocation)
private final int TARGET_HUMAN = -2;
private final int TARGET_AI = -3;
public GameState() {
}
@@ -67,18 +97,32 @@ public abstract class GameState {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("humanlife=%d\n", humanLife));
sb.append(String.format("ailife=%d\n", computerLife));
if (puzzleCreatorState) {
// append basic puzzle metadata if we're dumping from the puzzle creator screen
sb.append("[metadata]\n");
sb.append("Name:New Puzzle\n");
sb.append("URL:https://www.cardforge.org\n");
sb.append("Goal:Win\n");
sb.append("Turns:1\n");
sb.append("Difficulty:Easy\n");
sb.append("Description:Win this turn.\n");
sb.append("[state]\n");
}
sb.append(TextUtil.concatNoSpace("humanlife=", String.valueOf(humanLife), "\n"));
sb.append(TextUtil.concatNoSpace("ailife=", String.valueOf(computerLife), "\n"));
sb.append(TextUtil.concatNoSpace("turn=", String.valueOf(turn), "\n"));
if (!humanCounters.isEmpty()) {
sb.append(String.format("humancounters=%s\n", humanCounters));
sb.append(TextUtil.concatNoSpace("humancounters=", humanCounters, "\n"));
}
if (!computerCounters.isEmpty()) {
sb.append(String.format("aicounters=%s\n", computerCounters));
sb.append(TextUtil.concatNoSpace("aicounters=", computerCounters, "\n"));
}
sb.append(String.format("activeplayer=%s\n", tChangePlayer));
sb.append(String.format("activephase=%s\n", tChangePhase));
sb.append(TextUtil.concatNoSpace("activeplayer=", tChangePlayer, "\n"));
sb.append(TextUtil.concatNoSpace("activephase=", tChangePhase, "\n"));
appendCards(humanCardTexts, "human", sb);
appendCards(aiCardTexts, "ai", sb);
return sb.toString();
@@ -86,13 +130,13 @@ public abstract class GameState {
private void appendCards(Map<ZoneType, String> cardTexts, String categoryPrefix, StringBuilder sb) {
for (Entry<ZoneType, String> kv : cardTexts.entrySet()) {
sb.append(String.format("%s%s=%s\n", categoryPrefix, ZONES.get(kv.getKey()), kv.getValue()));
sb.append(TextUtil.concatNoSpace(categoryPrefix, ZONES.get(kv.getKey()), "=", kv.getValue(), "\n"));
}
}
public void initFromGame(Game game) throws Exception {
FCollectionView<Player> players = game.getPlayers();
// Can only serialized a two player game with one AI and one human.
// Can only serialize a two player game with one AI and one human.
if (players.size() != 2) {
throw new Exception("Game not supported");
}
@@ -108,14 +152,55 @@ public abstract class GameState {
tChangePlayer = game.getPhaseHandler().getPlayerTurn() == ai ? "ai" : "human";
tChangePhase = game.getPhaseHandler().getPhase().toString();
turn = game.getPhaseHandler().getTurn();
aiCardTexts.clear();
humanCardTexts.clear();
// Mark the cards that need their ID remembered for various reasons
cardsReferencedByID.clear();
for (ZoneType zone : ZONES.keySet()) {
for (Card card : game.getCardsIn(zone)) {
if (card.getExiledWith() != null) {
// Remember the ID of the card that exiled this card
cardsReferencedByID.add(card.getExiledWith());
}
if (zone == ZoneType.Battlefield) {
if (!card.getEnchantedBy(false).isEmpty()
|| !card.getEquippedBy(false).isEmpty()
|| !card.getFortifiedBy(false).isEmpty()) {
// Remember the ID of cards that have attachments
cardsReferencedByID.add(card);
}
}
for (Object o : card.getRemembered()) {
// Remember the IDs of remembered cards
if (o instanceof Card) {
cardsReferencedByID.add((Card)o);
}
}
for (Card i : card.getImprintedCards()) {
// Remember the IDs of imprinted cards
cardsReferencedByID.add(i);
}
if (game.getCombat() != null && game.getCombat().isAttacking(card)) {
// Remember the IDs of attacked planeswalkers
GameEntity def = game.getCombat().getDefenderByAttacker(card);
if (def instanceof Card) {
cardsReferencedByID.add((Card)def);
}
}
}
}
for (ZoneType zone : ZONES.keySet()) {
// Init texts to empty, so that restoring will clear the state
// if the zone had no cards in it (e.g. empty hand).
aiCardTexts.put(zone, "");
humanCardTexts.put(zone, "");
for (Card card : game.getCardsIn(zone)) {
if (card.getName().equals("Puzzle Goal") && card.getOracleText().contains("New Puzzle")) {
puzzleCreatorState = true;
}
if (card instanceof DetachedCardEffect) {
continue;
}
@@ -130,7 +215,7 @@ public abstract class GameState {
newText.append(";");
}
if (c.isToken()) {
newText.append("t:" + new CardFactory.TokenInfo(c).toString());
newText.append("t:" + new TokenInfo(c).toString());
} else {
if (c.getPaperCard() == null) {
return;
@@ -140,6 +225,11 @@ public abstract class GameState {
if (c.isCommander()) {
newText.append("|IsCommander");
}
if (cardsReferencedByID.contains(c)) {
newText.append("|Id:").append(c.getId());
}
if (zoneType == ZoneType.Battlefield) {
if (c.isTapped()) {
newText.append("|Tapped");
@@ -147,6 +237,16 @@ public abstract class GameState {
if (c.isSick()) {
newText.append("|SummonSick");
}
if (c.isRenowned()) {
newText.append("|Renowned");
}
if (c.isMonstrous()) {
newText.append("|Monstrous:");
newText.append(c.getMonstrosityNum());
}
if (c.isPhasedOut()) {
newText.append("|PhasedOut");
}
if (c.isFaceDown()) {
newText.append("|FaceDown");
if (c.isManifested()) {
@@ -155,11 +255,10 @@ public abstract class GameState {
}
if (c.getCurrentStateName().equals(CardStateName.Transformed)) {
newText.append("|Transformed");
}
Map<CounterType, Integer> counters = c.getCounters();
if (!counters.isEmpty()) {
newText.append("|Counters:");
newText.append(countersToString(counters));
} else if (c.getCurrentStateName().equals(CardStateName.Flipped)) {
newText.append("|Flipped");
} else if (c.getCurrentStateName().equals(CardStateName.Meld)) {
newText.append("|Meld");
}
if (c.getEquipping() != null) {
newText.append("|Attaching:").append(c.getEquipping().getId());
@@ -169,10 +268,69 @@ public abstract class GameState {
newText.append("|Attaching:").append(c.getEnchantingCard().getId());
}
if (!c.getEnchantedBy(false).isEmpty() || !c.getEquippedBy(false).isEmpty() || !c.getFortifiedBy(false).isEmpty()) {
newText.append("|Id:").append(c.getId());
if (c.getDamage() > 0) {
newText.append("|Damage:").append(c.getDamage());
}
if (!c.getChosenColor().isEmpty()) {
newText.append("|ChosenColor:").append(TextUtil.join(c.getChosenColors(), ","));
}
if (!c.getChosenType().isEmpty()) {
newText.append("|ChosenType:").append(c.getChosenType());
}
if (!c.getNamedCard().isEmpty()) {
newText.append("|NamedCard:").append(c.getNamedCard());
}
List<String> rememberedCardIds = Lists.newArrayList();
for (Object obj : c.getRemembered()) {
if (obj instanceof Card) {
int id = ((Card)obj).getId();
rememberedCardIds.add(String.valueOf(id));
}
}
if (!rememberedCardIds.isEmpty()) {
newText.append("|RememberedCards:").append(TextUtil.join(rememberedCardIds, ","));
}
List<String> imprintedCardIds = Lists.newArrayList();
for (Card impr : c.getImprintedCards()) {
int id = impr.getId();
imprintedCardIds.add(String.valueOf(id));
}
if (!imprintedCardIds.isEmpty()) {
newText.append("|Imprinting:").append(TextUtil.join(imprintedCardIds, ","));
}
}
if (zoneType == ZoneType.Exile) {
if (c.getExiledWith() != null) {
newText.append("|ExiledWith:").append(c.getExiledWith().getId());
}
if (c.isFaceDown()) {
newText.append("|FaceDown"); // Exiled face down
}
}
if (zoneType == ZoneType.Battlefield || zoneType == ZoneType.Exile) {
// A card can have counters on the battlefield and in exile (e.g. exiled by Mairsil, the Pretender)
Map<CounterType, Integer> counters = c.getCounters();
if (!counters.isEmpty()) {
newText.append("|Counters:");
newText.append(countersToString(counters));
}
}
if (c.getGame().getCombat() != null) {
if (c.getGame().getCombat().isAttacking(c)) {
newText.append("|Attacking");
GameEntity def = c.getGame().getCombat().getDefenderByAttacker(c);
if (def instanceof Card) {
newText.append(":" + def.getId());
}
}
}
cardTexts.put(zoneType, newText.toString());
}
@@ -186,7 +344,7 @@ public abstract class GameState {
}
first = false;
counterString.append(String.format("%s=%d", kv.getKey().toString(), kv.getValue()));
counterString.append(TextUtil.concatNoSpace(kv.getKey().toString(), "=", String.valueOf(kv.getValue())));
}
return counterString.toString();
}
@@ -238,6 +396,11 @@ public abstract class GameState {
boolean isHuman = categoryName.startsWith("human");
if (categoryName.equals("turn")) {
turn = Integer.parseInt(categoryValue);
} else {
turn = 1;
}
if (categoryName.endsWith("life")) {
if (isHuman)
humanLife = Integer.parseInt(categoryValue);
@@ -298,6 +461,12 @@ public abstract class GameState {
abilityString.put(categoryName.substring("ability".length()), categoryValue);
}
else if (categoryName.endsWith("precast")) {
if (isHuman)
precastHuman = categoryValue;
else
precastAI = categoryValue;
}
else {
System.out.println("Unknown key: " + categoryName);
}
@@ -318,6 +487,13 @@ public abstract class GameState {
idToCard.clear();
cardToAttachId.clear();
cardToRememberedId.clear();
cardToExiledWithId.clear();
markedDamage.clear();
cardToChosenClrs.clear();
cardToChosenType.clear();
cardToScript.clear();
cardAttackMap.clear();
Player newPlayerTurn = tChangePlayer.equals("human") ? human : tChangePlayer.equals("ai") ? ai : null;
PhaseType newPhase = tChangePhase.equals("none") ? null : PhaseType.smartValueOf(tChangePhase);
@@ -331,22 +507,369 @@ public abstract class GameState {
if (!computerCounters.isEmpty()) {
applyCountersToGameEntity(ai, computerCounters);
}
game.getPhaseHandler().devModeSet(newPhase, newPlayerTurn);
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
game.getPhaseHandler().devModeSet(newPhase, newPlayerTurn, turn);
game.getTriggerHandler().setSuppressAllTriggers(true);
setupPlayerState(humanLife, humanCardTexts, human);
setupPlayerState(computerLife, aiCardTexts, ai);
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
handleCardAttachments();
handleChosenEntities();
handleRememberedEntities();
handleScriptExecution(game);
handlePrecastSpells(game);
handleMarkedDamage();
game.getTriggerHandler().setSuppressAllTriggers(false);
// Combat only works for 1v1 matches for now (which are the only matches dev mode supports anyway)
// Note: triggers may fire during combat declarations ("whenever X attacks, ...", etc.)
if (newPhase == PhaseType.COMBAT_DECLARE_ATTACKERS || newPhase == PhaseType.COMBAT_DECLARE_BLOCKERS) {
boolean toDeclareBlockers = newPhase == PhaseType.COMBAT_DECLARE_BLOCKERS;
handleCombat(game, newPlayerTurn, newPlayerTurn.getSingleOpponent(), toDeclareBlockers);
}
game.getStack().setResolving(false);
game.getAction().checkStateEffects(true); //ensure state based effects and triggers are updated
}
private void handleCombat(final Game game, final Player attackingPlayer, final Player defendingPlayer, final boolean toDeclareBlockers) {
// First we need to ensure that all attackers are declared in the Declare Attackers step,
// even if proceeding straight to Declare Blockers
game.getPhaseHandler().devModeSet(PhaseType.COMBAT_DECLARE_ATTACKERS, attackingPlayer, turn);
if (game.getPhaseHandler().getCombat() == null) {
game.getPhaseHandler().setCombat(new Combat(attackingPlayer));
game.updateCombatForView();
}
Combat combat = game.getPhaseHandler().getCombat();
for (Entry<Card, Card> attackMap : cardAttackMap.entrySet()) {
Card attacker = attackMap.getKey();
Card attacked = attackMap.getValue();
combat.addAttacker(attacker, attacked == null ? defendingPlayer : attacked);
}
// Run the necessary combat events and triggers to set things up correctly as if the
// attack was actually declared by the attacking player
Multimap<GameEntity, Card> attackersMap = ArrayListMultimap.create();
for (GameEntity ge : combat.getDefenders()) {
attackersMap.putAll(ge, combat.getAttackersOf(ge));
}
game.fireEvent(new GameEventAttackersDeclared(attackingPlayer, attackersMap));
if (!combat.getAttackers().isEmpty()) {
List<GameEntity> attackedTarget = Lists.newArrayList();
for (final Card c : combat.getAttackers()) {
attackedTarget.add(combat.getDefenderByAttacker(c));
}
final Map<String, Object> runParams = Maps.newHashMap();
runParams.put("Attackers", combat.getAttackers());
runParams.put("AttackingPlayer", combat.getAttackingPlayer());
runParams.put("AttackedTarget", attackedTarget);
game.getTriggerHandler().runTrigger(TriggerType.AttackersDeclared, runParams, false);
}
for (final Card c : combat.getAttackers()) {
CombatUtil.checkDeclaredAttacker(game, c, combat);
}
game.getTriggerHandler().resetActiveTriggers();
game.updateCombatForView();
game.fireEvent(new GameEventCombatChanged());
// Gracefully proceed to Declare Blockers, giving priority to the defending player,
// but only if the stack is empty (otherwise the game will crash).
game.getStack().addAllTriggeredAbilitiesToStack();
if (toDeclareBlockers && game.getStack().isEmpty()) {
game.getPhaseHandler().devAdvanceToPhase(PhaseType.COMBAT_DECLARE_BLOCKERS);
}
}
private void handleRememberedEntities() {
// Remembered: X
for (Entry<Card, List<String>> rememberedEnts : cardToRememberedId.entrySet()) {
Card c = rememberedEnts.getKey();
List<String> ids = rememberedEnts.getValue();
for (String id : ids) {
Card tgt = idToCard.get(Integer.parseInt(id));
c.addRemembered(tgt);
}
}
// Imprinting: X
for (Entry<Card, List<String>> imprintedCards : cardToImprintedId.entrySet()) {
Card c = imprintedCards.getKey();
List<String> ids = imprintedCards.getValue();
for (String id : ids) {
Card tgt = idToCard.get(Integer.parseInt(id));
c.addImprintedCard(tgt);
}
}
// Exiled with X
for (Entry<Card, String> rememberedEnts : cardToExiledWithId.entrySet()) {
Card c = rememberedEnts.getKey();
String id = rememberedEnts.getValue();
Card exiledWith = idToCard.get(Integer.parseInt(id));
c.setExiledWith(exiledWith);
}
}
private int parseTargetInScript(final String tgtDef) {
int tgtID = TARGET_NONE;
if (tgtDef.equalsIgnoreCase("human")) {
tgtID = TARGET_HUMAN;
} else if (tgtDef.equalsIgnoreCase("ai")) {
tgtID = TARGET_AI;
} else {
tgtID = Integer.parseInt(tgtDef);
}
return tgtID;
}
private void handleScriptedTargetingForSA(final Game game, final SpellAbility sa, int tgtID) {
Player human = game.getPlayers().get(0);
Player ai = game.getPlayers().get(1);
if (tgtID != TARGET_NONE) {
switch (tgtID) {
case TARGET_HUMAN:
sa.getTargets().add(human);
break;
case TARGET_AI:
sa.getTargets().add(ai);
break;
default:
sa.getTargets().add(idToCard.get(tgtID));
break;
}
}
}
private void handleScriptExecution(final Game game) {
for (Entry<Card, String> scriptPtr : cardToScript.entrySet()) {
Card c = scriptPtr.getKey();
String sPtr = scriptPtr.getValue();
executeScript(game, c, sPtr);
}
}
private void executeScript(Game game, Card c, String sPtr) {
int tgtID = TARGET_NONE;
if (sPtr.contains("->")) {
String tgtDef = sPtr.substring(sPtr.lastIndexOf("->") + 2);
tgtID = parseTargetInScript(tgtDef);
sPtr = sPtr.substring(0, sPtr.lastIndexOf("->"));
}
SpellAbility sa = null;
if (StringUtils.isNumeric(sPtr)) {
int numSA = Integer.parseInt(sPtr);
if (c.getSpellAbilities().size() >= numSA) {
sa = c.getSpellAbilities().get(numSA);
} else {
System.err.println("ERROR: Unable to find SA with index " + numSA + " on card " + c + " to execute!");
}
} else {
// Special handling for keyworded abilities
if (sPtr.startsWith("KW#")) {
String kwName = sPtr.substring(3);
FCollectionView<SpellAbility> saList = c.getSpellAbilities();
if (kwName.equals("Awaken") || kwName.equals("AwakenOnly")) {
// AwakenOnly only creates the Awaken effect, while Awaken precasts the whole spell with Awaken
for (SpellAbility ab : saList) {
if (ab.getDescription().startsWith("Awaken")) {
ab.setActivatingPlayer(c.getController());
ab.getSubAbility().setActivatingPlayer(c.getController());
// target for Awaken is set in its first subability
handleScriptedTargetingForSA(game, ab.getSubAbility(), tgtID);
sa = kwName.equals("AwakenOnly") ? ab.getSubAbility() : ab;
}
}
if (sa == null) {
System.err.println("ERROR: Could not locate keyworded ability Awaken in card " + c + " to execute!");
return;
}
}
} else {
// SVar-based script execution
String svarValue = "";
if (sPtr.startsWith("CustomScript:")) {
// A custom line defined in the game state file
svarValue = sPtr.substring(sPtr.indexOf(":") + 1);
} else {
// A SVar from the card script file
if (!c.hasSVar(sPtr)) {
System.err.println("ERROR: Unable to find SVar " + sPtr + " on card " + c + " + to execute!");
return;
}
svarValue = c.getSVar(sPtr);
if (tgtID != TARGET_NONE && svarValue.contains("| Defined$")) {
// We want a specific target, so try to undefine a predefined target if possible
svarValue = TextUtil.fastReplace(svarValue, "| Defined$", "| Undefined$");
if (tgtID == TARGET_HUMAN || tgtID == TARGET_AI) {
svarValue += " | ValidTgts$ Player";
} else {
svarValue += " | ValidTgts$ Card";
}
}
}
sa = AbilityFactory.getAbility(svarValue, c);
if (sa == null) {
System.err.println("ERROR: Unable to generate ability for SVar " + svarValue);
}
}
}
sa.setActivatingPlayer(c.getController());
handleScriptedTargetingForSA(game, sa, tgtID);
sa.resolve();
// resolve subabilities
SpellAbility subSa = sa.getSubAbility();
while (subSa != null) {
subSa.resolve();
subSa = subSa.getSubAbility();
}
}
private void handlePrecastSpells(final Game game) {
Player human = game.getPlayers().get(0);
Player ai = game.getPlayers().get(1);
if (precastHuman != null) {
String[] spellList = TextUtil.split(precastHuman, ';');
for (String spell : spellList) {
precastSpellFromCard(spell, human, game);
}
}
if (precastAI != null) {
String[] spellList = TextUtil.split(precastAI, ';');
for (String spell : spellList) {
precastSpellFromCard(spell, ai, game);
}
}
}
private void precastSpellFromCard(String spellDef, final Player activator, final Game game) {
int tgtID = TARGET_NONE;
String scriptID = "";
if (spellDef.contains(":")) {
// targeting via -> will be handled in executeScript
scriptID = spellDef.substring(spellDef.indexOf(":") + 1).trim();
spellDef = spellDef.substring(0, spellDef.indexOf(":")).trim();
} else if (spellDef.contains("->")) {
String tgtDef = spellDef.substring(spellDef.indexOf("->") + 2).trim();
tgtID = parseTargetInScript(tgtDef);
spellDef = spellDef.substring(0, spellDef.indexOf("->")).trim();
}
PaperCard pc = StaticData.instance().getCommonCards().getCard(spellDef);
if (pc == null) {
System.err.println("ERROR: Could not find a card with name " + spellDef + " to precast!");
return;
}
Card c = Card.fromPaperCard(pc, activator);
SpellAbility sa = null;
if (!scriptID.isEmpty()) {
executeScript(game, c, scriptID);
return;
}
sa = c.getFirstSpellAbility();
sa.setActivatingPlayer(activator);
handleScriptedTargetingForSA(game, sa, tgtID);
sa.resolve();
}
private void handleMarkedDamage() {
for (Entry<Card, Integer> entry : markedDamage.entrySet()) {
Card c = entry.getKey();
Integer dmg = entry.getValue();
c.setDamage(dmg);
}
}
private void handleChosenEntities() {
// TODO: the AI still gets to choose something (and the notification box pops up) before the
// choice is overwritten here. Somehow improve this so that there is at least no notification
// about the choice that will be force-changed anyway.
// Chosen colors
for (Entry<Card, List<String>> entry : cardToChosenClrs.entrySet()) {
Card c = entry.getKey();
List<String> colors = entry.getValue();
c.setChosenColors(colors);
}
// Chosen type
for (Entry<Card, String> entry : cardToChosenType.entrySet()) {
Card c = entry.getKey();
c.setChosenType(entry.getValue());
}
// Named card
for (Entry<Card, String> entry : cardToNamedCard.entrySet()) {
Card c = entry.getKey();
c.setNamedCard(entry.getValue());
}
}
private void handleCardAttachments() {
// Unattach all permanents first
for(Entry<Card, Integer> entry : cardToAttachId.entrySet()) {
Card attachedTo = idToCard.get(entry.getValue());
attachedTo.unEnchantAllCards();
attachedTo.unEquipAllCards();
for (Card c : attachedTo.getFortifiedBy(true)) {
attachedTo.unFortifyCard(c);
}
}
// Attach permanents by ID
for(Entry<Card, Integer> entry : cardToAttachId.entrySet()) {
Card attachedTo = idToCard.get(entry.getValue());
Card attacher = entry.getKey();
if (attacher.isEquipment()) {
attacher.equipCard(attachedTo);
} else if (attacher.isAura()) {
attacher.enchantEntity(attachedTo);
} else if (attacher.isFortified()) {
attacher.fortifyCard(attachedTo);
}
}
}
private void applyCountersToGameEntity(GameEntity entity, String counterString) {
//entity.setCounters(new HashMap<CounterType, Integer>());
entity.setCounters(Maps.<CounterType, Integer>newEnumMap(CounterType.class));
String[] allCounterStrings = counterString.split(",");
for (final String counterPair : allCounterStrings) {
String[] pair = counterPair.split("=", 2);
@@ -356,7 +879,6 @@ public abstract class GameState {
private void setupPlayerState(int life, Map<ZoneType, String> cardTexts, final Player p) {
// Lock check static as we setup player state
final Game game = p.getGame();
Map<ZoneType, CardCollectionView> playerCards = new EnumMap<ZoneType, CardCollectionView>(ZoneType.class);
for (Entry<ZoneType, String> kv : cardTexts.entrySet()) {
@@ -384,11 +906,17 @@ public abstract class GameState {
Map<CounterType, Integer> counters = c.getCounters();
// Note: Not clearCounters() since we want to keep the counters
// var as-is.
c.setCounters(new HashMap<CounterType, Integer>());
p.getZone(ZoneType.Hand).add(c);
c.setCounters(Maps.<CounterType, Integer>newEnumMap(CounterType.class));
if (c.isAura()) {
p.getGame().getAction().moveToPlay(c, null);
// dummy "enchanting" to indicate that the card will be force-attached elsewhere
// (will be overridden later, so the actual value shouldn't matter)
c.setEnchanting(c);
}
if (cardsWithoutETBTrigs.contains(c)) {
p.getGame().getAction().moveTo(ZoneType.Battlefield, c, null);
} else {
p.getZone(ZoneType.Hand).add(c);
p.getGame().getAction().moveToPlay(c, null);
}
@@ -401,25 +929,6 @@ public abstract class GameState {
}
}
game.getTriggerHandler().suppressMode(TriggerType.Unequip);
for(Entry<Card, Integer> entry : cardToAttachId.entrySet()) {
Card attachedTo = idToCard.get(entry.getValue());
Card attacher = entry.getKey();
attachedTo.unEnchantAllCards();
attachedTo.unEquipAllCards();
if (attacher.isEquipment()) {
attacher.equipCard(attachedTo);
} else if (attacher.isAura()) {
attacher.enchantEntity(attachedTo);
} else if (attacher.isFortified()) {
attacher.fortifyCard(attachedTo);
}
}
game.getTriggerHandler().clearSuppression(TriggerType.Unequip);
}
/**
@@ -449,10 +958,16 @@ public abstract class GameState {
Card c;
boolean hasSetCurSet = false;
if (cardinfo[0].startsWith("t:")) {
// TODO Make sure Game State conversion works with new tokens
String tokenStr = cardinfo[0].substring(2);
c = CardFactory.makeOneToken(CardFactory.TokenInfo.fromString(tokenStr), player);
c = new TokenInfo(tokenStr).makeOneToken(player);
} else {
PaperCard pc = StaticData.instance().getCommonCards().getCard(cardinfo[0], setCode);
if (pc == null) {
System.err.println("ERROR: Tried to create a non-existent card named " + cardinfo[0] + " (set: " + (setCode == null ? "any" : setCode) + ") when loading game state!");
continue;
}
c = Card.fromPaperCard(pc, player);
if (setCode != null) {
hasSetCurSet = true;
@@ -463,6 +978,13 @@ public abstract class GameState {
for (final String info : cardinfo) {
if (info.startsWith("Tapped")) {
c.tap();
} else if (info.startsWith("Renowned")) {
c.setRenowned(true);
} else if (info.startsWith("Monstrous:")) {
c.setMonstrous(true);
c.setMonstrosityNum(Integer.parseInt(info.substring((info.indexOf(':') + 1))));
} else if (info.startsWith("PhasedOut")) {
c.setPhasedOut(true);
} else if (info.startsWith("Counters:")) {
applyCountersToGameEntity(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("SummonSick")) {
@@ -474,6 +996,10 @@ public abstract class GameState {
}
} else if (info.startsWith("Transformed")) {
c.setState(CardStateName.Transformed, true);
} else if (info.startsWith("Flipped")) {
c.setState(CardStateName.Flipped, true);
} else if (info.startsWith("Meld")) {
c.setState(CardStateName.Meld, true);
} else if (info.startsWith("IsCommander")) {
// TODO: This doesn't seem to properly restore the ability to play the commander. Why?
c.setCommander(true);
@@ -488,6 +1014,32 @@ public abstract class GameState {
} else if (info.startsWith("Ability:")) {
String abString = info.substring(info.indexOf(':') + 1).toLowerCase();
c.addSpellAbility(AbilityFactory.getAbility(abilityString.get(abString), c));
} else if (info.startsWith("Damage:")) {
int dmg = Integer.parseInt(info.substring(info.indexOf(':') + 1));
markedDamage.put(c, dmg);
} else if (info.startsWith("ChosenColor:")) {
cardToChosenClrs.put(c, Arrays.asList(info.substring(info.indexOf(':') + 1).split(",")));
} else if (info.startsWith("ChosenType:")) {
cardToChosenType.put(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("NamedCard:")) {
cardToNamedCard.put(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("ExecuteScript:")) {
cardToScript.put(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("RememberedCards:")) {
cardToRememberedId.put(c, Arrays.asList(info.substring(info.indexOf(':') + 1).split(",")));
} else if (info.startsWith("Imprinting:")) {
cardToImprintedId.put(c, Arrays.asList(info.substring(info.indexOf(':') + 1).split(",")));
} else if (info.startsWith("ExiledWith:")) {
cardToExiledWithId.put(c, info.substring(info.indexOf(':') + 1));
} else if (info.startsWith("Attacking")) {
if (info.contains(":")) {
int id = Integer.parseInt(info.substring(info.indexOf(':') + 1));
cardAttackMap.put(c, idToCard.get(id));
} else {
cardAttackMap.put(c, null);
}
} else if (info.equals("NoETBTrigs")) {
cardsWithoutETBTrigs.add(c);
}
}

View File

@@ -2,7 +2,6 @@ package forge.ai;
import java.util.Set;
import forge.AIOption;
import forge.LobbyPlayer;
import forge.game.Game;
import forge.game.player.IGameEntitiesFactory;

View File

@@ -1,22 +1,14 @@
package forge.ai;
import java.security.InvalidParameterException;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.esotericsoftware.minlog.Log;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import forge.LobbyPlayer;
import forge.ai.ability.ProtectAi;
import forge.card.CardStateName;
import forge.card.ColorSet;
import forge.card.ICardFace;
import forge.card.MagicColor;
@@ -32,21 +24,14 @@ import forge.game.ability.ApiType;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.combat.Combat;
import forge.game.cost.Cost;
import forge.game.cost.CostPart;
import forge.game.cost.CostPartMana;
import forge.game.cost.*;
import forge.game.mana.Mana;
import forge.game.mana.ManaCostBeingPaid;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.DelayedReveal;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.player.PlayerController;
import forge.game.player.PlayerView;
import forge.game.player.*;
import forge.game.replacement.ReplacementEffect;
import forge.game.spellability.*;
import forge.game.trigger.Trigger;
import forge.game.trigger.WrappedAbility;
import forge.game.zone.ZoneType;
import forge.item.PaperCard;
@@ -55,6 +40,12 @@ import forge.util.ITriggerEvent;
import forge.util.MyRandom;
import forge.util.collect.FCollection;
import forge.util.collect.FCollectionView;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.security.InvalidParameterException;
import java.util.*;
/**
@@ -115,7 +106,23 @@ public class PlayerControllerAi extends PlayerController {
if (ability.getApi() != null) {
switch (ability.getApi()) {
case ChooseNumber:
return ability.getActivatingPlayer().isOpponentOf(player) ? 0 : ComputerUtilMana.determineLeftoverMana(ability, player);
Player payingPlayer = ability.getActivatingPlayer();
String logic = ability.getParamOrDefault("AILogic", "");
boolean anyController = logic.equals("MaxForAnyController");
if (logic.startsWith("PowerLeakMaxMana.") && ability.getHostCard().isEnchantingCard()) {
// For cards like Power Leak, the payer will be the owner of the enchanted card
// TODO: is there any way to generalize this and avoid a special exclusion?
payingPlayer = ability.getHostCard().getEnchantingCard().getController();
}
int number = ComputerUtilMana.determineLeftoverMana(ability, player);
if (logic.startsWith("MaxMana.") || logic.startsWith("PowerLeakMaxMana.")) {
number = Math.min(number, Integer.parseInt(logic.substring(logic.indexOf(".") + 1)));
}
return payingPlayer.isOpponentOf(player) && !anyController ? 0 : number;
case BidLife:
return 0;
default:
@@ -180,7 +187,7 @@ public class PlayerControllerAi extends PlayerController {
@Override
public boolean confirmTrigger(WrappedAbility wrapper, Map<String, String> triggerParams, boolean isMandatory) {
final SpellAbility sa = wrapper.getWrappedAbility();
final Trigger regtrig = wrapper.getTrigger();
//final Trigger regtrig = wrapper.getTrigger();
if (ComputerUtilAbility.getAbilitySourceName(sa).equals("Deathmist Raptor")) {
return true;
}
@@ -282,8 +289,43 @@ public class PlayerControllerAi extends PlayerController {
}
@Override
public CardCollectionView orderMoveToZoneList(CardCollectionView cards, ZoneType destinationZone) {
//TODO Add logic for AI ordering here
public CardCollectionView orderMoveToZoneList(CardCollectionView cards, ZoneType destinationZone, SpellAbility source) {
//TODO Add more logic for AI ordering here
// In presence of Volrath's Shapeshifter in deck, try to place the best creature on top of the graveyard
if (destinationZone == ZoneType.Graveyard) {
if (!CardLists.filter(game.getCardsInGame(), new Predicate<Card>() {
@Override
public boolean apply(Card card) {
// need a custom predicate here since Volrath's Shapeshifter may have a different name OTB
return card.getName().equals("Volrath's Shapeshifter")
|| card.getStates().contains(CardStateName.OriginalText) && card.getState(CardStateName.OriginalText).getName().equals("Volrath's Shapeshifter");
}
}).isEmpty()) {
int bestValue = 0;
Card bestCreature = null;
for (Card c : cards) {
int curValue = ComputerUtilCard.evaluateCreature(c);
if (c.isCreature() && curValue > bestValue) {
bestValue = curValue;
bestCreature = c;
}
}
if (bestCreature != null) {
CardCollection reordered = new CardCollection();
for (Card c : cards) {
if (!c.equals(bestCreature)) {
reordered.add(c);
}
}
reordered.add(bestCreature);
return reordered;
}
}
}
// Default: return with the same order as was passed into this method
return cards;
}
@@ -355,7 +397,7 @@ public class PlayerControllerAi extends PlayerController {
if (StringUtils.isBlank(chosen) && !validTypes.isEmpty())
{
chosen = validTypes.get(0);
Log.warn("AI has no idea how to choose " + kindOfType +", defaulting to 1st element: chosen");
System.err.println("AI has no idea how to choose " + kindOfType +", defaulting to 1st element: chosen");
}
game.getAction().nofityOfValue(sa, player, chosen, player);
return chosen;
@@ -421,6 +463,24 @@ public class PlayerControllerAi extends PlayerController {
final Ability ability = new AbilityStatic(c, cost, null) { @Override public void resolve() {} };
ability.setActivatingPlayer(c.getController());
// FIXME: This is a hack to check if the AI can play the "exile from library" pay costs (Cumulative Upkeep,
// e.g. Thought Lash). We have to do it and bail early if the AI can't pay, because otherwise the AI will
// pay the cost partially, which should not be possible
int nExileLib = 0;
List<CostPart> parts = CostAdjustment.adjust(cost, sa).getCostParts();
for (final CostPart part : parts) {
if (part instanceof CostExile) {
CostExile exile = (CostExile) part;
if (exile.from == ZoneType.Library) {
nExileLib += exile.convertAmount();
}
}
}
if (nExileLib > c.getController().getCardsIn(ZoneType.Library).size()) {
return false;
}
// - End of hack for Exile a card from library Cumulative Upkeep -
if (ComputerUtilCost.canPayCost(ability, c.getController())) {
ComputerUtil.playNoStack(c.getController(), ability, game);
return true;
@@ -493,7 +553,41 @@ public class PlayerControllerAi extends PlayerController {
public boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultVal) {
switch(kindOfChoice) {
case TapOrUntap: return true;
case UntapOrLeaveTapped: return defaultVal != null && defaultVal.booleanValue();
case UntapOrLeaveTapped:
Card source = sa.getHostCard();
if (source != null && source.hasSVar("AIUntapPreference")) {
switch (source.getSVar("AIUntapPreference")) {
case "Always":
return true;
case "Never":
return false;
case "NothingRemembered":
if (source.getRememberedCount() == 0) {
return true;
} else {
Card rem = (Card) source.getFirstRemembered();
if (!rem.getZone().is(ZoneType.Battlefield)) {
return true;
}
}
case "BetterTgtThanRemembered":
if (source.getRememberedCount() > 0) {
Card rem = (Card) source.getFirstRemembered();
if (!rem.getZone().is(ZoneType.Battlefield)) {
return true;
}
for (Card c : source.getController().getCreaturesInPlay()) {
if (c != rem && ComputerUtilCard.evaluateCreature(c) > ComputerUtilCard.evaluateCreature(rem) + 30) {
return true;
}
}
return false;
}
default:
break;
}
}
return defaultVal != null && defaultVal.booleanValue();
case UntapTimeVault: return false; // TODO Should AI skip his turn for time vault?
case LeftOrRight: return brains.chooseDirection(sa);
default:
@@ -780,11 +874,6 @@ public class PlayerControllerAi extends PlayerController {
return brains.getBooleanProperty(AiProps.CHEAT_WITH_MANA_ON_SHUFFLE) ? brains.cheatShuffle(list) : list;
}
@Override
public CardShields chooseRegenerationShield(Card c) {
return Iterables.getFirst(c.getShields(), null);
}
@Override
public List<PaperCard> chooseCardsYouWonToAddToDeck(List<PaperCard> losses) {
// TODO AI takes all by default
@@ -844,21 +933,40 @@ public class PlayerControllerAi extends PlayerController {
@Override
public String chooseCardName(SpellAbility sa, Predicate<ICardFace> cpp, String valid, String message) {
if (sa.hasParam("AILogic")) {
CardCollectionView aiLibrary = player.getCardsIn(ZoneType.Library);
CardCollectionView oppLibrary = ComputerUtil.getOpponentFor(player).getCardsIn(ZoneType.Library);
final Card source = sa.getHostCard();
final String logic = sa.getParam("AILogic");
if (source != null && source.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) {
// If any Conspiracies are present, try not to choose the same name twice
// (otherwise the AI will spam the same name)
for (Card consp : player.getCardsIn(ZoneType.Command)) {
if (consp.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) {
String chosenName = consp.getNamedCard();
if (!chosenName.isEmpty()) {
aiLibrary = CardLists.filter(aiLibrary, Predicates.not(CardPredicates.nameEquals(chosenName)));
}
}
}
}
if (logic.equals("MostProminentInComputerDeck")) {
return ComputerUtilCard.getMostProminentCardName(player.getCardsIn(ZoneType.Library));
return ComputerUtilCard.getMostProminentCardName(aiLibrary);
} else if (logic.equals("MostProminentInHumanDeck")) {
return ComputerUtilCard.getMostProminentCardName(player.getOpponent().getCardsIn(ZoneType.Library));
return ComputerUtilCard.getMostProminentCardName(oppLibrary);
} else if (logic.equals("MostProminentCreatureInComputerDeck")) {
CardCollectionView cards = CardLists.getValidCards(player.getCardsIn(ZoneType.Library), "Creature", player, sa.getHostCard());
CardCollectionView cards = CardLists.getValidCards(aiLibrary, "Creature", player, sa.getHostCard());
return ComputerUtilCard.getMostProminentCardName(cards);
} else if (logic.equals("BestCreatureInComputerDeck")) {
return ComputerUtilCard.getBestCreatureAI(player.getCardsIn(ZoneType.Library)).getName();
return ComputerUtilCard.getBestCreatureAI(aiLibrary).getName();
} else if (logic.equals("RandomInComputerDeck")) {
return Aggregates.random(player.getCardsIn(ZoneType.Library)).getName();
return Aggregates.random(aiLibrary).getName();
} else if (logic.equals("MostProminentSpellInComputerDeck")) {
CardCollectionView cards = CardLists.getValidCards(player.getCardsIn(ZoneType.Library), "Card.Instant,Card.Sorcery", player, sa.getHostCard());
CardCollectionView cards = CardLists.getValidCards(aiLibrary, "Card.Instant,Card.Sorcery", player, sa.getHostCard());
return ComputerUtilCard.getMostProminentCardName(cards);
} else if (logic.equals("CursedScroll")) {
return SpecialCardAi.CursedScroll.chooseCard(player, sa);
}
} else {
CardCollectionView list = CardLists.filterControlledBy(game.getCardsInGame(), player.getOpponents());

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,7 @@
package forge.ai;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.card.ICardFace;
import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostParser;
@@ -25,6 +20,10 @@ import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityCondition;
import forge.util.MyRandom;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Base class for API-specific AI logic
* <p>
@@ -103,6 +102,12 @@ public abstract class SpellAbilityAi {
* Checks if the AI will play a SpellAbility with the specified AiLogic
*/
protected boolean checkAiLogic(final Player ai, final SpellAbility sa, final String aiLogic) {
if (aiLogic.equals("CheckCondition")) {
SpellAbility saCopy = sa.copy();
saCopy.setActivatingPlayer(ai);
return saCopy.getConditions().areMet(saCopy);
}
return !("Never".equals(aiLogic));
}
@@ -118,7 +123,7 @@ public abstract class SpellAbilityAi {
if (!ComputerUtilCost.checkDiscardCost(ai, cost, source)) {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, sa)) {
return false;
}
if (!ComputerUtilCost.checkRemoveCounterCost(cost, source, sa)) {

View File

@@ -1,14 +1,13 @@
package forge.ai;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import forge.ai.ability.*;
import forge.game.ability.ApiType;
import forge.util.ReflectionUtil;
import java.util.Map;
public enum SpellApiToAi {
Converter;
@@ -25,12 +24,14 @@ public enum SpellApiToAi {
.put(ApiType.Animate, AnimateAi.class)
.put(ApiType.AnimateAll, AnimateAllAi.class)
.put(ApiType.Attach, AttachAi.class)
.put(ApiType.Ascend, AlwaysPlayAi.class)
.put(ApiType.Balance, BalanceAi.class)
.put(ApiType.BecomeMonarch, AlwaysPlayAi.class)
.put(ApiType.BecomesBlocked, BecomesBlockedAi.class)
.put(ApiType.BidLife, BidLifeAi.class)
.put(ApiType.Bond, BondAi.class)
.put(ApiType.Branch, AlwaysPlayAi.class)
.put(ApiType.ChangeCombatants, CannotPlayAi.class)
.put(ApiType.ChangeTargets, ChangeTargetsAi.class)
.put(ApiType.ChangeZone, ChangeZoneAi.class)
.put(ApiType.ChangeZoneAll, ChangeZoneAllAi.class)
@@ -71,12 +72,14 @@ public enum SpellApiToAi {
.put(ApiType.ExchangeControlVariant, CannotPlayAi.class)
.put(ApiType.ExchangePower, PowerExchangeAi.class)
.put(ApiType.ExchangeZone, ZoneExchangeAi.class)
.put(ApiType.Explore, ExploreAi.class)
.put(ApiType.Fight, FightAi.class)
.put(ApiType.FlipACoin, FlipACoinAi.class)
.put(ApiType.Fog, FogAi.class)
.put(ApiType.GainControl, ControlGainAi.class)
.put(ApiType.GainLife, LifeGainAi.class)
.put(ApiType.GainOwnership, CannotPlayAi.class)
.put(ApiType.GameDrawn, CannotPlayAi.class)
.put(ApiType.GenericChoice, ChooseGenericEffectAi.class)
.put(ApiType.Goad, GoadAi.class)
.put(ApiType.Haunt, HauntAi.class)
@@ -114,6 +117,7 @@ public enum SpellApiToAi {
.put(ApiType.RearrangeTopOfLibrary, RearrangeTopOfLibraryAi.class)
.put(ApiType.Regenerate, RegenerateAi.class)
.put(ApiType.RegenerateAll, RegenerateAllAi.class)
.put(ApiType.Regeneration, AlwaysPlayAi.class)
.put(ApiType.RemoveCounter, CountersRemoveAi.class)
.put(ApiType.RemoveCounterAll, CannotPlayAi.class)
.put(ApiType.RemoveFromCombat, RemoveFromCombatAi.class)

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -21,7 +22,7 @@ public class ActivateAbilityAi extends SpellAbilityAi {
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Card source = sa.getHostCard();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
@@ -46,7 +47,7 @@ public class ActivateAbilityAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Card source = sa.getHostCard();
@@ -87,7 +88,7 @@ public class ActivateAbilityAi extends SpellAbilityAi {
}
} else {
sa.resetTargets();
sa.getTargets().add(ai.getOpponent());
sa.getTargets().add(ComputerUtil.getOpponentFor(ai));
}
return randomReturn;

View File

@@ -3,6 +3,7 @@ package forge.ai.ability;
import forge.ai.SpellAbilityAi;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
public class AlwaysPlayAi extends SpellAbilityAi {
@@ -13,4 +14,9 @@ public class AlwaysPlayAi extends SpellAbilityAi {
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
return true;
}
@Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
return true;
}
}

View File

@@ -1,28 +1,15 @@
package forge.ai.ability;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.ai.AiCardMemory;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.card.CardType;
import forge.game.Game;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CardUtil;
import forge.game.card.*;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -38,6 +25,10 @@ import forge.game.trigger.TriggerHandler;
import forge.game.zone.ZoneType;
import forge.util.collect.FCollectionView;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -86,13 +77,13 @@ public class AnimateAi extends SpellAbilityAi {
num = (num == null) ? "1" : num;
final int nToSac = AbilityUtils.calculateAmount(topStack.getHostCard(), num, topStack);
CardCollection list = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","),
ai.getOpponent(), topStack.getHostCard(), topStack);
ComputerUtil.getOpponentFor(ai), topStack.getHostCard(), topStack);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack));
ComputerUtilCard.sortByEvaluateCreature(list);
if (!list.isEmpty() && list.size() == nToSac && ComputerUtilCost.canPayCost(sa, ai)) {
Card animatedCopy = becomeAnimated(source, sa);
list.add(animatedCopy);
list = CardLists.getValidCards(list, valid.split(","), ai.getOpponent(), topStack.getHostCard(),
list = CardLists.getValidCards(list, valid.split(","), ComputerUtil.getOpponentFor(ai), topStack.getHostCard(),
topStack);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack));
if (ComputerUtilCard.evaluateCreature(animatedCopy) < ComputerUtilCard.evaluateCreature(list.get(0))
@@ -172,11 +163,17 @@ public class AnimateAi extends SpellAbilityAi {
}
}
if (power + toughness > c.getCurrentPower() + c.getCurrentToughness()) {
if (!c.isTapped() || (game.getCombat() != null && game.getCombat().isAttacking(c))) {
bFlag = true;
}
}
}
if (!SpellAbilityAi.isSorcerySpeed(sa) && !sa.hasParam("Permanent")) {
if (sa.hasParam("Crew") && c.isCreature()) {
// Do not try to crew a vehicle which is already a creature
return false;
}
Card animatedCopy = becomeAnimated(c, sa);
if (ph.isPlayerTurn(aiPlayer)
&& !ComputerUtilCard.doesSpecifiedCreatureAttackAI(aiPlayer, animatedCopy)) {
@@ -186,9 +183,21 @@ public class AnimateAi extends SpellAbilityAi {
&& !ComputerUtilCard.doesSpecifiedCreatureBlock(aiPlayer, animatedCopy)) {
return false;
}
this.rememberAnimatedThisTurn(aiPlayer, c);
// also check if maybe there are static effects applied to the animated copy that would matter
// (e.g. Myth Realized)
if (animatedCopy.getCurrentPower() + animatedCopy.getCurrentToughness() >
c.getCurrentPower() + c.getCurrentToughness()) {
if (!isAnimatedThisTurn(aiPlayer, sa.getHostCard())) {
if (!sa.getHostCard().isTapped() || (game.getCombat() != null && game.getCombat().isAttacking(sa.getHostCard()))) {
bFlag = true;
}
}
}
}
}
if (bFlag) {
this.rememberAnimatedThisTurn(aiPlayer, sa.getHostCard());
}
return bFlag; // All of the defined stuff is animated, not very useful
} else {
sa.resetTargets();
@@ -251,13 +260,8 @@ public class AnimateAi extends SpellAbilityAi {
// need to targetable
list = CardLists.getTargetableCards(list, sa);
// try to look for AI targets if able
if (sa.hasParam("AITgts")) {
CardCollection prefList = CardLists.getValidCards(list, sa.getParam("AITgts").split(","), ai, source, sa);
if(!prefList.isEmpty() || sa.hasParam("AITgtsStrict")) {
list = prefList;
}
}
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, false);
// list is empty, no possible targets
if (list.isEmpty()) {
@@ -301,8 +305,9 @@ public class AnimateAi extends SpellAbilityAi {
// if its player turn,
// check if its Permanent or that creature would attack
if (ph.isPlayerTurn(ai)) {
if (!sa.hasParam("Permanent") &&
!ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, animatedCopy)) {
if (!sa.hasParam("Permanent")
&& !ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, animatedCopy)
&& !sa.hasParam("UntilHostLeavesPlay")) {
continue;
}
}

View File

@@ -2,13 +2,13 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import forge.ai.*;
import forge.game.GameObject;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostPart;
@@ -24,7 +24,10 @@ import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.zone.ZoneType;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class AttachAi extends SpellAbilityAi {
@@ -38,7 +41,7 @@ public class AttachAi extends SpellAbilityAi {
if (abCost != null) {
// AI currently disabled for these costs
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
if (!ComputerUtilCost.checkLifeCost(ai, abCost, source, 4, sa)) {
@@ -250,6 +253,18 @@ public class AttachAi extends SpellAbilityAi {
return false;
}
if (!mandatory) {
if (!c.isCreature() && !c.getType().hasSubtype("Vehicle") && !c.isTapped()) {
// try to identify if this thing can actually tap
for (SpellAbility ab : c.getAllSpellAbilities()) {
if (ab.getPayCosts() != null && ab.getPayCosts().hasTapCost()) {
return true;
}
}
return false;
}
}
if (!c.isEnchanted()) {
return true;
}
@@ -455,6 +470,65 @@ public class AttachAi extends SpellAbilityAi {
return c;
}
// Cards that trigger on dealing damage
private static Card attachAICuriosityPreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
final Card attachSource) {
Card chosen = null;
int priority = 0;
for (Card card : list) {
int cardPriority = 0;
// Prefer Evasion
if (card.hasKeyword("Trample")) {
cardPriority += 10;
}
if (card.hasKeyword("Menace")) {
cardPriority += 10;
}
// Avoid this for Sleepers Robe?
if (card.hasKeyword("Fear")) {
cardPriority += 15;
}
if (card.hasKeyword("Flying")) {
cardPriority += 20;
}
if (card.hasKeyword("Shadow")) {
cardPriority += 30;
}
if (card.hasKeyword("Horsemanship")) {
cardPriority += 40;
}
if (card.hasKeyword("Unblockable")) {
cardPriority += 50;
}
// Prefer "tap to deal damage"
// TODO : Skip this one if triggers on combat damage only?
for (SpellAbility sa2 : card.getSpellAbilities()) {
if ((sa2.getApi().equals(ApiType.DealDamage))
&& (sa2.getTargetRestrictions().canTgtPlayer())) {
cardPriority += 300;
}
}
// Prefer stronger creatures, avoid if can't attack
cardPriority += card.getCurrentToughness() * 2;
cardPriority += card.getCurrentPower();
if (card.getCurrentPower() <= 0) {
cardPriority = -100;
}
if (card.hasKeyword("Defender")) {
cardPriority = -100;
}
if (card.hasKeyword("Indestructible")) {
cardPriority += 15;
}
if (cardPriority > priority) {
priority = cardPriority;
chosen = card;
}
}
return chosen;
}
/**
* Attach ai specific card preference.
*
@@ -478,7 +552,9 @@ public class AttachAi extends SpellAbilityAi {
if ("Guilty Conscience".equals(sourceName)) {
chosen = SpecialCardAi.GuiltyConscience.getBestAttachTarget(ai, sa, list);
} else if ("Bonds of Faith".equals(sourceName)) {
chosen = SpecialCardAi.BondsOfFaith.getBestAttachTarget(ai, sa, list);
chosen = doPumpOrCurseAILogic(ai, sa, list, "Human");
} else if ("Clutch of Undeath".equals(sourceName)) {
chosen = doPumpOrCurseAILogic(ai, sa, list, "Zombie");
}
// If Mandatory (brought directly into play without casting) gotta
@@ -490,6 +566,44 @@ public class AttachAi extends SpellAbilityAi {
return chosen;
}
private static Card attachAIInstantReequipPreference(final SpellAbility sa, final Card attachSource) {
// e.g. Cranial Plating
PhaseHandler ph = attachSource.getGame().getPhaseHandler();
Combat combat = attachSource.getGame().getCombat();
Card equipped = sa.getHostCard().getEquipping();
if (equipped == null) {
return null;
}
int powerBuff = 0;
for (StaticAbility stAb : sa.getHostCard().getStaticAbilities()) {
if ("Card.EquippedBy".equals(stAb.getParam("Affected")) && stAb.hasParam("AddPower")) {
powerBuff = AbilityUtils.calculateAmount(sa.getHostCard(), stAb.getParam("AddPower"), null);
}
}
if (combat != null && combat.isAttacking(equipped) && ph.is(PhaseType.COMBAT_DECLARE_BLOCKERS, sa.getActivatingPlayer())) {
int damage = 0;
for (Card c : combat.getUnblockedAttackers()) {
damage += ComputerUtilCombat.predictDamageTo(combat.getDefenderPlayerByAttacker(equipped), c.getNetCombatDamage(), c, true);
}
if (combat.isBlocked(equipped)) {
for (Card atk : combat.getAttackers()) {
if (!combat.isBlocked(atk) && !ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), null).contains(atk)) {
if (ComputerUtilCombat.predictDamageTo(combat.getDefenderPlayerByAttacker(atk),
atk.getNetCombatDamage(), atk, true) > 0) {
if (damage + powerBuff >= combat.getDefenderPlayerByAttacker(atk).getLife()) {
sa.resetTargets(); // this is needed to avoid bugs with adding two targets to a single SA
return atk; // lethal damage, we can win right now, so why not?
}
}
}
}
}
}
return null;
}
// Should generalize this code a bit since they all have similar structures
/**
* Attach ai control preference.
@@ -580,8 +694,8 @@ public class AttachAi extends SpellAbilityAi {
continue;
}
if ((affected.contains(stCheck) || affected.contains("AttachedBy"))) {
totToughness += AttachAi.parseSVar(attachSource, stabMap.get("AddToughness"));
totPower += AttachAi.parseSVar(attachSource, stabMap.get("AddPower"));
totToughness += AbilityUtils.calculateAmount(attachSource, stabMap.get("AddToughness"), sa);
totPower += AbilityUtils.calculateAmount(attachSource, stabMap.get("AddPower"), sa);
String kws = stabMap.get("AddKeyword");
if (kws != null) {
@@ -702,30 +816,6 @@ public class AttachAi extends SpellAbilityAi {
return true;
}
/**
* parseSVar TODO - flesh out javadoc for this method.
*
* @param hostCard
* the Card with the SVar on it
* @param amount
* a String
* @return the calculated number
*/
public static int parseSVar(final Card hostCard, final String amount) {
int num = 0;
if (amount == null) {
return num;
}
try {
num = Integer.valueOf(amount);
} catch (final NumberFormatException e) {
num = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(amount).split("\\$")[1]);
}
return num;
}
/**
* Attach preference.
*
@@ -874,8 +964,8 @@ public class AttachAi extends SpellAbilityAi {
continue;
}
if ((affected.contains(stCheck) || affected.contains("AttachedBy"))) {
totToughness += AttachAi.parseSVar(attachSource, stabMap.get("AddToughness"));
totPower += AttachAi.parseSVar(attachSource, stabMap.get("AddPower"));
totToughness += AbilityUtils.calculateAmount(attachSource, stabMap.get("AddToughness"), sa);
totPower += AbilityUtils.calculateAmount(attachSource, stabMap.get("AddPower"), sa);
grantingAbilities |= stabMap.containsKey("AddAbility");
@@ -1046,9 +1136,9 @@ public class AttachAi extends SpellAbilityAi {
return null;
}
CardCollection prefList = list;
if (sa.hasParam("AITgts")) {
prefList = CardLists.getValidCards(list, sa.getParam("AITgts"), sa.getActivatingPlayer(), attachSource);
}
// Filter AI-specific targets if provided
prefList = ComputerUtil.filterAITgts(sa, aiPlayer, (CardCollection)list, true);
Card c = attachGeneralAI(aiPlayer, sa, prefList, mandatory, attachSource, sa.getParam("AILogic"));
@@ -1061,6 +1151,10 @@ public class AttachAi extends SpellAbilityAi {
return null;
}
if ("InstantReequipPowerBuff".equals(sa.getParam("AILogic"))) {
return c;
}
boolean uselessCreature = ComputerUtilCard.isUselessCreature(aiPlayer, attachSource.getEquipping());
if (aic.getProperty(AiProps.MOVE_EQUIPMENT_TO_BETTER_CREATURES).equals("never")) {
@@ -1077,10 +1171,10 @@ public class AttachAi extends SpellAbilityAi {
// make sure to prioritize casting spells in main 2 (creatures, other equipment, etc.) rather than moving equipment around
boolean decideMoveFromUseless = uselessCreature && aic.getBooleanProperty(AiProps.PRIORITIZE_MOVE_EQUIPMENT_IF_USELESS);
if (!decideMoveFromUseless && AiCardMemory.isMemorySetEmpty(aiPlayer, AiCardMemory.MemorySet.HELD_MANA_SOURCES)) {
if (!decideMoveFromUseless && AiCardMemory.isMemorySetEmpty(aiPlayer, AiCardMemory.MemorySet.HELD_MANA_SOURCES_FOR_MAIN2)) {
SpellAbility futureSpell = aic.predictSpellToCastInMain2(ApiType.Attach);
if (futureSpell != null && futureSpell.getHostCard() != null) {
aic.reserveManaSourcesForMain2(futureSpell);
aic.reserveManaSources(futureSpell);
}
}
@@ -1123,7 +1217,7 @@ public class AttachAi extends SpellAbilityAi {
private static Card attachGeneralAI(final Player ai, final SpellAbility sa, final List<Card> list, final boolean mandatory,
final Card attachSource, final String logic) {
Player prefPlayer = ai.getWeakestOpponent();
if ("Pump".equals(logic) || "Animate".equals(logic)) {
if ("Pump".equals(logic) || "Animate".equals(logic) || "Curiosity".equals(logic)) {
prefPlayer = ai;
}
// Some ChangeType cards are beneficial, and PrefPlayer should be
@@ -1137,6 +1231,12 @@ public class AttachAi extends SpellAbilityAi {
prefList = CardLists.filterControlledBy(list, prefPlayer);
}
// AI logic types that do not require a prefList and that evaluate the
// usefulness of attach action autonomously
if ("InstantReequipPowerBuff".equals(logic)) {
return attachAIInstantReequipPreference(sa, attachSource);
}
// If there are no preferred cards, and not mandatory bail out
if (prefList.isEmpty()) {
return chooseUnpreferred(mandatory, list);
@@ -1151,6 +1251,8 @@ public class AttachAi extends SpellAbilityAi {
c = attachAICursePreference(sa, prefList, mandatory, attachSource);
} else if ("Pump".equals(logic)) {
c = attachAIPumpPreference(ai, sa, prefList, mandatory, attachSource);
} else if ("Curiosity".equals(logic)) {
c = attachAICuriosityPreference(sa, prefList, mandatory, attachSource);
} else if ("ChangeType".equals(logic)) {
c = attachAIChangeTypePreference(sa, prefList, mandatory, attachSource);
} else if ("KeepTapped".equals(logic)) {
@@ -1287,9 +1389,9 @@ public class AttachAi extends SpellAbilityAi {
if (card.hasKeyword("Flying") || !CombatUtil.canBlock(card, true)) {
return false;
}
} else if (keyword.endsWith("CARDNAME can block an additional creature.")) {
} else if (keyword.endsWith("CARDNAME can block an additional creature each combat.")) {
if (!CombatUtil.canBlock(card, true) || card.hasKeyword("CARDNAME can block any number of creatures.")
|| card.hasKeyword("CARDNAME can block an additional ninety-nine creatures.")) {
|| card.hasKeyword("CARDNAME can block an additional ninety-nine creatures each combat.")) {
return false;
}
} else if (keyword.equals("CARDNAME can attack as though it didn't have defender.")) {
@@ -1386,6 +1488,43 @@ public class AttachAi extends SpellAbilityAi {
return true;
}
public static Card doPumpOrCurseAILogic(final Player ai, final SpellAbility sa, final List<Card> list, final String type) {
Card chosen = null;
List<Card> aiType = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
// Don't buff opponent's creatures of given type
if (!c.getController().equals(ai)) {
return false;
}
return c.getType().hasCreatureType(type);
}
});
List<Card> oppNonType = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
// Don't debuff AI's own creatures not of given type
if (c.getController().equals(ai)) {
return false;
}
return !c.getType().hasCreatureType(type) && !ComputerUtilCard.isUselessCreature(ai, c);
}
});
if (!aiType.isEmpty() && !oppNonType.isEmpty()) {
Card bestAi = ComputerUtilCard.getBestCreatureAI(aiType);
Card bestOpp = ComputerUtilCard.getBestCreatureAI(oppNonType);
chosen = ComputerUtilCard.evaluateCreature(bestAi) > ComputerUtilCard.evaluateCreature(bestOpp) ? bestAi : bestOpp;
} else if (!aiType.isEmpty()) {
chosen = ComputerUtilCard.getBestCreatureAI(aiType);
} else if (!oppNonType.isEmpty()) {
chosen = ComputerUtilCard.getBestCreatureAI(oppNonType);
}
return chosen;
}
@Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
return true;

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
@@ -16,7 +17,7 @@ public class BalanceAi extends SpellAbilityAi {
int diff = 0;
// TODO Add support for multiplayer logic
final Player opp = aiPlayer.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(aiPlayer);
final CardCollectionView humPerms = opp.getCardsIn(ZoneType.Battlefield);
final CardCollectionView compPerms = aiPlayer.getCardsIn(ZoneType.Battlefield);

View File

@@ -2,6 +2,7 @@ package forge.ai.ability;
import java.util.List;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
@@ -24,7 +25,7 @@ public class BidLifeAi extends SpellAbilityAi {
if (tgt != null) {
sa.resetTargets();
if (tgt.canTgtCreature()) {
List<Card> list = CardLists.getTargetableCards(aiPlayer.getOpponent().getCardsIn(ZoneType.Battlefield), sa);
List<Card> list = CardLists.getTargetableCards(ComputerUtil.getOpponentFor(aiPlayer).getCardsIn(ZoneType.Battlefield), sa);
list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source, sa);
if (list.isEmpty()) {
return false;

View File

@@ -36,10 +36,10 @@ public final class BondAi extends SpellAbilityAi {
* <p>
* bondCanPlayAI.
* </p>
* @param aiPlayer
* a {@link forge.game.player.Player} object.
* @param sa
* a {@link forge.game.spellability.SpellAbility} object.
* @param af
* a {@link forge.game.ability.AbilityFactory} object.
*
* @return a boolean.
*/
@@ -53,4 +53,9 @@ public final class BondAi extends SpellAbilityAi {
protected Card chooseSingleCard(Player ai, SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer) {
return ComputerUtilCard.getBestCreatureAI(options);
}
@Override
protected boolean doTriggerAINoCost(final Player aiPlayer, final SpellAbility sa, final boolean mandatory) {
return true;
}
}

View File

@@ -1,20 +1,10 @@
package forge.ai.ability;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.ai.*;
import forge.card.MagicColor;
import forge.game.Game;
@@ -22,11 +12,7 @@ import forge.game.GameObject;
import forge.game.GlobalRuleChange;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.combat.Combat;
import forge.game.cost.Cost;
@@ -40,6 +26,9 @@ import forge.game.spellability.AbilitySub;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
public class ChangeZoneAi extends SpellAbilityAi {
/*
@@ -49,6 +38,10 @@ public class ChangeZoneAi extends SpellAbilityAi {
* too much: blink/bounce/exile/tutor/Raise Dead/Surgical Extraction/......
*/
// multipleCardsToChoose is used by Intuition and can be adapted to be used by other
// cards where multiple cards are fetched at once and they need to be coordinated
private static CardCollection multipleCardsToChoose = new CardCollection();
@Override
protected boolean checkAiLogic(final Player ai, final SpellAbility sa, final String aiLogic) {
if (sa.getHostCard() != null && sa.getHostCard().hasSVar("AIPreferenceOverride")) {
@@ -64,23 +57,49 @@ public class ChangeZoneAi extends SpellAbilityAi {
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
return false;
}
} else if (aiLogic.equals("PriorityOptionalCost")) {
boolean highPriority = false;
// if we have more than one of these in hand, might not be worth waiting for optional cost payment on the additional copy
highPriority |= CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.nameEquals(sa.getHostCard().getName())).size() > 1;
// if we are in danger in combat, no need to wait to pay the optional cost
highPriority |= ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& ai.getGame().getCombat() != null && ComputerUtilCombat.lifeInDanger(ai, ai.getGame().getCombat());
if (!highPriority) {
if (Iterables.isEmpty(sa.getOptionalCosts())) {
return false;
}
}
}
return super.checkAiLogic(ai, sa, aiLogic);
}
@Override
protected boolean checkApiLogic(Player aiPlayer, SpellAbility sa) {
// Checks for "return true" unlike checkAiLogic()
multipleCardsToChoose.clear();
String aiLogic = sa.getParam("AILogic");
if (aiLogic != null) {
if (aiLogic.equals("Always")) {
return true;
} else if (aiLogic.startsWith("SacAndUpgrade")) { // Birthing Pod, Natural Order, etc.
return this.doSacAndUpgradeLogic(aiPlayer, sa);
} else if (aiLogic.startsWith("SacAndRetFromGrave")) { // Recurring Nightmare, etc.
return this.doSacAndReturnFromGraveLogic(aiPlayer, sa);
} else if (aiLogic.equals("Necropotence")) {
return SpecialCardAi.Necropotence.consider(aiPlayer, sa);
} else if (aiLogic.equals("SameName")) { // Declaration in Stone
return this.doSameNameLogic(aiPlayer, sa);
} else if (aiLogic.equals("ReanimateAll")) {
return SpecialCardAi.LivingDeath.consider(aiPlayer, sa);
} else if (aiLogic.equals("TheScarabGod")) {
return SpecialCardAi.TheScarabGod.consider(aiPlayer, sa);
} else if (aiLogic.equals("Intuition")) {
// This logic only fills the multiple cards array, the decision to play is made
// separately in hiddenOriginCanPlayAI later.
multipleCardsToChoose = SpecialCardAi.Intuition.considerMultiple(aiPlayer, sa);
}
}
if (isHidden(sa)) {
@@ -133,6 +152,21 @@ public class ChangeZoneAi extends SpellAbilityAi {
return doReturnCommanderLogic(sa, aiPlayer);
}
if ("IfNotBuffed".equals(sa.getParam("AILogic"))) {
if (ComputerUtilCard.isUselessCreature(aiPlayer, sa.getHostCard())) {
return true; // debuffed by opponent's auras to the level that it becomes useless
}
int delta = 0;
for (Card enc : sa.getHostCard().getEnchantedBy(false)) {
if (enc.getController().isOpponentOf(aiPlayer)) {
delta--;
} else {
delta++;
}
}
return delta <= 0;
}
if (isHidden(sa)) {
return hiddenTriggerAI(aiPlayer, sa, mandatory);
}
@@ -166,7 +200,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
final Card source = sa.getHostCard();
final String sourceName = ComputerUtilAbility.getAbilitySourceName(sa);
ZoneType origin = null;
final Player opponent = ai.getOpponent();
final Player opponent = ComputerUtil.getOpponentFor(ai);
boolean activateForCost = ComputerUtil.activateForCost(sa, ai);
if (sa.hasParam("Origin")) {
@@ -182,7 +216,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
if (abCost != null) {
// AI currently disabled for these costs
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)
&& !(destination.equals("Battlefield") && !source.isLand())) {
return false;
}
@@ -367,7 +401,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
// if putting cards from hand to library and parent is drawing cards
// make sure this will actually do something:
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Player opp = aiPlayer.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(aiPlayer);
if (tgt != null && tgt.canTgtPlayer()) {
boolean isCurse = sa.isCurse();
if (isCurse && sa.canTarget(opp)) {
@@ -428,7 +462,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
Iterable<Player> pDefined;
final TargetRestrictions tgt = sa.getTargetRestrictions();
if ((tgt != null) && tgt.canTgtPlayer()) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
if (sa.isCurse()) {
if (sa.canTarget(opp)) {
sa.getTargets().add(opp);
@@ -547,8 +581,9 @@ public class ChangeZoneAi extends SpellAbilityAi {
*/
private static Card chooseCreature(final Player ai, CardCollection list) {
// Creating a new combat for testing purposes.
Combat combat = new Combat(ai.getOpponent());
for (Card att : ai.getOpponent().getCreaturesInPlay()) {
final Player opponent = ComputerUtil.getOpponentFor(ai);
Combat combat = new Combat(opponent);
for (Card att : opponent.getCreaturesInPlay()) {
combat.addAttacker(att, ai);
}
AiBlockController block = new AiBlockController(ai);
@@ -647,6 +682,20 @@ public class ChangeZoneAi extends SpellAbilityAi {
return false;
}
}
if (destination == ZoneType.Battlefield) {
// predict whether something may put a ETBing creature below zero toughness
// (e.g. Reassembing Skeleton + Elesh Norn, Grand Cenobite)
for (final Card c : retrieval) {
if (c.isCreature()) {
final Card copy = CardUtil.getLKICopy(c);
ComputerUtilCard.applyStaticContPT(c.getGame(), copy, null);
if (copy.getNetToughness() <= 0) {
return false;
}
}
}
}
}
final AbilitySub subAb = sa.getSubAbility();
@@ -666,6 +715,12 @@ public class ChangeZoneAi extends SpellAbilityAi {
*/
@Override
protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) {
String aiLogic = sa.getParamOrDefault("AILogic", "");
if (aiLogic.equals("SurvivalOfTheFittest") || aiLogic.equals("AtOppEOT")) {
return ph.getNextTurn().equals(ai) && ph.is(PhaseType.END_OF_TURN);
}
if (isHidden(sa)) {
return true;
}
@@ -720,6 +775,10 @@ public class ChangeZoneAi extends SpellAbilityAi {
* @return a boolean.
*/
private static boolean knownOriginPlayDrawbackAI(final Player aiPlayer, final SpellAbility sa) {
if ("MimicVat".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.MimicVat.considerExile(aiPlayer, sa);
}
if (!sa.usesTargeting()) {
return true;
}
@@ -764,9 +823,18 @@ public class ChangeZoneAi extends SpellAbilityAi {
sa.resetTargets();
CardCollection list = CardLists.getValidCards(game.getCardsIn(origin), tgt.getValidTgts(), ai, source, sa);
list = CardLists.getTargetableCards(list, sa);
if (sa.hasParam("AITgts")) {
list = CardLists.getValidCards(list, sa.getParam("AITgts"), ai, source);
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, true);
if (sa.hasParam("AITgtsOnlyBetterThanSelf")) {
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.evaluateCreature(card) > ComputerUtilCard.evaluateCreature(source) + 30;
}
});
}
if (source.isInZone(ZoneType.Hand)) {
list = CardLists.filter(list, Predicates.not(CardPredicates.nameEquals(source.getName()))); // Don't get the same card back.
}
@@ -828,7 +896,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
&& !currCombat.getBlockers(attacker).isEmpty()) {
ComputerUtilCard.sortByEvaluateCreature(blockers);
Combat combat = new Combat(ai);
combat.addAttacker(attacker, ai.getOpponent());
combat.addAttacker(attacker, ComputerUtil.getOpponentFor(ai));
for (Card blocker : blockers) {
combat.addBlocker(attacker, blocker);
}
@@ -974,6 +1042,8 @@ public class ChangeZoneAi extends SpellAbilityAi {
return false;
}
if (!sa.hasParam("AITgtOwnCards")) {
list = CardLists.filterControlledBy(list, ai.getOpponents());
list = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -988,6 +1058,13 @@ public class ChangeZoneAi extends SpellAbilityAi {
});
}
// See if maybe there's a special priority applicable for this, in case the opponent
// has dangerous unblockables in play
if (CardLists.getNotType(list, "Creature").isEmpty()) {
list = ComputerUtilCard.prioritizeCreaturesWorthRemovingNow(ai, list, false);
}
}
// Only care about combatants during combat
if (game.getPhaseHandler().inCombat() && origin.contains(ZoneType.Battlefield)) {
CardCollection newList = CardLists.getValidCards(list, "Card.attacking,Card.blocking", null, null);
@@ -1000,6 +1077,10 @@ public class ChangeZoneAi extends SpellAbilityAi {
return false;
}
// Check if the opponent can save a creature from bounce/blink/whatever by paying
// the Unless cost (for example, Erratic Portal)
list.removeAll(getSafeTargetsIfUnlessCostPaid(ai, sa, list));
if (!mandatory && list.size() < tgt.getMinTargets(sa.getHostCard(), sa)) {
return false;
}
@@ -1077,8 +1158,17 @@ public class ChangeZoneAi extends SpellAbilityAi {
return false;
} else {
if (!sa.isTrigger() && !ComputerUtil.shouldCastLessThanMax(ai, source)) {
boolean aiTgtsOK = false;
if (sa.hasParam("AIMinTgts")) {
int minTgts = Integer.parseInt(sa.getParam("AIMinTgts"));
if (sa.getTargets().getNumTargeted() >= minTgts) {
aiTgtsOK = true;
}
}
if (!aiTgtsOK) {
return false;
}
}
break;
}
}
@@ -1284,6 +1374,12 @@ public class ChangeZoneAi extends SpellAbilityAi {
* @return a boolean.
*/
private static boolean knownOriginTriggerAI(final Player ai, final SpellAbility sa, final boolean mandatory) {
if ("DeathgorgeScavenger".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.DeathgorgeScavenger.consider(ai, sa);
} else if ("ExtraplanarLens".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.ExtraplanarLens.consider(ai, sa);
}
if (sa.getTargetRestrictions() == null) {
// Just in case of Defined cases
if (!mandatory && sa.hasParam("AttachedTo")) {
@@ -1313,12 +1409,22 @@ public class ChangeZoneAi extends SpellAbilityAi {
String logic = sa.getParam("AILogic");
if ("NeverBounceItself".equals(logic)) {
Card source = sa.getHostCard();
if (fetchList.contains(source)) {
if (fetchList.contains(source) && (fetchList.size() > 1 && !sa.getTriggeringAbility().isMandatory())) {
// For cards that should never be bounced back to hand with their own [e.g. triggered] abilities, such as guild lands.
fetchList.remove(source);
}
} else if ("WorstCard".equals(logic)) {
return ComputerUtilCard.getWorstAI(fetchList);
} else if ("Mairsil".equals(logic)) {
return SpecialCardAi.MairsilThePretender.considerCardFromList(fetchList);
} else if ("SurvivalOfTheFittest".equals(logic)) {
return SpecialCardAi.SurvivalOfTheFittest.considerCardToGet(decider, sa);
} else if ("Intuition".equals(logic)) {
if (!multipleCardsToChoose.isEmpty()) {
Card choice = multipleCardsToChoose.get(0);
multipleCardsToChoose.remove(0);
return choice;
}
}
}
if (fetchList.isEmpty()) {
@@ -1459,7 +1565,33 @@ public class ChangeZoneAi extends SpellAbilityAi {
return Iterables.getFirst(options, null);
}
private boolean doSacAndUpgradeLogic(final Player ai, SpellAbility sa) {
private boolean doSacAndReturnFromGraveLogic(final Player ai, final SpellAbility sa) {
Card source = sa.getHostCard();
String definedSac = StringUtils.split(source.getSVar("AIPreference"), "$")[1];
CardCollection listToSac = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.restriction(definedSac.split(","), ai, source, sa));
listToSac.sort(Collections.reverseOrder(CardLists.CmcComparatorInv));
CardCollection listToRet = CardLists.filter(ai.getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
listToRet.sort(CardLists.CmcComparatorInv);
if (!listToSac.isEmpty() && !listToRet.isEmpty()) {
Card worstSac = listToSac.getFirst();
Card bestRet = listToRet.getFirst();
if (bestRet.getCMC() > worstSac.getCMC()
&& ComputerUtilCard.evaluateCreature(bestRet) > ComputerUtilCard.evaluateCreature(worstSac)) {
sa.resetTargets();
sa.getTargets().add(bestRet);
source.setSVar("AIPreferenceOverride", "Creature.cmcEQ" + worstSac.getCMC());
return true;
}
}
return false;
}
private boolean doSacAndUpgradeLogic(final Player ai, final SpellAbility sa) {
Card source = sa.getHostCard();
PhaseHandler ph = ai.getGame().getPhaseHandler();
String logic = sa.getParam("AILogic");
@@ -1604,7 +1736,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
// A blink effect implemented using ChangeZone API
return false;
} else if (subApi == ApiType.DelayedTrigger) {
SpellAbility exec = causeSub.getAdditonalAbility("Execute");
SpellAbility exec = causeSub.getAdditionalAbility("Execute");
if (exec != null && exec.getApi() == ApiType.ChangeZone) {
if ("Exile".equals(exec.getParam("Origin")) && "Battlefield".equals(exec.getParam("Destination"))) {
// A blink effect implemented using a delayed trigger
@@ -1623,6 +1755,45 @@ public class ChangeZoneAi extends SpellAbilityAi {
return true;
}
private static CardCollection getSafeTargetsIfUnlessCostPaid(Player ai, SpellAbility sa, Iterable<Card> potentialTgts) {
// Determines if the controller of each potential target can negate the ChangeZone effect
// by paying the Unless cost. Returns the list of targets that can be saved that way.
final Card source = sa.getHostCard();
final CardCollection canBeSaved = new CardCollection();
for (Card potentialTgt : potentialTgts) {
String unlessCost = sa.hasParam("UnlessCost") ? sa.getParam("UnlessCost").trim() : null;
if (unlessCost != null && !unlessCost.endsWith(">")) {
Player opp = potentialTgt.getController();
int usableManaSources = ComputerUtilMana.getAvailableManaEstimate(opp);
int toPay = 0;
boolean setPayX = false;
if (unlessCost.equals("X") && source.getSVar(unlessCost).equals("Count$xPaid")) {
setPayX = true;
toPay = ComputerUtilMana.determineLeftoverMana(sa, ai);
} else {
toPay = AbilityUtils.calculateAmount(source, unlessCost, sa);
}
if (toPay == 0) {
canBeSaved.add(potentialTgt);
}
if (toPay <= usableManaSources) {
canBeSaved.add(potentialTgt);
}
if (setPayX) {
source.setSVar("PayX", Integer.toString(toPay));
}
}
}
return canBeSaved;
}
private static void rememberBouncedThisTurn(Player ai, Card c) {
AiCardMemory.rememberCard(ai, c, AiCardMemory.MemorySet.BOUNCED_THIS_TURN);
}

View File

@@ -1,33 +1,24 @@
package forge.ai.ability;
import java.util.Collections;
import java.util.Random;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.ai.AiPlayerPredicates;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
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;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.cost.Cost;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.player.PlayerCollection;
import forge.game.player.PlayerPredicates;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import java.util.Collections;
import java.util.Random;
public class ChangeZoneAllAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player ai, SpellAbility sa) {
@@ -46,9 +37,13 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
}
if (!ComputerUtilCost.checkDiscardCost(ai, abCost, source)) {
boolean aiLogicAllowsDiscard = sa.hasParam("AILogic") && sa.getParam("AILogic").startsWith("DiscardAll");
if (!aiLogicAllowsDiscard) {
return false;
}
}
}
final Random r = MyRandom.getRandom();
// prevent run-away activations - first time will always return true
@@ -73,21 +68,55 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
oppType = AbilityUtils.filterListByType(oppType, sa.getParam("ChangeType"), sa);
computerType = AbilityUtils.filterListByType(computerType, sa.getParam("ChangeType"), sa);
// Living Death AI
if ("LivingDeath".equals(sa.getParam("AILogic"))) {
// Living Death AI
return SpecialCardAi.LivingDeath.consider(ai, sa);
} else if ("Timetwister".equals(sa.getParam("AILogic"))) {
// Timetwister AI
return SpecialCardAi.Timetwister.consider(ai, sa);
} else if ("RetDiscardedThisTurn".equals(sa.getParam("AILogic"))) {
// e.g. Shadow of the Grave
return ai.getNumDiscardedThisTurn() > 0 && ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN);
} else if ("ExileGraveyards".equals(sa.getParam("AILogic"))) {
for (Player opp : ai.getOpponents()) {
CardCollectionView cardsGY = opp.getCardsIn(ZoneType.Graveyard);
CardCollection creats = CardLists.filter(cardsGY, CardPredicates.Presets.CREATURES);
if (opp.hasDelirium() || opp.hasThreshold() || creats.size() >= 5) {
return true;
}
}
return false;
} else if ("ManifestCreatsFromGraveyard".equals(sa.getParam("AILogic"))) {
PlayerCollection players = new PlayerCollection();
players.addAll(ai.getOpponents());
players.add(ai);
int maxSize = 1;
for (Player player : players) {
Player bestTgt = null;
if (player.canBeTargetedBy(sa)) {
CardCollectionView cardsGY = CardLists.filter(player.getCardsIn(ZoneType.Graveyard),
CardPredicates.Presets.CREATURES);
if (cardsGY.size() > maxSize) {
maxSize = cardsGY.size();
bestTgt = player;
}
}
// Timetwister AI
if ("Timetwister".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.Timetwister.consider(ai, sa);
if (bestTgt != null) {
sa.resetTargets();
sa.getTargets().add(bestTgt);
return true;
}
}
return false;
}
// TODO improve restrictions on when the AI would want to use this
// spBounceAll has some AI we can compare to.
if (origin.equals(ZoneType.Hand) || origin.equals(ZoneType.Library)) {
if (!sa.usesTargeting()) {
// TODO: improve logic for non-targeted SAs of this type (most are currently RemAIDeck, e.g. Memory Jar, Timetwister)
// TODO: improve logic for non-targeted SAs of this type (most are currently RemAIDeck, e.g. Memory Jar)
return true;
} else {
// search targetable Opponents
@@ -130,15 +159,39 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
}
computerType = new CardCollection();
}
int creatureEvalThreshold = 200; // value difference (in evaluateCreatureList units)
int nonCreatureEvalThreshold = 3; // CMC difference
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
if (destination == ZoneType.Hand) {
creatureEvalThreshold = aic.getIntProperty(AiProps.BOUNCE_ALL_TO_HAND_CREAT_EVAL_DIFF);
nonCreatureEvalThreshold = aic.getIntProperty(AiProps.BOUNCE_ALL_TO_HAND_NONCREAT_EVAL_DIFF);
} else {
creatureEvalThreshold = aic.getIntProperty(AiProps.BOUNCE_ALL_ELSEWHERE_CREAT_EVAL_DIFF);
nonCreatureEvalThreshold = aic.getIntProperty(AiProps.BOUNCE_ALL_ELSEWHERE_NONCREAT_EVAL_DIFF);
}
}
// mass zone change for creatures: if in dire danger, do it; otherwise, only do it if the opponent's
// creatures are better in value
if ((CardLists.getNotType(oppType, "Creature").size() == 0)
&& (CardLists.getNotType(computerType, "Creature").size() == 0)) {
if ((ComputerUtilCard.evaluateCreatureList(computerType) + 200) >= ComputerUtilCard
if (game.getCombat() != null && ComputerUtilCombat.lifeInSeriousDanger(ai, game.getCombat())) {
if (game.getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& game.getPhaseHandler().getPlayerTurn().isOpponentOf(ai)) {
// Life is in serious danger, return all creatures from the battlefield to wherever
// so they don't deal lethal damage
return true;
}
}
if ((ComputerUtilCard.evaluateCreatureList(computerType) + creatureEvalThreshold) >= ComputerUtilCard
.evaluateCreatureList(oppType)) {
return false;
}
} // otherwise evaluate both lists by CMC and pass only if human
} // mass zone change for non-creatures: evaluate both lists by CMC and pass only if human
// permanents are more valuable
else if ((ComputerUtilCard.evaluatePermanentList(computerType) + 3) >= ComputerUtilCard
else if ((ComputerUtilCard.evaluatePermanentList(computerType) + nonCreatureEvalThreshold) >= ComputerUtilCard
.evaluatePermanentList(oppType)) {
return false;
}
@@ -180,6 +233,14 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
// minimum card advantage unless the hand will be fully reloaded
int minAdv = logic.contains(".minAdv") ? Integer.parseInt(logic.substring(logic.indexOf(".minAdv") + 7)) : 0;
if (numExiledWithSrc > curHandSize) {
if (ComputerUtil.predictThreatenedObjects(ai, sa, true).contains(source)) {
// Try to gain some card advantage if the card will die anyway
// TODO: ideally, should evaluate the hand value and not discard good hands to it
return true;
}
}
return (curHandSize + minAdv - 1 < numExiledWithSrc) || (numExiledWithSrc >= ai.getMaxHandSize());
}
} else if (origin.equals(ZoneType.Stack)) {
@@ -231,8 +292,8 @@ public class ChangeZoneAllAi extends SpellAbilityAi {
* </p>
* @param sa
* a {@link forge.game.spellability.SpellAbility} object.
* @param af
* a {@link forge.game.ability.AbilityFactory} object.
* @param aiPlayer
* a {@link forge.game.player.Player} object.
*
* @return a boolean.
*/

View File

@@ -1,15 +1,7 @@
package forge.ai.ability;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Lists;
import forge.ai.AiController;
import forge.ai.AiPlayDecision;
import forge.ai.ComputerUtilAbility;
import forge.ai.PlayerControllerAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.ability.effects.CharmEffect;
import forge.game.player.Player;
import forge.game.spellability.AbilitySub;
@@ -18,6 +10,9 @@ import forge.util.Aggregates;
import forge.util.MyRandom;
import forge.util.collect.FCollection;
import java.util.List;
import java.util.Random;
public class CharmAi extends SpellAbilityAi {
@Override
protected boolean checkApiLogic(Player ai, SpellAbility sa) {
@@ -124,6 +119,8 @@ public class CharmAi extends SpellAbilityAi {
private List<AbilitySub> chooseTriskaidekaphobia(List<AbilitySub> choices, final Player ai) {
List<AbilitySub> chosenList = Lists.newArrayList();
if (choices == null || choices.isEmpty()) { return chosenList; }
AbilitySub gain = choices.get(0);
AbilitySub lose = choices.get(1);
FCollection<Player> opponents = ai.getOpponents();

View File

@@ -6,6 +6,8 @@ import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
@@ -16,6 +18,7 @@ import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CardPredicates.Presets;
import forge.game.card.CounterType;
import forge.game.combat.Combat;
@@ -122,7 +125,7 @@ public class ChooseCardAi extends SpellAbilityAi {
}
} else if (aiLogic.equals("Duneblast")) {
CardCollection aiCreatures = ai.getCreaturesInPlay();
CardCollection oppCreatures = ai.getOpponent().getCreaturesInPlay();
CardCollection oppCreatures = ComputerUtil.getOpponentFor(ai).getCreaturesInPlay();
aiCreatures = CardLists.getNotKeyword(aiCreatures, "Indestructible");
oppCreatures = CardLists.getNotKeyword(oppCreatures, "Indestructible");
@@ -228,6 +231,13 @@ public class ChooseCardAi extends SpellAbilityAi {
Collections.reverse(creats);
choice = creats.get(0);
}
} else if ("NegativePowerFirst".equals(logic)) {
Card lowest = Aggregates.itemWithMin(options, CardPredicates.Accessors.fnGetNetPower);
if (lowest.getNetPower() <= 0) {
choice = lowest;
} else {
choice = ComputerUtilCard.getBestCreatureAI(options);
}
} else if ("TangleWire".equals(logic)) {
CardCollectionView betterList = CardLists.filter(options, new Predicate<Card>() {
@Override
@@ -259,6 +269,10 @@ public class ChooseCardAi extends SpellAbilityAi {
Card chosen = ComputerUtilCard.getBestCreatureAI(aiCreatures);
return chosen;
} else if (logic.equals("OrzhovAdvokist")) {
if (ai.equals(sa.getActivatingPlayer())) {
choice = ComputerUtilCard.getBestAI(options);
} // TODO: improve ai
} else {
choice = ComputerUtilCard.getBestAI(options);
}

View File

@@ -6,10 +6,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.StaticData;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.card.CardDb;
import forge.card.CardRules;
import forge.card.CardSplitType;
@@ -17,7 +14,6 @@ import forge.card.CardStateName;
import forge.card.ICardFace;
import forge.game.card.Card;
import forge.game.card.CardUtil;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
@@ -36,29 +32,16 @@ public class ChooseCardNameAi extends SpellAbilityAi {
String logic = sa.getParam("AILogic");
if (logic.equals("MomirAvatar")) {
if (source.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) {
return false;
}
// Set PayX here to maximum value.
int tokenSize = ComputerUtilMana.determineLeftoverMana(sa, ai);
// Some basic strategy for Momir
if (tokenSize < 2) {
return false;
}
if (tokenSize > 11) {
tokenSize = 11;
}
source.setSVar("PayX", Integer.toString(tokenSize));
return SpecialCardAi.MomirVigAvatar.consider(ai, sa);
} else if (logic.equals("CursedScroll")) {
return SpecialCardAi.CursedScroll.consider(ai, sa);
}
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) {
sa.resetTargets();
if (tgt.canOnlyTgtOpponent()) {
sa.getTargets().add(ai.getOpponent());
sa.getTargets().add(ComputerUtil.getOpponentFor(ai));
} else {
sa.getTargets().add(ai);
}
@@ -78,6 +61,7 @@ public class ChooseCardNameAi extends SpellAbilityAi {
*/
@Override
public Card chooseSingleCard(final Player ai, SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer) {
return ComputerUtilCard.getBestAI(options);
}
@@ -104,9 +88,9 @@ public class ChooseCardNameAi extends SpellAbilityAi {
Card copy = CardUtil.getLKICopy(card);
// for calcing i need only one split side
if (isOther) {
copy.getCurrentState().copyFrom(card, card.getState(CardStateName.RightSplit));
copy.getCurrentState().copyFrom(card.getState(CardStateName.RightSplit), true);
} else {
copy.getCurrentState().copyFrom(card, card.getState(CardStateName.LeftSplit));
copy.getCurrentState().copyFrom(card.getState(CardStateName.LeftSplit), true);
}
copy.updateStateForView();

View File

@@ -1,6 +1,5 @@
package forge.ai.ability;
import com.google.common.base.Predicates;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
@@ -53,7 +52,7 @@ public class ChooseColorAi extends SpellAbilityAi {
}
if ("Addle".equals(sourceName)) {
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) || ai.getOpponent().getCardsIn(ZoneType.Hand).isEmpty()) {
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) || ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Hand).isEmpty()) {
return false;
}
return true;
@@ -62,7 +61,7 @@ public class ChooseColorAi extends SpellAbilityAi {
if (logic.equals("MostExcessOpponentControls")) {
for (byte color : MagicColor.WUBRG) {
CardCollectionView ailist = ai.getCardsIn(ZoneType.Battlefield);
CardCollectionView opplist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
CardCollectionView opplist = ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield);
ailist = CardLists.filter(ailist, CardPredicates.isColor(color));
opplist = CardLists.filter(opplist, CardPredicates.isColor(color));

View File

@@ -196,7 +196,7 @@ public class ChooseGenericEffectAi extends SpellAbilityAi {
}
// milling against Tamiyo is pointless
if (owner.isCardInCommand("Tamiyo, the Moon Sage emblem")) {
if (owner.isCardInCommand("Emblem - Tamiyo, the Moon Sage")) {
return allow;
}

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
@@ -16,8 +17,9 @@ public class ChooseNumberAi extends SpellAbilityAi {
TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) {
sa.resetTargets();
if (sa.canTarget(aiPlayer.getOpponent())) {
sa.getTargets().add(aiPlayer.getOpponent());
Player opp = ComputerUtil.getOpponentFor(aiPlayer);
if (sa.canTarget(opp)) {
sa.getTargets().add(opp);
} else {
return false;
}

View File

@@ -5,6 +5,7 @@ import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCombat;
import forge.ai.ComputerUtilCost;
@@ -51,7 +52,7 @@ public class ChooseSourceAi extends SpellAbilityAi {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
@@ -63,8 +64,9 @@ public class ChooseSourceAi extends SpellAbilityAi {
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) {
sa.resetTargets();
if (sa.canTarget(ai.getOpponent())) {
sa.getTargets().add(ai.getOpponent());
Player opp = ComputerUtil.getOpponentFor(ai);
if (sa.canTarget(opp)) {
sa.getTargets().add(opp);
} else {
return false;
}

View File

@@ -1,7 +1,5 @@
package forge.ai.ability;
import java.util.List;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
@@ -15,6 +13,9 @@ import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import java.util.List;
public class CloneAi extends SpellAbilityAi {
@@ -131,13 +132,19 @@ public class CloneAi extends SpellAbilityAi {
* cloneTgtAI.
* </p>
*
* @param af
* a {@link forge.game.ability.AbilityFactory} object.
* @param sa
* a {@link forge.game.spellability.SpellAbility} object.
* @return a boolean.
*/
private boolean cloneTgtAI(final SpellAbility sa) {
// Specific logic for cards
if ("CloneAttacker".equals(sa.getParam("AILogic"))) {
CardCollection valid = CardLists.getValidCards(sa.getHostCard().getController().getCardsIn(ZoneType.Battlefield), sa.getParam("ValidTgts"), sa.getHostCard().getController(), sa.getHostCard());
sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(valid));
return true;
}
// Default:
// This is reasonable for now. Kamahl, Fist of Krosa and a sorcery or
// two are the only things
// that clone a target. Those can just use SVar:RemAIDeck:True until

View File

@@ -3,6 +3,7 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
@@ -29,7 +30,7 @@ public class ControlExchangeAi extends SpellAbilityAi {
sa.resetTargets();
CardCollection list =
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getHostCard(), sa);
CardLists.getValidCards(ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getHostCard(), sa);
// AI won't try to grab cards that are filtered out of AI decks on
// purpose
list = CardLists.filter(list, new Predicate<Card>() {

View File

@@ -227,6 +227,7 @@ public class ControlGainAi extends SpellAbilityAi {
t = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, true);
}
if (t != null) {
if (t.isCreature())
creatures--;
if (t.isPlaneswalker())
@@ -237,6 +238,7 @@ public class ControlGainAi extends SpellAbilityAi {
artifacts--;
if (t.isEnchantment())
enchantments--;
}
if (!sa.canTarget(t)) {
list.remove(t);

View File

@@ -1,37 +1,42 @@
package forge.ai.ability;
import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.card.CardUtil;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.player.PlayerCollection;
import forge.game.spellability.SpellAbility;
import java.util.List;
public class CopyPermanentAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
// Card source = sa.getHostCard();
// TODO - I'm sure someone can do this AI better
PhaseHandler ph = aiPlayer.getGame().getPhaseHandler();
String aiLogic = sa.getParamOrDefault("AILogic", "");
if (ComputerUtil.preventRunAwayActivations(sa)) {
return false;
}
if ("MimicVat".equals(aiLogic)) {
return SpecialCardAi.MimicVat.considerCopy(aiPlayer, sa);
} else if ("AtEOT".equals(aiLogic)) {
return ph.is(PhaseType.END_OF_TURN);
} else if ("AtOppEOT".equals(aiLogic)) {
return ph.is(PhaseType.END_OF_TURN) && ph.getPlayerTurn() != aiPlayer;
}
if (sa.hasParam("AtEOT") && !aiPlayer.getGame().getPhaseHandler().is(PhaseType.MAIN1)) {
return false;
}
@@ -43,6 +48,13 @@ public class CopyPermanentAi extends SpellAbilityAi {
}
}
if (sa.hasParam("Embalm") || sa.hasParam("Eternalize")) {
// E.g. Vizier of Many Faces: check to make sure it makes sense to make the token now
if (ComputerUtilCard.checkNeedsToPlayReqs(sa.getHostCard(), sa) != AiPlayDecision.WillPlay) {
return false;
}
}
if (sa.usesTargeting() && sa.hasParam("TargetingPlayer")) {
sa.resetTargets();
Player targetingPlayer = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("TargetingPlayer"), sa).get(0);

View File

@@ -3,6 +3,7 @@ package forge.ai.ability;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
import java.util.List;
@@ -25,9 +26,10 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
public boolean chkAIDrawback(final SpellAbility sa, final Player aiPlayer) {
// NOTE: Other SAs that use CopySpellAbilityAi (e.g. Chain Lightning) are currently routed through
// generic method SpellAbilityAi#chkDrawbackWithSubs and are handled there.
if ("ChainOfSmog".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.ChainOfSmog.consider(aiPlayer, sa);
} else if ("ChainOfAcid".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.ChainOfAcid.consider(aiPlayer, sa);
}
return super.chkAIDrawback(sa, aiPlayer);
@@ -37,5 +39,17 @@ public class CopySpellAbilityAi extends SpellAbilityAi {
public SpellAbility chooseSingleSpellAbility(Player player, SpellAbility sa, List<SpellAbility> spells) {
return spells.get(0);
}
@Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
// Chain of Acid requires special attention here since otherwise the AI will confirm the copy and then
// run into the necessity of confirming a mandatory Destroy, thus destroying all of its own permanents.
if ("ChainOfAcid".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.ChainOfAcid.consider(player, sa);
}
return true;
}
}

View File

@@ -1,30 +1,27 @@
package forge.ai.ability;
import forge.ai.AiController;
import forge.ai.AiProps;
import forge.ai.ComputerUtilAbility;
import java.util.Iterator;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
import forge.ai.PlayerControllerAi;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardFactoryUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostDiscard;
import forge.game.cost.CostExile;
import forge.game.cost.CostSacrifice;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Iterator;
public class CounterAi extends SpellAbilityAi {
@Override
@@ -43,7 +40,7 @@ public class CounterAi extends SpellAbilityAi {
if (abCost != null) {
// AI currently disabled for these costs
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
if (!ComputerUtilCost.checkLifeCost(ai, abCost, source, 4, sa)) {
@@ -66,6 +63,8 @@ public class CounterAi extends SpellAbilityAi {
// might as well check for player's friendliness
return false;
}
// check if the top ability on the stack corresponds to the AI-specific targeting declaration, if provided
if (sa.hasParam("AITgts") && (topSA.getHostCard() == null
|| !topSA.getHostCard().isValid(sa.getParam("AITgts"), sa.getActivatingPlayer(), source, sa))) {
return false;
@@ -75,6 +74,12 @@ public class CounterAi extends SpellAbilityAi {
return false;
}
if ("OppDiscardsHand".equals(sa.getParam("AILogic"))) {
if (topSA.getActivatingPlayer().getCardsIn(ZoneType.Hand).size() < 2) {
return false;
}
}
sa.resetTargets();
if (sa.canTargetSpellAbility(topSA)) {
sa.getTargets().add(topSA);
@@ -93,8 +98,9 @@ public class CounterAi extends SpellAbilityAi {
String unlessCost = sa.hasParam("UnlessCost") ? sa.getParam("UnlessCost").trim() : null;
if (unlessCost != null && !unlessCost.endsWith(">")) {
// Is this Usable Mana Sources? Or Total Available Mana?
final int usableManaSources = ComputerUtilMana.getAvailableMana(ai.getOpponent(), true).size();
Player opp = tgtSA.getActivatingPlayer();
int usableManaSources = ComputerUtilMana.getAvailableManaEstimate(opp);
int toPay = 0;
boolean setPayX = false;
if (unlessCost.equals("X") && source.getSVar(unlessCost).equals("Count$xPaid")) {
@@ -137,6 +143,10 @@ public class CounterAi extends SpellAbilityAi {
if (tgtCMC < minCMC) {
return false;
}
} else if ("NullBrooch".equals(logic)) {
if (!SpecialCardAi.NullBrooch.consider(ai, sa)) {
return false;
}
}
}
@@ -146,14 +156,31 @@ public class CounterAi extends SpellAbilityAi {
boolean ctrCmc0ManaPerms = aic.getBooleanProperty(AiProps.ALWAYS_COUNTER_CMC_0_MANA_MAKING_PERMS);
boolean ctrDamageSpells = aic.getBooleanProperty(AiProps.ALWAYS_COUNTER_DAMAGE_SPELLS);
boolean ctrRemovalSpells = aic.getBooleanProperty(AiProps.ALWAYS_COUNTER_REMOVAL_SPELLS);
boolean ctrPumpSpells = aic.getBooleanProperty(AiProps.ALWAYS_COUNTER_PUMP_SPELLS);
boolean ctrAuraSpells = aic.getBooleanProperty(AiProps.ALWAYS_COUNTER_AURAS);
boolean ctrOtherCounters = aic.getBooleanProperty(AiProps.ALWAYS_COUNTER_OTHER_COUNTERSPELLS);
int ctrChanceCMC1 = aic.getIntProperty(AiProps.CHANCE_TO_COUNTER_CMC_1);
int ctrChanceCMC2 = aic.getIntProperty(AiProps.CHANCE_TO_COUNTER_CMC_2);
int ctrChanceCMC3 = aic.getIntProperty(AiProps.CHANCE_TO_COUNTER_CMC_3);
String ctrNamed = aic.getProperty(AiProps.ALWAYS_COUNTER_SPELLS_FROM_NAMED_CARDS);
boolean dontCounter = false;
if (tgtCMC == 1 && !MyRandom.percentTrue(ctrChanceCMC1)) {
dontCounter = true;
} else if (tgtCMC == 2 && !MyRandom.percentTrue(ctrChanceCMC2)) {
dontCounter = true;
} else if (tgtCMC == 3 && !MyRandom.percentTrue(ctrChanceCMC3)) {
dontCounter = true;
}
if (tgtSA != null && tgtCMC < aic.getIntProperty(AiProps.MIN_SPELL_CMC_TO_COUNTER)) {
boolean dontCounter = true;
dontCounter = true;
Card tgtSource = tgtSA.getHostCard();
if ((tgtSource != null && tgtCMC == 0 && tgtSource.isPermanent() && !tgtSource.getManaAbilities().isEmpty() && ctrCmc0ManaPerms)
|| (tgtSA.getApi() == ApiType.DealDamage || tgtSA.getApi() == ApiType.LoseLife || tgtSA.getApi() == ApiType.DamageAll && ctrDamageSpells)
|| (tgtSA.getApi() == ApiType.Counter && ctrOtherCounters)
|| ((tgtSA.getApi() == ApiType.Pump || tgtSA.getApi() == ApiType.PumpAll) && ctrPumpSpells)
|| (tgtSA.getApi() == ApiType.Attach && ctrAuraSpells)
|| (tgtSA.getApi() == ApiType.Destroy || tgtSA.getApi() == ApiType.DestroyAll || tgtSA.getApi() == ApiType.Sacrifice
|| tgtSA.getApi() == ApiType.SacrificeAll && ctrRemovalSpells)) {
dontCounter = false;
@@ -167,15 +194,38 @@ public class CounterAi extends SpellAbilityAi {
}
}
// should always counter CMC 1 with Mental Misstep despite a possible limitation by minimum CMC
if (tgtCMC == 1 && "Mental Misstep".equals(source.getName())) {
// should not refrain from countering a CMC X spell if that's the only CMC
// counterable with that particular counterspell type (e.g. Mental Misstep vs. CMC 1 spells)
if (sa.getParamOrDefault("ValidTgts", "").startsWith("Card.cmcEQ")) {
int validTgtCMC = AbilityUtils.calculateAmount(source, sa.getParam("ValidTgts").substring(10), sa);
if (tgtCMC == validTgtCMC) {
dontCounter = false;
}
}
}
// Should ALWAYS counter if it doesn't spend a card, otherwise it wastes an opportunity
// to gain card advantage
if (sa.isAbility()
&& (!sa.getPayCosts().hasSpecificCostType(CostDiscard.class))
&& (!sa.getPayCosts().hasSpecificCostType(CostSacrifice.class))
&& (!sa.getPayCosts().hasSpecificCostType(CostExile.class))) {
// TODO: maybe also disallow CostPayLife?
dontCounter = false;
}
// Null Brooch is special - it has a discard cost, but the AI will be
// discarding no cards, or is playing a deck where discarding is a benefit
// as defined in SpecialCardAi.NullBrooch
if (sa.hasParam("AILogic")) {
if ("NullBrooch".equals(sa.getParam("AILogic"))) {
dontCounter = false;
}
}
if (dontCounter) {
return false;
}
}
return toReturn;
}
@@ -212,8 +262,9 @@ public class CounterAi extends SpellAbilityAi {
final Card source = sa.getHostCard();
if (unlessCost != null) {
// Is this Usable Mana Sources? Or Total Available Mana?
final int usableManaSources = ComputerUtilMana.getAvailableMana(ai.getOpponent(), true).size();
Player opp = tgtSA.getActivatingPlayer();
int usableManaSources = ComputerUtilMana.getAvailableManaEstimate(opp);
int toPay = 0;
boolean setPayX = false;
if (unlessCost.equals("X") && source.getSVar(unlessCost).equals("Count$xPaid")) {

View File

@@ -1,21 +1,13 @@
package forge.ai.ability;
import java.util.List;
import java.util.Map;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -24,6 +16,9 @@ import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.collect.FCollection;
import java.util.List;
import java.util.Map;
public class CountersMoveAi extends SpellAbilityAi {
@Override
protected boolean checkApiLogic(final Player ai, final SpellAbility sa) {
@@ -109,6 +104,12 @@ public class CountersMoveAi extends SpellAbilityAi {
if (!ph.getNextTurn().equals(ai) || ph.getPhase().isBefore(PhaseType.END_OF_TURN)) {
return false;
}
// Make sure that removing the last counter doesn't kill the creature
if ("Self".equals(sa.getParam("Source"))) {
if (host != null && host.getNetToughness() - 1 <= 0) {
return false;
}
}
}
return true;
}
@@ -188,6 +189,13 @@ public class CountersMoveAi extends SpellAbilityAi {
if (newEval < oldEval) {
return false;
}
// check for some specific AI preferences
if (src.hasStartOfKeyword("Graft") && "DontMoveCounterIfLethal".equals(src.getSVar("AIGraftPreference"))) {
if (cType == CounterType.P1P1 && src.getNetToughness() - src.getTempToughnessBoost() - 1 <= 0) {
return false;
}
}
}
// no target
return true;

View File

@@ -1,14 +1,8 @@
package forge.ai.ability;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.ai.*;
import forge.card.CardStateName;
import forge.game.Game;
@@ -20,6 +14,7 @@ import forge.game.combat.CombatUtil;
import forge.game.cost.Cost;
import forge.game.cost.CostPart;
import forge.game.cost.CostRemoveCounter;
import forge.game.cost.CostSacrifice;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -32,6 +27,11 @@ import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import forge.util.MyRandom;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class CountersPutAi extends SpellAbilityAi {
/*
@@ -225,13 +225,42 @@ public class CountersPutAi extends SpellAbilityAi {
}
if ("PayEnergyConservatively".equals(sa.getParam("AILogic"))) {
boolean onlyInCombat = ai.getController().isAI()
&& ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.CONSERVATIVE_ENERGY_PAYMENT_ONLY_IN_COMBAT);
boolean onlyDefensive = ai.getController().isAI()
&& ((PlayerControllerAi) ai.getController()).getAi().getBooleanProperty(AiProps.CONSERVATIVE_ENERGY_PAYMENT_ONLY_DEFENSIVELY);
if (playAggro) {
// aggro profiles ignore conservative play for this AI logic
return true;
} else if (ai.getCounters(CounterType.ENERGY) > ComputerUtilCard.getMaxSAEnergyCostOnBattlefield(ai) + sa.getPayCosts().getCostEnergy().convertAmount()) {
return true;
} else if (ai.getGame().getCombat() != null && sa.getHostCard() != null) {
if (ai.getGame().getCombat().isAttacking(sa.getHostCard())) {
if (ai.getGame().getCombat().isAttacking(sa.getHostCard()) && !onlyDefensive) {
return true;
} else if (ai.getGame().getCombat().isBlocking(sa.getHostCard())) {
// when blocking, consider this if it's possible to save the blocker and/or kill at least one attacker
CardCollection blocked = ai.getGame().getCombat().getAttackersBlockedBy(sa.getHostCard());
int totBlkPower = Aggregates.sum(blocked, CardPredicates.Accessors.fnGetNetPower);
int totBlkToughness = Aggregates.min(blocked, CardPredicates.Accessors.fnGetNetToughness);
int numActivations = ai.getCounters(CounterType.ENERGY) / sa.getPayCosts().getCostEnergy().convertAmount();
if (sa.getHostCard().getNetToughness() + numActivations > totBlkPower
|| sa.getHostCard().getNetPower() + numActivations >= totBlkToughness) {
return true;
}
}
} else if (sa.getSubAbility() != null
&& "Self".equals(sa.getSubAbility().getParam("Defined"))
&& sa.getSubAbility().getParamOrDefault("KW", "").contains("Hexproof")
&& !AiCardMemory.isRememberedCard(ai, source, AiCardMemory.MemorySet.ANIMATED_THIS_TURN)) {
// Bristling Hydra: save from death using a ping activation
if (ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), sa).contains(source)) {
AiCardMemory.rememberCard(ai, source, AiCardMemory.MemorySet.ACTIVATED_THIS_TURN);
return true;
}
} else if (ai.getCounters(CounterType.ENERGY) > ComputerUtilCard.getMaxSAEnergyCostOnBattlefield(ai) + sa.getPayCosts().getCostEnergy().convertAmount()) {
// outside of combat, this logic only works if the relevant AI profile option is enabled
// and if there is enough energy saved
if (!onlyInCombat) {
return true;
}
}
@@ -273,7 +302,8 @@ public class CountersPutAi extends SpellAbilityAi {
return FightAi.canFightAi(ai, sa, nPump, nPump);
}
if (amountStr.equals("X") && source.getSVar(amountStr).equals("Count$xPaid")) {
if (amountStr.equals("X")) {
if (source.getSVar(amountStr).equals("Count$xPaid")) {
// By default, set PayX here to maximum value (used for most SAs of this type).
amount = ComputerUtilMana.determineLeftoverMana(sa, ai);
@@ -289,10 +319,19 @@ public class CountersPutAi extends SpellAbilityAi {
}
amount = Math.min(amount, maxCtrs - curCtrs);
if (amount <= 0) { return false; }
if (amount <= 0) {
return false;
}
}
source.setSVar("PayX", Integer.toString(amount));
} else if ("ExiledCreatureFromGraveCMC".equals(sa.getParam("AILogic"))) {
// e.g. Necropolis
amount = Aggregates.max(CardLists.filter(ai.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES), CardPredicates.Accessors.fnGetCmc);
if (amount > 0 && ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)) {
return true;
}
}
}
// don't use it if no counters to add
@@ -326,7 +365,7 @@ public class CountersPutAi extends SpellAbilityAi {
PhaseHandler ph = ai.getGame().getPhaseHandler();
if ("AlwaysAtOppEOT".equals(sa.getParam("AILogic"))) {
if (ph.is(PhaseType.END_OF_TURN) && !ph.isPlayerTurn(ai)) {
if (ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn().equals(ai)) {
return true;
}
}
@@ -373,6 +412,13 @@ public class CountersPutAi extends SpellAbilityAi {
}
});
if (abCost.hasSpecificCostType(CostSacrifice.class)) {
Card sacTarget = ComputerUtil.getCardPreference(ai, source, "SacCost", list);
// this card is planned to be sacrificed during cost payment, so don't target it
// (otherwise the AI can cheat by activating this SA and not paying the sac cost, e.g. Extruder)
list.remove(sacTarget);
}
if (list.size() < sa.getTargetRestrictions().getMinTargets(source, sa)) {
return false;
}
@@ -491,7 +537,7 @@ public class CountersPutAi extends SpellAbilityAi {
boolean immediately = ComputerUtil.playImmediately(ai, sa);
if (abCost != null && !ComputerUtilCost.checkSacrificeCost(ai, abCost, source, immediately)) {
if (abCost != null && !ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa, immediately)) {
return false;
}
@@ -528,7 +574,7 @@ public class CountersPutAi extends SpellAbilityAi {
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), amountStr, sa);
final boolean isMandatoryTrigger = (sa.isTrigger() && !sa.isOptionalTrigger())
|| (sa.getRootAbility().isTrigger() || !sa.getRootAbility().isOptionalTrigger());
|| (sa.getRootAbility().isTrigger() && !sa.getRootAbility().isOptionalTrigger());
if (sa.usesTargeting()) {
CardCollection list = null;
@@ -670,6 +716,13 @@ public class CountersPutAi extends SpellAbilityAi {
list = CardLists.getTargetableCards(ai.getOpponents().getCardsIn(ZoneType.Battlefield), sa);
preferred = false;
}
if (list.isEmpty()) {
// Still an empty list, but we have to choose something (mandatory); expand targeting to
// include AI's own cards to see if there's anything targetable (e.g. Plague Belcher).
list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa);
preferred = false;
}
}
if (list.isEmpty()) {

View File

@@ -1,6 +1,8 @@
package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
@@ -35,10 +37,11 @@ public class CountersPutAllAi extends SpellAbilityAi {
final String type = sa.getParam("CounterType");
final String amountStr = sa.getParam("CounterNum");
final String valid = sa.getParam("ValidCards");
final String logic = sa.getParamOrDefault("AILogic", "");
final boolean curse = sa.isCurse();
final TargetRestrictions tgt = sa.getTargetRestrictions();
hList = CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
hList = CardLists.getValidCards(ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
cList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
if (abCost != null) {
@@ -51,13 +54,23 @@ public class CountersPutAllAi extends SpellAbilityAi {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
}
if (logic.equals("AtEOTOrBlock")) {
if (!ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN) && !ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
return false;
}
} else if (logic.equals("AtOppEOT")) {
if (!(ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN) && ai.getGame().getPhaseHandler().getNextTurn() == ai)) {
return false;
}
}
if (tgt != null) {
Player pl = curse ? ai.getOpponent() : ai;
Player pl = curse ? ComputerUtil.getOpponentFor(ai) : ai;
sa.getTargets().add(pl);
hList = CardLists.filterControlledBy(hList, pl);
@@ -138,6 +151,33 @@ public class CountersPutAllAi extends SpellAbilityAi {
*/
@Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
return player.getCreaturesInPlay().size() >= player.getOpponent().getCreaturesInPlay().size();
return player.getCreaturesInPlay().size() >= ComputerUtil.getOpponentFor(player).getCreaturesInPlay().size();
}
@Override
protected boolean doTriggerAINoCost(final Player aiPlayer, final SpellAbility sa, final boolean mandatory) {
if (sa.usesTargeting()) {
List<Player> players = Lists.newArrayList();
if (!sa.isCurse()) {
players.add(aiPlayer);
}
players.addAll(aiPlayer.getOpponents());
players.addAll(aiPlayer.getAllies());
if (sa.isCurse()) {
players.add(aiPlayer);
}
for (final Player p : players) {
if (p.canBeTargetedBy(sa) && sa.canTarget(p)) {
boolean preferred = false;
preferred = (sa.isCurse() && p.isOpponentOf(aiPlayer)) || (!sa.isCurse() && p == aiPlayer);
sa.resetTargets();
sa.getTargets().add(p);
return preferred || mandatory;
}
}
}
return mandatory;
}
}

View File

@@ -17,25 +17,20 @@
*/
package forge.ai.ability;
import java.util.List;
import java.util.Map;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.GlobalRuleChange;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.player.Player;
import forge.game.player.PlayerController.BinaryChoiceType;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import java.util.List;
import java.util.Map;
/**
* <p>
* AbilityFactory_PutOrRemoveCountersAi class.
@@ -75,13 +70,8 @@ public class CountersPutOrRemoveAi extends SpellAbilityAi {
return false;
}
if (sa.hasParam("AITgts")) {
String aiTgts = sa.getParam("AITgts");
CardCollection prefList = CardLists.getValidCards(list, aiTgts.split(","), ai, source, sa);
if (!prefList.isEmpty() || sa.hasParam("AITgtsStrict")) {
list = prefList;
}
}
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, false);
if (sa.hasParam("CounterType")) {
// currently only Jhoira's Timebug

View File

@@ -1,8 +1,6 @@
package forge.ai.ability;
import java.util.List;
import java.util.Map;
import com.google.common.base.Predicates;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
@@ -10,12 +8,7 @@ import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.GlobalRuleChange;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -23,6 +16,9 @@ import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import java.util.List;
import java.util.Map;
public class CountersRemoveAi extends SpellAbilityAi {
/*
@@ -102,13 +98,8 @@ public class CountersRemoveAi extends SpellAbilityAi {
return false;
}
if (sa.hasParam("AITgts")) {
String aiTgts = sa.getParam("AITgts");
CardCollection prefList = CardLists.getValidCards(list, aiTgts.split(","), ai, source, sa);
if (!prefList.isEmpty() || sa.hasParam("AITgtsStrict")) {
list = prefList;
}
}
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, false);
boolean noLegendary = game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule);
@@ -174,10 +165,11 @@ public class CountersRemoveAi extends SpellAbilityAi {
}
// Get rid of Planeswalkers:
list = ai.getOpponents().getCardsIn(ZoneType.Battlefield);
list = game.getPlayers().getCardsIn(ZoneType.Battlefield);
list = CardLists.filter(list, CardPredicates.isTargetableBy(sa));
CardCollection planeswalkerList = CardLists.filter(list, CardPredicates.Presets.PLANEWALKERS,
CardCollection planeswalkerList = CardLists.filter(list,
Predicates.and(CardPredicates.Presets.PLANEWALKERS, CardPredicates.isControlledByAnyOf(ai.getOpponents())),
CardPredicates.hasLessCounter(CounterType.LOYALTY, amount));
if (!planeswalkerList.isEmpty()) {

View File

@@ -1,24 +1,63 @@
package forge.ai.ability;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardPredicates;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerDamageDone;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
public abstract class DamageAiBase extends SpellAbilityAi {
protected boolean avoidTargetP(final Player comp, final SpellAbility sa) {
Player enemy = ComputerUtil.getOpponentFor(comp);
// Logic for cards that damage owner, like Fireslinger
// Do not target a player if they aren't below 75% of our health.
// Unless Lifelink will cancel the damage to us
Card hostcard = sa.getHostCard();
boolean lifelink = hostcard.hasKeyword("Lifelink");
for (Card ench : hostcard.getEnchantedBy(false)) {
// Treat cards enchanted by older cards with "when enchanted creature deals damage, gain life" as if they had lifelink.
if (ench.hasSVar("LikeLifeLink")) {
if ("True".equals(ench.getSVar("LikeLifeLink"))) {
lifelink = true;
}
}
}
if ("SelfDamage".equals(sa.getParam("AILogic"))) {
if (comp.getLife() * 0.75 < enemy.getLife()) {
if (!lifelink) {
return true;
}
}
}
return false;
}
protected boolean shouldTgtP(final Player comp, final SpellAbility sa, final int d, final boolean noPrevention) {
int restDamage = d;
final Game game = comp.getGame();
final Player enemy = comp.getOpponent();
Player enemy = ComputerUtil.getOpponentFor(comp);
boolean dmgByCardsInHand = false;
if ("X".equals(sa.getParam("NumDmg")) && sa.getHostCard() != null && sa.hasSVar(sa.getParam("NumDmg")) &&
sa.getHostCard().getSVar(sa.getParam("NumDmg")).equals("TargetedPlayer$CardsInHand")) {
dmgByCardsInHand = true;
}
// Not sure if type choice implemented for the AI yet but it should at least recognize this spell hits harder on larger enemy hand size
if ("Blood Oath".equals(sa.getHostCard().getName())) {
dmgByCardsInHand = true;
}
if (!sa.canTarget(enemy)) {
return false;
}
@@ -26,11 +65,27 @@ public abstract class DamageAiBase extends SpellAbilityAi {
return false;
}
// Benefits hitting players?
// If has triggered ability on dealing damage to an opponent, go for it!
Card hostcard = sa.getHostCard();
for (Trigger trig : hostcard.getTriggers()) {
if (trig instanceof TriggerDamageDone) {
if (("Opponent".equals(trig.getParam("ValidTarget")))
&& (!"True".equals(trig.getParam("CombatDamage")))) {
return true;
}
}
}
// burn Planeswalkers
if (Iterables.any(enemy.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS)) {
return true;
}
if (avoidTargetP(comp, sa)) {
return false;
}
if (!noPrevention) {
restDamage = ComputerUtilCombat.predictDamageTo(enemy, restDamage, sa.getHostCard(), false);
} else {
@@ -70,10 +125,20 @@ public abstract class DamageAiBase extends SpellAbilityAi {
value = 1.0f * restDamage / enemy.getLife();
}
} else {
if (phase.isPlayerTurn(enemy) && phase.is(PhaseType.END_OF_TURN)) {
// If Sudden Impact type spell, and can hit at least 3 cards during draw phase
// have a 100% chance to go for it, enemy hand will only lose cards over time!
// But if 3 or less cards, use normal rules, just in case enemy starts holding card or plays a draw spell or we need mana for other instants.
if (phase.isPlayerTurn(enemy)) {
if (dmgByCardsInHand
&& (phase.is(PhaseType.DRAW))
&& (enemy.getCardsIn(ZoneType.Hand).size() > 3)) {
value = 1;
} else if (phase.is(PhaseType.END_OF_TURN)
|| ((dmgByCardsInHand && phase.getPhase().isAfter(PhaseType.UPKEEP)))) {
value = 1.5f * restDamage / enemy.getLife();
}
}
}
if (value > 0) { //more likely to burn with larger hand
for (int i = 3; i < hand.size(); i++) {
value *= 1.1f;

View File

@@ -1,7 +1,6 @@
package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.*;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -56,16 +55,35 @@ public class DamageAllAi extends SpellAbilityAi {
x = source.getCounters(CounterType.LOYALTY);
}
if (x == -1) {
Player bestOpp = determineOppToKill(ai, sa, source, dmg);
if (determineOppToKill(ai, sa, source, dmg) != null) {
// we already know we can kill a player, so go for it
return true;
}
// look for other value in this (damaging creatures or
// creatures + player, e.g. Pestilence, etc.)
return evaluateDamageAll(ai, sa, source, dmg) > 0;
} else {
int best = -1, best_x = -1;
for (int i = 0; i < x; i++) {
Player bestOpp = determineOppToKill(ai, sa, source, x);
if (bestOpp != null) {
// we can finish off a player, so go for it
// TODO: improve this by possibly damaging more creatures
// on the battlefield belonging to other opponents at the same
// time, if viable
best_x = bestOpp.getLife();
} else {
// see if it's possible to get value from killing off creatures
for (int i = 0; i <= x; i++) {
final int value = evaluateDamageAll(ai, sa, source, i);
if (value > best) {
best = value;
best_x = i;
}
}
}
if (best_x > 0) {
if (sa.getSVar(damage).equals("Count$xPaid")) {
source.setSVar("PayX", Integer.toString(best_x));
@@ -79,8 +97,31 @@ public class DamageAllAi extends SpellAbilityAi {
}
}
private Player determineOppToKill(Player ai, SpellAbility sa, Card source, int x) {
// Attempt to determine which opponent can be finished off such that the most players
// are killed at the same time, given X damage tops
final String validP = sa.hasParam("ValidPlayers") ? sa.getParam("ValidPlayers") : "";
int aiLife = ai.getLife();
Player bestOpp = null; // default opponent, if all else fails
for (int dmg = 1; dmg <= x; dmg++) {
// Don't kill yourself in the process
if (validP.equals("Player") && aiLife <= ComputerUtilCombat.predictDamageTo(ai, dmg, source, false)) {
break;
}
for (Player opp : ai.getOpponents()) {
if ((validP.equals("Player") || validP.contains("Opponent"))
&& (opp.getLife() <= ComputerUtilCombat.predictDamageTo(opp, dmg, source, false))) {
bestOpp = opp;
}
}
}
return bestOpp;
}
private int evaluateDamageAll(Player ai, SpellAbility sa, final Card source, int dmg) {
Player opp = ai.getOpponent();
final Player opp = ai.getWeakestOpponent();
final CardCollection humanList = getKillableCreatures(sa, opp, dmg);
CardCollection computerList = getKillableCreatures(sa, ai, dmg);
@@ -98,12 +139,6 @@ public class DamageAllAi extends SpellAbilityAi {
return -1;
}
// if we can kill human, do it
if ((validP.equals("Player") || validP.contains("Opponent"))
&& (opp.getLife() <= ComputerUtilCombat.predictDamageTo(opp, dmg, source, false))) {
return 1;
}
int minGain = 200; // The minimum gain in destroyed creatures
if (sa.getPayCosts() != null && sa.getPayCosts().isReusuableResource()) {
if (computerList.isEmpty()) {
@@ -179,7 +214,7 @@ public class DamageAllAi extends SpellAbilityAi {
}
// Evaluate creatures getting killed
Player enemy = ai.getOpponent();
Player enemy = ComputerUtil.getOpponentFor(ai);
final CardCollection humanList = getKillableCreatures(sa, enemy, dmg);
CardCollection computerList = getKillableCreatures(sa, ai, dmg);
final TargetRestrictions tgt = sa.getTargetRestrictions();
@@ -261,7 +296,7 @@ public class DamageAllAi extends SpellAbilityAi {
}
// Evaluate creatures getting killed
Player enemy = ai.getOpponent();
Player enemy = ComputerUtil.getOpponentFor(ai);
final CardCollection humanList = getKillableCreatures(sa, enemy, dmg);
CardCollection computerList = getKillableCreatures(sa, ai, dmg);
final TargetRestrictions tgt = sa.getTargetRestrictions();

View File

@@ -1,21 +1,13 @@
package forge.ai.ability;
import java.util.List;
import java.util.Map;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.ai.*;
import forge.game.Game;
import forge.game.GameObject;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.cost.Cost;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
@@ -28,6 +20,9 @@ import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import java.util.List;
import java.util.Map;
public class DamageDealAi extends DamageAiBase {
@Override
public boolean chkAIDrawback(SpellAbility sa, Player ai) {
@@ -98,6 +93,29 @@ public class DamageDealAi extends DamageAiBase {
source.setSVar("PayX", Integer.toString(dmg));
} else if (sa.getSVar(damage).equals("Count$CardsInYourHand") && source.getZone().is(ZoneType.Hand)) {
dmg--; // the card will be spent casting the spell, so actual damage is 1 less
} else if (sa.getSVar(damage).equals("TargetedPlayer$CardsInHand")) {
// cards that deal damage by the number of cards in target player's hand, e.g. Sudden Impact
if (sa.getTargetRestrictions().canTgtPlayer()) {
int maxDmg = 0;
Player maxDamaged = null;
for (Player p : ai.getOpponents()) {
if (p.canBeTargetedBy(sa)) {
if (p.getCardsIn(ZoneType.Hand).size() > maxDmg) {
maxDmg = p.getCardsIn(ZoneType.Hand).size();
maxDamaged = p;
}
}
}
if (maxDmg > 0 && maxDamaged != null) {
if (shouldTgtP(ai, sa, maxDmg, false)) {
sa.resetTargets();
sa.getTargets().add(maxDamaged);
return true;
}
} else {
return false;
}
}
}
}
@@ -105,9 +123,20 @@ public class DamageDealAi extends DamageAiBase {
dmg += 2;
}
String logic = sa.getParam("AILogic");
String logic = sa.getParamOrDefault("AILogic", "");
if ("DiscardLands".equals(logic)) {
dmg = 2;
} else if (logic.startsWith("ProcRaid.")) {
if (ai.getGame().getPhaseHandler().isPlayerTurn(ai) && ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
for (Card potentialAtkr : ai.getCreaturesInPlay()) {
if (ComputerUtilCard.doesCreatureAttackAI(ai, potentialAtkr)) {
return false;
}
}
}
if (ai.getAttackedWithCreatureThisTurn()) {
dmg = Integer.parseInt(logic.substring(logic.indexOf(".") + 1));
}
} else if ("WildHunt".equals(logic)) {
// This dummy ability will just deal 0 damage, but holds the logic for the AI for Master of Wild Hunt
List<Card> wolves = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), "Creature.Wolf+untapped+YouCtrl+Other", ai, source);
@@ -131,6 +160,18 @@ public class DamageDealAi extends DamageAiBase {
} else {
return false;
}
} else if ("NinThePainArtist".equals(logic)) {
// Make sure not to mana lock ourselves + make the opponent draw cards into an immediate discard
if (ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)) {
boolean doTarget = damageTargetAI(ai, sa, dmg, true);
if (doTarget) {
Card tgt = sa.getTargets().getFirstTargetedCard();
if (tgt != null) {
return ai.getGame().getPhaseHandler().getPlayerTurn() == tgt.getController();
}
}
}
return false;
}
if (sourceName.equals("Sorin, Grim Nemesis")) {
@@ -157,7 +198,7 @@ public class DamageDealAi extends DamageAiBase {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
@@ -250,15 +291,19 @@ public class DamageDealAi extends DamageAiBase {
}
hPlay = CardLists.getTargetableCards(hPlay, sa);
final List<Card> killables = CardLists.filter(hPlay, new Predicate<Card>() {
List<Card> killables = CardLists.filter(hPlay, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return c.getSVar("Targeting").equals("Dies")
|| (ComputerUtilCombat.getEnoughDamageToKill(c, d, source, false, noPrevention) <= d) && !ComputerUtil.canRegenerate(ai, c)
|| (ComputerUtilCombat.getEnoughDamageToKill(c, d, source, false, noPrevention) <= d)
&& !ComputerUtil.canRegenerate(ai, c)
&& !(c.getSVar("SacMe").length() > 0);
}
});
// Filter AI-specific targets if provided
killables = ComputerUtil.filterAITgts(sa, ai, new CardCollection(killables), true);
Card targetCard = null;
if (pl.isOpponentOf(ai) && activator.equals(ai) && !killables.isEmpty()) {
if (sa.getTargetRestrictions().canTgtPlaneswalker()) {
@@ -345,7 +390,7 @@ public class DamageDealAi extends DamageAiBase {
final boolean divided = sa.hasParam("DividedAsYouChoose");
final boolean oppTargetsChoice = sa.hasParam("TargetingPlayer");
Player enemy = ai.getOpponent();
Player enemy = ComputerUtil.getOpponentFor(ai);
if ("PowerDmg".equals(sa.getParam("AILogic"))) {
// check if it is better to target the player instead, the original target is already set in PumpAi.pumpTgtAI()
@@ -366,6 +411,11 @@ public class DamageDealAi extends DamageAiBase {
// target loop
TargetChoices tcs = sa.getTargets();
// Do not use if would kill self
if (("SelfDamage".equals(sa.getParam("AILogic"))) && (ai.getLife() <= Integer.parseInt(source.getSVar("SelfDamageAmount")))) {
return false;
}
if ("ChoiceBurn".equals(sa.getParam("AILogic"))) {
// do not waste burns on player if other choices are present
if (this.shouldTgtP(ai, sa, dmg, noPrevention)) {
@@ -377,7 +427,7 @@ public class DamageDealAi extends DamageAiBase {
}
if ("Polukranos".equals(sa.getParam("AILogic"))) {
int dmgTaken = 0;
CardCollection humCreatures = ai.getOpponent().getCreaturesInPlay();
CardCollection humCreatures = enemy.getCreaturesInPlay();
Card lastTgt = null;
humCreatures = CardLists.getTargetableCards(humCreatures, sa);
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
@@ -486,7 +536,7 @@ public class DamageDealAi extends DamageAiBase {
}
}
if (freePing && sa.canTarget(enemy)) {
if (freePing && sa.canTarget(enemy) && (!avoidTargetP(ai, sa))) {
tcs.add(enemy);
if (divided) {
tgt.addDividedAllocation(enemy, dmg);
@@ -528,10 +578,11 @@ public class DamageDealAi extends DamageAiBase {
// TODO: Improve Damage, we shouldn't just target the player just
// because we can
else if (sa.canTarget(enemy)) {
if ((phase.is(PhaseType.END_OF_TURN) && phase.getNextTurn().equals(ai))
if (((phase.is(PhaseType.END_OF_TURN) && phase.getNextTurn().equals(ai))
|| (SpellAbilityAi.isSorcerySpeed(sa) && phase.is(PhaseType.MAIN2))
|| sa.getPayCosts() == null || immediately
|| this.shouldTgtP(ai, sa, dmg, noPrevention)) {
|| this.shouldTgtP(ai, sa, dmg, noPrevention)) &&
(!avoidTargetP(ai, sa))) {
tcs.add(enemy);
if (divided) {
tgt.addDividedAllocation(enemy, dmg);
@@ -633,7 +684,7 @@ public class DamageDealAi extends DamageAiBase {
// this is for Triggered targets that are mandatory
final boolean noPrevention = sa.hasParam("NoPrevention");
final boolean divided = sa.hasParam("DividedAsYouChoose");
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
System.out.println("damageChooseRequiredTargets " + ai + " " + sa);
while (sa.getTargets().getNumTargeted() < tgt.getMinTargets(sa.getHostCard(), sa)) {

View File

@@ -3,10 +3,6 @@ package forge.ai.ability;
import forge.ai.SpecialCardAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.player.Player;
import forge.game.player.PlayerCollection;
import forge.game.player.PlayerPredicates;

View File

@@ -42,7 +42,7 @@ public class DamagePreventAi extends SpellAbilityAi {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, hostCard)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, hostCard, sa)) {
return false;
}

View File

@@ -30,7 +30,7 @@ public class DamagePreventAllAi extends SpellAbilityAi {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, hostCard)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, hostCard, sa)) {
return false;
}

View File

@@ -4,6 +4,7 @@ import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.SpellAbilityAi;
@@ -42,7 +43,7 @@ public class DebuffAi extends SpellAbilityAi {
final Cost cost = sa.getPayCosts();
// temporarily disabled until AI is improved
if (!ComputerUtilCost.checkCreatureSacrificeCost(ai, cost, source)) {
if (!ComputerUtilCost.checkCreatureSacrificeCost(ai, cost, source, sa)) {
return false;
}
@@ -176,7 +177,7 @@ public class DebuffAi extends SpellAbilityAi {
* @return a CardCollection.
*/
private CardCollection getCurseCreatures(final Player ai, final SpellAbility sa, final List<String> kws) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
CardCollection list = CardLists.getTargetableCards(opp.getCreaturesInPlay(), sa);
if (!list.isEmpty()) {
list = CardLists.filter(list, new Predicate<Card>() {
@@ -216,7 +217,7 @@ public class DebuffAi extends SpellAbilityAi {
list.remove(c);
}
final CardCollection pref = CardLists.filterControlledBy(list, ai.getOpponent());
final CardCollection pref = CardLists.filterControlledBy(list, ComputerUtil.getOpponentFor(ai));
final CardCollection forced = CardLists.filterControlledBy(list, ai);
final Card source = sa.getHostCard();

View File

@@ -18,8 +18,12 @@ public class DelayedTriggerAi extends SpellAbilityAi {
// TODO: improve ai
return true;
}
final String svarName = sa.getParam("Execute");
final SpellAbility trigsa = AbilityFactory.getAbility(sa.getHostCard().getSVar(svarName), sa.getHostCard());
SpellAbility trigsa = null;
if (sa.hasAdditionalAbility("Execute")) {
trigsa = sa.getAdditionalAbility("Execute");
} else {
trigsa = AbilityFactory.getAbility(sa.getHostCard(), sa.getParam("Execute"));
}
trigsa.setActivatingPlayer(ai);
if (trigsa instanceof AbilitySub) {
@@ -31,8 +35,12 @@ public class DelayedTriggerAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final String svarName = sa.getParam("Execute");
final SpellAbility trigsa = AbilityFactory.getAbility(sa.getHostCard().getSVar(svarName), sa.getHostCard());
SpellAbility trigsa = null;
if (sa.hasAdditionalAbility("Execute")) {
trigsa = sa.getAdditionalAbility("Execute");
} else {
trigsa = AbilityFactory.getAbility(sa.getHostCard(), sa.getParam("Execute"));
}
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
trigsa.setActivatingPlayer(ai);
@@ -45,8 +53,12 @@ public class DelayedTriggerAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player ai, SpellAbility sa) {
final String svarName = sa.getParam("Execute");
final SpellAbility trigsa = AbilityFactory.getAbility(sa.getSVar(svarName), sa.getHostCard());
SpellAbility trigsa = null;
if (sa.hasAdditionalAbility("Execute")) {
trigsa = sa.getAdditionalAbility("Execute");
} else {
trigsa = AbilityFactory.getAbility(sa.getHostCard(), sa.getParam("Execute"));
}
trigsa.setActivatingPlayer(ai);
return AiPlayDecision.WillPlay == ((PlayerControllerAi)ai.getController()).getAi().canPlaySa(trigsa);
}

View File

@@ -1,24 +1,10 @@
package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.AiController;
import forge.ai.AiProps;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
import forge.ai.PlayerControllerAi;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardFactoryUtil;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.cost.Cost;
import forge.game.cost.CostPart;
import forge.game.cost.CostSacrifice;
@@ -49,7 +35,7 @@ public class DestroyAi extends SpellAbilityAi {
CardCollection list;
if (abCost != null) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
@@ -64,10 +50,44 @@ public class DestroyAi extends SpellAbilityAi {
hasXCost = abCost.getCostMana() != null ? abCost.getCostMana().getAmountOfX() > 0 : false;
}
if ("AtOpponentsCombatOrAfter".equals(sa.getParam("AILogic"))) {
PhaseHandler ph = ai.getGame().getPhaseHandler();
if (ph.getPlayerTurn() == ai || ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
return false;
}
} else if ("AtEOT".equals(sa.getParam("AILogic"))) {
PhaseHandler ph = ai.getGame().getPhaseHandler();
if (!ph.is(PhaseType.END_OF_TURN)) {
return false;
}
} else if ("AtEOTIfNotAttacking".equals(sa.getParam("AILogic"))) {
PhaseHandler ph = ai.getGame().getPhaseHandler();
if (!ph.is(PhaseType.END_OF_TURN) || ai.getAttackedWithCreatureThisTurn()) {
return false;
}
}
if (ComputerUtil.preventRunAwayActivations(sa)) {
return false;
}
// Ability that's intended to destroy own useless token to trigger Grave Pacts
// should be fired at end of turn or when under attack after blocking to make opponent sac something
boolean havepact = false;
// TODO replace it with look for a dies -> sacrifice trigger check
havepact |= ai.isCardInPlay("Grave Pact");
havepact |= ai.isCardInPlay("Butcher of Malakir");
havepact |= ai.isCardInPlay("Dictate of Erebos");
if ("Pactivator".equals(logic) && havepact) {
if ((!ai.getGame().getPhaseHandler().isPlayerTurn(ai))
&& ((ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)) || (ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS)))
&& (ai.getOpponents().getCreaturesInPlay().size() > 0)) {
ai.getController().chooseTargetsFor(sa);
return true;
}
}
// Targeting
if (abTgt != null) {
sa.resetTargets();
@@ -78,6 +98,11 @@ public class DestroyAi extends SpellAbilityAi {
}
if ("MadSarkhanDragon".equals(logic)) {
return SpecialCardAi.SarkhanTheMad.considerMakeDragon(ai, sa);
} else if (logic != null && logic.startsWith("MinLoyalty.")) {
int minLoyalty = Integer.parseInt(logic.substring(logic.indexOf(".") + 1));
if (source.getCounters(CounterType.LOYALTY) < minLoyalty) {
return false;
}
} else if ("Polymorph".equals(logic)) {
list = CardLists.getTargetableCards(ai.getCardsIn(ZoneType.Battlefield), sa);
if (list.isEmpty()) {
@@ -104,26 +129,14 @@ public class DestroyAi extends SpellAbilityAi {
final int cmcMax = ai.hasRevolt() ? 4 : 2;
list = CardLists.filter(list, CardPredicates.lessCMC(cmcMax));
}
if (sa.hasParam("AITgts")) {
if (sa.getParam("AITgts").equals("BetterThanSource")) {
if (source.isEnchanted()) {
if (source.getEnchantedBy(false).get(0).getController().equals(ai)) {
return false;
}
} else {
final int value = ComputerUtilCard.evaluateCreature(source);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return ComputerUtilCard.evaluateCreature(c) > value + 30;
}
});
}
} else {
list = CardLists.getValidCards(list, sa.getParam("AITgts"), sa.getActivatingPlayer(), source);
}
}
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, true);
list = CardLists.getNotKeyword(list, "Indestructible");
if (CardLists.getNotType(list, "Creature").isEmpty()) {
list = ComputerUtilCard.prioritizeCreaturesWorthRemovingNow(ai, list, false);
}
if (!SpellAbilityAi.playReusable(ai, sa)) {
list = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -173,6 +186,11 @@ public class DestroyAi extends SpellAbilityAi {
if (hasXCost) {
// TODO: currently the AI will maximize mana spent on X, trying to maximize damage. This may need improvement.
maxTargets = Math.min(ComputerUtilMana.determineMaxAffordableX(ai, sa), abTgt.getMaxTargets(sa.getHostCard(), sa));
// X can't be more than the lands we have in our hand for "discard X lands"!
if ("ScorchedEarth".equals(logic)) {
int lands = CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS).size();
maxTargets = Math.min(maxTargets, lands);
}
}
if (sa.hasParam("AIMaxTgtsCount")) {
// Cards that have confusing costs for the AI (e.g. Eliminate the Competition) can have forced max target constraints specified
@@ -267,7 +285,7 @@ public class DestroyAi extends SpellAbilityAi {
} else if (sa.hasParam("Defined")) {
list = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
if ("WillSkipTurn".equals(logic) && (sa.getHostCard().getController().equals(ai)
|| ai.getCreaturesInPlay().size() < ai.getOpponent().getCreaturesInPlay().size()
|| ai.getCreaturesInPlay().size() < ComputerUtil.getOpponentFor(ai).getCreaturesInPlay().size()
|| !source.getGame().getPhaseHandler().isPlayerTurn(ai)
|| ai.getLife() <= 5)) {
// Basic ai logic for Lethal Vapors
@@ -300,6 +318,9 @@ public class DestroyAi extends SpellAbilityAi {
CardCollection preferred = CardLists.getNotKeyword(list, "Indestructible");
preferred = CardLists.filterControlledBy(preferred, ai.getOpponents());
if (CardLists.getNotType(preferred, "Creature").isEmpty()) {
preferred = ComputerUtilCard.prioritizeCreaturesWorthRemovingNow(ai, preferred, false);
}
// If NoRegen is not set, filter out creatures that have a
// regeneration shield
@@ -314,25 +335,8 @@ public class DestroyAi extends SpellAbilityAi {
});
}
if (sa.hasParam("AITgts")) {
if (sa.getParam("AITgts").equals("BetterThanSource")) {
if (source.isEnchanted()) {
if (source.getEnchantedBy(false).get(0).getController().equals(ai)) {
preferred.clear();
}
} else {
final int value = ComputerUtilCard.evaluateCreature(source);
preferred = CardLists.filter(preferred, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return ComputerUtilCard.evaluateCreature(c) > value + 30;
}
});
}
} else {
preferred = CardLists.getValidCards(preferred, sa.getParam("AITgts"), sa.getActivatingPlayer(), source);
}
}
// Filter AI-specific targets if provided
preferred = ComputerUtil.filterAITgts(sa, ai, (CardCollection)preferred, true);
for (final Card c : preferred) {
list.remove(c);
@@ -453,4 +457,5 @@ public class DestroyAi extends SpellAbilityAi {
return tempoCheck;
}
}
}

View File

@@ -64,7 +64,7 @@ public class DestroyAllAi extends SpellAbilityAi {
public boolean doMassRemovalLogic(Player ai, SpellAbility sa) {
final Card source = sa.getHostCard();
Player opponent = ai.getOpponent(); // TODO: how should this AI logic work for multiplayer and getOpponents()?
Player opponent = ComputerUtil.getOpponentFor(ai); // TODO: how should this AI logic work for multiplayer and getOpponents()?
final int CREATURE_EVAL_THRESHOLD = 200;
@@ -101,6 +101,19 @@ public class DestroyAllAi extends SpellAbilityAi {
}
}
// If effect is destroying creatures and AI is about to lose, activate effect anyway no matter what!
if ((!CardLists.getType(opplist, "Creature").isEmpty()) && (ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS))
&& (ai.getGame().getCombat() != null && ComputerUtilCombat.lifeInSeriousDanger(ai, ai.getGame().getCombat()))) {
return true;
}
// If effect is destroying creatures and AI is about to get low on life, activate effect anyway if difference in lost permanents not very much
if ((!CardLists.getType(opplist, "Creature").isEmpty()) && (ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS))
&& (ai.getGame().getCombat() != null && ComputerUtilCombat.lifeInDanger(ai, ai.getGame().getCombat()))
&& ((ComputerUtilCard.evaluatePermanentList(ailist) - 6) >= ComputerUtilCard.evaluatePermanentList(opplist))) {
return true;
}
// if only creatures are affected evaluate both lists and pass only if
// human creatures are more valuable
if (CardLists.getNotType(opplist, "Creature").isEmpty() && CardLists.getNotType(ailist, "Creature").isEmpty()) {

View File

@@ -1,15 +1,9 @@
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;
import forge.game.card.CounterType;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
@@ -26,7 +20,7 @@ public class DigAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player ai, SpellAbility sa) {
final Game game = ai.getGame();
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
final Card host = sa.getHostCard();
Player libraryOwner = ai;
@@ -47,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
@@ -103,7 +99,7 @@ public class DigAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
if (sa.usesTargeting()) {
sa.resetTargets();
if (mandatory && sa.canTarget(opp)) {

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
import forge.game.card.Card;
@@ -20,6 +21,7 @@ public class DigUntilAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player ai, SpellAbility sa) {
Card source = sa.getHostCard();
final String logic = sa.getParamOrDefault("AILogic", "");
double chance = .4; // 40 percent chance with instant speed stuff
if (SpellAbilityAi.isSorcerySpeed(sa)) {
chance = .667; // 66.7% chance for sorcery speed (since it will
@@ -29,7 +31,22 @@ public class DigUntilAi extends SpellAbilityAi {
final boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1);
Player libraryOwner = ai;
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
if ("DontMillSelf".equals(logic)) {
// A card that digs for specific things and puts everything revealed before it into graveyard
// (e.g. Hermit Druid) - don't use it to mill itself and also make sure there's enough playable
// material in the library after using it several times.
// TODO: maybe this should happen for any DigUntil SA with RevealedDestination$ Graveyard?
if (ai.getCardsIn(ZoneType.Library).size() < 20) {
return false;
}
if ("Land.Basic".equals(sa.getParam("Valid"))
&& !CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS_PRODUCING_MANA).isEmpty()) {
// We already have a mana-producing land in hand, so bail
return false;
}
}
if (sa.usesTargeting()) {
sa.resetTargets();

View File

@@ -1,12 +1,11 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.cost.Cost;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -27,10 +26,11 @@ public class DiscardAi extends SpellAbilityAi {
final Card source = sa.getHostCard();
final String sourceName = ComputerUtilAbility.getAbilitySourceName(sa);
final Cost abCost = sa.getPayCosts();
final String aiLogic = sa.getParamOrDefault("AILogic", "");
if (abCost != null) {
// AI currently disabled for these costs
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa)) {
return false;
}
@@ -53,7 +53,11 @@ public class DiscardAi extends SpellAbilityAi {
return MyRandom.getRandom().nextFloat() < (1.0 / (1 + hand));
}
final boolean humanHasHand = ai.getOpponent().getCardsIn(ZoneType.Hand).size() > 0;
if (aiLogic.equals("VolrathsShapeshifter")) {
return SpecialCardAi.VolrathsShapeshifter.consider(ai, sa);
}
final boolean humanHasHand = ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Hand).size() > 0;
if (tgt != null) {
if (!discardTargetAI(ai, sa)) {
@@ -84,7 +88,7 @@ public class DiscardAi extends SpellAbilityAi {
if (sa.hasParam("NumCards")) {
if (sa.getParam("NumCards").equals("X") && source.getSVar("X").equals("Count$xPaid")) {
// Set PayX here to maximum value.
final int cardsToDiscard = Math.min(ComputerUtilMana.determineLeftoverMana(sa, ai), ai.getOpponent()
final int cardsToDiscard = Math.min(ComputerUtilMana.determineLeftoverMana(sa, ai), ComputerUtil.getOpponentFor(ai)
.getCardsIn(ZoneType.Hand).size());
if (cardsToDiscard < 1) {
return false;
@@ -97,7 +101,35 @@ public class DiscardAi extends SpellAbilityAi {
}
}
// TODO: Implement support for Discard AI for cards with AnyNumber set to true.
// TODO: Improve support for Discard AI for cards with AnyNumber set to true.
if (sa.hasParam("AnyNumber")) {
if ("DiscardUncastableAndExcess".equals(aiLogic)) {
final CardCollectionView inHand = ai.getCardsIn(ZoneType.Hand);
final int numLandsOTB = CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS).size();
int numDiscard = 0;
int numOppInHand = 0;
for (Player p : ai.getGame().getPlayers()) {
if (p.getCardsIn(ZoneType.Hand).size() > numOppInHand) {
numOppInHand = p.getCardsIn(ZoneType.Hand).size();
}
}
for (Card c : inHand) {
if (c.equals(sa.getHostCard())) { continue; }
if (c.hasSVar("DoNotDiscardIfAble") || c.hasSVar("IsReanimatorCard")) { continue; }
if (c.isCreature() && !ComputerUtilMana.hasEnoughManaSourcesToCast(c.getSpellPermanent(), ai)) {
numDiscard++;
}
if ((c.isLand() && numLandsOTB >= 5) || (c.getFirstSpellAbility() != null && !ComputerUtilMana.hasEnoughManaSourcesToCast(c.getFirstSpellAbility(), ai))) {
if (numDiscard + 1 <= numOppInHand) {
numDiscard++;
}
}
}
if (numDiscard == 0) {
return false;
}
}
}
// Don't use draw abilities before main 2 if possible
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
@@ -120,7 +152,7 @@ public class DiscardAi extends SpellAbilityAi {
private boolean discardTargetAI(final Player ai, final SpellAbility sa) {
final TargetRestrictions tgt = sa.getTargetRestrictions();
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
if (opp.getCardsIn(ZoneType.Hand).isEmpty() && !ComputerUtil.activateForCost(sa, ai)) {
return false;
}
@@ -139,7 +171,7 @@ public class DiscardAi extends SpellAbilityAi {
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) {
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
if (!discardTargetAI(ai, sa)) {
if (mandatory && sa.canTarget(opp)) {
sa.getTargets().add(opp);
@@ -160,7 +192,7 @@ public class DiscardAi extends SpellAbilityAi {
}
if ("X".equals(sa.getParam("RevealNumber")) && sa.getHostCard().getSVar("X").equals("Count$xPaid")) {
// Set PayX here to maximum value.
final int cardsToDiscard = Math.min(ComputerUtilMana.determineLeftoverMana(sa, ai), ai.getOpponent()
final int cardsToDiscard = Math.min(ComputerUtilMana.determineLeftoverMana(sa, ai), ComputerUtil.getOpponentFor(ai)
.getCardsIn(ZoneType.Hand).size());
sa.getHostCard().setSVar("PayX", Integer.toString(cardsToDiscard));
}

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -19,7 +20,7 @@ public class DrainManaAi extends SpellAbilityAi {
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Card source = sa.getHostCard();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
@@ -42,7 +43,7 @@ public class DrainManaAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Card source = sa.getHostCard();
@@ -83,7 +84,7 @@ public class DrainManaAi extends SpellAbilityAi {
}
} else {
sa.resetTargets();
sa.getTargets().add(ai.getOpponent());
sa.getTargets().add(ComputerUtil.getOpponentFor(ai));
}
return randomReturn;

View File

@@ -86,7 +86,7 @@ public class DrawAi extends SpellAbilityAi {
*/
@Override
protected boolean willPayCosts(Player ai, SpellAbility sa, Cost cost, Card source) {
if (!ComputerUtilCost.checkCreatureSacrificeCost(ai, cost, source)) {
if (!ComputerUtilCost.checkCreatureSacrificeCost(ai, cost, source, sa)) {
return false;
}
@@ -126,6 +126,16 @@ public class DrawAi extends SpellAbilityAi {
*/
@Override
protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) {
String logic = sa.getParamOrDefault("AILogic", "");
if (logic.startsWith("LifeLessThan.")) {
// LifeLessThan logic presupposes activation as soon as possible in an
// attempt to save the AI from dying
return true;
} else if (logic.equals("AlwaysAtOppEOT")) {
return ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn().equals(ai);
}
// Don't use draw abilities before main 2 if possible
if (ph.getPhase().isBefore(PhaseType.MAIN2) && !sa.hasParam("ActivationPhases")
&& !ComputerUtil.castSpellInMain1(ai, sa)) {
@@ -204,6 +214,7 @@ public class DrawAi extends SpellAbilityAi {
final Card source = sa.getHostCard();
final boolean drawback = sa.getParent() != null;
final Game game = ai.getGame();
final String logic = sa.getParamOrDefault("AILogic", "");
int computerHandSize = ai.getCardsIn(ZoneType.Hand).size();
final int computerLibrarySize = ai.getCardsIn(ZoneType.Library).size();
@@ -240,11 +251,23 @@ public class DrawAi extends SpellAbilityAi {
}
}
// Logic for cards that require special handling
if (sa.hasParam("AILogic")) {
if ("YawgmothsBargain".equals(sa.getParam("AILogic"))) {
return SpecialCardAi.YawgmothsBargain.consider(ai, sa);
if (num != null && num.equals("ChosenX")) {
// Necrologia, Pay X Life : Draw X Cards
if (sa.getSVar("X").equals("XChoice")) {
// Draw up to max hand size but leave at least 3 in library
numCards = Math.min(computerMaxHandSize - computerHandSize, computerLibrarySize - 3);
// But no more than what's "safe" and doesn't risk a near death experience
// Maybe would be better to check for "serious danger" and take more risk?
while ((ComputerUtil.aiLifeInDanger(ai, false, numCards) && (numCards > 0))) {
numCards--;
}
sa.setSVar("ChosenX", Integer.toString(numCards));
source.setSVar("ChosenX", Integer.toString(numCards));
}
}
// Logic for cards that require special handling
if ("YawgmothsBargain".equals(logic)) {
return SpecialCardAi.YawgmothsBargain.consider(ai, sa);
}
// Generic logic for all cards that do not need any special handling
@@ -312,6 +335,13 @@ public class DrawAi extends SpellAbilityAi {
return true;
}
}
// we're trying to save ourselves from death
// (e.g. Bargain), so target the opp anyway
if (logic.startsWith("LifeLessThan.")) {
int threshold = Integer.parseInt(logic.substring(logic.indexOf(".") + 1));
sa.getTargets().add(oppA);
return ai.getLife() < threshold;
}
}
boolean aiTarget = sa.canTarget(ai);

View File

@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Random;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
@@ -15,8 +16,7 @@ import forge.ai.SpellApiToAi;
import forge.game.Game;
import forge.game.GlobalRuleChange;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardLists;
import forge.game.card.*;
import forge.game.combat.CombatUtil;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
@@ -48,6 +48,21 @@ public class EffectAi extends SpellAbilityAi {
return false;
}
randomReturn = true;
} else if (logic.equals("KeepOppCreatsLandsTapped")) {
for (Player opp : ai.getOpponents()) {
boolean worthHolding = false;
CardCollectionView oppCreatsLands = CardLists.filter(opp.getCardsIn(ZoneType.Battlefield),
Predicates.or(CardPredicates.Presets.LANDS, CardPredicates.Presets.CREATURES));
CardCollectionView oppCreatsLandsTapped = CardLists.filter(oppCreatsLands, CardPredicates.Presets.TAPPED);
if (oppCreatsLandsTapped.size() >= 3 || oppCreatsLands.size() == oppCreatsLandsTapped.size()) {
worthHolding = true;
}
if (!worthHolding) {
return false;
}
randomReturn = true;
}
} else if (logic.equals("Fog")) {
if (game.getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
return false;
@@ -179,9 +194,7 @@ public class EffectAi extends SpellAbilityAi {
break;
}
if (shouldPlay) {
return true;
}
return shouldPlay;
} else if (logic.equals("RedirectSpellDamageFromPlayer")) {
if (game.getStack().isEmpty()) {
return false;
@@ -246,6 +259,12 @@ public class EffectAi extends SpellAbilityAi {
}
}
return true;
} else if (logic.equals("CastFromGraveThisTurn")) {
CardCollection list = new CardCollection(game.getCardsIn(ZoneType.Graveyard));
list = CardLists.getValidCards(list, sa.getTargetRestrictions().getValidTgts(), ai, sa.getHostCard(), sa);
if (!ComputerUtil.targetPlayableSpellCard(ai, list, sa, false)) {
return false;
}
}
} else { //no AILogic
return false;
@@ -281,4 +300,35 @@ public class EffectAi extends SpellAbilityAi {
return randomReturn;
}
@Override
protected boolean doTriggerAINoCost(final Player aiPlayer, final SpellAbility sa, final boolean mandatory) {
String aiLogic = sa.getParamOrDefault("AILogic", "");
// E.g. Nova Pentacle
if (aiLogic.equals("RedirectFromOppToCreature")) {
// try to target the opponent's best targetable permanent, if able
CardCollection oppPerms = CardLists.getValidCards(aiPlayer.getOpponents().getCardsIn(ZoneType.Battlefield), sa.getTargetRestrictions().getValidTgts(), aiPlayer, sa.getHostCard(), sa);
if (!oppPerms.isEmpty()) {
sa.resetTargets();
sa.getTargets().add(ComputerUtilCard.getBestAI(oppPerms));
return true;
}
if (mandatory) {
// try to target the AI's worst targetable permanent, if able
CardCollection aiPerms = CardLists.getValidCards(aiPlayer.getCardsIn(ZoneType.Battlefield), sa.getTargetRestrictions().getValidTgts(), aiPlayer, sa.getHostCard(), sa);
if (!aiPerms.isEmpty()) {
sa.resetTargets();
sa.getTargets().add(ComputerUtilCard.getWorstAI(aiPerms));
return true;
}
}
return false;
}
return super.doTriggerAINoCost(aiPlayer, sa, mandatory);
}
}

View File

@@ -0,0 +1,63 @@
package forge.ai.ability;
import forge.ai.*;
import forge.game.card.*;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
public class ExploreAi extends SpellAbilityAi {
/* (non-Javadoc)
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
*/
@Override
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
// Explore with a target (e.g. Enter the Unknown)
if (sa.usesTargeting()) {
Card bestCreature = ComputerUtilCard.getBestCreatureAI(aiPlayer.getCardsIn(ZoneType.Battlefield));
if (bestCreature == null) {
return false;
}
sa.resetTargets();
sa.getTargets().add(bestCreature);
}
return true;
}
public static Card shouldPutInGraveyard(CardCollection top, Player ai) {
int predictedMana = ComputerUtilMana.getAvailableManaSources(ai, false).size();
CardCollectionView cardsOTB = ai.getCardsIn(ZoneType.Battlefield);
CardCollectionView cardsInHand = ai.getCardsIn(ZoneType.Hand);
CardCollection landsOTB = CardLists.filter(cardsOTB, CardPredicates.Presets.LANDS_PRODUCING_MANA);
CardCollection landsInHand = CardLists.filter(cardsInHand, CardPredicates.Presets.LANDS_PRODUCING_MANA);
int maxCMCDiff = 1;
int numLandsToStillNeedMore = 2;
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();
maxCMCDiff = aic.getIntProperty(AiProps.EXPLORE_MAX_CMC_DIFF_TO_PUT_IN_GRAVEYARD);
numLandsToStillNeedMore = aic.getIntProperty(AiProps.EXPLORE_NUM_LANDS_TO_STILL_NEED_MORE);
}
if (!top.isEmpty()) {
Card topCard = top.getFirst();
if (landsInHand.isEmpty() && landsOTB.size() <= numLandsToStillNeedMore) {
// We need more lands to improve our mana base, explore away the non-lands
return topCard;
}
if (topCard.getCMC() - maxCMCDiff >= predictedMana && !topCard.hasSVar("DoNotDiscardIfAble")) {
// We're not casting this in foreseeable future, put it in the graveyard
return topCard;
}
}
// Put on top of the library (do not mark the card for placement in the graveyard)
return null;
}
}

View File

@@ -1,14 +1,6 @@
package forge.ai.ability;
import java.util.List;
import java.util.Map;
import java.util.Random;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -22,6 +14,10 @@ import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.util.MyRandom;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class FightAi extends SpellAbilityAi {
@Override
protected boolean checkAiLogic(final Player ai, final SpellAbility sa, final String aiLogic) {
@@ -59,6 +55,7 @@ public class FightAi extends SpellAbilityAi {
return true;
}
}
return false; // bail at this point, otherwise the AI will overtarget and waste the activation
}
if (sa.hasParam("TargetsFromDifferentZone")) {
@@ -103,6 +100,11 @@ public class FightAi extends SpellAbilityAi {
return false;
}
@Override
public boolean chkAIDrawback(final SpellAbility sa, final Player aiPlayer) {
return checkApiLogic(aiPlayer, sa);
}
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
if (canPlayAI(ai, sa)) {

View File

@@ -1,12 +1,16 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.card.Card;
import forge.game.card.CardPredicates;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.util.Aggregates;
public class FogAi extends SpellAbilityAi {
@@ -34,6 +38,25 @@ public class FogAi extends SpellAbilityAi {
return false;
}
if ("SeriousDamage".equals(sa.getParam("AILogic")) && game.getCombat() != null) {
int dmg = 0;
for (Card atk : game.getCombat().getAttackersOf(ai)) {
if (game.getCombat().isUnblocked(atk)) {
dmg += atk.getNetCombatDamage();
} else if (atk.hasKeyword("Trample")) {
dmg += atk.getNetCombatDamage() - Aggregates.sum(game.getCombat().getBlockers(atk), CardPredicates.Accessors.fnGetNetToughness);
}
}
if (dmg > ai.getLife() / 4) {
return true;
} else if (dmg >= 5) {
return true;
} else if (ai.getLife() < ai.getStartingLife() / 3) {
return true;
}
}
// Cast it if life is in danger
return ComputerUtilCombat.lifeInDanger(ai, game.getCombat());
}
@@ -58,7 +81,7 @@ public class FogAi extends SpellAbilityAi {
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
final Game game = aiPlayer.getGame();
boolean chance;
if (game.getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
if (game.getPhaseHandler().isPlayerTurn(ComputerUtil.getOpponentFor(sa.getActivatingPlayer()))) {
chance = game.getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
} else {
chance = game.getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE);

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
@@ -8,7 +9,7 @@ import forge.game.spellability.TargetRestrictions;
public class GameLossAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player ai, SpellAbility sa) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
if (opp.cantLose()) {
return false;
}
@@ -34,14 +35,14 @@ public class GameLossAi extends SpellAbilityAi {
// (Final Fortune would need to attach it's delayed trigger to a
// specific turn, which can't be done yet)
if (!mandatory && ai.getOpponent().cantLose()) {
if (!mandatory && ComputerUtil.getOpponentFor(ai).cantLose()) {
return false;
}
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) {
sa.resetTargets();
sa.getTargets().add(ai.getOpponent());
sa.getTargets().add(ComputerUtil.getOpponentFor(ai));
}
return true;

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
@@ -22,7 +23,7 @@ public class LifeExchangeAi extends SpellAbilityAi {
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
final Random r = MyRandom.getRandom();
final int myLife = aiPlayer.getLife();
Player opponent = aiPlayer.getOpponent();
Player opponent = ComputerUtil.getOpponentFor(aiPlayer);
final int hLife = opponent.getLife();
if (!aiPlayer.canGainLife()) {
@@ -78,7 +79,7 @@ public class LifeExchangeAi extends SpellAbilityAi {
final boolean mandatory) {
final TargetRestrictions tgt = sa.getTargetRestrictions();
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
if (tgt != null) {
sa.resetTargets();
if (sa.canTarget(opp) && (mandatory || ai.getLife() < opp.getLife())) {

View File

@@ -1,10 +1,13 @@
package forge.ai.ability;
import com.google.common.collect.Iterables;
import forge.ai.*;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.cost.Cost;
import forge.game.cost.CostRemoveCounter;
import forge.game.cost.CostSacrifice;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -35,7 +38,7 @@ public class LifeGainAi extends SpellAbilityAi {
if (!lifeCritical) {
// return super.willPayCosts(ai, sa, cost, source);
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, false)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, sa,false)) {
return false;
}
if (!ComputerUtilCost.checkLifeCost(ai, cost, source, 4, sa)) {
@@ -60,7 +63,7 @@ public class LifeGainAi extends SpellAbilityAi {
skipCheck |= ComputerUtilCost.isSacrificeSelfCost(cost) && !source.isCreature();
if (!skipCheck) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, false)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, source, sa,false)) {
return false;
}
}
@@ -80,6 +83,23 @@ public class LifeGainAi extends SpellAbilityAi {
lifeCritical |= ph.getPhase().isBefore(PhaseType.COMBAT_DAMAGE)
&& ComputerUtilCombat.lifeInDanger(ai, game.getCombat());
// When life is critical but there is no immediate danger, try to wait until declare blockers
// before using the lifegain ability if it's an ability on a creature with a detrimental activation cost
if (lifeCritical
&& sa.isAbility()
&& sa.getHostCard() != null && sa.getHostCard().isCreature()
&& sa.getPayCosts() != null
&& (sa.getPayCosts().hasSpecificCostType(CostRemoveCounter.class) || sa.getPayCosts().hasSpecificCostType(CostSacrifice.class))) {
if (!game.getStack().isEmpty()) {
SpellAbility saTop = game.getStack().peekAbility();
if (saTop.getTargets() != null && Iterables.contains(saTop.getTargets().getTargetPlayers(), ai)) {
return ComputerUtil.predictDamageFromSpell(saTop, ai) > 0;
}
}
if (game.getCombat() == null) { return false; }
if (!ph.is(PhaseType.COMBAT_DECLARE_BLOCKERS)) { return false; }
}
// Don't use lifegain before main 2 if possible
if (!lifeCritical && ph.getPhase().isBefore(PhaseType.MAIN2) && !sa.hasParam("ActivationPhases")
&& !ComputerUtil.castSpellInMain1(ai, sa)) {

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
@@ -22,7 +23,7 @@ public class LifeSetAi extends SpellAbilityAi {
// Ability_Cost abCost = sa.getPayCosts();
final Card source = sa.getHostCard();
final int myLife = ai.getLife();
final Player opponent = ai.getOpponent();
final Player opponent = ComputerUtil.getOpponentFor(ai);
final int hlife = opponent.getLife();
final String amountStr = sa.getParam("LifeAmount");
@@ -93,7 +94,7 @@ public class LifeSetAi extends SpellAbilityAi {
}
}
}
if (amount < myLife) {
if (amount <= myLife) {
return false;
}
}
@@ -109,7 +110,7 @@ public class LifeSetAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final int myLife = ai.getLife();
final Player opponent = ai.getOpponent();
final Player opponent = ComputerUtil.getOpponentFor(ai);
final int hlife = opponent.getLife();
final Card source = sa.getHostCard();
final String sourceName = ComputerUtilAbility.getAbilitySourceName(sa);

View File

@@ -1,26 +1,20 @@
package forge.ai.ability;
import com.google.common.base.Predicates;
import forge.ai.AiPlayDecision;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
import forge.ai.PlayerControllerAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.card.mana.ManaCost;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.cost.CostPart;
import forge.game.cost.CostRemoveCounter;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import java.util.Arrays;
import java.util.List;
@@ -110,13 +104,28 @@ public class ManaEffectAi extends SpellAbilityAi {
private boolean doManaRitualLogic(Player ai, SpellAbility sa) {
final Card host = sa.getHostCard();
CardCollection manaSources = ComputerUtilMana.getAvailableMana(ai, true);
CardCollection manaSources = ComputerUtilMana.getAvailableManaSources(ai, true);
int numManaSrcs = manaSources.size();
int manaReceived = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(host, sa.getParam("Amount"), sa) : 1;
manaReceived *= sa.getParam("Produced").split(" ").length;
int selfCost = sa.getPayCosts().getCostMana() != null ? sa.getPayCosts().getCostMana().getMana().getCMC() : 0;
byte producedColor = MagicColor.fromName(sa.getParam("Produced"));
String produced = sa.getParam("Produced");
byte producedColor = produced.equals("Any") ? MagicColor.ALL_COLORS : MagicColor.fromName(produced);
if ("ChosenX".equals(sa.getParam("Amount"))
&& sa.getPayCosts() != null && sa.getPayCosts().hasSpecificCostType(CostRemoveCounter.class)) {
CounterType ctrType = CounterType.KI; // Petalmane Baku
for (CostPart part : sa.getPayCosts().getCostParts()) {
if (part instanceof CostRemoveCounter) {
ctrType = ((CostRemoveCounter)part).counter;
break;
}
}
manaReceived = host.getCounters(ctrType);
}
int searchCMC = numManaSrcs - selfCost + manaReceived;
if ("X".equals(sa.getParam("Produced"))) {
@@ -156,6 +165,9 @@ public class ManaEffectAi extends SpellAbilityAi {
}
SpellAbility testSaNoCost = testSa.copyWithNoManaCost();
if (testSaNoCost == null) {
continue;
}
testSaNoCost.setActivatingPlayer(ai);
if (((PlayerControllerAi)ai.getController()).getAi().canPlaySa(testSaNoCost) == AiPlayDecision.WillPlay) {
if (testSa.getHostCard().isPermanent() && !testSa.getHostCard().hasKeyword("Haste")

View File

@@ -1,6 +1,8 @@
package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
@@ -60,7 +62,7 @@ public class MustBlockAi extends SpellAbilityAi {
boolean chance = false;
if (abTgt != null) {
List<Card> list = CardLists.filter(ai.getOpponent().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
List<Card> list = CardLists.filter(ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
list = CardLists.getTargetableCards(list, sa);
list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source, sa);
list = CardLists.filter(list, new Predicate<Card>() {

View File

@@ -1,6 +1,9 @@
package forge.ai.ability;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicates;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
@@ -14,13 +17,13 @@ import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.cost.Cost;
import forge.game.keyword.KeywordInterface;
import forge.game.mana.ManaCostBeingPaid;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import org.apache.commons.lang3.StringUtils;
public class PermanentAi extends SpellAbilityAi {
@@ -62,6 +65,8 @@ public class PermanentAi extends SpellAbilityAi {
return false;
}
}
/* -- not used anymore after Ixalan (Planeswalkers are now legendary, not unique by subtype) --
if (card.isPlaneswalker()) {
CardCollection list = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield),
CardPredicates.Presets.PLANEWALKERS);
@@ -75,7 +80,7 @@ public class PermanentAi extends SpellAbilityAi {
}
break;
}
}
}*/
if (card.getType().hasSupertype(Supertype.World)) {
CardCollection list = CardLists.getType(ai.getCardsIn(ZoneType.Battlefield), "World");
@@ -142,7 +147,8 @@ public class PermanentAi extends SpellAbilityAi {
}
// don't play cards without being able to pay the upkeep for
for (String ability : card.getKeywords()) {
for (KeywordInterface inst : card.getKeywords()) {
String ability = inst.getOriginal();
if (ability.startsWith("UpkeepCost")) {
final String[] k = ability.split(":");
final String costs = k[1];
@@ -175,22 +181,44 @@ public class PermanentAi extends SpellAbilityAi {
if (!hasCard) {
dontCast = true;
}
} else if (param.equals("MaxControlled")) {
// Only cast unless there are X or more cards like this on the battlefield under AI control already
int numControlled = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals(card.getName())).size();
} else if (param.startsWith("MaxControlled")) {
// Only cast unless there are X or more cards like this on the battlefield under AI control already,
CardCollection ctrld = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals(card.getName()));
int numControlled = 0;
if (param.endsWith("WithoutOppAuras")) {
// Check that the permanet does not have any auras attached to it by the opponent (this assumes that if
// the opponent cast an aura on the opposing permanent, it's not with good intentions, and thus it might
// be better to have a pristine copy of the card - might not always be a correct assumption, but sounds
// like a reasonable default for some cards).
for (Card c : ctrld) {
if (c.getEnchantedBy(false).isEmpty()) {
numControlled++;
} else {
for (Card att : c.getEnchantedBy(false)) {
if (!att.getController().isOpponentOf(ai)) {
numControlled++;
}
}
}
}
} else {
numControlled = ctrld.size();
}
if (numControlled >= Integer.parseInt(value)) {
dontCast = true;
}
} else if (param.equals("NumManaSources")) {
// Only cast if there are X or more mana sources controlled by the AI
CardCollection m = ComputerUtilMana.getAvailableMana(ai, true);
CardCollection m = ComputerUtilMana.getAvailableManaSources(ai, true);
if (m.size() < Integer.parseInt(value)) {
dontCast = true;
}
} else if (param.equals("NumManaSourcesNextTurn")) {
// Only cast if there are X or more mana sources controlled by the AI *or*
// if there are X-1 mana sources in play but the AI has an extra land in hand
CardCollection m = ComputerUtilMana.getAvailableMana(ai, true);
CardCollection m = ComputerUtilMana.getAvailableManaSources(ai, true);
int extraMana = CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS).size() > 0 ? 1 : 0;
if (card.getName().equals("Illusions of Grandeur")) {
// TODO: this is currently hardcoded for specific Illusions-Donate cost reduction spells, need to make this generic.

View File

@@ -1,6 +1,7 @@
package forge.ai.ability;
import com.google.common.base.Predicates;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
@@ -33,6 +34,10 @@ public class PhasesAi extends SpellAbilityAi {
tgtCards = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
if (tgtCards.contains(source)) {
// Protect it from something
final boolean isThreatened = ComputerUtil.predictThreatenedObjects(aiPlayer, null, true).contains(source);
if (isThreatened) {
return true;
}
} else {
// Card def = tgtCards.get(0);
// Phase this out if it might attack me, or before it can be

View File

@@ -1,14 +1,9 @@
package forge.ai.ability;
import java.util.List;
import com.google.common.base.Predicate;
import forge.ai.AiPlayDecision;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.PlayerControllerAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.card.CardStateName;
import forge.card.CardTypeView;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -22,6 +17,8 @@ import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import java.util.List;
public class PlayAi extends SpellAbilityAi {
@Override
@@ -59,6 +56,16 @@ public class PlayAi extends SpellAbilityAi {
return ComputerUtil.targetPlayableSpellCard(ai, cards, sa, sa.hasParam("WithoutManaCost"));
}
if (source != null && source.hasKeyword("Hideaway") && source.hasRemembered()) {
// AI is not very good at playing non-permanent spells this way, at least yet
// (might be possible to enable it for Sorceries in Main1/Main2 if target is available,
// but definitely not for most Instants)
Card rem = (Card) source.getFirstRemembered();
CardTypeView t = rem.getState(CardStateName.Original).getType();
return t.isPermanent() && !t.isLand();
}
return true;
}
@@ -99,12 +106,13 @@ public class PlayAi extends SpellAbilityAi {
* @see forge.card.ability.SpellAbilityAi#chooseSingleCard(forge.game.player.Player, forge.card.spellability.SpellAbility, java.util.List, boolean)
*/
@Override
public Card chooseSingleCard(final Player ai, final SpellAbility sa, Iterable<Card> options, boolean isOptional,
public Card chooseSingleCard(final Player ai, final SpellAbility sa, Iterable<Card> options,
final boolean isOptional,
Player targetedPlayer) {
List<Card> tgtCards = CardLists.filter(options, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
for (SpellAbility s : c.getBasicSpells()) {
for (SpellAbility s : c.getBasicSpells(c.getState(CardStateName.Original))) {
Spell spell = (Spell) s;
s.setActivatingPlayer(ai);
// timing restrictions still apply

View File

@@ -2,6 +2,7 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
@@ -31,7 +32,7 @@ public class PowerExchangeAi extends SpellAbilityAi {
sa.resetTargets();
List<Card> list =
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getHostCard(), sa);
CardLists.getValidCards(ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getHostCard(), sa);
// AI won't try to grab cards that are filtered out of AI decks on
// purpose
list = CardLists.filter(list, new Predicate<Card>() {

View File

@@ -147,9 +147,10 @@ public class ProtectAi extends SpellAbilityAi {
if (s==null) {
return false;
} else {
Player opponent = ComputerUtil.getOpponentFor(ai);
Combat combat = ai.getGame().getCombat();
int dmg = ComputerUtilCombat.damageIfUnblocked(c, ai.getOpponent(), combat, true);
float ratio = 1.0f * dmg / ai.getOpponent().getLife();
int dmg = ComputerUtilCombat.damageIfUnblocked(c, opponent, combat, true);
float ratio = 1.0f * dmg / opponent.getLife();
Random r = MyRandom.getRandom();
return r.nextFloat() < ratio;
}

View File

@@ -29,7 +29,7 @@ public class ProtectAllAi extends SpellAbilityAi {
return false;
}
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, hostCard)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, cost, hostCard, sa)) {
return false;
}

View File

@@ -1,31 +1,18 @@
package forge.ai.ability;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
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.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.combat.Combat;
import forge.game.cost.Cost;
import forge.game.cost.CostPart;
import forge.game.cost.CostRemoveCounter;
import forge.game.cost.CostTapType;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
@@ -34,7 +21,13 @@ import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityRestriction;
import forge.game.spellability.TargetRestrictions;
import forge.game.staticability.StaticAbility;
import forge.game.zone.ZoneType;
import forge.util.Aggregates;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
public class PumpAi extends PumpAiBase {
@@ -82,16 +75,19 @@ public class PumpAi extends PumpAiBase {
System.err.println("MoveCounter AiLogic without MoveCounter SubAbility!");
return false;
}
} else if ("Aristocrat".equals(aiLogic)) {
return doAristocratLogic(sa, ai);
} else if (aiLogic.startsWith("AristocratCounters")) {
return doAristocratWithCountersLogic(sa, ai);
}
return super.checkAiLogic(ai, sa, aiLogic);
}
@Override
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph,
final String logic) {
// special Phase check for MoveCounter
// special Phase check for various AI logics
if (logic.equals("MoveCounter")) {
if (ph.inCombat() && ph.getPlayerTurn().isOpponentOf(ai)) {
return true;
@@ -101,6 +97,11 @@ public class PumpAi extends PumpAiBase {
return false;
}
return true;
} else if (logic.equals("Aristocrat")) {
final boolean isThreatened = ComputerUtil.predictThreatenedObjects(ai, null, true).contains(sa.getHostCard());
if (!ph.is(PhaseType.COMBAT_DECLARE_BLOCKERS) && !isThreatened) {
return false;
}
}
return super.checkPhaseRestrictions(ai, sa, ph);
}
@@ -112,7 +113,7 @@ public class PumpAi extends PumpAiBase {
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) && ph.isPlayerTurn(ai)) {
return false;
}
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS) && ph.getPlayerTurn().isOpponentOf(ai)) {
if (ph.getPhase().isBefore(PhaseType.COMBAT_BEGIN) && ph.getPlayerTurn().isOpponentOf(ai)) {
return false;
}
}
@@ -136,12 +137,16 @@ public class PumpAi extends PumpAiBase {
final String numDefense = sa.hasParam("NumDef") ? sa.getParam("NumDef") : "";
final String numAttack = sa.hasParam("NumAtt") ? sa.getParam("NumAtt") : "";
final String aiLogic = sa.getParam("AILogic");
final String aiLogic = sa.getParamOrDefault("AILogic", "");
final boolean isFight = "Fight".equals(aiLogic) || "PowerDmg".equals(aiLogic);
final boolean isBerserk = "Berserk".equals(aiLogic);
if ("MoveCounter".equals(aiLogic)) {
if ("Pummeler".equals(aiLogic)) {
return SpecialCardAi.ElectrostaticPummeler.consider(ai, sa);
} else if (aiLogic.startsWith("AristocratCounters")) {
return true; // the preconditions to this are already tested in checkAiLogic
} else if ("MoveCounter".equals(aiLogic)) {
final SpellAbility moveSA = sa.findSubAbilityByType(ApiType.MoveCounter);
if (moveSA == null) {
@@ -333,6 +338,23 @@ public class PumpAi extends PumpAiBase {
attack = AbilityUtils.calculateAmount(sa.getHostCard(), numAttack, sa);
}
if ("ContinuousBonus".equals(aiLogic)) {
// P/T bonus in a continuous static ability
for (StaticAbility stAb : source.getStaticAbilities()) {
if ("Continuous".equals(stAb.getParam("Mode"))) {
if (stAb.hasParam("AddPower")) {
attack += AbilityUtils.calculateAmount(source, stAb.getParam("AddPower"), stAb);
}
if (stAb.hasParam("AddToughness")) {
defense += AbilityUtils.calculateAmount(source, stAb.getParam("AddToughness"), stAb);
}
if (stAb.hasParam("AddKeyword")) {
keywords.addAll(Lists.newArrayList(stAb.getParam("AddKeyword").split(" & ")));
}
}
}
}
if ((numDefense.contains("X") && defense == 0) || (numAttack.contains("X") && attack == 0 && !isBerserk)) {
return false;
}
@@ -359,9 +381,21 @@ public class PumpAi extends PumpAiBase {
return true;
}
if (!card.getController().isOpponentOf(ai)
&& ComputerUtilCard.shouldPumpCard(ai, sa, card, defense, attack, keywords, false)) {
if (!card.getController().isOpponentOf(ai)) {
if (ComputerUtilCard.shouldPumpCard(ai, sa, card, defense, attack, keywords, false)) {
return true;
} else if (containsUsefulKeyword(ai, keywords, card, sa, attack)) {
Card pumped = ComputerUtilCard.getPumpedCreature(ai, sa, card, 0, 0, keywords);
if (game.getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS, ai)
|| game.getPhaseHandler().is(PhaseType.COMBAT_BEGIN, ai)) {
if (!ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, pumped)) {
return false;
}
}
return true;
}
}
}
return false;
@@ -371,6 +405,21 @@ public class PumpAi extends PumpAiBase {
return false;
}
if ("DebuffForXCounters".equals(sa.getParam("AILogic")) && sa.getTargetCard() != null) {
// e.g. Skullmane Baku
CounterType ctrType = CounterType.KI;
for (CostPart part : sa.getPayCosts().getCostParts()) {
if (part instanceof CostRemoveCounter) {
ctrType = ((CostRemoveCounter)part).counter;
break;
}
}
// Do not pay more counters than necessary to kill the targeted creature
int chosenX = Math.min(source.getCounters(ctrType), sa.getTargetCard().getNetToughness());
sa.setSVar("ChosenX", String.valueOf(chosenX));
}
return true;
} // pumpPlayAI()
@@ -405,10 +454,28 @@ public class PumpAi extends PumpAiBase {
CardCollection list;
if (sa.hasParam("AILogic")) {
if (sa.getParam("AILogic").equals("HighestPower")) {
if (sa.getParam("AILogic").equals("HighestPower") || sa.getParam("AILogic").equals("ContinuousBonus")) {
list = CardLists.getValidCards(CardLists.filter(game.getCardsIn(ZoneType.Battlefield), Presets.CREATURES), tgt.getValidTgts(), ai, source, sa);
list = CardLists.getTargetableCards(list, sa);
CardLists.sortByPowerDesc(list);
// Try not to kill own creatures with this pump
CardCollection canDieToPump = new CardCollection();
for (Card c : list) {
if (c.isCreature() && c.getController() == ai
&& c.getNetToughness() - c.getTempToughnessBoost() + defense <= 0) {
canDieToPump.add(c);
}
}
list.removeAll(canDieToPump);
// Generally, don't pump anything that your opponents control
if ("ContinuousBonus".equals(sa.getParam("AILogic"))) {
// TODO: make it possible for the AI to use this logic to kill opposing creatures
// when a toughness debuff is applied
list = CardLists.filter(list, CardPredicates.isController(ai));
}
if (!list.isEmpty()) {
sa.getTargets().add(list.get(0));
return true;
@@ -461,6 +528,25 @@ public class PumpAi extends PumpAiBase {
}
}
// Detain target nonland permanent: don't target noncreature permanents that don't have
// any activated abilities.
if ("DetainNonLand".equals(sa.getParam("AILogic"))) {
list = CardLists.filter(list, Predicates.or(CardPredicates.Presets.CREATURES, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
for (SpellAbility sa: card.getSpellAbilities()) {
if (sa.isAbility()) {
return true;
}
}
return false;
}
}));
}
// Filter AI-specific targets if provided
list = ComputerUtil.filterAITgts(sa, ai, (CardCollection)list, true);
if (list.isEmpty()) {
if (ComputerUtil.activateForCost(sa, ai)) {
return pumpMandatoryTarget(ai, sa);
@@ -473,6 +559,17 @@ public class PumpAi extends PumpAiBase {
list = ComputerUtil.getSafeTargets(ai, sa, list);
}
if ("BetterCreatureThanSource".equals(sa.getParam("AILogic"))) {
// Don't target cards that are not better in value than the targeting card
final int sourceValue = ComputerUtilCard.evaluateCreature(source);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return card.isCreature() && ComputerUtilCard.evaluateCreature(card) > sourceValue + 30;
}
});
}
if ("Snapcaster".equals(sa.getParam("AILogic"))) {
if (!ComputerUtil.targetPlayableSpellCard(ai, list, sa, false)) {
return false;
@@ -695,8 +792,6 @@ public class PumpAi extends PumpAiBase {
return true;
} // pumpDrawbackAI()
@Override
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
//TODO Add logic here if necessary but I think the AI won't cast
@@ -704,4 +799,248 @@ public class PumpAi extends PumpAiBase {
//and the pump isn't mandatory
return true;
}
public boolean doAristocratLogic(final SpellAbility sa, final Player ai) {
// A logic for cards that say "Sacrifice a creature: CARDNAME gets +X/+X until EOT"
final Game game = ai.getGame();
final Combat combat = game.getCombat();
final Card source = sa.getHostCard();
final int numOtherCreats = Math.max(0, ai.getCreaturesInPlay().size() - 1);
final int powerBonus = sa.hasParam("NumAtt") ? AbilityUtils.calculateAmount(source, sa.getParam("NumAtt"), sa) : 0;
final int toughnessBonus = sa.hasParam("NumDef") ? AbilityUtils.calculateAmount(source, sa.getParam("NumDef"), sa) : 0;
final boolean indestructible = sa.hasParam("KW") && sa.getParam("KW").contains("Indestructible");
final int selfEval = ComputerUtilCard.evaluateCreature(source);
final boolean isThreatened = ComputerUtil.predictThreatenedObjects(ai, null, true).contains(source);
if (numOtherCreats == 0) {
return false;
}
// Try to save the card from death by pumping it if it's threatened with a damage spell
if (isThreatened && (toughnessBonus > 0 || indestructible)) {
SpellAbility saTop = game.getStack().peekAbility();
if (saTop.getApi() == ApiType.DealDamage || saTop.getApi() == ApiType.DamageAll) {
int dmg = AbilityUtils.calculateAmount(saTop.getHostCard(), saTop.getParam("NumDmg"), saTop) + source.getDamage();
final int numCreatsToSac = indestructible ? 1 : Math.max(1, (int)Math.ceil((dmg - source.getNetToughness() + 1) / toughnessBonus));
if (numCreatsToSac > 1) { // probably not worth sacrificing too much
return false;
}
if (indestructible || (source.getNetToughness() <= dmg && source.getNetToughness() + toughnessBonus * numCreatsToSac > dmg)) {
final CardCollection sacFodder = CardLists.filter(ai.getCreaturesInPlay(),
new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.isUselessCreature(ai, card)
|| card.hasSVar("SacMe")
|| ComputerUtilCard.evaluateCreature(card) < selfEval; // Maybe around 150 is OK?
}
}
);
if (sacFodder.size() >= numCreatsToSac) {
return true;
}
}
}
return false;
}
if (combat == null) {
return false;
}
if (combat.isAttacking(source)) {
if (combat.getBlockers(source).isEmpty()) {
// Unblocked. Check if able to deal lethal, then sac'ing everything is fair game if
// the opponent is tapped out or if we're willing to risk it (will currently risk it
// in case it sacs less than half its creatures to deal lethal damage)
// TODO: also teach the AI to account for Trample, but that's trickier (needs to account fully
// for potential damage prevention, various effects like reducing damage to 0, etc.)
final Player defPlayer = combat.getDefendingPlayerRelatedTo(source);
final boolean defTappedOut = ComputerUtilMana.getAvailableManaEstimate(defPlayer) == 0;
final boolean isInfect = source.hasKeyword("Infect"); // Flesh-Eater Imp
int lethalDmg = isInfect ? 10 - defPlayer.getPoisonCounters() : defPlayer.getLife();
if (isInfect && !combat.getDefenderByAttacker(source).canReceiveCounters(CounterType.POISON)) {
lethalDmg = Integer.MAX_VALUE; // won't be able to deal poison damage to kill the opponent
}
final int numCreatsToSac = indestructible ? 1 : (lethalDmg - source.getNetCombatDamage()) / powerBonus;
if (defTappedOut || numCreatsToSac < numOtherCreats / 2) {
return source.getNetCombatDamage() < lethalDmg
&& source.getNetCombatDamage() + numOtherCreats * powerBonus >= lethalDmg;
} else {
return false;
}
} else {
// We have already attacked. Thus, see if we have a creature to sac that is worse to lose
// than the card we attacked with.
final CardCollection sacTgts = CardLists.filter(ai.getCreaturesInPlay(),
new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.isUselessCreature(ai, card)
|| ComputerUtilCard.evaluateCreature(card) < selfEval;
}
}
);
if (sacTgts.isEmpty()) {
return false;
}
final int minDefT = Aggregates.min(combat.getBlockers(source), CardPredicates.Accessors.fnGetNetToughness);
final int DefP = indestructible ? 0 : Aggregates.sum(combat.getBlockers(source), CardPredicates.Accessors.fnGetNetPower);
// Make sure we don't over-sacrifice, only sac until we can survive and kill a creature
return source.getNetToughness() - source.getDamage() <= DefP || source.getNetCombatDamage() < minDefT;
}
} else {
// We can't deal lethal, check if there's any sac fodder than can be used for other circumstances
final CardCollection sacFodder = CardLists.filter(ai.getCreaturesInPlay(),
new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.isUselessCreature(ai, card)
|| card.hasSVar("SacMe")
|| ComputerUtilCard.evaluateCreature(card) < selfEval; // Maybe around 150 is OK?
}
}
);
return !sacFodder.isEmpty();
}
}
public boolean doAristocratWithCountersLogic(final SpellAbility sa, final Player ai) {
// A logic for cards that say "Sacrifice a creature: put X +1/+1 counters on CARDNAME" (e.g. Falkenrath Aristocrat)
final Card source = sa.getHostCard();
final String logic = sa.getParam("AILogic"); // should not even get here unless there's an Aristocrats logic applied
final boolean isDeclareBlockers = ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS);
final int numOtherCreats = Math.max(0, ai.getCreaturesInPlay().size() - 1);
if (numOtherCreats == 0) {
// Cut short if there's nothing to sac at all
return false;
}
// Check if the standard Aristocrats logic applies first (if in the right conditions for it)
final boolean isThreatened = ComputerUtil.predictThreatenedObjects(ai, null, true).contains(source);
if (isDeclareBlockers || isThreatened) {
if (doAristocratLogic(sa, ai)) {
return true;
}
}
// Check if anything is to be gained from the PutCounter subability
if (sa.getSubAbility() == null || sa.getSubAbility().getApi() != ApiType.PutCounter) {
// Shouldn't get here if there is no PutCounter subability (wrong AI logic specified?)
System.err.println("Warning: AILogic AristocratCounters was specified on " + source + ", but there was no PutCounter subability!");
return false;
}
final Game game = ai.getGame();
final Combat combat = game.getCombat();
final int selfEval = ComputerUtilCard.evaluateCreature(source);
String typeToGainCtr = "";
if (logic.contains(".")) {
typeToGainCtr = logic.substring(logic.indexOf(".") + 1);
}
CardCollection relevantCreats = typeToGainCtr.isEmpty() ? ai.getCreaturesInPlay()
: CardLists.filter(ai.getCreaturesInPlay(), CardPredicates.isType(typeToGainCtr));
relevantCreats.remove(source);
if (relevantCreats.isEmpty()) {
// No relevant creatures to sac
return false;
}
int numCtrs = AbilityUtils.calculateAmount(source, sa.getSubAbility().getParam("CounterNum"), sa.getSubAbility());
if (combat != null && combat.isAttacking(source) && isDeclareBlockers) {
if (combat.getBlockers(source).isEmpty()) {
// Unblocked. Check if we can deal lethal after receiving counters.
final Player defPlayer = combat.getDefendingPlayerRelatedTo(source);
final boolean defTappedOut = ComputerUtilMana.getAvailableManaEstimate(defPlayer) == 0;
final boolean isInfect = source.hasKeyword("Infect");
int lethalDmg = isInfect ? 10 - defPlayer.getPoisonCounters() : defPlayer.getLife();
if (isInfect && !combat.getDefenderByAttacker(source).canReceiveCounters(CounterType.POISON)) {
lethalDmg = Integer.MAX_VALUE; // won't be able to deal poison damage to kill the opponent
}
// Check if there's anything that will die anyway that can be eaten to gain a perma-bonus
final CardCollection forcedSacTgts = CardLists.filter(relevantCreats,
new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtil.predictThreatenedObjects(ai, null, true).contains(card)
|| (combat.isAttacking(card) && combat.isBlocked(card) && ComputerUtilCombat.combatantWouldBeDestroyed(ai, card, combat));
}
}
);
if (!forcedSacTgts.isEmpty()) {
return true;
}
final int numCreatsToSac = Math.max(0, (lethalDmg - source.getNetCombatDamage()) / numCtrs);
if (defTappedOut || numCreatsToSac < relevantCreats.size() / 2) {
return source.getNetCombatDamage() < lethalDmg
&& source.getNetCombatDamage() + relevantCreats.size() * numCtrs >= lethalDmg;
} else {
return false;
}
} else {
// We have already attacked. Thus, see if we have a creature to sac that is worse to lose
// than the card we attacked with. Since we're getting a permanent bonus, consider sacrificing
// things that are also threatened to be destroyed anyway.
final CardCollection sacTgts = CardLists.filter(relevantCreats,
new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.isUselessCreature(ai, card)
|| ComputerUtilCard.evaluateCreature(card) < selfEval
|| ComputerUtil.predictThreatenedObjects(ai, null, true).contains(card);
}
}
);
if (sacTgts.isEmpty()) {
return false;
}
final boolean sourceCantDie = ComputerUtilCombat.attackerCantBeDestroyedInCombat(ai, source);
final int minDefT = Aggregates.min(combat.getBlockers(source), CardPredicates.Accessors.fnGetNetToughness);
final int DefP = sourceCantDie ? 0 : Aggregates.sum(combat.getBlockers(source), CardPredicates.Accessors.fnGetNetPower);
// Make sure we don't over-sacrifice, only sac until we can survive and kill a creature
return source.getNetToughness() - source.getDamage() <= DefP || source.getNetCombatDamage() < minDefT;
}
} else {
// We can't deal lethal, check if there's any sac fodder than can be used for other circumstances
final boolean isBlocking = combat != null && combat.isBlocking(source);
final CardCollection sacFodder = CardLists.filter(relevantCreats,
new Predicate<Card>() {
@Override
public boolean apply(Card card) {
return ComputerUtilCard.isUselessCreature(ai, card)
|| card.hasSVar("SacMe")
|| (isBlocking && ComputerUtilCard.evaluateCreature(card) < selfEval)
|| ComputerUtil.predictThreatenedObjects(ai, null, true).contains(card);
}
}
);
return !sacFodder.isEmpty();
}
}
}

View File

@@ -3,18 +3,13 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
import forge.card.MagicColor;
import forge.game.Game;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CardUtil;
import forge.game.card.*;
import forge.game.combat.Combat;
import forge.game.combat.CombatUtil;
import forge.game.phase.PhaseHandler;
@@ -181,7 +176,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
final Game game = ai.getGame();
final Combat combat = game.getCombat();
final PhaseHandler ph = game.getPhaseHandler();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final int newPower = card.getNetCombatDamage() + attack;
//int defense = getNumDefense(sa);
if (!CardUtil.isStackingKeyword(keyword) && card.hasKeyword(keyword)) {
@@ -207,6 +202,19 @@ public abstract class PumpAiBase extends SpellAbilityAi {
return true;
}
Predicate<Card> flyingOrReach = Predicates.or(CardPredicates.hasKeyword("Flying"), CardPredicates.hasKeyword("Reach"));
if (ph.isPlayerTurn(opp) && combat != null
&& Iterables.any(combat.getAttackers(), CardPredicates.hasKeyword("Flying"))
&& CombatUtil.canBlock(card)) {
// Use defensively to destroy the opposing Flying creature when possible, or to block with an indestructible
// creature buffed with Flying
for (Card c : CardLists.filter(combat.getAttackers(), CardPredicates.hasKeyword("Flying"))) {
if (!ComputerUtilCombat.attackerCantBeDestroyedInCombat(c.getController(), c)
&& (card.getNetPower() >= c.getNetToughness() && card.getNetToughness() > c.getNetPower()
|| ComputerUtilCombat.attackerCantBeDestroyedInCombat(ai, card))) {
return true;
}
}
}
if (ph.isPlayerTurn(opp) || !(CombatUtil.canAttack(card, opp) || (combat != null && combat.isAttacking(card)))
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)
|| newPower <= 0
@@ -371,7 +379,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
|| !CombatUtil.canBlock(card)) {
return false;
}
} else if (keyword.endsWith("CARDNAME can block an additional creature.")) {
} else if (keyword.endsWith("CARDNAME can block an additional creature each combat.")) {
if (ph.isPlayerTurn(ai)
|| !ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
return false;
@@ -532,6 +540,15 @@ public abstract class PumpAiBase extends SpellAbilityAi {
else {
final boolean addsKeywords = !keywords.isEmpty();
if (addsKeywords) {
// If the keyword can prevent a creature from attacking, see if there's some kind of viable prioritization
if (keywords.contains("CARDNAME can't attack.") || keywords.contains("CARDNAME can't attack or block.")
|| keywords.contains("HIDDEN CARDNAME can't attack.") || keywords.contains("HIDDEN CARDNAME can't attack or block.")) {
if (CardLists.getNotType(list, "Creature").isEmpty()) {
list = ComputerUtilCard.prioritizeCreaturesWorthRemovingNow(ai, list, true);
}
}
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {

View File

@@ -48,7 +48,7 @@ public class PumpAllAi extends PumpAiBase {
}
if (abCost != null && source.hasSVar("AIPreference")) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, true)) {
if (!ComputerUtilCost.checkSacrificeCost(ai, abCost, source, sa, true)) {
return false;
}
}
@@ -57,7 +57,7 @@ public class PumpAllAi extends PumpAiBase {
valid = sa.getParam("ValidCards");
}
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
CardCollection comp = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);
CardCollection human = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source);

View File

@@ -1,6 +1,7 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
@@ -27,7 +28,7 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
// ability is targeted
sa.resetTargets();
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
final boolean canTgtHuman = opp.canBeTargetedBy(sa);
if (!canTgtHuman) {

View File

@@ -17,6 +17,12 @@ public class RemoveFromCombatAi extends SpellAbilityAi {
public boolean chkAIDrawback(SpellAbility sa, Player aiPlayer) {
// AI should only activate this during Human's turn
if ("RemoveBestAttacker".equals(sa.getParam("AILogic"))) {
if (aiPlayer.getGame().getCombat() != null && aiPlayer.getGame().getCombat().getDefenders().contains(aiPlayer)) {
return true;
}
}
// TODO - implement AI
return false;
}

View File

@@ -1,11 +1,9 @@
package forge.ai.ability;
import forge.ai.AiController;
import forge.ai.ComputerUtilMana;
import forge.ai.PlayerControllerAi;
import forge.ai.SpellAbilityAi;
import forge.ai.*;
import forge.game.card.Card;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
@@ -17,7 +15,7 @@ public class RepeatAi extends SpellAbilityAi {
protected boolean canPlayAI(Player ai, SpellAbility sa) {
final Card source = sa.getHostCard();
final TargetRestrictions tgt = sa.getTargetRestrictions();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
if (tgt != null) {
if (!opp.canBeTargetedBy(sa)) {
@@ -27,7 +25,10 @@ public class RepeatAi extends SpellAbilityAi {
sa.getTargets().add(opp);
}
String logic = sa.getParam("AILogic");
if ("MaxX".equals(logic)) {
if ("MaxX".equals(logic) || "MaxXAtOppEOT".equals(logic)) {
if ("MaxXAtOppEOT".equals(logic) && !(ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN) && ai.getGame().getPhaseHandler().getNextTurn() == ai)) {
return false;
}
// Set PayX here to maximum value.
final int max = ComputerUtilMana.determineLeftoverMana(sa, ai);
source.setSVar("PayX", Integer.toString(max));
@@ -48,7 +49,7 @@ public class RepeatAi extends SpellAbilityAi {
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
if (sa.usesTargeting()) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
if (sa.canTarget(opp)) {
sa.resetTargets();
sa.getTargets().add(opp);
@@ -59,10 +60,10 @@ public class RepeatAi extends SpellAbilityAi {
}
// setup subability to repeat
final SpellAbility repeat = sa.getAdditonalAbility("RepeatSubAbility");
final SpellAbility repeat = sa.getAdditionalAbility("RepeatSubAbility");
if (repeat == null) {
return false;
return mandatory;
}
AiController aic = ((PlayerControllerAi)ai.getController()).getAi();

View File

@@ -1,10 +1,8 @@
package forge.ai.ability;
import java.util.List;
import com.google.common.base.Predicate;
import forge.ai.ComputerUtilCard;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -15,6 +13,9 @@ import forge.game.player.Player;
import forge.game.spellability.AbilitySub;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.TextUtil;
import java.util.List;
public class RepeatEachAi extends SpellAbilityAi {
@@ -26,7 +27,9 @@ public class RepeatEachAi extends SpellAbilityAi {
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
String logic = sa.getParam("AILogic");
if ("Never".equals(logic)) {
if ("PriceOfProgress".equals(logic)) {
return SpecialCardAi.PriceOfProgress.consider(aiPlayer, sa);
} else if ("Never".equals(logic)) {
return false;
} else if ("CloneMyTokens".equals(logic)) {
if (CardLists.filter(aiPlayer.getCreaturesInPlay(), Presets.TOKEN).size() < 2) {
@@ -81,11 +84,11 @@ public class RepeatEachAi extends SpellAbilityAi {
return false;
} else if ("AllPlayerLoseLife".equals(logic)) {
final Card source = sa.getHostCard();
AbilitySub repeat = sa.getAdditonalAbility("RepeatSubAbility");
AbilitySub repeat = sa.getAdditionalAbility("RepeatSubAbility");
String svar = repeat.getSVar(repeat.getParam("LifeAmount"));
// replace RememberedPlayerCtrl with YouCtrl
String svarYou = svar.replace("RememberedPlayer", "You");
String svarYou = TextUtil.fastReplace(svar, "RememberedPlayer", "You");
// Currently all Cards with that are affect all player, including AI
if (aiPlayer.canLoseLife()) {

View File

@@ -11,6 +11,7 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.TextUtil;
public class RollPlanarDiceAi extends SpellAbilityAi {
/* (non-Javadoc)
@@ -107,7 +108,7 @@ public class RollPlanarDiceAi extends SpellAbilityAi {
}
break;
default:
System.out.println(String.format("Unexpected AI hint parameter in card %s in RollPlanarDiceAi: %s.", plane.getName(), paramName));
System.out.println(TextUtil.concatNoSpace("Unexpected AI hint parameter in card ", plane.getName(), " in RollPlanarDiceAi: ", paramName, "."));
break;
}
}

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
@@ -59,7 +60,7 @@ public class SacrificeAi extends SpellAbilityAi {
final TargetRestrictions tgt = sa.getTargetRestrictions();
final boolean destroy = sa.hasParam("Destroy");
Player opp = ai.getOpponent();
Player opp = ComputerUtil.getOpponentFor(ai);
if (tgt != null) {
sa.resetTargets();
if (!opp.canBeTargetedBy(sa)) {
@@ -72,7 +73,7 @@ public class SacrificeAi extends SpellAbilityAi {
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), num, sa);
List<Card> list =
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
for (Card c : list) {
if (c.hasSVar("SacMe") && Integer.parseInt(c.getSVar("SacMe")) > 3) {
return false;

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.ComputerUtilMana;
@@ -12,6 +13,7 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.TextUtil;
import java.util.Random;
@@ -34,11 +36,11 @@ public class SacrificeAllAi extends SpellAbilityAi {
// Set PayX here to maximum value.
final int xPay = ComputerUtilMana.determineLeftoverMana(sa, ai);
source.setSVar("PayX", Integer.toString(xPay));
valid = valid.replace("X", Integer.toString(xPay));
valid = TextUtil.fastReplace(valid, "X", Integer.toString(xPay));
}
CardCollection humanlist =
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source, sa);
CardLists.getValidCards(ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source, sa);
CardCollection computerlist =
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source, sa);

View File

@@ -1,14 +1,13 @@
package forge.ai.ability;
import com.google.common.base.Predicates;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
import forge.game.card.Card;
import forge.game.ability.ApiType;
import forge.game.card.*;
import forge.game.card.Card.SplitCMCMode;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.CounterType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
@@ -18,8 +17,6 @@ import forge.util.MyRandom;
import java.util.Random;
import com.google.common.base.Predicates;
public class ScryAi extends SpellAbilityAi {
/* (non-Javadoc)
@@ -49,6 +46,24 @@ public class ScryAi extends SpellAbilityAi {
*/
@Override
protected boolean checkPhaseRestrictions(final Player ai, final SpellAbility sa, final PhaseHandler ph) {
// if the Scry ability requires tapping and has a mana cost, it's best done at the end of opponent's turn
// and right before the beginning of AI's turn, if possible, to avoid mana locking the AI and also to
// try to scry right before drawing a card. Also, avoid tapping creatures in the AI's turn, if possible,
// even if there's no mana cost.
if (sa.getPayCosts() != null) {
if (sa.getPayCosts().hasTapCost()
&& (sa.getPayCosts().hasManaCost() || (sa.getHostCard() != null && sa.getHostCard().isCreature()))
&& !SpellAbilityAi.isSorcerySpeed(sa)) {
return ph.getNextTurn() == ai && ph.is(PhaseType.END_OF_TURN);
}
}
// AI logic to scry in Main 1 if there is no better option, otherwise scry at opponent's EOT
// (e.g. Glimmer of Genius)
if ("BestOpportunity".equals(sa.getParam("AILogic"))) {
return doBestOpportunityLogic(ai, sa, ph);
}
// in the playerturn Scry should only be done in Main1 or in upkeep if able
if (ph.isPlayerTurn(ai)) {
if (SpellAbilityAi.isSorcerySpeed(sa)) {
@@ -60,6 +75,27 @@ public class ScryAi extends SpellAbilityAi {
return true;
}
private boolean doBestOpportunityLogic(Player ai, SpellAbility sa, PhaseHandler ph) {
// Check to see if there are any cards in hand that may be worth casting
boolean hasSomethingElse = false;
for (Card c : CardLists.filter(ai.getCardsIn(ZoneType.Hand), Predicates.not(CardPredicates.Presets.LANDS))) {
for (SpellAbility ab : c.getAllSpellAbilities()) {
if (ab.getPayCosts() != null
&& ab.getPayCosts().hasManaCost()
&& ComputerUtilMana.hasEnoughManaSourcesToCast(ab, ai)) {
// TODO: currently looks for non-Scry cards, can most certainly be made smarter.
if (ab.getApi() != ApiType.Scry) {
hasSomethingElse = true;
break;
}
}
}
}
return (!hasSomethingElse && ph.getPlayerTurn() == ai && ph.getPhase().isAfter(PhaseType.DRAW))
|| (ph.getNextTurn() == ai && ph.is(PhaseType.END_OF_TURN));
}
/**
* Checks if the AI will play a SpellAbility with the specified AiLogic
*/

View File

@@ -1,23 +1,19 @@
package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.card.CardSplitType;
import forge.card.CardStateName;
import forge.game.Game;
import forge.game.GlobalRuleChange;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
import forge.game.card.CardState;
import forge.game.card.CardUtil;
import forge.game.card.CounterType;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.player.PlayerActionConfirmMode;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
@@ -67,6 +63,13 @@ public class SetStateAi extends SpellAbilityAi {
return false;
}
@Override
protected boolean checkAiLogic(final Player aiPlayer, final SpellAbility sa, final String aiLogic) {
final Card source = sa.getHostCard();
return super.checkAiLogic(aiPlayer, sa, aiLogic);
}
@Override
public boolean chkAIDrawback(SpellAbility sa, Player aiPlayer) {
// Gross generalization, but this always considers alternate
@@ -78,6 +81,7 @@ public class SetStateAi extends SpellAbilityAi {
protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) {
final String mode = sa.getParam("Mode");
final Card source = sa.getHostCard();
final String logic = sa.getParamOrDefault("AILogic", "");
final Game game = source.getGame();
if("Transform".equals(mode)) {
@@ -86,7 +90,7 @@ public class SetStateAi extends SpellAbilityAi {
if (source.hasKeyword("CARDNAME can't transform")) {
return false;
}
return shouldTransformCard(source, ai, ph);
return shouldTransformCard(source, ai, ph) || "Always".equals(logic);
} else {
final TargetRestrictions tgt = sa.getTargetRestrictions();
sa.resetTargets();
@@ -108,7 +112,7 @@ public class SetStateAi extends SpellAbilityAi {
}
for (final Card c : list) {
if (shouldTransformCard(c, ai, ph)) {
if (shouldTransformCard(c, ai, ph) || "Always".equals(logic)) {
sa.getTargets().add(c);
if (sa.getTargets().getNumTargeted() == tgt.getMaxTargets(source, sa)) {
break;
@@ -126,7 +130,7 @@ public class SetStateAi extends SpellAbilityAi {
if (list.isEmpty()) {
return false;
}
return shouldTurnFace(list.get(0), ai, ph);
return shouldTurnFace(list.get(0), ai, ph) || "Always".equals(logic);
} else {
final TargetRestrictions tgt = sa.getTargetRestrictions();
sa.resetTargets();
@@ -139,7 +143,7 @@ public class SetStateAi extends SpellAbilityAi {
}
for (final Card c : list) {
if (shouldTurnFace(c, ai, ph)) {
if (shouldTurnFace(c, ai, ph) || "Always".equals(logic)) {
sa.getTargets().add(c);
if (sa.getTargets().getNumTargeted() == tgt.getMaxTargets(source, sa)) {
break;
@@ -163,15 +167,29 @@ public class SetStateAi extends SpellAbilityAi {
// need a copy for evaluation
Card transformed = CardUtil.getLKICopy(card);
transformed.getCurrentState().copyFrom(card, card.getAlternateState());
transformed.getCurrentState().copyFrom(card.getAlternateState(), true);
transformed.updateStateForView();
// TODO: compareCards assumes that a creature will transform into a creature. Need to improve this
// for other things potentially transforming.
return compareCards(card, transformed, ai, ph);
}
private boolean shouldTurnFace(Card card, Player ai, PhaseHandler ph) {
if (card.isFaceDown()) {
// hidden agenda
if (card.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")
&& card.getZone().is(ZoneType.Command)) {
String chosenName = card.getNamedCard();
for (Card cast : ai.getGame().getStack().getSpellsCastThisTurn()) {
if (cast.getController() == ai && cast.getName().equals(chosenName)) {
return true;
}
}
return false;
}
// non-permanent facedown can't be turned face up
if (!card.getRules().getType().isPermanent()) {
return false;
@@ -241,4 +259,9 @@ public class SetStateAi extends SpellAbilityAi {
// but for more cleaner way use Evaluate for check
return valueCard <= valueTransformed;
}
public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
// TODO: improve the AI for when it may want to transform something that's optional to transform
return true;
}
}

View File

@@ -5,7 +5,10 @@ import forge.ai.ComputerUtilCost;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CounterType;
import forge.game.cost.Cost;
import forge.game.cost.CostPart;
import forge.game.cost.CostRemoveCounter;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
@@ -58,6 +61,20 @@ public class TapAi extends TapAiBase {
return false;
}
} else {
if ("TapForXCounters".equals(sa.getParam("AILogic"))) {
// e.g. Waxmane Baku
CounterType ctrType = CounterType.KI;
for (CostPart part : sa.getPayCosts().getCostParts()) {
if (part instanceof CostRemoveCounter) {
ctrType = ((CostRemoveCounter)part).counter;
break;
}
}
int numTargetable = Math.min(sa.getHostCard().getCounters(ctrType), ai.getOpponents().getCreaturesInPlay().size());
sa.setSVar("ChosenX", String.valueOf(numTargetable));
}
sa.resetTargets();
if (!tapPrefTargeting(ai, source, tgt, sa, false)) {
return false;

View File

@@ -2,11 +2,12 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardLists;
@@ -111,7 +112,7 @@ public abstract class TapAiBase extends SpellAbilityAi {
* @return a boolean.
*/
protected boolean tapPrefTargeting(final Player ai, final Card source, final TargetRestrictions tgt, final SpellAbility sa, final boolean mandatory) {
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final Game game = ai.getGame();
CardCollection tapList = CardLists.filterControlledBy(game.getCardsIn(ZoneType.Battlefield), ai.getOpponents());
tapList = CardLists.getValidCards(tapList, tgt.getValidTgts(), source.getController(), source, sa);
@@ -155,6 +156,11 @@ public abstract class TapAiBase extends SpellAbilityAi {
});
}
//try to exclude things that will already be tapped due to something on stack or because something is
//already targeted in a parent or sub SA
CardCollection toExclude = ComputerUtilAbility.getCardsTargetedWithApi(ai, tapList, sa, ApiType.Tap);
tapList.removeAll(toExclude);
if (tapList.isEmpty()) {
return false;
}

View File

@@ -3,6 +3,7 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCombat;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
@@ -30,7 +31,7 @@ public class TapAllAi extends SpellAbilityAi {
// or during upkeep/begin combat?
final Card source = sa.getHostCard();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final Game game = ai.getGame();
if (game.getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_BEGIN)) {
@@ -126,8 +127,8 @@ public class TapAllAi extends SpellAbilityAi {
if (tgt != null) {
sa.resetTargets();
sa.getTargets().add(ai.getOpponent());
validTappables = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
sa.getTargets().add(ComputerUtil.getOpponentFor(ai));
validTappables = ComputerUtil.getOpponentFor(ai).getCardsIn(ZoneType.Battlefield);
}
if (mandatory) {

View File

@@ -1,27 +1,15 @@
package forge.ai.ability;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
import forge.ai.SpellApiToAi;
import forge.ai.*;
import forge.game.Game;
import forge.game.GameEntity;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.ability.ApiType;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.card.CardFactory;
import forge.game.card.CardLists;
import forge.game.card.CardPredicates;
import forge.game.card.*;
import forge.game.card.token.TokenInfo;
import forge.game.combat.Combat;
import forge.game.cost.CostPart;
import forge.game.cost.CostPutCounter;
@@ -38,6 +26,11 @@ import forge.game.trigger.TriggerHandler;
import forge.game.zone.ZoneType;
import forge.item.PaperToken;
import forge.util.MyRandom;
import forge.util.TextUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* <p>
@@ -179,7 +172,7 @@ public class TokenAi extends SpellAbilityAi {
*/
final Card source = sa.getHostCard();
final Game game = ai.getGame();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
if (ComputerUtil.preventRunAwayActivations(sa)) {
return false; // prevent infinite tokens?
@@ -233,7 +226,29 @@ public class TokenAi extends SpellAbilityAi {
}
}
}
return MyRandom.getRandom().nextFloat() < .8;
double chance = 1.0F; // 100%
boolean alwaysFromPW = true;
boolean alwaysOnOppAttack = true;
if (ai.getController().isAI()) {
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
chance = (double)aic.getIntProperty(AiProps.TOKEN_GENERATION_ABILITY_CHANCE) / 100;
alwaysFromPW = aic.getBooleanProperty(AiProps.TOKEN_GENERATION_ALWAYS_IF_FROM_PLANESWALKER);
alwaysOnOppAttack = aic.getBooleanProperty(AiProps.TOKEN_GENERATION_ALWAYS_IF_OPP_ATTACKS);
}
if (sa.getRestrictions() != null && sa.getRestrictions().isPwAbility() && alwaysFromPW) {
return true;
} else if (ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& ai.getGame().getPhaseHandler().getPlayerTurn().isOpponentOf(ai)
&& ai.getGame().getCombat() != null
&& !ai.getGame().getCombat().getAttackers().isEmpty()
&& alwaysOnOppAttack) {
return true;
}
return MyRandom.getRandom().nextFloat() <= chance;
}
/**
@@ -254,13 +269,13 @@ public class TokenAi extends SpellAbilityAi {
num = (num == null) ? "1" : num;
final int nToSac = AbilityUtils.calculateAmount(topStack.getHostCard(), num, topStack);
CardCollection list = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","),
ai.getOpponent(), topStack.getHostCard(), sa);
ComputerUtil.getOpponentFor(ai), topStack.getHostCard(), sa);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack));
// only care about saving single creature for now
if (!list.isEmpty() && nTokens > 0 && list.size() == nToSac) {
ComputerUtilCard.sortByEvaluateCreature(list);
list.add(token);
list = CardLists.getValidCards(list, valid.split(","), ai.getOpponent(), topStack.getHostCard(), sa);
list = CardLists.getValidCards(list, valid.split(","), ComputerUtil.getOpponentFor(ai), topStack.getHostCard(), sa);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack));
if (ComputerUtilCard.evaluateCreature(token) < ComputerUtilCard.evaluateCreature(list.get(0))
&& list.contains(token)) {
@@ -278,7 +293,7 @@ public class TokenAi extends SpellAbilityAi {
if (tgt != null) {
sa.resetTargets();
if (tgt.canOnlyTgtOpponent()) {
sa.getTargets().add(ai.getOpponent());
sa.getTargets().add(ComputerUtil.getOpponentFor(ai));
} else {
sa.getTargets().add(ai);
}
@@ -414,7 +429,7 @@ public class TokenAi extends SpellAbilityAi {
final List<String> imageNames = new ArrayList<String>(1);
if (tokenImage.equals("")) {
imageNames.add(PaperToken.makeTokenFileName(colorDesc.replace(" ", ""), tokenPower, tokenToughness, tokenName));
imageNames.add(PaperToken.makeTokenFileName(TextUtil.fastReplace(colorDesc, " ", ""), tokenPower, tokenToughness, tokenName));
} else {
imageNames.add(0, tokenImage);
}
@@ -436,9 +451,9 @@ public class TokenAi extends SpellAbilityAi {
}
final String substitutedName = tokenName.equals("ChosenType") ? host.getChosenType() : tokenName;
final String imageName = imageNames.get(MyRandom.getRandom().nextInt(imageNames.size()));
final CardFactory.TokenInfo tokenInfo = new CardFactory.TokenInfo(substitutedName, imageName,
final TokenInfo tokenInfo = new TokenInfo(substitutedName, imageName,
cost, substitutedTypes, tokenKeywords, finalPower, finalToughness);
Card token = CardFactory.makeOneToken(tokenInfo, ai);
Card token = tokenInfo.makeOneToken(ai);
if (token == null) {
return null;

View File

@@ -2,6 +2,7 @@ package forge.ai.ability;
import java.util.List;
import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
@@ -28,7 +29,7 @@ public class TwoPilesAi extends SpellAbilityAi {
valid = sa.getParam("ValidCards");
}
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (tgt != null) {

View File

@@ -1,5 +1,6 @@
package forge.ai.ability;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilMana;
import forge.ai.SpellAbilityAi;
@@ -66,7 +67,7 @@ public class UnattachAllAi extends SpellAbilityAi {
@Override
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
final Card card = sa.getHostCard();
final Player opp = ai.getOpponent();
final Player opp = ComputerUtil.getOpponentFor(ai);
// Check if there are any valid targets
List<GameObject> targets = new ArrayList<GameObject>();
final TargetRestrictions tgt = sa.getTargetRestrictions();

Some files were not shown because too many files have changed in this diff Show More