mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[FRF] Added Soulflayer.
This commit is contained in:
parent
a0d2c0c22f
commit
6bf07e7763
4 changed files with 202 additions and 5 deletions
179
Mage.Sets/src/mage/sets/fatereforged/Soulflayer.java
Normal file
179
Mage.Sets/src/mage/sets/fatereforged/Soulflayer.java
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.sets.fatereforged;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.abilities.effects.common.continious.SourceEffect;
|
||||||
|
import mage.abilities.keyword.DeathtouchAbility;
|
||||||
|
import mage.abilities.keyword.DelveAbility;
|
||||||
|
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||||
|
import mage.abilities.keyword.FirstStrikeAbility;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.abilities.keyword.HexproofAbility;
|
||||||
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
|
import mage.abilities.keyword.ReachAbility;
|
||||||
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Layer;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.SubLayer;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class Soulflayer extends CardImpl {
|
||||||
|
|
||||||
|
public Soulflayer(UUID ownerId) {
|
||||||
|
super(ownerId, 84, "Soulflayer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
|
||||||
|
this.expansionSetCode = "FRF";
|
||||||
|
this.subtype.add("Demon");
|
||||||
|
this.power = new MageInt(4);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Delve
|
||||||
|
this.addAbility(new DelveAbility());
|
||||||
|
|
||||||
|
// If a creature card with flying was exiled with Soulflayer's delve ability, Soulflayer has flying. The same is true for first strike, double strike, deathtouch, haste, hexproof, indestructible, lifelink, reach, trample, and vigilance.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SoulflayerEffect()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Soulflayer(final Soulflayer card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Soulflayer copy() {
|
||||||
|
return new Soulflayer(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class SoulflayerEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||||
|
|
||||||
|
private Set<Ability> abilitiesToAdd;
|
||||||
|
|
||||||
|
public SoulflayerEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
|
staticText = "If a creature card with flying was exiled with Soulflayer's delve ability, Soulflayer has flying. The same is true for first strike, double strike, deathtouch, haste, hexproof, indestructible, lifelink, reach, trample, and vigilance";
|
||||||
|
abilitiesToAdd = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SoulflayerEffect(final SoulflayerEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
if (effect.abilitiesToAdd != null) {
|
||||||
|
this.abilitiesToAdd = new HashSet<>();
|
||||||
|
this.abilitiesToAdd.addAll(effect.abilitiesToAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SoulflayerEffect copy() {
|
||||||
|
return new SoulflayerEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
if (abilitiesToAdd == null) {
|
||||||
|
for (Ability ability :permanent.getAbilities()) {
|
||||||
|
if (ability instanceof DelveAbility) {
|
||||||
|
List<Card> delvedCards = ((DelveAbility) ability).getDelvedCards();
|
||||||
|
abilitiesToAdd = new HashSet<>();
|
||||||
|
if (delvedCards != null) {
|
||||||
|
for(Card card: delvedCards) {
|
||||||
|
if (!card.getCardType().contains(CardType.CREATURE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (Ability cardAbility: card.getAbilities()) {
|
||||||
|
if (cardAbility instanceof FlyingAbility) {
|
||||||
|
abilitiesToAdd.add(FlyingAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof FirstStrikeAbility) {
|
||||||
|
abilitiesToAdd.add(FirstStrikeAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof DoubleStrikeAbility) {
|
||||||
|
abilitiesToAdd.add(DoubleStrikeAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof DeathtouchAbility) {
|
||||||
|
abilitiesToAdd.add(DeathtouchAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof HasteAbility) {
|
||||||
|
abilitiesToAdd.add(HasteAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof HexproofAbility) {
|
||||||
|
abilitiesToAdd.add(HexproofAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof LifelinkAbility) {
|
||||||
|
abilitiesToAdd.add(LifelinkAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof ReachAbility) {
|
||||||
|
abilitiesToAdd.add(ReachAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof TrampleAbility) {
|
||||||
|
abilitiesToAdd.add(TrampleAbility.getInstance());
|
||||||
|
}
|
||||||
|
if (cardAbility instanceof VigilanceAbility) {
|
||||||
|
abilitiesToAdd.add(VigilanceAbility.getInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Ability ability: abilitiesToAdd) {
|
||||||
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (abilitiesToAdd != null) {
|
||||||
|
abilitiesToAdd = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -77,7 +77,7 @@ class AstralSlideEffect extends OneShotEffect {
|
||||||
|
|
||||||
public AstralSlideEffect() {
|
public AstralSlideEffect() {
|
||||||
super(Outcome.Detriment);
|
super(Outcome.Detriment);
|
||||||
staticText = "Exile target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step";
|
staticText = "exile target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step";
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstralSlideEffect(final AstralSlideEffect effect) {
|
public AstralSlideEffect(final AstralSlideEffect effect) {
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
|
@ -71,13 +73,20 @@ import mage.util.CardUtil;
|
||||||
|
|
||||||
public class DelveAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
public class DelveAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
||||||
|
|
||||||
|
private List<Card> delvedCards;
|
||||||
|
|
||||||
public DelveAbility() {
|
public DelveAbility() {
|
||||||
super(Zone.STACK, null);
|
super(Zone.STACK, null);
|
||||||
this.setRuleAtTheTop(true);
|
this.setRuleAtTheTop(true);
|
||||||
|
this.delvedCards = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelveAbility(final DelveAbility ability) {
|
public DelveAbility(final DelveAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
|
if (ability.delvedCards != null) {
|
||||||
|
this.delvedCards = new ArrayList<>();
|
||||||
|
this.delvedCards.addAll(ability.delvedCards);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,15 +106,18 @@ import mage.util.CardUtil;
|
||||||
if (!target.canChoose(sourceId, controllerId, game)) {
|
if (!target.canChoose(sourceId, controllerId, game)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!CardUtil.isCheckPlayableMode(ability) && player.chooseUse(Outcome.Detriment, "Delve cards from your graveyard?", game)) {
|
if (!CardUtil.isCheckPlayableMode(ability) &&
|
||||||
|
player.chooseUse(Outcome.Detriment, "Delve cards from your graveyard?", game)) {
|
||||||
player.chooseTarget(Outcome.Detriment, target, ability, game);
|
player.chooseTarget(Outcome.Detriment, target, ability, game);
|
||||||
if (target.getTargets().size() > 0) {
|
if (target.getTargets().size() > 0) {
|
||||||
|
delvedCards = new ArrayList<>();
|
||||||
int adjCost = 0;
|
int adjCost = 0;
|
||||||
for (UUID cardId: target.getTargets()) {
|
for (UUID cardId: target.getTargets()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
delvedCards.add(card);
|
||||||
player.moveCardToExileWithInfo(card, null, "", getSourceId(), game, Zone.GRAVEYARD);
|
player.moveCardToExileWithInfo(card, null, "", getSourceId(), game, Zone.GRAVEYARD);
|
||||||
++adjCost;
|
++adjCost;
|
||||||
}
|
}
|
||||||
|
@ -120,4 +132,9 @@ import mage.util.CardUtil;
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Delve <i>(You may exile any number of cards from your graveyard as you cast this spell. It costs {1} less to cast for each card exiled this way.)</i>";
|
return "Delve <i>(You may exile any number of cards from your graveyard as you cast this spell. It costs {1} less to cast for each card exiled this way.)</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Card> getDelvedCards() {
|
||||||
|
return delvedCards;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ public class ReplicateAbility extends StaticAbility implements OptionalAdditiona
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isActivated() {
|
public boolean isActivated() {
|
||||||
if (additionalCost != null) {
|
if (additionalCost != null) {
|
||||||
return additionalCost.isActivated();
|
return additionalCost.isActivated();
|
||||||
|
@ -117,8 +118,8 @@ public class ReplicateAbility extends StaticAbility implements OptionalAdditiona
|
||||||
while (player.isInGame() && again) {
|
while (player.isInGame() && again) {
|
||||||
String times = "";
|
String times = "";
|
||||||
if (additionalCost.isRepeatable()) {
|
if (additionalCost.isRepeatable()) {
|
||||||
int activated = additionalCost.getActivateCount();
|
int numActivations = additionalCost.getActivateCount();
|
||||||
times = Integer.toString(activated + 1) + (activated == 0 ? " time ":" times ");
|
times = Integer.toString(numActivations + 1) + (numActivations == 0 ? " time ":" times ");
|
||||||
}
|
}
|
||||||
if (additionalCost.canPay(ability, sourceId, controllerId, game) &&
|
if (additionalCost.canPay(ability, sourceId, controllerId, game) &&
|
||||||
player.chooseUse(Outcome.Benefit, new StringBuilder("Pay ").append(times).append(additionalCost.getText(false)).append(" ?").toString(), game)) {
|
player.chooseUse(Outcome.Benefit, new StringBuilder("Pay ").append(times).append(additionalCost.getText(false)).append(" ?").toString(), game)) {
|
||||||
|
|
Loading…
Reference in a new issue