From bbfda7c479d56c152720a78dce4e26f9187bf502 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:08:22 +0000 Subject: [PATCH] [FDN] Implement Banner of Kinship --- .../src/mage/cards/b/BannerOfKinship.java | 113 ++++++++++++++++++ Mage.Sets/src/mage/sets/Foundations.java | 3 + .../main/java/mage/counters/CounterType.java | 1 + 3 files changed, 117 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BannerOfKinship.java diff --git a/Mage.Sets/src/mage/cards/b/BannerOfKinship.java b/Mage.Sets/src/mage/cards/b/BannerOfKinship.java new file mode 100644 index 000000000000..816d2def063b --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BannerOfKinship.java @@ -0,0 +1,113 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class BannerOfKinship extends CardImpl { + + public BannerOfKinship(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "5"); + + // As this artifact enters, choose a creature type. This artifact enters with a fellowship counter on it for each creature you control of the chosen type. + AsEntersBattlefieldAbility ability = new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature)); + ability.addEffect(new BannerOfKinshipEffect()); + this.addAbility(ability); + + // Creatures you control of the chosen type get +1/+1 for each fellowship counter on this artifact. + this.addAbility(new SimpleStaticAbility(new BannerOfKinshipBoostEffect())); + } + + private BannerOfKinship(final BannerOfKinship card) { + super(card); + } + + @Override + public BannerOfKinship copy() { + return new BannerOfKinship(this); + } +} + +class BannerOfKinshipEffect extends OneShotEffect { + + BannerOfKinshipEffect() { + super(Outcome.BoostCreature); + this.staticText = "This artifact enters with a fellowship counter on it for each creature you control of the chosen type"; + } + + private BannerOfKinshipEffect(final BannerOfKinshipEffect effect) { + super(effect); + } + + @Override + public BannerOfKinshipEffect copy() { + return new BannerOfKinshipEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanentEntering(source.getSourceId()); + if (controller == null || permanent == null) { + return false; + } + SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); + int amount = game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(subtype), source.getControllerId(), game).size(); + if (amount > 0) { + permanent.addCounters(CounterType.FELLOWSHIP.createInstance(amount), source.getControllerId(), source, game); + } + return true; + } +} + +class BannerOfKinshipBoostEffect extends ContinuousEffectImpl { + + BannerOfKinshipBoostEffect() { + super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature); + staticText = "Creatures you control of the chosen type get +1/+1 for each fellowship counter on this artifact"; + } + + private BannerOfKinshipBoostEffect(final BannerOfKinshipBoostEffect effect) { + super(effect); + } + + @Override + public BannerOfKinshipBoostEffect copy() { + return new BannerOfKinshipBoostEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type"); + if (subtype != null) { + for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game)) { + if (perm.hasSubtype(subtype, game)) { + int boost = permanent.getCounters(game).getCount(CounterType.FELLOWSHIP); + perm.addPower(boost); + perm.addToughness(boost); + } + } + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Foundations.java b/Mage.Sets/src/mage/sets/Foundations.java index 13f782234a49..feff446ad97c 100644 --- a/Mage.Sets/src/mage/sets/Foundations.java +++ b/Mage.Sets/src/mage/sets/Foundations.java @@ -60,6 +60,9 @@ private Foundations() { cards.add(new SetCardInfo("Ballyrush Banneret", 567, Rarity.COMMON, mage.cards.b.BallyrushBanneret.class)); cards.add(new SetCardInfo("Balmor, Battlemage Captain", 237, Rarity.UNCOMMON, mage.cards.b.BalmorBattlemageCaptain.class)); cards.add(new SetCardInfo("Banishing Light", 138, Rarity.COMMON, mage.cards.b.BanishingLight.class)); + cards.add(new SetCardInfo("Banner of Kinship", 127, Rarity.RARE, mage.cards.b.BannerOfKinship.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Banner of Kinship", 352, Rarity.RARE, mage.cards.b.BannerOfKinship.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Banner of Kinship", 484, Rarity.RARE, mage.cards.b.BannerOfKinship.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Basilisk Collar", 669, Rarity.RARE, mage.cards.b.BasiliskCollar.class)); cards.add(new SetCardInfo("Battle-Rattle Shaman", 533, Rarity.UNCOMMON, mage.cards.b.BattleRattleShaman.class)); cards.add(new SetCardInfo("Battlesong Berserker", 78, Rarity.UNCOMMON, mage.cards.b.BattlesongBerserker.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index d1003b4bce01..dcb5353e8b3d 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -81,6 +81,7 @@ public enum CounterType { FATE("fate"), FEATHER("feather"), FEEDING("feeding"), + FELLOWSHIP("fellowship"), FETCH("fetch"), FILIBUSTER("filibuster"), FINALITY("finality"),