mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[VOW] Implemented Ancient Lumberknot
This commit is contained in:
parent
1862ad6a2a
commit
6a3b768ca6
4 changed files with 79 additions and 20 deletions
57
Mage.Sets/src/mage/cards/a/AncientLumberknot.java
Normal file
57
Mage.Sets/src/mage/cards/a/AncientLumberknot.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class AncientLumberknot extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter
|
||||
= new FilterCreaturePermanent("creature you control with toughness greater than its power");
|
||||
|
||||
static {
|
||||
filter.add(AncientLumberknotPredicate.instance);
|
||||
}
|
||||
|
||||
public AncientLumberknot(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{G}");
|
||||
|
||||
this.subtype.add(SubType.TREEFOLK);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Each creature you control with toughness greater than its power assigns combat damage equal to its toughness rather than its power.
|
||||
this.addAbility(new SimpleStaticAbility(new CombatDamageByToughnessEffect(filter, true)));
|
||||
}
|
||||
|
||||
private AncientLumberknot(final AncientLumberknot card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AncientLumberknot copy() {
|
||||
return new AncientLumberknot(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum AncientLumberknotPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input.getToughness().getValue() > input.getPower().getValue();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import mage.MageInt;
|
||||
|
@ -9,7 +8,6 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -37,12 +35,9 @@ public final class DoranTheSiegeTower extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Each creature assigns combat damage equal to its toughness rather than its power.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new CombatDamageByToughnessEffect(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE, false
|
||||
)
|
||||
));
|
||||
this.addAbility(new SimpleStaticAbility(new CombatDamageByToughnessEffect(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE, false
|
||||
)));
|
||||
}
|
||||
|
||||
private DoranTheSiegeTower(final DoranTheSiegeTower card) {
|
||||
|
|
|
@ -33,6 +33,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
|||
|
||||
cards.add(new SetCardInfo("Abrade", 139, Rarity.COMMON, mage.cards.a.Abrade.class));
|
||||
cards.add(new SetCardInfo("Ancestor's Embrace", 22, Rarity.COMMON, mage.cards.a.AncestorsEmbrace.class));
|
||||
cards.add(new SetCardInfo("Ancient Lumberknot", 230, Rarity.UNCOMMON, mage.cards.a.AncientLumberknot.class));
|
||||
cards.add(new SetCardInfo("Angelic Quartermaster", 2, Rarity.UNCOMMON, mage.cards.a.AngelicQuartermaster.class));
|
||||
cards.add(new SetCardInfo("Anje, Maid of Dishonor", 231, Rarity.RARE, mage.cards.a.AnjeMaidOfDishonor.class));
|
||||
cards.add(new SetCardInfo("Apprentice Sharpshooter", 185, Rarity.COMMON, mage.cards.a.ApprenticeSharpshooter.class));
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.abilities.effects.common.ruleModifying;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
@ -20,11 +21,9 @@ public class CombatDamageByToughnessEffect extends ContinuousEffectImpl {
|
|||
private final boolean onlyControlled;
|
||||
|
||||
public CombatDamageByToughnessEffect(FilterCreaturePermanent filter, boolean onlyControlled) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
super(Duration.WhileOnBattlefield, Layer.RulesEffects, SubLayer.NA, Outcome.Detriment);
|
||||
this.filter = filter;
|
||||
this.onlyControlled = onlyControlled;
|
||||
staticText = "Each " + filter.getMessage() + (onlyControlled ? " you control" : "") +
|
||||
" assigns combat damage equal to its toughness rather than its power";
|
||||
}
|
||||
|
||||
private CombatDamageByToughnessEffect(final CombatDamageByToughnessEffect effect) {
|
||||
|
@ -39,11 +38,14 @@ public class CombatDamageByToughnessEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// Change the rule
|
||||
FilterCreaturePermanent filterPermanent = filter.copy();
|
||||
FilterCreaturePermanent filterPermanent;
|
||||
if (onlyControlled) {
|
||||
filterPermanent = filter.copy();
|
||||
filterPermanent.add(new ControllerIdPredicate(source.getControllerId()));
|
||||
} else {
|
||||
filterPermanent = filter;
|
||||
}
|
||||
game.getCombat().setUseToughnessForDamage(true);
|
||||
game.getCombat().addUseToughnessForDamageFilter(filterPermanent);
|
||||
|
@ -51,12 +53,16 @@ public class CombatDamageByToughnessEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.RulesEffects;
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("Each ");
|
||||
sb.append(filter.getMessage());
|
||||
if (onlyControlled && !filter.getMessage().contains("you control")) {
|
||||
sb.append(" you control");
|
||||
}
|
||||
sb.append(" assigns combat damage equal to its toughness rather than its power");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue