mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed Frenetic Sliver's ability causing coin flips when its source isn't on the battlefield
This commit is contained in:
parent
4e3961a819
commit
10b51d3a4c
1 changed files with 24 additions and 20 deletions
|
@ -1,13 +1,11 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||
|
@ -26,19 +24,26 @@ import mage.players.Player;
|
|||
public final class FreneticSliver extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.SLIVER, "All Slivers");
|
||||
private static final String rule = "All Slivers have \"{0}: If this permanent is on the battlefield, "
|
||||
+ "flip a coin. If you win the flip, exile this permanent and return it to the battlefield "
|
||||
+ "under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it.\"";
|
||||
|
||||
public FreneticSliver(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}");
|
||||
this.subtype.add(SubType.SLIVER);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// All Slivers have "{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it."
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD,
|
||||
new FreneticSliverEffect(), new ManaCostsImpl("{0}"), SourceOnBattlefieldCondition.instance, "{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it.");
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||
new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, filter, "All Slivers have \"{0}: If this permanent is on the battlefield, flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it.\"")));
|
||||
new GainAbilityAllEffect(
|
||||
new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new FreneticSliverEffect(),
|
||||
new ManaCostsImpl("{0}")
|
||||
), Duration.WhileOnBattlefield, filter, rule
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public FreneticSliver(final FreneticSliver card) {
|
||||
|
@ -55,7 +60,9 @@ class FreneticSliverEffect extends OneShotEffect {
|
|||
|
||||
public FreneticSliverEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "Flip a coin. If you win the flip, exile this permanent and return it to the battlefield under its owner's control at the beginning of the next end step. If you lose the flip, sacrifice it";
|
||||
staticText = "if this permanent is on the battlefield, flip a coin. If you win the flip, "
|
||||
+ "exile this permanent and return it to the battlefield under its owner's control "
|
||||
+ "at the beginning of the next end step. If you lose the flip, sacrifice it";
|
||||
}
|
||||
|
||||
public FreneticSliverEffect(final FreneticSliverEffect effect) {
|
||||
|
@ -65,18 +72,15 @@ class FreneticSliverEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.flipCoin(game)) {
|
||||
return new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true).apply(game, source);
|
||||
} else {
|
||||
Permanent perm = game.getPermanent(source.getSourceId());
|
||||
if (perm != null) {
|
||||
perm.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Permanent perm = game.getPermanent(source.getSourceId());
|
||||
if (player == null || perm == null) {
|
||||
return false;
|
||||
}
|
||||
if (player.flipCoin(game)) {
|
||||
return new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true).apply(game, source);
|
||||
} else {
|
||||
return perm.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue