mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
performance: added day/night performance test for transform ability (disabled by default, see DayNightTest, related to #11285), added day/night rules ref
This commit is contained in:
parent
70c79fd6a6
commit
d6c858ecaf
4 changed files with 68 additions and 0 deletions
|
|
@ -51,6 +51,8 @@ class DayboundEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!game.hasDayNight()) {
|
||||
// 702.145d
|
||||
// Any time a player controls a permanent with daybound, if it’s neither day nor night, it becomes day.
|
||||
game.setDaytime(true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ class NightboundEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!game.hasDayNight()) {
|
||||
// 702.145f
|
||||
// Any time a player controls a permanent that is back face up with nightbound and it’s day,
|
||||
// that player transforms that permanent. This happens immediately and isn’t a state-based action.
|
||||
game.setDaytime(false);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,15 @@ public class UntapStep extends Step {
|
|||
@Override
|
||||
public void beginStep(Game game, UUID activePlayerId) {
|
||||
super.beginStep(game, activePlayerId);
|
||||
|
||||
// 726.2.
|
||||
// As the second part of the untap step, the game checks the previous turn to see
|
||||
// if the game’s day/night designation should change. See rule 502, “Untap Step.”
|
||||
//
|
||||
// Before a player untaps their permanents during the untap step, the game checks to see
|
||||
// if the day/night designation should change. (2021-09-24)
|
||||
handleDayNight(game);
|
||||
|
||||
Player activePlayer = game.getPlayer(activePlayerId);
|
||||
//20091005 - 502.1/703.4a
|
||||
activePlayer.phasing(game);
|
||||
|
|
@ -52,8 +60,18 @@ public class UntapStep extends Step {
|
|||
.getWatcher(CastSpellLastTurnWatcher.class)
|
||||
.getActivePlayerPrevTurnCount();
|
||||
if (game.checkDayNight(true) && previousSpells == 0) {
|
||||
// 726.2a
|
||||
// If it’s day and the previous turn’s active player didn’t cast any spells during that turn,
|
||||
// it becomes night. Multiplayer games using the shared team turns option (see rule 805)
|
||||
// use a modified rule: if it’s day and no player from the previous turn’s active team cast a
|
||||
// spell during that turn, it becomes night.
|
||||
game.setDaytime(false);
|
||||
} else if (game.checkDayNight(false) && previousSpells >= 2) {
|
||||
// 726.2b
|
||||
// If it’s night, and previous turn’s active player cast two or more spells during the previous turn,
|
||||
// it becomes day. Multiplayer games using the shared team turns option (see rule 805) use a modified
|
||||
// rule: if it’s night and any player from the previous turn’s active team cast two or more spells
|
||||
// during that turn, it becomes day.
|
||||
game.setDaytime(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue