mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
Fix for Soul Barrier
This commit is contained in:
parent
391e0bac89
commit
2bc077677c
1 changed files with 11 additions and 6 deletions
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
|
@ -39,10 +41,9 @@ import mage.constants.SetTargetPointer;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Galatolol
|
* @author Galatolol
|
||||||
|
|
@ -51,10 +52,10 @@ public class SoulBarrier extends CardImpl {
|
||||||
|
|
||||||
public SoulBarrier(UUID ownerId, CardSetInfo setInfo) {
|
public SoulBarrier(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
|
||||||
|
|
||||||
// Whenever an opponent casts a creature spell, Soul Barrier deals 2 damage to that player unless he or she pays {2}.
|
// Whenever an opponent casts a creature spell, Soul Barrier deals 2 damage to that player unless he or she pays {2}.
|
||||||
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new SoulBarrierEffect(),
|
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new SoulBarrierEffect(),
|
||||||
StaticFilters.FILTER_SPELL,false, SetTargetPointer.PLAYER));
|
StaticFilters.FILTER_SPELL_A_CREATURE, false, SetTargetPointer.PLAYER));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SoulBarrier(final SoulBarrier card) {
|
public SoulBarrier(final SoulBarrier card) {
|
||||||
|
|
@ -86,9 +87,13 @@ class SoulBarrierEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
|
||||||
|
if (player != null && permanent != null) {
|
||||||
GenericManaCost cost = new GenericManaCost(2);
|
GenericManaCost cost = new GenericManaCost(2);
|
||||||
if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
|
String message = "Would you like to pay {2} to prevent taking 2 damage from " + permanent.getLogName() + "?";
|
||||||
|
if (!(player.chooseUse(Outcome.Benefit, message, source, game)
|
||||||
|
&& cost.pay(source, game, source.getSourceId(), player.getId(), false, null))) {
|
||||||
player.damage(2, source.getSourceId(), game, false, true);
|
player.damage(2, source.getSourceId(), game, false, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue