mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[ONS] fixed Thrashing Mudspawn null pointer exception (fixes #7775)
This commit is contained in:
parent
05d5eeb941
commit
c3983dac63
2 changed files with 14 additions and 17 deletions
|
@ -1,11 +1,8 @@
|
|||
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.MorphAbility;
|
||||
|
@ -13,11 +10,13 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ThrashingMudspawn extends CardImpl {
|
||||
|
@ -30,11 +29,13 @@ public final class ThrashingMudspawn extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever Thrashing Mudspawn is dealt damage, you lose that much life.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new ThrashingMudspawnEffect(), false);
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(
|
||||
new ThrashingMudspawnEffect(), false, false, true
|
||||
);
|
||||
this.addAbility(ability);
|
||||
|
||||
// Morph {1}{B}{B}
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{1}{B}{B}")));
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{1}{B}{B}")));
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,14 +67,12 @@ class ThrashingMudspawnEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int amount = (Integer) getValue("damage");
|
||||
if (amount > 0) {
|
||||
Integer amount = (Integer) getValue("damage");
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (amount == null || amount < 1 || player == null) {
|
||||
return false;
|
||||
}
|
||||
player.loseLife(amount, game, source, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,9 +55,7 @@ public class DealtDamageToSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (useValue) {
|
||||
// TODO: this ability should only trigger once for multiple creatures dealing combat damage.
|
||||
// If the damaged creature uses the amount (e.g. Boros Reckoner), this will still trigger separately instead of all at once
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
getEffects().setValue("damage", event.getAmount());
|
||||
return true;
|
||||
} else {
|
||||
if (((DamagedEvent) event).isCombatDamage()) {
|
||||
|
|
Loading…
Reference in a new issue