Commit Graph

6452 Commits (master)

Author SHA1 Message Date
Mike 648806f1d8 add AiStrCal tool to compare AI implementations 2020-01-17 08:26:14 +08:00
Leandro Doctors 2733516cb9 Organize imports 2020-01-16 08:21:24 +08:00
Bilbo a6e97873fd Optimize mesage generation.
* Use faster stringbuilder for card token formatting instead of full-blown formatter.
* When SN/RN/PN and similar placeholders are expanded, calculate the replacement
  value only if the placeholder is present in the string.
   In a test with some random games:
    55.4M times replaceName was called
    39.2M times SN was present
     2.0M times PN was present
     0.2M times RN was present
     0.2M times X was present
* Generate event description on demand, instead on event construction.
   In a test with some random games:
   71.601M times description is generated
    0.258M time it is actually read or used
 By postponing generating the description to a point when it is actually needed,
 CPU time spent when going through possible actions is reduced to about 80%,
 so in given amount of time, MMAB AI and similar
 is able to examine larger part of the possible game states.
2019-12-13 05:25:23 +01:00
Ada Joule 217bee1bc6 Make Riot grant Haste forever 2019-02-12 00:11:07 +07:00
melvinzhang 8b8d590cd6 replace clunky comparison using getId with isFriend 2019-01-16 19:58:02 +08:00
Ada Joule 460a51da88 Merge branch 'spectacle' 2019-01-16 17:44:54 +07:00
Ada Joule 0b35c1d557 Add EntersSpectacleEffect to MagicAbility 2019-01-16 17:43:57 +07:00
Ada Joule 542cbb9c89 Change Spectacle cost to mana cost instead of just cost 2019-01-16 17:40:44 +07:00
Ada Joule f6e4a18cde Fix error 2019-01-16 17:36:11 +07:00
Ada Joule fcb38517b3 Add Addendum condition 2019-01-16 17:27:05 +07:00
Ada Joule e42b42c829 Add Adapt to effect script 2019-01-16 17:09:54 +07:00
Ada Joule 357eeb284b Add Spectacle mechanic 2019-01-16 03:58:06 +07:00
Ada Joule 50b97bd746 Add Afterlife [number] to ability script 2019-01-16 03:31:46 +07:00
Ada Joule be00f393ea Add imports 2019-01-16 03:31:32 +07:00
Ada Joule 866d374441 Add Afterlife trigger 2019-01-16 03:28:08 +07:00
Ada Joule 4690cbe4b8 Add Riot ability to script 2019-01-16 03:14:25 +07:00
Ada Joule 0efcab7f0d Add Riot trigger 2019-01-16 03:13:56 +07:00
Ada Joule 1f84ef595b Use addFirstEvent instead of addEvent for explore
This fixes the Jadelight Ranger bug
2018-11-28 03:55:05 +07:00
Ada Joule 2ff0e11de6 Use getGameCost() instead of getCost() 2018-11-26 19:32:44 +08:00
Ada Joule 81d0562f0f Move mana cost to the Jump-start event 2018-11-26 19:32:44 +08:00
Ada Joule 13ae81e0e2 Add Jump-start to MagicAbility.java 2018-11-26 19:32:44 +08:00
Ada Joule 6e03b1ceb3 Add MagicJumpStartActivation.java 2018-11-26 19:32:44 +08:00
Ada Joule b4e2e742a1 Rename ReturnCardAction to PutOntoBattlefieldAction
fixes #1632
2018-11-26 05:19:37 +07:00
Ada Joule 8c1901072c Add Mentor mechanic 2018-11-15 18:48:09 +08:00
Ada Joule b90a1c5a17 Add permanent CMCEQ to target filter parser 2018-11-12 18:30:08 +08:00
Ada Joule 8ccca8aa3d Add corpse counter to MagicPlayMod 2018-11-12 18:30:08 +08:00
Ada Joule 1d7bdc0cbb Add "when you become targeted" ability 2018-11-12 18:30:08 +08:00
melvinzhang 3e02c92f3c reduce nesting using 'else if' and merging condition of nested if, for #1630 2018-11-04 10:08:08 +08:00
Bilbo ce02d4afbb Refactor: Use Collections.singletonList instead of Arrays.asList where appropriate. 2018-11-04 10:05:25 +08:00
Bilbo 28732e250a Implement cost reduction to apply for most cases of reducing hybrid/split/phyrexian cost.
Extend unit test with those cases.
2018-11-04 10:05:25 +08:00
Bilbo dd3f975c9d Cost increasing abilities were put into wrong layer.
Fix YourCostIncrease and CostIncrease ignoring reduction cost/amount.
Enhance cost reduction to support colored-mana-cost reduction.
2018-11-02 11:55:24 +08:00
Bilbo 5aaa5ddc02 Make surveil trigger unconditional, as unlike scry, there is no "pseudo-surveil" action. 2018-10-25 09:45:13 +08:00
Bilbo 27545e5df1 Move exception rethrowing closer to the cause. 2018-10-25 09:45:13 +08:00
Bilbo 07b23d478e If a card could not be parsed due to missing abilities, report name of the card in the exception.
Without this change you would not have known which card is unparseable.

