mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Pursued Whale
This commit is contained in:
parent
686d6e1777
commit
7cf52ce136
3 changed files with 168 additions and 0 deletions
120
Mage.Sets/src/mage/cards/p/PursuedWhale.java
Normal file
120
Mage.Sets/src/mage/cards/p/PursuedWhale.java
Normal file
|
@ -0,0 +1,120 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.PursuedWhaleToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PursuedWhale extends CardImpl {
|
||||
|
||||
public PursuedWhale(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
|
||||
|
||||
this.subtype.add(SubType.WHALE);
|
||||
this.power = new MageInt(8);
|
||||
this.toughness = new MageInt(8);
|
||||
|
||||
// When Pursued Whale enters the battlefield, each opponent creates a 1/1 red Pirate creature token with "This creature can't block" and "Creatures you control attack each combat if able."
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new PursuedWhaleTokenEffect()));
|
||||
|
||||
// Spells your opponents cast that target Pursued Whale cost {3} more to cast.
|
||||
this.addAbility(new SimpleStaticAbility(new PursuedWhaleCostIncreaseEffect()));
|
||||
}
|
||||
|
||||
private PursuedWhale(final PursuedWhale card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PursuedWhale copy() {
|
||||
return new PursuedWhale(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PursuedWhaleTokenEffect extends OneShotEffect {
|
||||
|
||||
private static final Token token = new PursuedWhaleToken();
|
||||
|
||||
PursuedWhaleTokenEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "each opponent creates a 1/1 red Pirate creature token with " +
|
||||
"\"This creature can't block\" and \"Creatures you control attack each combat if able.\"";
|
||||
}
|
||||
|
||||
private PursuedWhaleTokenEffect(final PursuedWhaleTokenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PursuedWhaleTokenEffect copy() {
|
||||
return new PursuedWhaleTokenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), playerId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class PursuedWhaleCostIncreaseEffect extends CostModificationEffectImpl {
|
||||
|
||||
PursuedWhaleCostIncreaseEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
|
||||
staticText = "Spells your opponents cast that target {this} cost {3} more to cast";
|
||||
}
|
||||
|
||||
private PursuedWhaleCostIncreaseEffect(PursuedWhaleCostIncreaseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
SpellAbility spellAbility = (SpellAbility) abilityToModify;
|
||||
CardUtil.adjustCost(spellAbility, -3);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (!(abilityToModify instanceof SpellAbility)
|
||||
|| !game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
return abilityToModify
|
||||
.getModes()
|
||||
.getSelectedModes()
|
||||
.stream()
|
||||
.map(uuid -> abilityToModify.getModes().get(uuid))
|
||||
.map(Mode::getTargets)
|
||||
.flatMap(Collection::stream)
|
||||
.map(Target::getTargets)
|
||||
.flatMap(Collection::stream)
|
||||
.anyMatch(uuid -> uuid.equals(source.getSourceId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PursuedWhaleCostIncreaseEffect copy() {
|
||||
return new PursuedWhaleCostIncreaseEffect(this);
|
||||
}
|
||||
}
|
|
@ -97,6 +97,7 @@ public final class CoreSet2021 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Plains", 309, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Predatory Wurm", 338, Rarity.UNCOMMON, mage.cards.p.PredatoryWurm.class));
|
||||
cards.add(new SetCardInfo("Pridemalkin", 196, Rarity.COMMON, mage.cards.p.Pridemalkin.class));
|
||||
cards.add(new SetCardInfo("Pursued Whale", 60, Rarity.RARE, mage.cards.p.PursuedWhale.class));
|
||||
cards.add(new SetCardInfo("Quirion Dryad", 198, Rarity.UNCOMMON, mage.cards.q.QuirionDryad.class));
|
||||
cards.add(new SetCardInfo("Radiant Fountain", 248, Rarity.COMMON, mage.cards.r.RadiantFountain.class));
|
||||
cards.add(new SetCardInfo("Rain of Revelation", 61, Rarity.UNCOMMON, mage.cards.r.RainOfRevelation.class));
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect;
|
||||
import mage.abilities.effects.common.combat.CantBlockSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PursuedWhaleToken extends TokenImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
}
|
||||
|
||||
public PursuedWhaleToken() {
|
||||
super("Pirate", "1/1 red Pirate creature token with \"This creature can't block\" and \"Creatures you control attack each combat if able.\"");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setRed(true);
|
||||
subtype.add(SubType.PIRATE);
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(new CantBlockSourceEffect(Duration.WhileOnBattlefield)
|
||||
.setText("this creature can't block")));
|
||||
this.addAbility(new SimpleStaticAbility(new AttacksIfAbleAllEffect(
|
||||
filter, Duration.WhileOnBattlefield, true
|
||||
)));
|
||||
}
|
||||
|
||||
private PursuedWhaleToken(final PursuedWhaleToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PursuedWhaleToken copy() {
|
||||
return new PursuedWhaleToken(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue