foul-magics/Mage/src/main/java/mage/abilities/common/EndOfCombatTriggeredAbility.java
Susucre f75b1c9f0a
Code cleanup: protect all copy constructors (#10750)
* apply regex to change public copy constructors to protected
* cleanup code using now protected constructors
* fix manaBuilder weird casting of Mana into ConditionalMana
2023-08-04 19:34:58 -04:00

53 lines
1.3 KiB
Java

package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
* @author LevelX2
*/
public class EndOfCombatTriggeredAbility extends TriggeredAbilityImpl {
private final String rule;
public EndOfCombatTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, null);
}
public EndOfCombatTriggeredAbility(Effect effect, boolean optional, String rule) {
super(Zone.BATTLEFIELD, effect, optional);
this.rule = rule;
setTriggerPhrase("At end of combat, ");
}
protected EndOfCombatTriggeredAbility(final EndOfCombatTriggeredAbility ability) {
super(ability);
this.rule = ability.rule;
}
@Override
public EndOfCombatTriggeredAbility copy() {
return new EndOfCombatTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.END_COMBAT_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return true;
}
@Override
public String getRule() {
if (rule != null) {
return rule;
}
return super.getRule();
}
}