Commit graph

345 commits

Author SHA1 Message Date
ssk97
969ffa1c98
FDN New Combat Rules (#13279)
* Remove all combat ordering code

* Use MultiAmount division for damage

* Remove damage selection division skipping in tests

* Fix Banding, Multi-block, add tests

* Fix test

* Fix random iteration order, fix new tests

* Add more info to choose dialog, make MultiAmountType class instead of enum

* Don't prompt for trample damage assignment if none possible

* Mark "Assign default damage" on tests, minor other test improvements
2025-03-30 14:42:05 -07:00
Oleg Agafonov
07f68fbf38 server: fixed error on server startup from a launcher (temporary fix, #13315); 2025-02-08 21:41:43 +04:00
Oleg Agafonov
f17cbbe72b AI: improved performance and fixed crashes on use cases with too much target options like "deals 5 damage divided as you choose" (related to #11285):
* added DebugUtil.AI_ENABLE_DEBUG_MODE for better IDE's debugging AI code;
 * it's a target amount optimizations;
 * it's use a grouping of possible targets due same static and dynamic stats (name, abilities, rules, damage, etc);
 * instead of going through all possible combinations, AI uses only meaningful targets from particular groups;
2025-02-06 17:40:22 +04:00
Oleg Agafonov
7d229e511c tests: added AI performance tests to reproduce bad use cases with too much possible targets 2025-02-05 13:12:22 +04:00
Oleg Agafonov
b62ac065c1 AI: improved performance in tournament games (now computer will play AI vs AI games at the same time); 2025-02-04 14:26:17 +04:00
Oleg Agafonov
39872e2625 AI: fixed that computer can cheat with target selection and choose 1 creature instead multiple required (example: sacrifice, close #13219) 2025-01-12 14:46:16 +04:00
xenohedron
9c5c394c75
refactor: TargetCreatureOrPlayer inheritance (#13199)
* update TargetCreatureOrPlayer to be a subclass of TargetPermanentOrPlayer

closes #11161

* fix usages
2025-01-08 22:47:36 -05:00
Oleg Agafonov
2d9ac4e732 refactor: removed outdated Player::assignDamage by multi amount dialog, fixed getMultiAmount to work with min values, added additional checks 2024-10-24 15:31:04 +04:00
ssk97
b70638acc9
Unbound Flourishing's X doubling should be a triggered ability (and related refactors) (#12597)
Complete rework of Unbound Flourishing, removing the multiplier code for casting X spells.
Adds ActivateAbilityTriggeredAbility, NotManaAbilityPredicate, AbilitySourceAttachedPredicate
CopyStackObjectEffect now uses a MOR.
OrTriggeredAbility now works with target pointer setting abilities.
2024-08-22 13:33:39 -07:00
Oleg Agafonov
7b2e9b390c GUI: added card hints in choose replacement effect dialog 2024-07-19 00:06:18 +04:00
Evan Kranzler
27bea843a3
[M3C] Implement Ulalek, Fused Atrocity and new colorless hybrid mana (#12273)
* improved by (#12415)
* Added symbol downloads for new colorless hybrid
---------

Co-authored-by: Alexander Novotny <alexander_novo@mail.tmcc.edu>
Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
2024-06-06 23:43:45 +04:00
Oleg Agafonov
add2d0473e dev, AI: improved AI logs:
* added object and targets info for possible actions;
* added detailed score for each action in possible action chains;
* added stack info;
* improved output for easy read and analyse;
2024-05-28 17:17:16 +04:00
Oleg Agafonov
2298ebc5f5 Playable mana calculation improved:
* server: fixed server crashes on usage of multiple permanents with {Any} mana abilities (example: Energy Refractor, related to #11285);
* AI: fixed game freezes and errors on computer's {Any} mana usage (closes #9467, closes #6419);
2024-05-27 22:24:58 +04:00
Susucre
754b382e78
implement [MH3] Nethergoyf, refactor targets usages by game param (#12267) 2024-05-21 13:34:38 +02:00
Oleg Agafonov
ebe04dc3a6 tests: added tests for Chandra Ablaze card and some AI logic; 2024-05-12 14:37:10 +04:00
Susucre
85cad4ff1e
cleanup AbilityType for easier check that an ability is an activated ability (#12153)
* cleanup AbilityType

* further cleanup

* cleanup instanceof

* tweak formatting

* rework Rex

* fix mistake in PlayerImpl

* cleanup 'instanceof' for 'ActivatedManaAbilityImpl'
2024-05-03 22:13:34 -04:00
Oleg Agafonov
ad8e7daf97 refactor: improved card info 2024-02-18 22:40:30 +04:00
Oleg Agafonov
229e8d3075 game engine, tests and other fixes:
tests: fixed wrong permanent structure for battlefield cards (addCard command);
tests: added docs and additional runtime checks;
game: Modal double-faced cards - improved support, no more other side effects on battlefield;
game: Copy abilities - improved stability and cards support;
game: Player under control - improved stability and related cards support (possible NPE errors, additional runtime checks);
server: fixed bloated logs with game timer;
AI: fixed wrong timer in computer games;
2024-02-17 19:35:44 +04:00
Oleg Agafonov
08b99fcbf7 AI: removed outdated AIMinimax project (#7075), removed some useless player classes, code and config files, improved docs; 2024-01-15 05:03:21 +04:00
xenohedron
9b3ff32a33
Rework sacrifice effects to support "can't be sacrificed" (#11587)
* add TargetSacrifice and canBeSacrificed

* SacrificeTargetCost refactor, now uses TargetSacrifice, constructors simplified, subclasses aligned

* fix text errors introduced by refactor

* refactor SacrificeEffect, SacrificeAllEffect, SacrificeOpponentsEffect

* cleanup keyword abilities involving sacrifice

* fix a bunch of custom effect classes involving sacrifice

* fix test choices

* update Assault Suit implementation

* fix filter check arguments

* add documentation to refactored common classes

* [CLB] Implement Jon Irenicus, Shattered One

* implement "{this} can't be sacrificed"

* add tests for Assault Suit and Jon Irenicus

* refactor out PlayerToRightGainsControlOfSourceEffect

* implement [LTC] Hithlain Rope

* add choose hint to all TargetSacrifice

---------

Co-authored-by: Evan Kranzler <theelk801@gmail.com>
Co-authored-by: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com>
2023-12-31 14:10:37 -05:00
xenohedron
35f4a898f9
Small rework for autochoosing color of mana to add (#11495)
fix #11494
2023-12-01 00:49:42 -05:00
Oleg Agafonov
58ce3296b6 AI: little refactor 2023-11-26 21:37:47 +04:00
Jeff Wadsworth
c7007a3de3 Fixed #11426 2023-11-22 10:22:34 -06:00
Jeff Wadsworth
0820761c3a Fixed #8771 2023-11-01 21:26:28 -05:00
Susucre
7c454fb24c
Rework AsThough handling to allow choosing/affecting a specific alternate cast (#11114)
* Rework AsThoughEffect

* some cleanup of MageIdentifer

* refactor ActivationStatus

* fix bolas's citadel

* fix a couple of the Alternative Cost being applied too broadly.

* fix Risen Executioneer

* allow cancellation of AsThough choice.

* fix One with the Multiverse

* cleanup cards needing their own MageIdentifier

* last couple of fixes

* apply reviews for cleaner code.

* some more cleanup
2023-10-02 18:42:54 -04:00
Oleg Agafonov
4e77ccb381 refactor: removed unused data from special action, improved code (related to #11137) 2023-09-17 14:37:49 +04:00
Oleg Agafonov
8a65b0f149 refactor: removed netbeans's auto-generated comments 2023-09-02 16:05:29 +04:00
Susucre
5062c84098
Refactor: removed server side objects from a client side game's data (#10788)
* Clean original values transmitted with CardView.originalObject
* Move RateCard to mage.Common, support cardView as argument.
* Clean PermanentView constructor for TestCardRenderDialog
2023-08-24 12:04:07 +04:00
Artemis Kearney
9ba0da00ff
Basic groundwork for extra decks (contraptions, attractions) (#10378)
* extra deck cards not counted in deck size

* extra deck handling in deckbuilder

* move responsibility for extraDeckCard boolean to CardImpl

* remove redundant field copy
2023-08-06 21:06:32 -04:00
Alexander Novotny
a36a7d9b7f
[LTR] Add Goldberry, River-Daughter (#10524)
* Added Goldberry

* Slight optimizaztion

* Happy Path Test

* More unhappy tests

* Sanity check for Goldberry's counter choices

* Updated player.getMultiAmount to support individual constraints

* Some cleanup

Also modified ResourcefulDefense to use new multi amount api

* Updated logging

* Added hint for number of counters

* Fixed issue with Resourceful Defense

* Improvements to defaults

Default list will properly make sure to stay within individual maximums
If a player is asked for a choice that isn't actually a choice because each choice's min and max are equal, instead the default response is immediately returned. This helps with situations like moving a counter off of Goldberry when she only has one counter on her.

* -1/-1 Counter test

* Fixed issue with -1/-1 counters

* Adjusted dialog to properly enforce constraints
2023-07-28 21:29:40 -04:00
Evan Kranzler
a850e3660b
Change supertype method in constructors (#10361)
* replace addSuperType with supertype.add in card constructors

* more supertype replacements

* update MDFC supertype implementation

* remove unnecessary class

* update test
2023-05-12 20:45:07 -04:00
Oleg Agafonov
1dea98cf1f Game: fixed that search by card name was able to return a wrong card (example: cheat command) 2023-05-08 22:58:30 +04:00
Oleg Agafonov
5474787641 Refactor: added miss Ability source in some choose methods 2023-04-21 10:08:33 +04:00
Evan Kranzler
947351932b
Ready for Review: Implementing Battles (#10156)
* add types and subtypes

* add startingDefense attribute

* [MOM] Implement Invasion of Ravnica / Guildpact Paragon

* fix two small errors

* refactor various instances of "any target"

* fully implement defense counters

* battles can now be attacked

* [MOM] Implement Invasion of Dominaria / Serra Faithkeeper

* [MOM] Implement Invasion of Innistrad / Deluge of the Dead

* [MOM] Implement Invasion of Kaladesh / Aetherwing, Golden-Scale Flagship

* [MOM] Implement Invasion of Kamigawa / Rooftop Saboteurs

* [MOM] Implement Invasion of Karsus / Refraction Elemental

* [MOM] Implement Invasion of Tolvada / The Broken Sky

* simplify battle info ability

* fix verify failure

* some more fixes for attacking battles

* [MOM] Implement Invasion of Kaldheim / Pyre of the World Tree

* [MOM] Implement Invasion of Lorwyn / Winnowing Forces

* [MOM] Implement Invasion of Moag / Bloomwielder Dryads

* [MOM] Implement Invasion of Shandalar / Leyline Surge

* [MOM] Implement Invasion of Belenon / Belenon War Anthem

* [MOM] Implement Invasion of Pyrulea / Gargantuan Slabhorn

* [MOM] Implement Invasion of Vryn / Overloaded Mage-Ring

* [MOM] Implement Marshal of Zhalfir

* [MOM] Implement Sunfall

* implement protectors for sieges

* partially implement siege defeated trigger

* fix verify failure

* some updates to blocking

* [MOM] Implement Invasion of Mercadia / Kyren Flamewright

* [MOM] Implement Invasion of Theros / Ephara, Ever-Sheltering

* [MOM] Implement Invasion of Ulgrotha / Grandmother Ravi Sengir

* [MOM] Implement Invasion of Xerex / Vertex Paladin

* add initial battle test

* fix verify failure

* [MOM] Implement Invasion of Amonkhet / Lazotep Convert

* [MOM] update spoiler

* update how protectors are chosen

* update text

* battles can't block

* add control change test

* rename battle test for duel

* add multiplayer test

* [MOM] Implement Invasion of Alara / Awaken the Maelstrom

* [MOM] Implement Invasion of Eldraine

* [MOM] Implement Invasion of Ergamon / Truga Cliffhanger

* [MOM] Implement Invasion of Ixalan / Belligerent Regisaur

* battles now cast transformed (this is super hacky but we need to refactor TDFCs anyway)

* add TODO

* add ignore for randomly failing test

* a few small fixes

* add defense to MtgJsonCard (unused like loyalty)

* implement ProtectorIdPredicate

* small fixes
2023-04-13 20:03:16 -04:00
Oleg Agafonov
a15a0daa04 Fixed potential NPE errors in getPhase usage (fixed Berserker's Frenzy, etc) 2023-03-25 16:01:27 +04:00
Alex Vasile
f68db93683 Fix minor bug in ComputerPlayer mana handling 2022-10-04 02:01:34 -04:00
Alex Vasile
55a6acba22
Refactor: Significant speed-up for ManaOptions (#9233) 2022-10-04 00:08:20 -04:00
Alex Vasile
b14af42280
[DMU] Karn's Sylex (#9507) 2022-09-17 22:37:56 -04:00
Alex W. Jackson
a6c5209a2a Combat.getAttackers and Combat.getBlockers now return a Set instead of a List, so that two-headed blockers aren't included twice 2022-09-07 22:36:05 -04:00
sprangg
7554a2b6b5
Make Add Land dialog no longer add a random mix of regular and snow-covered basic lands (#9353)
The Add Land dialog now only adds regular basic lands and never snow-covered ones, unless you specifically select a set that only contains snow basics (e.g. MH1) Sets that only contain snow basics are not selectable when adding lands to a Limited deck.
2022-08-10 20:11:01 -04:00
Alex Vasile
137f02f31b Added AI Targeting for TargetActivatedOrTriggeredAbility. Closes #9276. 2022-07-17 00:29:39 -04:00
DeepCrimson
12595ac651
Refactor: Replace unnecessary Collections.sort with List.sort (#9168) 2022-06-26 22:59:28 -04:00
DeepCrimson
3f96f243b2
Refactor: Remove redundant 'blockers' variable declaration (#9167) 2022-06-26 22:58:55 -04:00
DeepCrimson
7bb851e0a5
Refactor: Fix spelling of 'controller' (#9163) 2022-06-26 22:58:06 -04:00
DeepCrimson
0c8ef41012
Fix spelling of doneChoosing() (#9002) 2022-05-25 22:25:15 -06:00
Alex Vasile
015cdf3136
Revert "Added missing fields to many copy constructors. (#8957)" (#8999)
This reverts commit 82708e4273.

Some of these (AI related result in bloated memory usage, needs more investigation).
2022-05-25 12:57:24 -06:00
Alex Vasile
82708e4273
Added missing fields to many copy constructors. (#8957) 2022-05-25 09:51:18 -06:00
Evan Kranzler
9ead88bacb [SNC] Implemented Endless Detour 2022-04-19 18:40:45 -04:00
Evan Kranzler
80e11b2052
(WIP) Replacing blocking/blocked by predicates (#8729)
* replaced blocking/blocked by predicates

* added test for knight of dusk (currently fails)

* added source parameter to filters and everything else that needs it

* some changes to various predicates

* test fix

* small changes to filter code

* merge fix

* fixed a test failure

* small change to Karn, Scion of Urza

* removed sourceId from filter methods and other similar places

* added new getobject method to fix some test failures

* a few more fixes

* fixed merge conflicts

* merge fix
2022-03-23 18:45:02 -04:00
Evan Kranzler
bbb9382150
Reworking effects which allow casting spells from a selection of cards (ready for review) (#8136)
* added function for casting spells with specific attributes from a selection of cards

* updated cascade to use new method

* refactored various cards to use new methods

* added TestPlayer method

* fixed a small error

* text fix

* broke out some repeated code

* added missing notTarget setting

* add additional retain zone check

* some more cards refactored

* more refactoring

* added interface for split/modal cards

* reworked spell casting methods

* reworked multiple cast to prevent unnecessary dialogs

* fixed test failures due to change in functionality

* add AI code

* small nonfunctional change

* reworked Kaya, the Inexorable

* added currently failing test

* added more tests

* updated Geode Golem implementation

* fixed adventure/cascade interaction, added/updated tests

* some nonfunctional refactoring

* added interface for subcards

* [AFC] Implemented Fevered Suspicion

* [AFC] Implemented Extract Brain

* [AFC] updated Arcane Endeavor implementation

* [C17] reworked implementation of Izzet Chemister

* [ZEN] reworked implemented of Chandra Ablaze

* additional merge fix

* [SLD] updated Eleven, the Mage

* [NEO] Implemented Discover the Impossible

* [NEO] Implemented The Dragon-Kami Reborn / Dragon-Kami's Egg

* [NEO] Implemented Invoke Calamity

* [AFR] Implemented Rod of Absorption

* [VOC] Implemented Spectral Arcanist

* [VOC] added additional printings

* [NEO] added all variants

* [SLD] updated implementation of Ken, Burning Brawler
2022-03-09 08:03:54 -05:00