Commit Graph

2240 Commits

Author SHA1 Message Date
Hanmac
3f15270d75 ReplaceSplitEffect: update prevent variable on card, not on SpellAbility 2017-01-05 06:39:07 +00:00
Hanmac
126b1c3e7b ReplaceDamage: add DamageTarget param, use it for DamageRedirection and SplitDamage to check if Damage can be redirected 2017-01-05 06:18:47 +00:00
Hanmac
71180403a0 Player: add ReplacementEffect for addCounter (using existing one) 2017-01-03 20:04:57 +00:00
Hanmac
d96a79177b API: add ReplaceSplitDamageEffect its used for Damage splitting like en-Kor 2017-01-03 19:06:48 +00:00
Agetian
7feaa42299 - Code formatting. 2017-01-02 20:33:32 +00:00
Sol
9eeb7cdb11 Add Ludevic Necro-Alchemist (C16) 2017-01-02 02:52:55 +00:00
Hanmac
163cb460ab GameEntity moved addCombatDamage from the other classes there. Also add a more generic AddDamage version 2017-01-01 13:47:22 +00:00
Agetian
beadf13c30 - Added a TODO entry for now. 2017-01-01 09:01:58 +00:00
Agetian
3a285fcd92 - Reverting r32912 for now, more investigation needed. 2017-01-01 08:29:35 +00:00
Agetian
7797224826 - Simpler solution for Boonweaver Giant + Animate Dead 2017-01-01 08:13:38 +00:00
Agetian
451db2a5db - Removed unused import. 2017-01-01 07:18:22 +00:00
Agetian
8d2cf088a0 - Attempting to fix interaction of Boonweaver Giant with cards that can't legally target it (e.g. Animate Dead) such that those auras trying to enchant the creature do not move (per 303.4i/303.4j) and other similar interactions. 2017-01-01 07:17:48 +00:00
Agetian
4d5fae1c6f - Only add avatars to decks if the Vanguard or Momir Basic variant is applied. 2016-12-31 10:58:29 +00:00
Agetian
f105b3f1c1 - Allow the player to draw cards before the game starts (drawing the initial hand, drawing a new hand after a mulligan), fixes Maralen of the Mornsong Avatar. 2016-12-31 10:55:13 +00:00
Agetian
787c8decb7 - Reverting the StaticAbility change for now (PlayerTurn can be used as a type of Defined parameter to define whose turn it should be when the static ability is applied again). 2016-12-31 06:37:05 +00:00
Agetian
fd883c8190 - getDefinedPlayers should use the "Defined" parameter to look for the definition of whose turn it should be, True == You (fixes Gisa and Geralf). 2016-12-31 06:19:02 +00:00
Myrd
5046c00566 One more fix for the TrackableTypes changes. 2016-12-30 19:57:31 +00:00
Myrd
a14a370107 Fix NPE from my previous change to TrackableTypes. 2016-12-30 19:43:40 +00:00
Myrd
18ba55ae27 Attempt to fix memory leak with TrackableTypes.
The problem was that TrackableTypes were all global (held in static variables), but kept around state (objLookup maps) that shouldn't be global - e.g. that could contain per game data. Additionally, it seems this state wasn't always getting cleared correctly and thus would cause leaking of memory over multiple games - which would especially be a problem for Simulated AI code which created temporary games for simulation.

