Commit graph

4077 commits

Author SHA1 Message Date
xenohedron
e6bd35eb77
refactor selecting cards from multiple zones (#11584)
* refactor selecting cards from multiple zones

fix MV <= controlled lands predicate

fix filter checks without source parameter

* fix test choice
2023-12-31 14:25:25 -05: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
Oleg Agafonov
7d860378f7 tests: added Mana Maze test to reproduce stack overflow error (#11572, #11575) 2023-12-24 01:30:26 +04:00
xenohedron
7ff2570024 fix #11520 (Elite Spellbinder)
and similar card InvasionOfGobakhan
2023-12-21 22:32:33 -05:00
Oleg Agafonov
0dbd86fb58 Merge fix 2023-12-14 22:25:45 +04:00
Oleg Agafonov
10641f8d63 GUI: hand - added default card sorting on mulligan (lands > other > creatures; mana value, name); 2023-12-14 22:13:07 +04:00
Oleg Agafonov
525ca9a1a2 tests: fixed random fails due wrong mana usage 2023-12-13 20:30:39 +04:00
Oleg Agafonov
d5b582c1b3 images: fixed miss images for double faced tokens like Incubator/Phyrexian (closes #11535); 2023-12-10 15:59:27 +04:00
Oleg Agafonov
725a27d6ad Double faced tokens - fixed wrong abilities on the back side (example: Incubator/Phyrexian tokens with transform, fixes #10351); 2023-12-10 15:01:00 +04:00
Oleg Agafonov
00a7cc645d Copy abilities - fixed wrong copy of transformed tokens like Incubator/Phyrexian (related to #11535, #11307, #10801, #10263); 2023-12-10 14:49:47 +04:00
Oleg Agafonov
50fd029c3b tests: improved show playable abilities to print playable list instead unique (see showAvailableAbilities), added custom effect for transform tests (see addCustomEffect_TransformTarget); 2023-12-10 14:31:55 +04:00
Oleg Agafonov
f5c47686ac server: fixed broken games with banned players (regression) 2023-12-09 18:28:21 +04:00
Oleg Agafonov
960e896903
Network upgrade and new reconnection mode (#11527)
Network upgrade and new reconnection mode:
* users can disconnect or close app without game progress loose now;
* disconnect dialog will show active tables stats and additional options;
* all active tables will be restored on reconnect (tables, tourneys, games, drafts, sideboarding, constructing);
* user must use same server and username on next connection;
* there are few minutes for reconnect until server kick off a disconnected player from all player's tables (concede/loose);
* now you can safety reconnect after IP change (after proxy/vpn/wifi/router restart);

Other improvements and fixes:
* gui: main menu - improved switch panel button, added stats about current tables/panels;
* gui: improved data sync and updates (fixes many use cases with empty battlefield, not started games/drafts/tourneys, not updatable drafts, etc);
* gui: improved stability on game updates (fixes some random errors related to wrong threads);
* server: fixed miss messages about player's disconnection problems for other players in the chat;
* refactor: simplified and improved connection and network related code, deleted outdated code, added docs;
* tests: improved load test to support lands only set for more stable performance/network testing (set TEST_AI_RANDOM_DECK_SETS = PELP and run test_TwoAIPlayGame_Multiple);
2023-12-07 20:56:52 +04:00
ssk97
898952515e
[LCI] Implement Intrepid Paleontologist (#11508)
* Improve some "mana spent -> give effect to permanent spell" cards
make effect source be the SpellAbility itself

* Implement Intrepid Paleontologist and tests

* Use a common class for the "specific MOR ETBs with counter" effect

* Prevent casting non-owned dinosuars

* Rename AddCounterEnteringMOR to AddCounterEnteringCreature

* fixes from review
2023-12-05 20:27:49 -05:00
Grath
5c83818cba
[LCC] Implement Topography Tracker (#11504)
* Refactor replacement effects on ExploreEvent by using a queue of events
2023-12-04 00:46:21 -05:00
Oleg Agafonov
eaa510b265 GUI: added restriction card icon to permanent (contains all applied restrictions and requirements, #7471) 2023-12-03 00:01:47 +04:00
Oleg Agafonov
11a19f9a43
tests: added test to check jboss serialization and java 17 compatibility (related to #5862, part of #6197) (#11499) 2023-12-01 14:24:34 +04:00
xenohedron
c164d70135 remove PlayersAttackedThisTurnWatcher from default watchers 2023-11-30 00:56:32 -05:00
Oleg Agafonov
2eac541b80 gui: fixed broken watcher view mode (closes #11481) 2023-11-28 08:04:14 +04:00
Oleg Agafonov
c5632f6868 refactor: removed client side threads from a server, improved test log files rotation; 2023-11-27 18:13:05 +04:00
Oleg Agafonov
99cbddb8b8
Merge pull request #11431 from Susucre/lci-mana-tracking
[LCI] Implement Thousand Moons Smithy // Barracks of the Thousand and Brass's Tunnel-Grinder // Tecutlan, the Searing Rift
2023-11-25 17:13:54 +03:00
xenohedron
867a8f54b0 fix #11456 (Become Brutes)
CreateRoleAttachedTargetEffect changed to use all targets, not just first
2023-11-25 02:20:11 -05:00
Oleg Agafonov
53add71826 Improved network stability and other related fixes:
* server: fixed that a critical errors ignored in user commands threads (now it will be added to the logs);
* network: fixed frozen user responses in some use cases;
* network: fixed accidental and incorrect user responses (only latest response will be used now);
* network: improved freeze logs, added problem method name and code's line number;
* cheats: removed outdated deck and card load logic (only init.txt commands supports now);
* cheats: fixed wrong priority after add card dialog (closes #11437);
* cheats: improved stability and random errors on cheat executes (related to #11437);
* docs: added details on network and thread logic, human feedback life cycle, etc (see HumanPlayer, ThreadExecutorImpl);
2023-11-24 21:22:16 +04:00
Oleg Agafonov
75958e3710 refactor: improved and reorganized client-server api, added additional logs, fixed miss admin checks for some commands 2023-11-23 09:12:02 +04:00
ssk97
e43e918c67
Conditional mana - fixed that some mana cant be used for paying “counter unless” cost and other things (#11447)
* Add tests for conditional mana usage with soft counterspells

* Fix "to cast" conditions on common ManaCondition classes

* Add fix to all remaining ManaCondition classes

* SimpleActivatedAbilityConditionalMana is tested to pay for a soft counterspell activated ability

* Remove now-unused imports
2023-11-23 01:37:45 +04:00
ssk97
2cc9957753
Costs Tag Tracking part 4: Convoke (#11446)
* Switch Convoke to using costs tag system

* Add Convoke copy/clone tests

* update author name on sufficiently changed files

* Remove now-unused CONVOKED event
2023-11-23 01:31:56 +04:00
xenohedron
4977fea307
Merge pull request #11417 from ssk97/TagTracking3_KeywordAbilities
Costs Tag Tracking part 3: Most keyword abilities
2023-11-20 21:28:40 -05:00
xenohedron
d328a30d9d add another saga test 2023-11-20 21:26:20 -05:00
xenohedron
8ad53750ee fix ability text in test 2023-11-19 21:48:45 -05:00
Susucre
f45c9e8ee9 [LCI] Implement Thousand Moons Smithy // Barracks of the Thousand 2023-11-19 17:54:57 +01:00
Oleg Agafonov
571711e67d tests: added multiple tests for ring emblem and ring-bearer effects (related to #11425) 2023-11-19 19:12:07 +04:00
ssk97
38adbb4ae5
[UNF] "Name Sticker" Goblin, [WHO] Coward // Killer, [WHO] Thijarian Witness (#11392)
* Add [WHO] Coward // Killer

* Add MTGO version of [UNF] "Name Sticker" Goblin

* Implement [WHO] Thijarian Witness

* Add NameStickerGoblinTest

* Fix Thijarian Witness, add tests (may need additional tests). Also adds a simple toString for MageObjectReference

* Don't spam the java garbage collector, add another test

* Replace non-ASCII characters in card text

* improve MOR toString

* Thijarian Witness fixed better, add AttackingBlockingWatcher in common

* cleanup from xenohedron's review

* Fix test, add warning not to use AttackingBlockingWatcher for static effects

* rename AttackingBlockingWatcher to AttackingBlockingDelayedWatcher to make it more obvious how it should be used, minor documentation changes
Simplify and rename Thijarian Witness Predicate

* add null checks
2023-11-19 00:38:21 -05:00
xenohedron
2457255130 add test for Tiller Engine 2023-11-19 00:03:09 -05:00
xenohedron
67d9127027 add test for Banewasp Affliction 2023-11-19 00:03:09 -05:00
Oleg Agafonov
4f081c0918 Merge fix 2023-11-18 15:36:55 +04:00
Oleg Agafonov
2bbe2b3c43 GUI - new card hints window features:
* new help window can be opened from a player panel;
* it collect and show all visible game hints from all players and all zones;
* it updates in real time on game update;
* allows to customize visible data;
* allows to open multiple windows (current limit is 5 windows, can be slow to render);
* allows to minimize opened windows;
* workable card popup on mouse move over card name or card id;
* filter modes:
  * all - show hints from all players;
  * player - show hints from single player;
* group mode:
  * by hints - show same hints as one with all used cards;
  * by cards - show full cards list with own hints;
* search mode:
  * allows to filter card hints by player name, card name, card id or card hint;
  * allows to search multiple words (equals to "or")
* current limitation:
  * card popup shows a card instead a real object, e.g. miss card hints in it (relelated to game logs problem);
  * unsupport of emblems, dungeons and other non card objects from a command zone;
  * unsupport of revealed and library's top cards;

GUI - player's panel improves:
* added hints helper button;
* added player hithlight as possible target in choose dialogs;
* improved player name button in small mode;
* fixed wrong height in small mode;

Other fixes:
* game logs: added card popup support for logs with custom object name;
2023-11-18 14:48:25 +04:00
Steven Knipe
79f8601e26 Minor test improvements 2023-11-17 23:20:35 -08:00
ssk97
ca80849249
game: fixed "if mana was spent to cast" abilities after leaves (#11419)
* ManaWasSpentCondition should use MageObjectReferences
2023-11-17 12:02:47 +04:00
Steven Knipe
193a19104c Improved Altered Ego rules documentation 2023-11-16 23:35:09 -08:00
Tirth Bharatiya
44b8a0faf4
refactor: improved code to increase readability. (#11418)
Moved the cardViewEquals method from CardPanelRenderModeMTGO to CardView
Decomposed conditional to increase readability.
Changed the variable/constant names to increase the readability.
2023-11-17 10:47:53 +04:00
Steven Knipe
177f72c8d8 Altered ego X value should be separate 2023-11-16 18:21:02 -08:00
Steven Knipe
18600a53a9 Add new/Enable existing tests 2023-11-16 18:09:02 -08:00
ssk97
bea33c7493
Costs Tag Tracking part 2: Tag system and X values, reworked deep copy code (#11406)
* Implement Costs Tag Map system

* Use Costs Tag Map system to store X value for spells, abilities, and resolving permanents

* Store Bestow without target's tags
Change functions for getting tags and storing the tags of a new permanent

* Create and use deep copy function in CardUtil, add Copyable<T> to many classes

* Fix Hall Of the Bandit Lord infinite loop

* Add additional comments

* Don't store null/empty costs tags maps (saves memory)

* Fix two more Watchers with Ability variable

* Add check for exact collection types during deep copy

* Use generics instead of pure type erasure during deep copy

* convert more code to using deep copy helper, everything use Object copier, add EnumMap

* fix documentation

* Don't need the separate null checks anymore (handled in deepCopyObject)

* Minor cleanup
2023-11-16 23:12:32 +04:00
ssk97
ec4c79e0e0
Fix copying subabilities to no longer duplicate them (#11399)
* Fix Subability copy bug (fix #10526 )

* Cards which copy abilities of other cards should not copy subabilities.

* Enable previously-failing tests

* Find more addAbility that should be done without subabilities

* Add documentation to addAbility function

* Add warning about not using basic addAbility when copying from a source

* Invert withSubabilities to fromExistingObject
2023-11-12 19:57:39 -05:00
xenohedron
933d694b08 implement [LCI] Market Gnome 2023-11-09 21:42:57 -05:00
xenohedron
af05e6f940 add test coverage 2023-11-09 19:53:30 -05:00
Oleg Agafonov
d6c858ecaf performance: added day/night performance test for transform ability (disabled by default, see DayNightTest, related to #11285), added day/night rules ref 2023-11-07 01:25:15 +04:00
Oleg Agafonov
089ff267a7 tests: added additional check for Karn Liberated (related to #11081) 2023-11-06 12:11:59 +04:00
Oleg Agafonov
dfbd6627e5 game: fixed miss watchers from second side of transformable cards (closes #11329); 2023-11-06 10:40:05 +04:00
Jeff Wadsworth
af8e790522 Adjusted a test to cast detrimental "forked" spells onto an opponents creatures instead of it own. 2023-11-05 20:45:04 -06:00