[CLB] Implemented Raised by Giants

This commit is contained in:
Evan Kranzler 2022-05-18 08:19:40 -04:00
parent b2d7afcfe8
commit 6437ca119c
5 changed files with 73 additions and 22 deletions

View file

@ -0,0 +1,48 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.AddCardSubtypeAllEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RaisedByGiants extends CardImpl {
public RaisedByGiants(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.BACKGROUND);
// Commander creatures you own have base power and toughness 10/10 and are Giants in addition to their other types.
Ability ability = new SimpleStaticAbility(new SetPowerToughnessAllEffect(
10, 10, Duration.WhileOnBattlefield,
StaticFilters.FILTER_CREATURES_OWNED_COMMANDER, true
));
ability.addEffect(new AddCardSubtypeAllEffect(
StaticFilters.FILTER_CREATURES_OWNED_COMMANDER,
SubType.GIANT, null
).setText("and are Giants in addition to their other types"));
this.addAbility(ability);
}
private RaisedByGiants(final RaisedByGiants card) {
super(card);
}
@Override
public RaisedByGiants copy() {
return new RaisedByGiants(this);
}
}

View file

@ -48,6 +48,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Mountain", 463, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Passageway Seer", 141, Rarity.UNCOMMON, mage.cards.p.PassagewaySeer.class));
cards.add(new SetCardInfo("Plains", 451, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Raised by Giants", 250, Rarity.RARE, mage.cards.r.RaisedByGiants.class));
cards.add(new SetCardInfo("Reflecting Pool", 358, Rarity.RARE, mage.cards.r.ReflectingPool.class));
cards.add(new SetCardInfo("Roving Harper", 40, Rarity.COMMON, mage.cards.r.RovingHarper.class));
cards.add(new SetCardInfo("Sea of Clouds", 360, Rarity.RARE, mage.cards.s.SeaOfClouds.class));

View file

@ -366,8 +366,10 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
@Override
public void addDependencyType(DependencyType dependencyType) {
if (dependencyType != null) {
dependencyTypes.add(dependencyType);
}
}
@Override
public void setDependedToType(DependencyType dependencyType) {

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -12,33 +10,31 @@ import mage.game.permanent.Permanent;
/**
* @author Galatolol
*/
public class AddCardSubtypeAllEffect extends ContinuousEffectImpl {
private FilterPermanent filter;
private SubType addedSubtype;
private final FilterPermanent filter;
private final SubType addedSubtype;
public AddCardSubtypeAllEffect(FilterPermanent _filter, SubType _addedSubtype, DependencyType _dependency) {
public AddCardSubtypeAllEffect(FilterPermanent filter, SubType addedSubtype, DependencyType dependency) {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
filter = _filter;
staticText = "";
addedSubtype = _addedSubtype;
addDependencyType(_dependency);
this.filter = filter;
this.addedSubtype = addedSubtype;
addDependencyType(dependency);
}
public AddCardSubtypeAllEffect(final AddCardSubtypeAllEffect effect) {
super(effect);
filter = effect.filter.copy();
filter = effect.filter;
addedSubtype = effect.addedSubtype;
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
if (perm != null) {
for (Permanent perm : game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source, game
)) {
perm.addSubType(game, addedSubtype);
}
}
return true;
}
@ -46,5 +42,4 @@ public class AddCardSubtypeAllEffect extends ContinuousEffectImpl {
public AddCardSubtypeAllEffect copy() {
return new AddCardSubtypeAllEffect(this);
}
}

View file

@ -8,10 +8,7 @@ import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.*;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.KickedSpellPredicate;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.filter.predicate.mageobject.*;
import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
@ -631,6 +628,14 @@ public final class StaticFilters {
FILTER_PERMANENT_CREATURES_CONTROLLED.setLockedFilter(true);
}
public static final FilterCreaturePermanent FILTER_CREATURES_OWNED_COMMANDER = new FilterCreaturePermanent("commander creatures you own");
static {
FILTER_CREATURES_OWNED_COMMANDER.add(TargetController.YOU.getOwnerPredicate());
FILTER_CREATURES_OWNED_COMMANDER.add(CommanderPredicate.instance);
FILTER_CREATURES_OWNED_COMMANDER.setLockedFilter(true);
}
public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_NON_BLACK = new FilterCreaturePermanent("nonblack creature");
static {