forked from External/mage
Rework "second main phase" abilities (#12970)
* replace all instances of "postcombat main phase" with "second main phase" minus exceptions * second main trigger now works correctly * add survival test * additional text fixes
This commit is contained in:
parent
3131365abd
commit
1484e3b575
39 changed files with 339 additions and 115 deletions
|
|
@ -1,28 +1,26 @@
|
|||
package mage.abilities.abilityword;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfSecondMainTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* TODO: This should only trigger on the second main phase, this is part of a larger refactor that has to be done
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class SurvivalAbility extends TriggeredAbilityImpl {
|
||||
public class SurvivalAbility extends BeginningOfSecondMainTriggeredAbility {
|
||||
|
||||
public SurvivalAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public SurvivalAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
super(Zone.BATTLEFIELD, effect, TargetController.YOU, optional, false);
|
||||
setTriggerPhrase("At the beginning of your second main phase, if {this} is tapped, ");
|
||||
setAbilityWord(AbilityWord.SURVIVAL);
|
||||
}
|
||||
|
|
@ -36,20 +34,10 @@ public class SurvivalAbility extends TriggeredAbilityImpl {
|
|||
return new SurvivalAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.POSTCOMBAT_MAIN_PHASE_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return game.isActivePlayer(getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return Optional
|
||||
.ofNullable(getSourcePermanentIfItStillExists(game))
|
||||
.ofNullable(getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::isTapped)
|
||||
.orElse(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue