mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Implement [LTC] Lothlorien Blade
This commit is contained in:
parent
448375a527
commit
367cf9169c
5 changed files with 138 additions and 83 deletions
|
|
@ -1,12 +1,10 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeAttachedCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.AttachedPermanentPowerCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DamageAllEffect;
|
||||
|
|
@ -14,15 +12,15 @@ import mage.abilities.keyword.EnchantAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
|
|
@ -41,7 +39,7 @@ public final class BloodfireInfusion extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// {R}, Sacrifice enchanted creature: Bloodfire Infusion deals damage equal to the sacrificed creature's power to each creature.
|
||||
Effect effect = new DamageAllEffect(new AttachedPermanentPowerCount(), new FilterCreaturePermanent());
|
||||
Effect effect = new DamageAllEffect(AttachedPermanentPowerCount.instance, new FilterCreaturePermanent());
|
||||
effect.setText("{this} deals damage equal to the sacrificed creature's power to each creature");
|
||||
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{R}"));
|
||||
ability2.addCost(new SacrificeAttachedCost());
|
||||
|
|
@ -58,34 +56,3 @@ public final class BloodfireInfusion extends CardImpl {
|
|||
return new BloodfireInfusion(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AttachedPermanentPowerCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Permanent attachment = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
|
||||
if (attachment == null) {
|
||||
return 0;
|
||||
}
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(attachment.getAttachedTo());
|
||||
if (permanent != null && (permanent.getPower().getValue() >= 0)) {
|
||||
return permanent.getPower().getValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachedPermanentPowerCount copy() {
|
||||
return new AttachedPermanentPowerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "enchanted creature's power";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
83
Mage.Sets/src/mage/cards/l/LothlorienBlade.java
Normal file
83
Mage.Sets/src/mage/cards/l/LothlorienBlade.java
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAttachedTriggeredAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.dynamicvalue.common.AttachedPermanentPowerCount;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class LothlorienBlade extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
private static final FilterControlledCreaturePermanent filterElf = new FilterControlledCreaturePermanent(SubType.ELF, "Elf");
|
||||
|
||||
static {
|
||||
filter.add(LothlorienBladePredicate.instance);
|
||||
}
|
||||
|
||||
public LothlorienBlade(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Whenever equipped creature attacks, it deals damage equal to its power to target creature defending player controls.
|
||||
Ability ability = new AttacksAttachedTriggeredAbility(new DamageTargetEffect(AttachedPermanentPowerCount.instance)
|
||||
.setText("it deals damage equal to its power to target creature defending player controls"));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Equip Elf {2}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), new TargetControlledCreaturePermanent(filterElf), false));
|
||||
|
||||
// Equip {5}
|
||||
this.addAbility(new EquipAbility(5, false));
|
||||
|
||||
}
|
||||
|
||||
private LothlorienBlade(final LothlorienBlade card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LothlorienBlade copy() {
|
||||
return new LothlorienBlade(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LothlorienBladePredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return Optional.ofNullable(input.getSource().getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(uuid -> game.getCombat().getDefendingPlayerId(uuid, game))
|
||||
.map(input.getObject()::isControlledBy)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +1,22 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.AttachedPermanentPowerCount;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.permanent.token.SoldierToken;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -39,7 +35,7 @@ public final class MurderInvestigation extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When enchanted creature dies, create X 1/1 white Soldier creature tokens, where X is its power.
|
||||
this.addAbility(new DiesAttachedTriggeredAbility(new CreateTokenEffect(new SoldierToken(), new AttachedPermanentPowerCount()), "enchanted creature"));
|
||||
this.addAbility(new DiesAttachedTriggeredAbility(new CreateTokenEffect(new SoldierToken(), AttachedPermanentPowerCount.instance), "enchanted creature"));
|
||||
}
|
||||
|
||||
private MurderInvestigation(final MurderInvestigation card) {
|
||||
|
|
@ -51,38 +47,3 @@ public final class MurderInvestigation extends CardImpl {
|
|||
return new MurderInvestigation(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AttachedPermanentPowerCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId());
|
||||
if (attachmentPermanent == null) {
|
||||
attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getSourceObjectZoneChangeCounter());
|
||||
}
|
||||
if (attachmentPermanent != null && attachmentPermanent.getAttachedTo() != null) {
|
||||
if (effect.getValue("attachedTo") != null) {
|
||||
Permanent attached = (Permanent)effect.getValue("attachedTo");
|
||||
if (attached != null) {
|
||||
return attached.getPower().getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachedPermanentPowerCount copy() {
|
||||
return new AttachedPermanentPowerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "its power";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Lord of the Nazgul", 60, Rarity.RARE, mage.cards.l.LordOfTheNazgul.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Lord of the Nazgul", 142, Rarity.RARE, mage.cards.l.LordOfTheNazgul.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Lossarnach Captain", 16, Rarity.RARE, mage.cards.l.LossarnachCaptain.class));
|
||||
cards.add(new SetCardInfo("Lothlorien Blade", 77, Rarity.RARE, mage.cards.l.LothlorienBlade.class));
|
||||
cards.add(new SetCardInfo("Marshal's Anthem", 172, Rarity.RARE, mage.cards.m.MarshalsAnthem.class));
|
||||
cards.add(new SetCardInfo("Mentor of the Meek", 173, Rarity.RARE, mage.cards.m.MentorOfTheMeek.class));
|
||||
cards.add(new SetCardInfo("Merciless Executioner", 204, Rarity.UNCOMMON, mage.cards.m.MercilessExecutioner.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public enum AttachedPermanentPowerCount implements DynamicValue {
|
||||
instance;
|
||||
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Permanent attachment = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
|
||||
if (attachment == null) {
|
||||
return 0;
|
||||
}
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(attachment.getAttachedTo());
|
||||
if (permanent != null && (permanent.getPower().getValue() >= 0)) {
|
||||
return permanent.getPower().getValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachedPermanentPowerCount copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "its power";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue