mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* Figure of Destiny - Fixed that effects didn't work correctly if Figure returned to battlefield.
This commit is contained in:
parent
dec4794fbc
commit
2b916a5dfb
2 changed files with 33 additions and 10 deletions
|
@ -63,17 +63,32 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl<Conditional
|
|||
|
||||
public ConditionalContinousEffect(final ConditionalContinousEffect effect) {
|
||||
super(effect);
|
||||
this.effect = effect.effect;
|
||||
this.otherwiseEffect = effect.otherwiseEffect;
|
||||
this.effect = (ContinuousEffect) effect.effect.copy();
|
||||
if (otherwiseEffect != null) {
|
||||
this.otherwiseEffect = (ContinuousEffect) effect.otherwiseEffect.copy();
|
||||
}
|
||||
this.condition = effect.condition;
|
||||
this.lockedInCondition = effect.lockedInCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
if (lockedInCondition && !(condition instanceof FixedCondition)) {
|
||||
public boolean isDiscarded() {
|
||||
return effect.isDiscarded() || (otherwiseEffect != null && otherwiseEffect.isDiscarded());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
if (lockedInCondition) {
|
||||
condition = new FixedCondition(condition.apply(game, source));
|
||||
}
|
||||
effect.init(source, game);
|
||||
if (otherwiseEffect != null) {
|
||||
otherwiseEffect.init(source, game);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
if (condition.apply(game, source)) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
return effect.apply(layer, sublayer, source, game);
|
||||
|
|
|
@ -28,8 +28,10 @@
|
|||
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
@ -47,6 +49,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
|||
|
||||
protected Token token;
|
||||
protected String type;
|
||||
protected int zoneChangeCounter;
|
||||
|
||||
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
|
||||
super(duration, Outcome.BecomeCreature);
|
||||
|
@ -59,6 +62,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
|||
super(effect);
|
||||
this.token = effect.token.copy();
|
||||
this.type = effect.type;
|
||||
this.zoneChangeCounter = effect.zoneChangeCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,12 +74,16 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
|||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
this.getAffectedObjects().add(source.getSourceId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
this.zoneChangeCounter = permanent.getZoneChangeCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if (permanent != null && permanent.getZoneChangeCounter() == this.zoneChangeCounter) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
|
@ -112,11 +120,11 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
|||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
int power = token.getPower().getValue();
|
||||
int toughness = token.getToughness().getValue();
|
||||
if (power != 0 && toughness != 0) {
|
||||
permanent.getPower().setValue(power);
|
||||
permanent.getToughness().setValue(toughness);
|
||||
MageInt power = token.getPower();
|
||||
MageInt toughness = token.getToughness();
|
||||
if (power != null && toughness != null) {
|
||||
permanent.getPower().setValue(power.getValue());
|
||||
permanent.getToughness().setValue(toughness.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue