mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[DMC] Implemented Baru Wurmspeaker
This commit is contained in:
parent
b14d7d24bb
commit
af0fa56c10
3 changed files with 158 additions and 0 deletions
125
Mage.Sets/src/mage/cards/b/BaruWurmspeaker.java
Normal file
125
Mage.Sets/src/mage/cards/b/BaruWurmspeaker.java
Normal file
|
@ -0,0 +1,125 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
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.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Wurm44Token;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BaruWurmspeaker extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.WURM, "Wurms");
|
||||
private static final FilterPermanent filter2 = new FilterPermanent(SubType.WURM, "");
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Highest power among Wurms you control", BaruWurmspeakerValue.instance
|
||||
);
|
||||
|
||||
public BaruWurmspeaker(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Wurms you control get +2/+2 and have trample.
|
||||
Ability ability = new SimpleStaticAbility(new BoostControlledEffect(
|
||||
2, 2, Duration.WhileOnBattlefield, filter, false
|
||||
));
|
||||
ability.addEffect(new GainAbilityControlledEffect(
|
||||
TrampleAbility.getInstance(), Duration.WhileOnBattlefield, filter2
|
||||
));
|
||||
this.addAbility(ability);
|
||||
|
||||
// {7}{G}, {T}: Create a 4/4 green Wurm creature token. This ability costs {X} less to activate, whre X is the greatest power among Wurms you control.
|
||||
ability = new SimpleActivatedAbility(new CreateTokenEffect(new Wurm44Token()), new ManaCostsImpl<>("{7}{G}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addEffect(new InfoEffect("this ability costs {X} less to activate, " +
|
||||
"where X is the greatest power among Wurms you control"));
|
||||
ability.setCostAdjuster(BaruWurmspeakerAdjuster.instance);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private BaruWurmspeaker(final BaruWurmspeaker card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaruWurmspeaker copy() {
|
||||
return new BaruWurmspeaker(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BaruWurmspeakerValue implements DynamicValue {
|
||||
instance;
|
||||
private static final FilterPermanent filter = new FilterControlledCreaturePermanent(SubType.WURM);
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility, game)
|
||||
.stream()
|
||||
.map(MageObject::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
.max()
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaruWurmspeakerValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
enum BaruWurmspeakerAdjuster implements CostAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int value = BaruWurmspeakerValue.instance.calculate(game, ability, null);
|
||||
if (value > 0) {
|
||||
CardUtil.reduceCost(ability, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ public final class DominariaUnitedCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Atla Palani, Nest Tender", 142, Rarity.RARE, mage.cards.a.AtlaPalaniNestTender.class));
|
||||
cards.add(new SetCardInfo("Bad River", 197, Rarity.UNCOMMON, mage.cards.b.BadRiver.class));
|
||||
cards.add(new SetCardInfo("Baleful Strix", 143, Rarity.RARE, mage.cards.b.BalefulStrix.class));
|
||||
cards.add(new SetCardInfo("Baru, Wurmspeaker", 26, Rarity.RARE, mage.cards.b.BaruWurmspeaker.class));
|
||||
cards.add(new SetCardInfo("Battlefield Forge", 198, Rarity.RARE, mage.cards.b.BattlefieldForge.class));
|
||||
cards.add(new SetCardInfo("Beast Within", 129, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class));
|
||||
cards.add(new SetCardInfo("Bedevil", 144, Rarity.RARE, mage.cards.b.Bedevil.class));
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Wurm44Token extends TokenImpl {
|
||||
|
||||
public Wurm44Token() {
|
||||
super("Wurm Token", "4/4 green Wurm creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setGreen(true);
|
||||
subtype.add(SubType.WURM);
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(4);
|
||||
|
||||
availableImageSetCodes = Arrays.asList("DMU");
|
||||
}
|
||||
|
||||
public Wurm44Token(final Wurm44Token token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public Wurm44Token copy() {
|
||||
return new Wurm44Token(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue