Commit Graph

338 Commits (2733516cb9cdad7ac4cef98b819d4d01846e5c66)

Author SHA1 Message Date
Leandro Doctors 2733516cb9 Organize imports 2020-01-16 08:21:24 +08:00
Martin Petricek bd5ae5fd7a Refactoring (#1543)
* Fix typos.

* Remove unnecessary boxing/unboxing.

* Replace traditional 'for' loops with 'foreach' loops.

* Replace explicit types with <> (diamonds) where they can be inferred.

* Collapse identical catch branches.

* Replace statement lambda with expression lambda for short statements.

* Remove unnecessary imports.

* Replace some lambdas with Comparator.comparing

* Replace Runnables with lambdas.

* Use addAll instead of adding whole collection manually.

* Simplify boolean expressions.

* Remove redundant 'else'.

* Simplify some boolean conditions that are always true or false.

* Inline redundant local variables.

* Remove extraneous semicolons.

* Fix Javadoc errors.

* Replace anonymous classes with lambdas.

* Replace chain of 'if's with switch.

* Remove delaration of exception that is never thrown.

* Use String/StringBuilder properly.
2018-04-08 08:59:14 +08:00
melvinzhang beefc066c8 consider hand/exiles as ordered as it affects future choice of cards in these locations, fixes #1311 2017-09-23 10:25:02 +08:00
melvinzhang 0d0bab259c remove planeswalker uniqueness rule, add legendary to planeswalkers, closes #1275 2017-08-29 17:36:28 +08:00
melvinzhang 3c50b951b4 add isLegal check to SetBlockerAction and other actions, fixes #1156 2017-08-20 11:13:35 +08:00
melvinzhang 8d037d0152 ensure pending triggers go on the stack in APNAP order, fixes #423 2017-08-13 17:47:54 +08:00
melvinzhang 3b6ca41646 split GlobalPreventDamageToTarget into high priority ProtectionShield and low priority PreventDamageShield, fixes #153 2017-08-08 21:50:34 +08:00
melvinzhang 14e94e787e add Suspend trigger for non-creature cards, for #351 2017-08-07 11:13:21 +08:00
melvinzhang be6837044c add effect 'you get an emblem with <abilities>' 2017-08-05 19:13:29 +08:00
melvinzhang 1ceec54539 remove turnTriggers, track whether triggers ends at end of turn in MagicPermanentTrigger 2017-07-30 21:11:39 +08:00
melvinzhang ac42c8acc4 make skipping phases in AI game model optional and disabled by default, for #815 2017-07-29 21:39:58 +08:00
melvinzhang eb925c1922 add MagicGame.addNextCostEvent to be used when cost event are generated from a cost event 2017-07-26 16:30:12 +08:00
lodici d0f18cb57d move general config 'pass' to BooleanSetting. 2017-07-15 23:33:29 +01:00
melvinzhang acbde213a0 costs must be paid before before the effect will occur, for #1177
If a cost becomes unpayable, player has to undo and AI will get a game loss during its simulations.
2017-07-12 22:50:05 +08:00
melvinzhang bbbdcac9ef add override annotation to overridden methods 2017-06-17 11:19:03 +08:00
lodici b4397e1201 remove UI-related and poorly named visiblePlayer reference from MagicGame. 2017-05-14 08:58:43 +01:00
lodici 9e6a2b25d8 remove hard-coded MagicPlayer array elements from MagicGame. 2017-05-14 08:30:43 +01:00
lodici 3d97985934 core code for implementing H2 game stats database (see #1041 for more details). 2017-02-01 12:44:59 +00:00
ShawnieBoy fb4e8fd1be use imports for MurmurHash3 2017-01-28 15:08:10 +00:00
melvinzhang f0195725db reduce updates by only updating between events if the next one has a choice 2016-09-26 21:45:03 +08:00
melvinzhang f7efeca48c use game triggers to implement Monarch triggers, for #826 2016-09-19 11:00:00 +08:00
ShawnieBoy 8211b47f00 use MagicMessage for legend rule 2016-02-18 13:13:15 +00:00
melvinzhang 6055a6b664 remove trailing spaces 2016-01-11 10:49:42 +08:00
melvinzhang 96e453ec42 only allow trigger to be associated with NONE or permanent on the battlefield, remove doValidAction 2016-01-04 10:27:29 +08:00
lodici 357dbaa510 remove reference to MagicGame from MagicSound. 2016-01-03 19:33:53 +00:00
melvinzhang c1a12c97f9 fix bug where only the last cost reduction/increase got applied as input to function is always original cost, fixes #616 2015-12-31 22:24:40 +08:00
melvinzhang c8f1262b45 remove trailing space from java code 2015-12-31 18:54:52 +08:00
melvinzhang e1a48ef015 add support for static effects that increase/decrease mana cost
does not work on additional mana costs such as kicker and {X} in cost
2015-12-29 21:01:16 +08:00
melvinzhang dc2078e36b improve indentation of src code 2015-12-24 12:45:50 +08:00
melvinzhang 72121f789d add doValidAction 2015-12-12 09:14:44 +08:00
ShawnieBoy 6a837fb34c rename MagicWhenOtherComesIntoPlayTrigger to OtherEntersBattlefieldTrigger 2015-11-22 15:36:44 +00:00
ShawnieBoy b84bece3f8 rename MagicPreventDamageTrigger to PreventDamageTrigger 2015-11-22 14:47:27 +00:00
melvinzhang b58936076e pass source from MagicCondition.accept into getNrOfPermanents and controlsPermanent, fixes #467 2015-10-12 20:29:29 +08:00
lodici 24b7e58df2 tokenize card name(s) in "...blocks with..." log message. 2015-09-19 22:04:54 +01:00
lodici 5336166c6c tokenize card name(s) in "...attacks with..." log message. 2015-09-19 19:00:55 +01:00
melvinzhang d124925f61 remove maximum activation limit from MagicActivationHints 2015-07-24 20:40:15 +08:00
melvinzhang 5b97dbd9bb add getNrOfPermanents(MagicPermanentState) 2015-06-04 09:45:13 +08:00
melvinzhang 46d5cb2158 fix skip till end of turn not stopping at end of turn. fixes issue #318 2015-05-30 11:49:58 +08:00
ShawnieBoy f7a52f1206 add logAppendX to MagicGame 2015-05-24 17:31:49 +01:00
ShawnieBoy 228ce970dc add logAppendValue method to MagicGame 2015-05-24 16:49:59 +01:00
melvinzhang 201018db2a replace player and source from getArtificialOptions, getArtificialChoiceResults, and getPlayerChoiceResults 2015-05-16 09:41:33 +08:00
melvinzhang f25f8d6860 replace filter(game) with filter(source) 2015-05-13 11:23:00 +08:00
melvinzhang d6be38ca9a replace game.filterPermanents with .filter 2015-05-10 13:39:34 +08:00
melvinzhang d3a94a4a27 remove MagicGame.filterPlayers 2015-05-09 19:07:16 +08:00
melvinzhang c853f0f316 remove MagicGame.filterCards 2015-05-09 19:06:00 +08:00
melvinzhang 01d36fd539 remove MagicGame.filterItemOnStack and MagicGame.filterTargets 2015-05-09 17:22:48 +08:00
melvinzhang 74f65a134e use large id for global prevent so it occurs last as it uses up the prevent damage on a permanent 2015-05-02 19:59:25 +08:00
melvinzhang 3e797def5b use EnqueueTriggerAction instead of PutItemOnStackAction for state trigger so they go onto the stack when a player has priority 2015-05-02 13:30:48 +08:00
melvinzhang b72f7010a4 ensure prevent damage trigger and prevent damage shield act at the same time
move preventDamage check in DealDamageAction to MagicPreventDamageTrigger GlobalPreventDamageToTarget,
move prevent damage triggers to MagicPreventDamageTrigger
2015-05-02 09:42:45 +08:00
melvinzhang 21f085fda4 include token in MagicCard.getStateId 2015-04-29 23:28:28 +08:00