mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
try toi fix NPE in Gatekeeper of Malakir
This commit is contained in:
parent
11a64a1c6a
commit
b02e87ea67
2 changed files with 7 additions and 2 deletions
|
@ -32,6 +32,7 @@ import mage.Constants.CardType;
|
|||
import mage.Constants.Duration;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.costs.mana.KickerManaCost;
|
||||
|
@ -72,9 +73,10 @@ public class GatekeeperOfMalakir extends CardImpl<GatekeeperOfMalakir> {
|
|||
|
||||
EntersBattlefieldTriggeredAbility ability =
|
||||
new EntersBattlefieldTriggeredAbility(new SacrificeEffect(filter, 1, "target player"));
|
||||
ability.addTarget(new TargetPlayer());
|
||||
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, target player sacrifices a creature"));
|
||||
Ability conditionalAbility = new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, target player sacrifices a creature");
|
||||
conditionalAbility.addTarget(new TargetPlayer());
|
||||
this.addAbility(conditionalAbility);
|
||||
}
|
||||
|
||||
public GatekeeperOfMalakir(final GatekeeperOfMalakir card) {
|
||||
|
|
|
@ -72,6 +72,9 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
//filter.setTargetController(TargetController.YOU);
|
||||
int amount = count.calculate(game, source);
|
||||
amount = Math.min(amount, game.getBattlefield().countAll(filter, player.getId()));
|
||||
|
|
Loading…
Reference in a new issue