* Marionette Master and Mortis Dogs, fixed that power below 0 caused life gain.

This commit is contained in:
LevelX2 2016-12-31 17:41:12 +01:00
parent 68a6920b63
commit df0cd60fbc
3 changed files with 24 additions and 7 deletions

View file

@ -48,7 +48,7 @@ import mage.target.common.TargetOpponent;
public class MarionetteMaster extends CardImpl {
public MarionetteMaster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
this.subtype.add("Human");
this.subtype.add("Artificer");
this.power = new MageInt(1);
@ -58,7 +58,7 @@ public class MarionetteMaster extends CardImpl {
this.addAbility(new FabricateAbility(3));
// Whenever an artifact you control is put into a graveyard from the battlefield, target opponent loses life equal to Marionette Master's power.
Effect effect = new LoseLifeTargetEffect(new SourcePermanentPowerCount());
Effect effect = new LoseLifeTargetEffect(new SourcePermanentPowerCount(false));
effect.setText("target opponent loses life equal to Marionette Master's power");
Ability ability = new PutIntoGraveFromBattlefieldAllTriggeredAbility(effect, false, new FilterControlledArtifactPermanent("an artifact you control"), false);
ability.addTarget(new TargetOpponent());

View file

@ -48,7 +48,7 @@ import mage.target.TargetPlayer;
public class MortisDogs extends CardImpl {
public MortisDogs(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add("Hound");
this.power = new MageInt(2);
@ -57,7 +57,7 @@ public class MortisDogs extends CardImpl {
// Whenever Mortis Dogs attacks, it gets +2/+0 until end of turn.
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn), false));
// When Mortis Dogs dies, target player loses life equal to its power.
Ability ability = new DiesTriggeredAbility(new LoseLifeTargetEffect(new SourcePermanentPowerCount()));
Ability ability = new DiesTriggeredAbility(new LoseLifeTargetEffect(new SourcePermanentPowerCount(false)));
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
@ -70,4 +70,4 @@ public class MortisDogs extends CardImpl {
public MortisDogs copy() {
return new MortisDogs(this);
}
}
}

View file

@ -11,10 +11,27 @@ import mage.game.permanent.Permanent;
*/
public class SourcePermanentPowerCount implements DynamicValue {
boolean allowNegativeValues;
public SourcePermanentPowerCount() {
this(true);
}
public SourcePermanentPowerCount(boolean allowNegativeValues) {
super();
this.allowNegativeValues = allowNegativeValues;
}
public SourcePermanentPowerCount(final SourcePermanentPowerCount dynamicValue) {
super();
this.allowNegativeValues = dynamicValue.allowNegativeValues;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
if (sourcePermanent != null) {
if (sourcePermanent != null
&& (allowNegativeValues || sourcePermanent.getPower().getValue() >= 0)) {
return sourcePermanent.getPower().getValue();
}
return 0;
@ -22,7 +39,7 @@ public class SourcePermanentPowerCount implements DynamicValue {
@Override
public SourcePermanentPowerCount copy() {
return new SourcePermanentPowerCount();
return new SourcePermanentPowerCount(this);
}
@Override