Commit graph

342 commits

Author SHA1 Message Date
Oleg Agafonov
0505f5159e Turn under control reworked:
- game: added support when a human is take control over a computer player (related to #12878);
 - game: fixed game freezes while controlling player leaves/disconnect on active priority/choose of another player;
2025-01-10 20:20:11 +04:00
Oleg Agafonov
c076f4925f Turn under control reworked:
- game: added support for human games (cards like Emrakul, the Promised End, #12878);
 - game: added support of 720.1. to reset control in the turn beginning instead cleanup step (related to #12115);
 - game: added game logs for priorities in cleanup step;
 - game: fixed game freezes and wrong skip settings usages (related to #12878);
 - gui: added playable and choose-able marks for controlling player's cards and permanents, including switched hands;
 - gui: added controlling player name in all choice dialogs;
 - info: control of computer players is it not yet supported;
2025-01-07 12:38:01 +04:00
Oleg Agafonov
60112c6be5 test framework: added commands to check declared attackers and blockers creatures (useful for AI tests, see checkAttackers and checkBlockers) 2024-12-31 22:08:13 +04:00
Oleg Agafonov
2fa07c8ecc GUI, game: added default card hint to see day/night and next turn transform conditions (use player panel to see that hints, related to #8414) 2024-10-06 13:23:55 +04:00
Oleg Agafonov
f7d702d5df images: added The Ring image support (part of #12274, #12899);
images: fixed miss dungeon image in choose dungeon dialog (part of #12274);
2024-09-21 18:41:53 +04:00
Oleg Agafonov
bf2c4cac15 Venture into abilities - added card hints about current dungeon and room (part of #12274); 2024-09-20 18:03:23 +04:00
Oleg Agafonov
b40e7222b3 Dungeon improves:
* Dungeons: added dungeon name hint to room's game log and choices (part of #12274);
* GUI, game: added card popup hints support in feedback panel (yes/no choices);
* Images: fixed miss images for dungeons in command zone, game logs and choice dialogs;
2024-09-19 13:42:23 +04:00
xenohedron
9fcbfdeac6
Rework drawing cards and associated replacement effects; implement [WHO] River Song (#12700)
* remove unused scoring system code

* add test for Alms Collector replacement effect

* flatten draw cards into single method in PlayerImpl

* remove outdated MageAction framework

* clarify game event for drawing two or more cards

* clarify methods for getting cards from library

* implement [WHO] River Song

* fix error

* adjust library methods

* add lots of test cases for draw replacement effects

* fix #12616

* track cards drawn this way through multi draw replacement as well

* add test for River Song

* remove redundant comment
2024-08-24 01:02:55 -04:00
Oleg Agafonov
521a0f6e32 GUI: introduced default card hints:
* refactor: added helper emblems instead rad counter's inherent emblems (use initGameDefaultHelperEmblems to define new card hints or other fake objects);
* refactor: added card hints support for emblems, planes and other command objects;
* GUI: added storm counter as default card hint (use hints tool to see it, closes #12360);
2024-07-27 09:40:41 +04:00
ssk97
78649c1a62
Remove KickerAbility.getSpellKickedCount (#12553)
* Remove KickerAbility.getSpellKickedCount

* Check spell LKI instead of only current spell object

* Remove bad LKI storage under wrong ID
2024-07-22 23:13:48 -04:00
Oleg Agafonov
1e2d179410 multiple player/opponent choose - fixed that game ask players in random order instead APNAP (closes #12532);
game: fixed wrong player restore for TestPlayer and SimulatedPlayer2;
2024-07-01 13:22:58 +04:00
xenohedron
fdd244786b refactor: improve method name (related to 86fa9278) 2024-06-13 00:43:51 -04:00
xenohedron
d61de05eb8
refactor: simpler processAction syntax (#12458)
* game.processAction() instead of game.getState().processAction(game)

* add simpler method name and docs

* find/replace to new method

* remove old method

* deprecate applyEffects
2024-06-11 22:55:43 -04:00
Oleg Agafonov
fe4814680e game, AI: fixed bloated logs in AI and other games 2024-06-10 20:29:40 +04:00
xenohedron
0d4acf26e5 refactor: improve method name - checkShortLivingLKI 2024-06-09 22:13:33 -04:00
xenohedron
aeaeccb63b
Fix bugs with dies triggers due to short living LKI reset (#12438)
* replace applyEffects() with processAction() for card usages

* update Goblin Welder and test

* add test for Historian's Wisdom

* enable other related tests

* only reset short living LKI for process action, not all apply effects

* update docs

* remove applyEffects from condition in Historian's Wisdom

* add another test case
2024-06-09 18:56:19 -04:00
Oleg Agafonov
c2ae1386ff server: improved conceding logic with more protection from game errors/freeze (related to #11285, #11460) 2024-06-07 12:52:42 +04:00
Susucre
20b7a115da
prevent direct access of Player->counters ; some cleanup on counter removal effects ; implement [MH3] Izzet Generatorium (#12314) 2024-05-29 22:34:54 +02:00
xenohedron
33fe4730ae
Fix first strike damage logic (#12297)
* add tests for first strike rules

* fix first strike damage logic per 702.7c

* add more test cases

* update logic to not check actual damage dealt

* add another test case

* adjust naming and docs
2024-05-26 20:01:01 -04:00
Susucre
bcff245a31
rework more Prevention Effects involving counters. Implement [PIP] Bloatfly Swarm (#12205) 2024-05-23 19:48:44 +02:00
Susucre
d8959f1588
fix [OTJ] Fortune, Loyal Steed — DelayedAbility's zcc was wrong when started from another trigger (#12154) 2024-05-04 19:26:11 +02:00
Susucre
868cd4d8fd clean all usage of GameEvent::setSourceId 2024-04-28 14:21:43 +02:00
Susucre
9d7bf27d38
[PIP] Implement Rad Counters mechanic (#12087) 2024-04-17 20:04:17 +02:00
Oleg Agafonov
88eb35ebc7 code clean 2024-04-16 23:37:22 +04:00
Oleg Agafonov
e8e2f23284 server: improved server stability (#11285) and reworked triggers/playable logic (#8426):
* game: now all playable calculations done in game simulation, outside real game (no more freeze and ruined games by wrong Nyxbloom Ancient and other cards with wrong replacement dialog);
* game: fixed multiple problems with triggers (wrong order, duplicated calls or "too many mana" bugs, see #8426, #12087);
* tests: added data integrity checks for game's triggers (3 enabled and 3 disabled due current game engine logic);
2024-04-16 23:10:18 +04:00
Oleg Agafonov
367defd995 tests: added tests for non-stack delayed trigger and details docs about problem 2024-04-11 22:46:25 +04:00
Oleg Agafonov
e38a79f231
Face down images and cards rework (#11873)
Face down changes:
* GUI: added visible face down type and real card name for controller/owner (opponent can see it after game ends);
* GUI: added day/night button to view real card for controller/owner (opponent can see it after game ends);
* game: fixed that faced-down card can render symbols, abilities and other hidden data from a real card;
* images: added image support for normal faced-down cards;
* images: added image support for morph and megamorph faced-down cards;
* images: added image support for foretell faced-down cards;

Other changes:
* images: fixed missing tokens from DDD set;
* images: no more client restart to apply newly downloaded images or render settings;
* images: improved backface image quality (use main menu -> symbols to download it);
2024-02-29 01:14:54 +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
Matthew Wilson
0db2599fa5
tests: allow cards to be added to exile during a card test (#11739) 2024-01-31 10:50:04 +04:00
Susucre
3343aebf79 Fix Emblem Cards not adding Watcher to GameState 2024-01-26 13:39:10 +01:00
Evan Kranzler
5a809f6fe4
Implementing "suspected" mechanic (#11670)
* [MKM] Implement Agrus Kos, Spirit of Justice

* rework effects

* [MKM] Implement Airtight Alibi

* [MKM] Implement Convenient Target

* [MKM] Implement Repeat Offender

* add test

* add more tests

* add tooltip for suspected

* implement requested changes
2024-01-25 20:30:51 -05:00
Oleg Agafonov
95481cd736 Mana Maze - fixed game error on usage (closes #11572, closes #11575); 2024-01-13 11:42:22 +04:00
Oleg Agafonov
72d6a7134d Merge fix 2024-01-08 23:28:17 +04:00
Oleg Agafonov
eedb9e6054 server, tests: improved game error and AI logs, added docs, added error stats in load test's result table (related to #11572); 2024-01-08 23:21:44 +04:00
Oleg Agafonov
b3c55555a1 tests: fixed error on load tests end (related to #11572), improved logs, improved session lifecycle on load tests;
tests: added additional test for Mana Maze and deep copy (related to #11572);
docs: added more info to network related code;
2024-01-08 04:14:27 +04:00
xenohedron
1bdacc6676
cleanup: CardsImpl and related (#11585)
* minor cleanup of unused params in ExileZone

* cleanup CardsImpl

standardize logic for different methods

remove unused ownerId param
2023-12-29 22:39:56 -05:00
Oleg Agafonov
d97b034711 cheats: fixed broken emblem commands (example: emblem:Human:ElspethSunsChampionEmblem:1) 2023-12-16 02:25:03 +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
ssk97
f3e310cfd3
Fixed tags cost and MageObjectReference usage (#11500)
* Fix costs tag clearing while permanent still on the battlefield
* Improved version of game.getPermanentOrLKIBattlefield with MageObjectReference
* Improve documentation
2023-12-01 19:24:39 +04:00
xenohedron
201c1ef443 (can't remove PlanarRollWatcher without test rework) 2023-11-30 01:00:48 -05:00
xenohedron
6155f2d403 remove DamageDoneWatcher from default watchers 2023-11-30 00:59:21 -05:00
xenohedron
c164d70135 remove PlayersAttackedThisTurnWatcher from default watchers 2023-11-30 00:56:32 -05:00
xenohedron
1f764515f6 merge MorbidWatcher with CreaturesDiedWatcher 2023-11-30 00:11:10 -05:00
xenohedron
1ac4fe4e4a add doc comments for usage of default watchers 2023-11-29 20:57:12 -05:00
xenohedron
cd439ab8c8 remove another game default watcher with one usage 2023-11-29 20:40:57 -05:00
xenohedron
f801c9851e move watchers used only in Arboria effect 2023-11-29 20:37:47 -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
27c9543f62 The Ring Emblem - fixed not working 3rd effect with blocker sacrifice (closes #11425), added docs and usage example for BLOCKER_DECLARED and CREATURE_BLOCKED game events 2023-11-19 19:16:55 +04: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
Oleg Agafonov
dfbd6627e5 game: fixed miss watchers from second side of transformable cards (closes #11329); 2023-11-06 10:40:05 +04:00