Implemented Octopus Umbra

This commit is contained in:
Evan Kranzler 2018-07-25 12:39:06 -04:00
parent b3786358c7
commit 7c6dfe3e56
3 changed files with 91 additions and 4 deletions

View file

@ -0,0 +1,76 @@
package mage.cards.o;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessEnchantedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.TotemArmorAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
/**
*
* @author TheElk801
*/
public final class OctopusUmbra extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power 8 or less");
static {
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 9));
}
public OctopusUmbra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}");
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 has base power and toughness 8/8 and has "Whenever this creature attacks, you may tap target creature with power 8 or less."
Ability abilityToAdd = new AttacksTriggeredAbility(new TapTargetEffect(), true);
abilityToAdd.addTarget(new TargetCreaturePermanent(filter));
ability = new SimpleStaticAbility(
Zone.BATTLEFIELD,
new SetPowerToughnessEnchantedEffect(8, 8)
);
ability.addEffect(new GainAbilityAttachedEffect(
abilityToAdd, AttachmentType.AURA
).setText("and has \"Whenever this creature attacks, "
+ "you may tap target creature with power 8 or less.\""));
this.addAbility(ability);
// Totem armor
this.addAbility(new TotemArmorAbility());
}
public OctopusUmbra(final OctopusUmbra card) {
super(card);
}
@Override
public OctopusUmbra copy() {
return new OctopusUmbra(this);
}
}

View file

@ -47,6 +47,7 @@ public final class Commander2018 extends ExpansionSet {
cards.add(new SetCardInfo("Loyal Guardian", 31, Rarity.UNCOMMON, mage.cards.l.LoyalGuardian.class));
cards.add(new SetCardInfo("Loyal Subordinate", 16, Rarity.UNCOMMON, mage.cards.l.LoyalSubordinate.class));
cards.add(new SetCardInfo("Nesting Dragon", 24, Rarity.RARE, mage.cards.n.NestingDragon.class));
cards.add(new SetCardInfo("Octopus Umbra", 11, Rarity.RARE, mage.cards.o.OctopusUmbra.class));
cards.add(new SetCardInfo("Rampaging Baloths", 158, Rarity.RARE, mage.cards.r.RampagingBaloths.class));
cards.add(new SetCardInfo("Retrofitter Foundry", 57, Rarity.RARE, mage.cards.r.RetrofitterFoundry.class));
cards.add(new SetCardInfo("Ruinous Path", 117, Rarity.RARE, mage.cards.r.RuinousPath.class));

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -16,13 +15,24 @@ import mage.game.permanent.Permanent;
*/
public class SetPowerToughnessEnchantedEffect extends ContinuousEffectImpl {
private final int power;
private final int toughness;
public SetPowerToughnessEnchantedEffect() {
this(0, 2);
}
public SetPowerToughnessEnchantedEffect(int power, int toughness) {
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature);
staticText = "Enchanted creature has base power and toughness 0/2";
staticText = "Enchanted creature has base power and toughness " + power + "/" + toughness;
this.power = power;
this.toughness = toughness;
}
public SetPowerToughnessEnchantedEffect(final SetPowerToughnessEnchantedEffect effect) {
super(effect);
this.power = effect.power;
this.toughness = effect.toughness;
}
@Override
@ -36,8 +46,8 @@ public class SetPowerToughnessEnchantedEffect extends ContinuousEffectImpl {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
if (enchanted != null) {
enchanted.getPower().setValue(0);
enchanted.getToughness().setValue(2);
enchanted.getPower().setValue(power);
enchanted.getToughness().setValue(toughness);
}
return true;
}