before:
ScriptParseException: unknown ability "Menace"

after:
InvalidDeckException: Error parsing Dimir Spybug: unknown ability "Menace"
2018-10-25 09:45:13 +08:00
Bilbo 7a29fc561a Add support for "surveil 1" action and "Whenever you surveil" triggers 2018-10-25 09:45:13 +08:00
melvinzhang 09680d733e simplify AbstractMillAction, remove setCardsToMill have subclass override getMilledCards 2018-10-22 21:22:23 +08:00
Martin Petricek d7e856da68 Add several new cards (#1619)
* Add several new cards:

Balustrade Spy
Corpse Augur
Galvanoth
Gift of Growth
Living Artifact
Marchesa, the Black Rose
Phytotitan
Pyromancer's Assault
Settle the Score

* Fix indentation in Galvanoth

* Refactor Pyromancer's Assault, remove trigger condition from action text.

* Generalize milling actions to fixed amount milling and "mill until certain number of cartain cards are milled".

* Refactor cards to use new MillLibraryUntilAction

* Add parser for MillLibraryUntilAction, so it can be used without need for groovy.

* Add new parseable cards:
Mind Funeral
Consuming Aberration
Destroy the Evidence
Undercity Informer
(no groovy needed)

* Balustrade Spy now does not need groovy anymore.
2018-10-22 21:09:12 +08:00
ShawnieBoy 310fcac9a9 include "this spell" in casting restriction 2018-08-10 15:41:42 +01:00
ShawnieBoy a0bf0c4502 include "This spell" in alternate costs 2018-08-10 15:35:55 +01:00
ShawnieBoy 9567f6f1ec include "This spell" in cost modifications 2018-08-10 14:10:55 +01:00
ShawnieBoy 3a38aaf2e5 include "this spell" in additional costs 2018-08-07 19:21:09 +01:00
ShawnieBoy 5537e925c9 update "SN can't be countered" to "This spell can't be countered" 2018-08-07 15:47:41 +01:00
ShawnieBoy 74b0200c71 add NEG_TARGET_PLAYER_OR_PLANESWALKER 2018-08-07 14:46:24 +01:00
ShawnieBoy 3d9133e294 add "player or planeswalker" to MagicTargetFilterFactory 2018-08-07 14:14:12 +01:00
ShawnieBoy 1cc80e6ae4 add Jaya and Vivien to planeswalker subtypes 2018-08-07 13:39:46 +01:00
ShawnieBoy 7b15f79f9d include "their" in MagicRuleEventAction DiscardHand 2018-08-07 12:33:16 +01:00
ShawnieBoy ce52e31a25 add Egg to subtypes 2018-08-07 12:32:15 +01:00
Martin Petricek 413a5a2230 Unlimited-number cards (#1593)
* Store list of "can be any times in deck" cards in one central location. Add Rat Colony to the list.

* Add Rat Colony
2018-06-21 10:39:27 +08:00
Ada Joule d213884dc2 Add Saga mechanic (#1564)
* Add AtBeginOfFirstMainPhaseTrigger and adding lore counter to saga

* Make add counter trigger more generic

* Change begin main phase trigger to Saga-specific

* Add magic.data.RomanToInt

* Add chapter parsing to ARG

* Add SagaChapterTrigger

* Add chapter ability to MagicAbility

* Add lore counter mechanic to Saga card definiton

* Add Saga sacrifice state-based action

* Fix import

* Fix getPendingTriggers

* Add History of Benalia

* Fix adding ETB trigger

* Remove AtBeginningOfFirstMainPhaseTrigger.Saga, Add counters directly in MagicMainPhase.executeBeginStep()

* Remove null case from RomanToInt

* Revert "Remove AtBeginningOfFirstMainPhaseTrigger.Saga, Add counters directly in MagicMainPhase.executeBeginStep()"

This reverts commit d8e5d1f253ab7b54f401f4151b44d39ee927f44c.

* Move isSaga method to IRenderableCard
2018-05-04 14:17:55 +08:00
melvinzhang 62f4e84e00 only change unknown cards during showRandomizedHandAndLibrary, fixes #1506 2018-04-15 12:03:04 +08:00