[LTC] Implement Sam, Loyal Attendant

This commit is contained in:
theelk801 2023-04-22 19:26:32 -04:00
parent 1fab54772f
commit 8a67df77b2
2 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.FoodToken;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SamLoyalAttendant extends CardImpl {
public SamLoyalAttendant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HALFLING);
this.subtype.add(SubType.PEASANT);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Partner with Frodo, Adventurous Hobbit
this.addAbility(new PartnerWithAbility("Frodo, Adventurous Hobbit"));
// At the beginning of combat on your turn, create a Food token.
this.addAbility(new BeginningOfCombatTriggeredAbility(
new CreateTokenEffect(new FoodToken()), TargetController.YOU, false
));
// Activated abilities of Foods you control cost {1} less to activate.
this.addAbility(new SimpleStaticAbility(new SamLoyalAttendantEffect()));
}
private SamLoyalAttendant(final SamLoyalAttendant card) {
super(card);
}
@Override
public SamLoyalAttendant copy() {
return new SamLoyalAttendant(this);
}
}
class SamLoyalAttendantEffect extends CostModificationEffectImpl {
SamLoyalAttendantEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "activated abilities of Foods you control cost {1} less to activate";
}
private SamLoyalAttendantEffect(SamLoyalAttendantEffect effect) {
super(effect);
}
@Override
public SamLoyalAttendantEffect copy() {
return new SamLoyalAttendantEffect(this);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, 1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (!(abilityToModify instanceof ActivatedAbility)) {
return false;
}
Permanent permanent = abilityToModify.getSourcePermanentIfItStillExists(game);
return permanent != null
&& permanent.isControlledBy(source.getControllerId())
&& permanent.hasSubtype(SubType.FOOD, game);
}
}

View file

@ -17,6 +17,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet {
this.hasBasicLands = false; this.hasBasicLands = false;
cards.add(new SetCardInfo("Ensnaring Bridge", 350, Rarity.MYTHIC, mage.cards.e.EnsnaringBridge.class)); cards.add(new SetCardInfo("Ensnaring Bridge", 350, Rarity.MYTHIC, mage.cards.e.EnsnaringBridge.class));
cards.add(new SetCardInfo("Sam, Loyal Attendant", 7, Rarity.MYTHIC, mage.cards.s.SamLoyalAttendant.class));
cards.add(new SetCardInfo("Sol Ring", 284, Rarity.UNCOMMON, mage.cards.s.SolRing.class)); cards.add(new SetCardInfo("Sol Ring", 284, Rarity.UNCOMMON, mage.cards.s.SolRing.class));
cards.add(new SetCardInfo("The Great Henge", 348, Rarity.MYTHIC, mage.cards.t.TheGreatHenge.class)); cards.add(new SetCardInfo("The Great Henge", 348, Rarity.MYTHIC, mage.cards.t.TheGreatHenge.class));
cards.add(new SetCardInfo("Wasteland", 376, Rarity.MYTHIC, mage.cards.w.Wasteland.class)); cards.add(new SetCardInfo("Wasteland", 376, Rarity.MYTHIC, mage.cards.w.Wasteland.class));