mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
Implemented Treefolk Umbra
This commit is contained in:
parent
753f5d639d
commit
526a3b0b0f
2 changed files with 97 additions and 0 deletions
96
Mage.Sets/src/mage/cards/t/TreefolkUmbra.java
Normal file
96
Mage.Sets/src/mage/cards/t/TreefolkUmbra.java
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.TotemArmorAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TreefolkUmbra extends CardImpl {
|
||||
|
||||
public TreefolkUmbra(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature gets +0/+2 and assigns combat damage equal to its toughness rather than its power.
|
||||
ability = new SimpleStaticAbility(new BoostEnchantedEffect(0, 2));
|
||||
ability.addEffect(new TreefolkUmbraEffect());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Totem armor
|
||||
this.addAbility(new TotemArmorAbility());
|
||||
}
|
||||
|
||||
private TreefolkUmbra(final TreefolkUmbra card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreefolkUmbra copy() {
|
||||
return new TreefolkUmbra(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TreefolkUmbraEffect extends ContinuousEffectImpl {
|
||||
|
||||
TreefolkUmbraEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "and assigns combat damage equal to its toughness rather than its power";
|
||||
}
|
||||
|
||||
private TreefolkUmbraEffect(final TreefolkUmbraEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreefolkUmbraEffect copy() {
|
||||
return new TreefolkUmbraEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null || permanent.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new PermanentIdPredicate(permanent.getAttachedTo()));
|
||||
game.getCombat().setUseToughnessForDamage(true);
|
||||
game.getCombat().addUseToughnessForDamageFilter(filter);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.RulesEffects;
|
||||
}
|
||||
}
|
||||
|
|
@ -236,6 +236,7 @@ public final class ModernHorizons extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Throes of Chaos", 150, Rarity.UNCOMMON, mage.cards.t.ThroesOfChaos.class));
|
||||
cards.add(new SetCardInfo("Thundering Djinn", 215, Rarity.UNCOMMON, mage.cards.t.ThunderingDjinn.class));
|
||||
cards.add(new SetCardInfo("Tranquil Thicket", 248, Rarity.UNCOMMON, mage.cards.t.TranquilThicket.class));
|
||||
cards.add(new SetCardInfo("Treefolk Umbra", 185, Rarity.COMMON, mage.cards.t.TreefolkUmbra.class));
|
||||
cards.add(new SetCardInfo("Treetop Ambusher", 186, Rarity.COMMON, mage.cards.t.TreetopAmbusher.class));
|
||||
cards.add(new SetCardInfo("Tribute Mage", 73, Rarity.UNCOMMON, mage.cards.t.TributeMage.class));
|
||||
cards.add(new SetCardInfo("Trumpeting Herd", 187, Rarity.COMMON, mage.cards.t.TrumpetingHerd.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue