mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[TDC] Implement Broodcaller Scourge
This commit is contained in:
parent
69a8a1c041
commit
1ace958057
3 changed files with 90 additions and 0 deletions
76
Mage.Sets/src/mage/cards/b/BroodcallerScourge.java
Normal file
76
Mage.Sets/src/mage/cards/b/BroodcallerScourge.java
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.OneOrMoreDamagePlayerTriggeredAbility;
|
||||
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BroodcallerScourge extends CardImpl {
|
||||
|
||||
private static final FilterCard filter
|
||||
= new FilterPermanentCard("a permanent card with mana value less than or equal to that damage");
|
||||
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(SubType.DRAGON, "Dragons");
|
||||
|
||||
static {
|
||||
filter.add(BroodcallerScourgePredicate.instance);
|
||||
}
|
||||
|
||||
public BroodcallerScourge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
|
||||
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(7);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever one or more Dragons you control deal combat damage to a player, you may put a permanent card with mana value less than or equal to that damage from your hand onto the battlefield.
|
||||
this.addAbility(new OneOrMoreDamagePlayerTriggeredAbility(
|
||||
new PutCardFromHandOntoBattlefieldEffect(filter),
|
||||
filter2, true, true
|
||||
));
|
||||
}
|
||||
|
||||
private BroodcallerScourge(final BroodcallerScourge card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BroodcallerScourge copy() {
|
||||
return new BroodcallerScourge(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BroodcallerScourgePredicate implements ObjectSourcePlayerPredicate<Card> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
return input
|
||||
.getObject()
|
||||
.getManaValue()
|
||||
<= CardUtil
|
||||
.getEffectValueFromAbility(
|
||||
input.getSource(), "damage",
|
||||
Integer.class, 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -61,6 +61,7 @@ public final class TarkirDragonstormCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bone Devourer", 26, Rarity.RARE, mage.cards.b.BoneDevourer.class));
|
||||
cards.add(new SetCardInfo("Boros Signet", 314, Rarity.UNCOMMON, mage.cards.b.BorosSignet.class));
|
||||
cards.add(new SetCardInfo("Bountiful Landscape", 342, Rarity.COMMON, mage.cards.b.BountifulLandscape.class));
|
||||
cards.add(new SetCardInfo("Broodcaller Scourge", 44, Rarity.RARE, mage.cards.b.BroodcallerScourge.class));
|
||||
cards.add(new SetCardInfo("Caldera Pyremaw", 33, Rarity.RARE, mage.cards.c.CalderaPyremaw.class));
|
||||
cards.add(new SetCardInfo("Canopy Gargantuan", 45, Rarity.RARE, mage.cards.c.CanopyGargantuan.class));
|
||||
cards.add(new SetCardInfo("Canopy Vista", 343, Rarity.RARE, mage.cards.c.CanopyVista.class));
|
||||
|
|
|
|||
|
|
@ -2236,6 +2236,19 @@ public final class CardUtil {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public static <T> T getEffectValueFromAbility(Ability ability, String key, Class<T> clazz) {
|
||||
return getEffectValueFromAbility(ability, key, clazz, null);
|
||||
}
|
||||
|
||||
public static <T> T getEffectValueFromAbility(Ability ability, String key, Class<T> clazz, T defaultValue) {
|
||||
return castStream(
|
||||
ability.getAllEffects()
|
||||
.stream()
|
||||
.map(effect -> effect.getValue(key)),
|
||||
clazz
|
||||
).findFirst().orElse(defaultValue);
|
||||
}
|
||||
|
||||
public static <T> Stream<T> castStream(Collection<?> collection, Class<T> clazz) {
|
||||
return castStream(collection.stream(), clazz);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue