* Cryptborn Horror - Fixed that it did not get the +1/+1 counters when entering the battlefield.

This commit is contained in:
LevelX2 2015-12-31 11:12:39 +01:00
parent 9f22eb0688
commit b0e8b03b74
3 changed files with 15 additions and 20 deletions

View file

@ -28,9 +28,6 @@
package mage.sets.returntoravnica;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -38,7 +35,9 @@ import mage.abilities.dynamicvalue.common.OpponentsLostLifeCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -64,7 +63,7 @@ public class CryptbornHorror extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Cryptborn Horror enters the battlefield with X +1/+1 counters on it, where X is the total life lost by your opponents this turn.
this.addAbility(new EntersBattlefieldAbility(new CryptbornHorrorEffect(),rule));
this.addAbility(new EntersBattlefieldAbility(new CryptbornHorrorEffect(), rule));
}
public CryptbornHorror(final CryptbornHorror card) {
@ -76,7 +75,9 @@ public class CryptbornHorror extends CardImpl {
return new CryptbornHorror(this);
}
}
class CryptbornHorrorEffect extends OneShotEffect {
CryptbornHorrorEffect() {
super(Outcome.BoostCreature);
}
@ -87,16 +88,13 @@ class CryptbornHorrorEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent != null) {
OpponentsLostLifeCount dynamicValue = new OpponentsLostLifeCount();
if (dynamicValue != null) {
int oll = dynamicValue.calculate(game, source, this);
if (oll > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(oll), game);
}
return true;
int oll = new OpponentsLostLifeCount().calculate(game, source, this);
if (oll > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(oll), game);
}
return true;
}
return false;
}
@ -105,4 +103,4 @@ class CryptbornHorrorEffect extends OneShotEffect {
public CryptbornHorrorEffect copy() {
return new CryptbornHorrorEffect(this);
}
}
}

View file

@ -49,8 +49,8 @@ public class OpponentsLostLifeCount implements DynamicValue {
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
if (watcher != null) {
int amountLifeLost = 0;
for (UUID opponent : game.getOpponents(controllerId)) {
amountLifeLost += watcher.getLiveLost(opponent);
for (UUID opponentId : game.getOpponents(controllerId)) {
amountLifeLost += watcher.getLiveLost(opponentId);
}
return amountLifeLost;
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.watchers.common;
import java.util.HashMap;
@ -37,11 +36,9 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.Watcher;
/**
/*
* Counts amount of life lost current or last turn by players.
*
* This watcher is always added in gameImpl.init
*
* @author LevelX2
*/