This change attempts to fix the issue by moving the storage of objLookup maps to the Tracker object, which corresponds to a single Game. This way, there is no cross-contamination between different games and the state is properly cleaned up when a Game goes away.
2016-12-30 19:34:07 +00:00
Hanmac
1738f49798 Big Damage Rewrite Part 2: now use CombatDamageMap everywhere 2016-12-30 14:50:45 +00:00
Hanmac
4aa68c3fa6 CardDamageMap: add extra Table class for storeing the damage dealt by Card to GameEntity, might extended with extra functions 2016-12-30 08:08:18 +00:00
Hanmac
71871686a4 ReplaceEffect: make it ready for getting other types like Card or Player 2016-12-30 08:03:31 +00:00
Agetian
03f5f1f42a - Somewhat better explanation for presenceCondition. 2016-12-30 05:47:35 +00:00
Agetian
8a9d80c10c - Check SpellAbility for Presence condition (fixes Dragon Presence cards like Draconic Roar, Dragonlord's Prerogative, Foul-Tongue Invocation and others). 2016-12-30 05:25:56 +00:00
Myrd
0e9b327fd9 [Simulated AI] Fix memory leak caused by SAs making it into the wrong game's spabCache.
The problem was that during copying of SAs, the spabCache was not updated correctly due to the code being in the wrong order. A further problem was that activatingPlayer was not being correctly set on the new abilities, so you would end up referencing a Player from a different Game object from an SA that was in a spabCache, resulting in many previously-simulated Game objects being leaked through this reference chain.

This change fixes both of those problems and also adds a validation function that checks the contents of the spabCache at every game copy.
2016-12-29 22:31:18 +00:00
Myrd
f2204c594a Remove dealtDamageToThisCombat field from Combat class.
Its contents were never used and it was actually causing a problem for simulated AI when the current Combat was copied into a simulated game - as it would contain references to tokens that were killed that were no longer in the game and thus caused a mapping exception.
2016-12-29 18:54:18 +00:00
Hanmac
0b087fc884 AbilityFactory: removed unneeded special cases 2016-12-29 16:15:26 +00:00
Agetian
256f539cb0 - Fixing additional abilities not working for Mana Clash, Fiery Gambit et al. (not created for Repeat/RepeatEach APIs) 2016-12-29 15:51:33 +00:00
Hanmac
c32fbaa94d DamageAllEffect: fixed sourceLKI for Lifelink 2016-12-29 13:16:20 +00:00
Hanmac
21a34b8f3c commit GameEntity i forgot 2016-12-29 12:47:28 +00:00
Hanmac
f891446b8b Combat: fixed assigin damage more than once if damage got replaced 2016-12-29 12:43:36 +00:00
Hanmac
0426896c01 Refactor Damage/CombatDamage/Lifelink, now it works as it should with DamageRedirection/Prevention/Multiplication 2016-12-29 11:33:25 +00:00
Hanmac
c56c8af0bc LifeGain + LifeLost Effect: make AFLifeLost better. No warnings anymore for Gray Merchant of Asphodel 2016-12-29 09:16:55 +00:00
Hanmac
08a2b54e76 fixed Replacement Effects 2016-12-28 15:01:33 +00:00
Hanmac
3629be1a38 Card & Player: update replaceDamage to use new Replacement Effect (not finished yet) 2016-12-28 14:30:52 +00:00
Hanmac
a8fcc7c464 new ReplacementEffect now handles if it got replaced with something else. 2016-12-28 14:14:41 +00:00
Agetian
7f05f08efc - Change a replace call to a put call to satisfy Android SDK demands (fixes Android Forge compilation). 2016-12-27 19:11:11 +00:00
Agetian
e707613ff0 - Fixed Scourge of the Throne 2016-12-27 17:57:43 +00:00
Myrd
d64774dba0 Fix commander casting which I broke in r32823.
Revert to the original implementation of adding the ability to the Game cache in clone(), but now update this in setHostCard() if the new card comes from a different Game object.
2016-12-27 17:24:59 +00:00
Agetian
2344d02085 - Logic fix related to previous commit. 2016-12-27 12:42:15 +00:00
Agetian
2f121ee34e - A somewhat more transparent implementation of DelayedTriggerRemembered fix. 2016-12-27 12:35:17 +00:00
Agetian
47709d4061 - Fixed Arcane Denial, Sapphire Charm and other similar delayed triggers not activating correctly (to make them work it's apparently necessary to check the SA itself first for DelayTriggerRemembered info before searching up the chain in getRootAbility). 2016-12-27 12:21:06 +00:00
Myrd
35014d76f8 Revert my previous change for cloning a SpellAbility.
Looks like setHostCard() is being called when the clone gets added to a card. However, previously the SpellAbility was being added to the Game in clone(), which doesn't work if the cloned ability should be part of a different Game - such as in simulation AI code. So, this change moves that to addSpellAbility().
2016-12-27 06:39:25 +00:00
Myrd
3729533ea9 I think I missed this in my previous commit. 2016-12-27 04:24:59 +00:00
Myrd
0fe2afb3c0 When copying spell-abilities to a new card, update the hostCard.
(Not sure what this affects, but noticed that it wasn't being done.)
2016-12-27 04:20:56 +00:00
Myrd
741d38f50b Make getTargetedString() not have a trailing space. 2016-12-27 04:09:59 +00:00
Myrd
77a526b6d9 [Simulated AI] Fix copying tokens with abilities, like Eldrazi Scions.
Also fixes a bug in the main game code where if you have Clone try to copy a token with abilities, like an Eldrazi Scion, it would previously not get those abilities.

Adds a test for the game simulation/copy case.
2016-12-27 04:09:18 +00:00
Myrd
eafaaf5088 [Simulated AI] Copy combat when copying game state. This fixes an NPE in AI code that expects the Combat object to exist if we're in the corresponding phase. 2016-12-26 17:28:50 +00:00
Hanmac
e2eb916d72 make TokenDoubler use new Replacement Effect 2016-12-26 16:57:28 +00:00
Myrd
32cb5690d3 Reland r32802 (lazy FaceDown characteristic creation) which had an issue with hasAlternateState() which this revision hopefully fixes. 2016-12-26 16:06:12 +00:00