* Fracturing Gust - Fixed that the life gain did not work if permanent with life gain preventing effect was destroyed.

This commit is contained in:
LevelX2 2015-03-22 09:45:19 +01:00
parent 4de7e27b8e
commit 07a6c8154a
3 changed files with 76 additions and 5 deletions

View file

@ -59,8 +59,6 @@ public class WitchHunt extends CardImpl {
super(ownerId, 133, "Witch Hunt", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");
this.expansionSetCode = "C13";
this.color.setRed(true);
// Players can't gain life.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantGainLifeAllEffect()));
// At the beginning of your upkeep, Witch Hunt deals 4 damage to you.

View file

@ -91,10 +91,19 @@ class FracturingGustDestroyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
for (Permanent permanent: game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.destroy(source.getSourceId(), game, false)) {
controller.gainLife(2, game);
if (controller != null) {
int destroyedPermanents = 0;
for (Permanent permanent: game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.destroy(source.getSourceId(), game, false)) {
++destroyedPermanents;
}
}
game.applyEffects(); // needed in case a destroyed permanent did prevent life gain
if (destroyedPermanents > 0) {
controller.gainLife(2 * destroyedPermanents, game);
}
return true;
}
return false;
}