mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fixed Chimeric Mass.
Also fixed the BecomesCreature effects. In case the token had another ability with a SetPT effect there would have been two effects on the same layer and the outcome would not be predictable.
This commit is contained in:
parent
e851fb4d8e
commit
775b3276c9
3 changed files with 28 additions and 56 deletions
|
@ -27,27 +27,29 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.scarsofmirrodin;
|
package mage.sets.scarsofmirrodin;
|
||||||
|
|
||||||
import mage.Constants.*;
|
import java.util.UUID;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Duration;
|
||||||
|
import mage.Constants.Outcome;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.Constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
|
||||||
import mage.abilities.dynamicvalue.common.CountersCount;
|
import mage.abilities.dynamicvalue.common.CountersCount;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
|
||||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect;
|
import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect;
|
||||||
|
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -109,39 +111,8 @@ class ChimericMassToken extends Token {
|
||||||
super("", "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"");
|
super("", "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"");
|
||||||
cardType.add(CardType.CREATURE);
|
cardType.add(CardType.CREATURE);
|
||||||
subtype.add("Construct");
|
subtype.add("Construct");
|
||||||
power = MageInt.EmptyMageInt;
|
power = new MageInt(0);
|
||||||
toughness = MageInt.EmptyMageInt;
|
toughness = new MageInt(0);
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ChimericMassTokenEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new CountersCount(CounterType.CHARGE), Duration.WhileOnBattlefield)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChimericMassTokenEffect extends ContinuousEffectImpl<ChimericMassTokenEffect> {
|
|
||||||
|
|
||||||
private DynamicValue counters = new CountersCount(CounterType.CHARGE);
|
|
||||||
|
|
||||||
public ChimericMassTokenEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChimericMassTokenEffect(final ChimericMassTokenEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChimericMassTokenEffect copy() {
|
|
||||||
return new ChimericMassTokenEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent token = game.getPermanent(source.getSourceId());
|
|
||||||
if (token != null) {
|
|
||||||
int count = counters.calculate(game, source);
|
|
||||||
token.getPower().setValue(count);
|
|
||||||
token.getToughness().setValue(count);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -33,7 +33,6 @@ import mage.Constants.Duration;
|
||||||
import mage.Constants.Layer;
|
import mage.Constants.Layer;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.SubLayer;
|
import mage.Constants.SubLayer;
|
||||||
import mage.MageInt;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -81,7 +80,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == "" || type == null) {
|
if ("".equals(type) || type == null) {
|
||||||
permanent.getSubtype().clear();
|
permanent.getSubtype().clear();
|
||||||
}
|
}
|
||||||
if (token.getSubtype().size() > 0) {
|
if (token.getSubtype().size() > 0) {
|
||||||
|
@ -106,10 +105,12 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
||||||
break;
|
break;
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
if (token.getPower() != MageInt.EmptyMageInt)
|
int power = token.getPower().getValue();
|
||||||
permanent.getPower().setValue(token.getPower().getValue());
|
int toughness = token.getToughness().getValue();
|
||||||
if (token.getToughness() != MageInt.EmptyMageInt)
|
if (power != 0 && toughness != 0) {
|
||||||
permanent.getToughness().setValue(token.getToughness().getValue());
|
permanent.getPower().setValue(power);
|
||||||
|
permanent.getToughness().setValue(toughness);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -131,7 +132,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,12 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import mage.Constants;
|
import java.util.UUID;
|
||||||
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Duration;
|
import mage.Constants.Duration;
|
||||||
import mage.Constants.Layer;
|
import mage.Constants.Layer;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.SubLayer;
|
import mage.Constants.SubLayer;
|
||||||
import mage.MageInt;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
@ -40,8 +40,6 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +75,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl<BecomesCre
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
if (token.getCardType().size() > 0) {
|
if (token.getCardType().size() > 0) {
|
||||||
for (Constants.CardType t : token.getCardType()) {
|
for (CardType t : token.getCardType()) {
|
||||||
if (!permanent.getCardType().contains(t)) {
|
if (!permanent.getCardType().contains(t)) {
|
||||||
permanent.getCardType().add(t);
|
permanent.getCardType().add(t);
|
||||||
}
|
}
|
||||||
|
@ -108,10 +106,12 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl<BecomesCre
|
||||||
break;
|
break;
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
if (token.getPower() != MageInt.EmptyMageInt)
|
int power = token.getPower().getValue();
|
||||||
permanent.getPower().setValue(token.getPower().getValue());
|
int toughness = token.getToughness().getValue();
|
||||||
if (token.getToughness() != MageInt.EmptyMageInt)
|
if (power != 0 && toughness != 0) {
|
||||||
permanent.getToughness().setValue(token.getToughness().getValue());
|
permanent.getPower().setValue(power);
|
||||||
|
permanent.getToughness().setValue(toughness);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl<BecomesCre
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue