mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed import (compilation error fix)
This commit is contained in:
parent
b81992bf9d
commit
925e879fb0
1 changed files with 16 additions and 17 deletions
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.abilities.decorator;
|
package mage.abilities.decorator;
|
||||||
|
|
||||||
import com.sun.istack.internal.Nullable;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -36,48 +35,48 @@ import mage.game.Game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds condition to {@link OneShotEffect}. Acts as decorator.
|
* Adds condition to {@link OneShotEffect}. Acts as decorator.
|
||||||
*
|
*
|
||||||
* @author maurer.it_at_gmail.com
|
* @author maurer.it_at_gmail.com
|
||||||
*/
|
*/
|
||||||
public class ConditionalOneShotEffect extends OneShotEffect<ConditionalOneShotEffect> {
|
public class ConditionalOneShotEffect extends OneShotEffect<ConditionalOneShotEffect> {
|
||||||
|
|
||||||
private OneShotEffect effect;
|
private OneShotEffect effect;
|
||||||
private OneShotEffect otherwiseEffect;
|
private OneShotEffect otherwiseEffect;
|
||||||
private Condition condition;
|
private Condition condition;
|
||||||
|
|
||||||
public ConditionalOneShotEffect ( OneShotEffect effect, Condition condition, String text ) {
|
public ConditionalOneShotEffect(OneShotEffect effect, Condition condition, String text) {
|
||||||
this(effect, null, condition, text);
|
this(effect, null, condition, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConditionalOneShotEffect ( OneShotEffect effect, OneShotEffect otherwiseEffect, Condition condition, String text ) {
|
public ConditionalOneShotEffect(OneShotEffect effect, OneShotEffect otherwiseEffect, Condition condition, String text) {
|
||||||
super(effect.getOutcome());
|
super(effect.getOutcome());
|
||||||
this.effect = effect;
|
this.effect = effect;
|
||||||
this.otherwiseEffect = otherwiseEffect;
|
this.otherwiseEffect = otherwiseEffect;
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
this.staticText = text;
|
this.staticText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConditionalOneShotEffect ( ConditionalOneShotEffect effect ) {
|
public ConditionalOneShotEffect(ConditionalOneShotEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.effect = (OneShotEffect) effect.effect.copy();
|
this.effect = (OneShotEffect) effect.effect.copy();
|
||||||
if (effect.otherwiseEffect != null)
|
if (effect.otherwiseEffect != null)
|
||||||
this.otherwiseEffect = (OneShotEffect) effect.otherwiseEffect.copy();
|
this.otherwiseEffect = (OneShotEffect) effect.otherwiseEffect.copy();
|
||||||
this.condition = effect.condition;
|
this.condition = effect.condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply ( Game game, Ability source ) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if ( condition.apply(game, source) ) {
|
if (condition.apply(game, source)) {
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
} else if (otherwiseEffect != null) {
|
} else if (otherwiseEffect != null) {
|
||||||
return otherwiseEffect.apply(game, source);
|
return otherwiseEffect.apply(game, source);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConditionalOneShotEffect copy ( ) {
|
public ConditionalOneShotEffect copy() {
|
||||||
return new ConditionalOneShotEffect ( this );
|
return new ConditionalOneShotEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue