mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
implement [TDM] All-Out Assault (#13512)
- new main phase condition - Added when you attack delayed triggered ability
This commit is contained in:
parent
6d9079b2d2
commit
482745928e
18 changed files with 173 additions and 129 deletions
|
|
@ -0,0 +1,49 @@
|
|||
package mage.abilities.common.delayed;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
* @author androosss
|
||||
*/
|
||||
public class WhenYouAttackDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||
|
||||
public WhenYouAttackDelayedTriggeredAbility(Effect effect) {
|
||||
this(effect, Duration.EndOfTurn);
|
||||
}
|
||||
|
||||
public WhenYouAttackDelayedTriggeredAbility(Effect effect, Duration duration) {
|
||||
this(effect, duration, false);
|
||||
}
|
||||
|
||||
public WhenYouAttackDelayedTriggeredAbility(Effect effect, Duration duration, boolean triggerOnlyOnce) {
|
||||
super(effect, duration, triggerOnlyOnce);
|
||||
setTriggerPhrase((triggerOnlyOnce ? "When you next" : "Whenever you") + " attack"
|
||||
+ (duration == Duration.EndOfTurn ? " this turn, " : ", "));
|
||||
}
|
||||
|
||||
protected WhenYouAttackDelayedTriggeredAbility(final WhenYouAttackDelayedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WhenYouAttackDelayedTriggeredAbility copy() {
|
||||
return new WhenYouAttackDelayedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
UUID attackerId = game.getCombat().getAttackingPlayerId();
|
||||
return attackerId != null && attackerId.equals(getControllerId()) && !game.getCombat().getAttackers().isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author androosss
|
||||
*/
|
||||
public enum IsMainPhaseCondition implements Condition {
|
||||
|
||||
YOUR(true),
|
||||
ANY(false);
|
||||
|
||||
private final boolean yourMainPhaseOnly;
|
||||
|
||||
IsMainPhaseCondition(boolean yourMainPhaseOnly) {
|
||||
this.yourMainPhaseOnly = yourMainPhaseOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game.getTurnPhaseType().isMain() &&
|
||||
(!yourMainPhaseOnly || game.getActivePlayerId().equals(source.getControllerId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "it's" + (yourMainPhaseOnly ? " your " : " ") + "main phase";
|
||||
}
|
||||
}
|
||||
|
|
@ -35,8 +35,7 @@ public class AddCombatAndMainPhaseEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// 15.07.2006 If it's somehow not a main phase when Fury of the Horde resolves, all it does is untap all creatures that attacked that turn. No new phases are created.
|
||||
if (game.getTurnPhaseType() == TurnPhase.PRECOMBAT_MAIN
|
||||
|| game.getTurnPhaseType() == TurnPhase.POSTCOMBAT_MAIN) {
|
||||
if (game.getTurnPhaseType().isMain()) {
|
||||
// we can't add two turn modes at once, will add additional post combat on delayed trigger resolution
|
||||
TurnMod combat = new TurnMod(source.getControllerId()).withExtraPhase(TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN);
|
||||
game.getState().getTurnMods().add(combat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue