mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
[VOW] Implemented Screaming Swarm
This commit is contained in:
parent
7970eecc47
commit
10185a0999
3 changed files with 123 additions and 3 deletions
111
Mage.Sets/src/mage/cards/s/ScreamingSwarm.java
Normal file
111
Mage.Sets/src/mage/cards/s/ScreamingSwarm.java
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.MillCardsTargetEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ScreamingSwarm extends CardImpl {
|
||||||
|
|
||||||
|
public ScreamingSwarm(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.BIRD);
|
||||||
|
this.subtype.add(SubType.HORROR);
|
||||||
|
this.power = new MageInt(4);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever you attack with one or more creatures, target player mills that many cards.
|
||||||
|
Ability ability = new AttacksWithCreaturesTriggeredAbility(
|
||||||
|
new MillCardsTargetEffect(ScreamingSwarmValue.instance)
|
||||||
|
.setText("target player mills that many cards"),
|
||||||
|
0
|
||||||
|
).setTriggerPhrase("Whenever you attack with one or more creatures, ");
|
||||||
|
ability.addTarget(new TargetPlayer());
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
// {2}{U}: Put Screaming Swarm from your graveyard into your library second from the top.
|
||||||
|
this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ScreamingSwarmEffect(), new ManaCostsImpl<>("{2}{U}")));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScreamingSwarm(final ScreamingSwarm card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreamingSwarm copy() {
|
||||||
|
return new ScreamingSwarm(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ScreamingSwarmValue implements DynamicValue {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
|
return (Integer) effect.getValue("attackers");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreamingSwarmValue copy() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ScreamingSwarmEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
ScreamingSwarmEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "put {this} from your graveyard into your library second from the top";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScreamingSwarmEffect(final ScreamingSwarmEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreamingSwarmEffect copy() {
|
||||||
|
return new ScreamingSwarmEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
|
||||||
|
return player != null
|
||||||
|
&& sourceObject instanceof Card
|
||||||
|
&& player.putCardOnTopXOfLibrary(
|
||||||
|
(Card) sourceObject, game, source, 2, true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -246,6 +246,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Savage Packmate", 234, Rarity.UNCOMMON, mage.cards.s.SavagePackmate.class));
|
cards.add(new SetCardInfo("Savage Packmate", 234, Rarity.UNCOMMON, mage.cards.s.SavagePackmate.class));
|
||||||
cards.add(new SetCardInfo("Sawblade Slinger", 217, Rarity.UNCOMMON, mage.cards.s.SawbladeSlinger.class));
|
cards.add(new SetCardInfo("Sawblade Slinger", 217, Rarity.UNCOMMON, mage.cards.s.SawbladeSlinger.class));
|
||||||
cards.add(new SetCardInfo("Scattered Thoughts", 74, Rarity.COMMON, mage.cards.s.ScatteredThoughts.class));
|
cards.add(new SetCardInfo("Scattered Thoughts", 74, Rarity.COMMON, mage.cards.s.ScatteredThoughts.class));
|
||||||
|
cards.add(new SetCardInfo("Screaming Swarm", 75, Rarity.UNCOMMON, mage.cards.s.ScreamingSwarm.class));
|
||||||
cards.add(new SetCardInfo("Selhoff Entomber", 76, Rarity.COMMON, mage.cards.s.SelhoffEntomber.class));
|
cards.add(new SetCardInfo("Selhoff Entomber", 76, Rarity.COMMON, mage.cards.s.SelhoffEntomber.class));
|
||||||
cards.add(new SetCardInfo("Serpentine Ambush", 77, Rarity.COMMON, mage.cards.s.SerpentineAmbush.class));
|
cards.add(new SetCardInfo("Serpentine Ambush", 77, Rarity.COMMON, mage.cards.s.SerpentineAmbush.class));
|
||||||
cards.add(new SetCardInfo("Shattered Sanctum", 264, Rarity.RARE, mage.cards.s.ShatteredSanctum.class));
|
cards.add(new SetCardInfo("Shattered Sanctum", 264, Rarity.RARE, mage.cards.s.ShatteredSanctum.class));
|
||||||
|
|
|
@ -49,14 +49,22 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return isControlledBy(game.getCombat().getAttackingPlayerId())
|
if (!isControlledBy(game.getCombat().getAttackingPlayerId())) {
|
||||||
&& game
|
return false;
|
||||||
|
}
|
||||||
|
int attackers = game
|
||||||
.getCombat()
|
.getCombat()
|
||||||
.getAttackers()
|
.getAttackers()
|
||||||
.stream()
|
.stream()
|
||||||
.map(game::getPermanent)
|
.map(game::getPermanent)
|
||||||
.filter(permanent -> filter.match(permanent, sourceId, controllerId, game))
|
.filter(permanent -> filter.match(permanent, sourceId, controllerId, game))
|
||||||
.mapToInt(x -> 1).sum() >= minAttackers;
|
.mapToInt(x -> 1)
|
||||||
|
.sum();
|
||||||
|
if (attackers < minAttackers) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
getEffects().setValue("attackers", attackers);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue