mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 04:09:54 -08:00
BoostEnchantedEffect enhanced with DynamicValue
This commit is contained in:
parent
b9c9532724
commit
e1a05a7e4b
4 changed files with 53 additions and 80 deletions
|
|
@ -31,35 +31,41 @@ package mage.sets.magic2011;
|
|||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Layer;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.SubLayer;
|
||||
import mage.Constants.TargetController;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @author BetaSteward_at_googlemail.com, North
|
||||
*/
|
||||
public class EarthServant extends CardImpl<EarthServant> {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("Mountain you control");
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Mountain");
|
||||
filter.setTargetController(TargetController.YOU);
|
||||
}
|
||||
|
||||
public EarthServant(UUID ownerId) {
|
||||
super(ownerId, 134, "Earth Servant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{R}");
|
||||
this.expansionSetCode = "M11";
|
||||
this.subtype.add("Elemental");
|
||||
|
||||
this.color.setRed(true);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EarthServantEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new PermanentsOnBattlefieldCount(filter, 0),
|
||||
new PermanentsOnBattlefieldCount(filter, 1),
|
||||
Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
public EarthServant(final EarthServant card) {
|
||||
|
|
@ -72,58 +78,3 @@ public class EarthServant extends CardImpl<EarthServant> {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class EarthServantEffect extends ContinuousEffectImpl<EarthServantEffect> {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("Mountain");
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Mountain");
|
||||
}
|
||||
|
||||
public EarthServantEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
}
|
||||
|
||||
public EarthServantEffect(final EarthServantEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EarthServantEffect copy() {
|
||||
return new EarthServantEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanent(source.getSourceId());
|
||||
if (creature != null) {
|
||||
switch (layer) {
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.ModifyPT_7c) {
|
||||
int amount = game.getBattlefield().countAll(filter, source.getControllerId());
|
||||
creature.addToughness(amount);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == layer.PTChangingEffects_7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
return "Earth Servant gets +0/+1 for each Mountain you control";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,6 @@ import mage.Constants.Duration;
|
|||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continious.BoostEnchantedEffect;
|
||||
|
|
@ -58,8 +57,7 @@ public class DefensiveStance extends CardImpl<DefensiveStance> {
|
|||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(-1, 1, Duration.WhileOnBattlefield)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue