mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Vastwood Animist - Fixed a bug that the activated ability was not correctly implemented as a P/T setting effect (fixes #600).
This commit is contained in:
parent
e34d428d97
commit
1e20d00f41
1 changed files with 42 additions and 16 deletions
|
@ -28,27 +28,29 @@
|
||||||
package mage.sets.worldwake;
|
package mage.sets.worldwake;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
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.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
|
||||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect;
|
import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledLandPermanent;
|
import mage.filter.common.FilterControlledLandPermanent;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -69,7 +71,7 @@ public class VastwoodAnimist extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// {tap}: Target land you control becomes an X/X Elemental creature until end of turn, where X is the number of Allies you control. It's still a land.
|
// {tap}: Target land you control becomes an X/X Elemental creature until end of turn, where X is the number of Allies you control. It's still a land.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new ElementalLandToken(), "land", Duration.EndOfTurn), new TapSourceCost());
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new VastwoodAnimistEffect(), new TapSourceCost());
|
||||||
ability.addTarget(new TargetControlledPermanent(filter));
|
ability.addTarget(new TargetControlledPermanent(filter));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
@ -84,21 +86,45 @@ public class VastwoodAnimist extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ElementalLandToken extends Token {
|
class VastwoodAnimistEffect extends OneShotEffect {
|
||||||
|
|
||||||
final static FilterControlledPermanent filterAllies = new FilterControlledPermanent("allies you control");
|
final static FilterControlledPermanent filterAllies = new FilterControlledPermanent("allies you control");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterAllies.add(new SubtypePredicate("Ally"));
|
filterAllies.add(new SubtypePredicate("Ally"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementalLandToken() {
|
public VastwoodAnimistEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "Target land you control becomes an X/X Elemental creature until end of turn, where X is the number of Allies you control. It's still a land.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public VastwoodAnimistEffect(final VastwoodAnimistEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VastwoodAnimistEffect copy() {
|
||||||
|
return new VastwoodAnimistEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
int amount = new PermanentsOnBattlefieldCount(filterAllies).calculate(game, source, this);
|
||||||
|
ContinuousEffect effect = new BecomesCreatureTargetEffect(new VastwoodAnimistElementalToken(amount), "land", Duration.EndOfTurn);
|
||||||
|
effect.setTargetPointer(targetPointer);
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VastwoodAnimistElementalToken extends Token {
|
||||||
|
|
||||||
|
|
||||||
|
VastwoodAnimistElementalToken(int amount) {
|
||||||
super("", "X/X Elemental creature, where X is the number of Allies you control");
|
super("", "X/X Elemental creature, where X is the number of Allies you control");
|
||||||
cardType.add(CardType.CREATURE);
|
cardType.add(CardType.CREATURE);
|
||||||
subtype.add("Elemental");
|
subtype.add("Elemental");
|
||||||
power = new MageInt(0);
|
power = new MageInt(amount);
|
||||||
toughness = new MageInt(0);
|
toughness = new MageInt(amount);
|
||||||
DynamicValue controlledAllies = new PermanentsOnBattlefieldCount(filterAllies);
|
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(controlledAllies, controlledAllies, Duration.WhileOnBattlefield)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue