foul-magics/Mage/src/main/java/mage/abilities/effects/common/RemoveSpecialActionEffect.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

46 lines
1.1 KiB
Java

package mage.abilities.effects.common;
import java.util.UUID;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.SpecialAction;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
/**
* @author BetaSteward_at_googlemail.com
*/
public class RemoveSpecialActionEffect extends OneShotEffect {
protected UUID actionId;
public RemoveSpecialActionEffect(UUID actionId) {
super(Outcome.Neutral);
this.actionId = actionId;
}
protected RemoveSpecialActionEffect(final RemoveSpecialActionEffect effect) {
super(effect);
this.actionId = effect.actionId;
}
@Override
public RemoveSpecialActionEffect copy() {
return new RemoveSpecialActionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (SpecialAction action : game.getState().getSpecialActions()) {
if (action.getId().equals(actionId)) {
game.getState().getSpecialActions().remove(action);
break;
}
}
return true;
}
}