mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[UNF] Implemented Saw in Half
This commit is contained in:
parent
8e866d95c2
commit
2d54a2e313
3 changed files with 84 additions and 6 deletions
76
Mage.Sets/src/mage/cards/s/SawInHalf.java
Normal file
76
Mage.Sets/src/mage/cards/s/SawInHalf.java
Normal file
|
@ -0,0 +1,76 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SawInHalf extends CardImpl {
|
||||
|
||||
public SawInHalf(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||
|
||||
// Destroy target creature. If that creature dies this way, its controller creates two tokens that are copies of that creature, except their base power is half that creature's power and their base toughness is half that creature's toughness. Round up each time.
|
||||
this.getSpellAbility().addEffect(new SawInHalfEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
private SawInHalf(final SawInHalf card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SawInHalf copy() {
|
||||
return new SawInHalf(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SawInHalfEffect extends OneShotEffect {
|
||||
|
||||
SawInHalfEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "destroy target creature. If that creature dies this way, its controller creates " +
|
||||
"two tokens that are copies of that creature, except their base power is half that creature's " +
|
||||
"power and their base toughness is half that creature's toughness. Round up each time";
|
||||
}
|
||||
|
||||
private SawInHalfEffect(final SawInHalfEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SawInHalfEffect copy() {
|
||||
return new SawInHalfEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent == null
|
||||
|| !permanent.destroy(source, game)
|
||||
|| game.getState().getZone(permanent.getId()) != Zone.GRAVEYARD) {
|
||||
return false;
|
||||
}
|
||||
return new CreateTokenCopyTargetEffect(
|
||||
permanent.getControllerId(), null, false, 2, false, false, null,
|
||||
divide(permanent.getPower()), divide(permanent.getToughness()), false
|
||||
).setSavedPermanent(permanent).apply(game, source);
|
||||
}
|
||||
|
||||
private static final int divide(MageInt mageInt) {
|
||||
return Math.floorDiv(mageInt.getValue(), 2) + mageInt.getValue() % 2;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ public final class Unfinity extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Overgrown Tomb", 284, Rarity.RARE, mage.cards.o.OvergrownTomb.class));
|
||||
cards.add(new SetCardInfo("Plains", 240, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sacred Foundry", 285, Rarity.RARE, mage.cards.s.SacredFoundry.class));
|
||||
cards.add(new SetCardInfo("Saw in Half", 88, Rarity.RARE, mage.cards.s.SawInHalf.class));
|
||||
cards.add(new SetCardInfo("Steam Vents", 283, Rarity.RARE, mage.cards.s.SteamVents.class));
|
||||
cards.add(new SetCardInfo("Stomping Ground", 280, Rarity.RARE, mage.cards.s.StompingGround.class));
|
||||
cards.add(new SetCardInfo("Swamp", 237, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
|
||||
|
|
|
@ -12,6 +12,7 @@ import mage.abilities.keyword.FlyingAbility;
|
|||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
|
@ -24,7 +25,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
|
@ -82,11 +82,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param playerId null the token is controlled/owned by the controller of
|
||||
* the source ability
|
||||
* @param playerId null the token is controlled/owned by the controller of
|
||||
* the source ability
|
||||
* @param additionalCardType the token gains this card type in addition
|
||||
* @param hasHaste the token gains haste
|
||||
* @param number number of tokens to put into play
|
||||
* @param hasHaste the token gains haste
|
||||
* @param number number of tokens to put into play
|
||||
* @param tapped
|
||||
* @param attacking
|
||||
*/
|
||||
|
@ -341,7 +341,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
Arrays.stream(abilities).forEach(this.additionalAbilities::add);
|
||||
}
|
||||
|
||||
public void setSavedPermanent(Permanent savedPermanent) {
|
||||
public CreateTokenCopyTargetEffect setSavedPermanent(Permanent savedPermanent) {
|
||||
this.savedPermanent = savedPermanent;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue