mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
* Fixed some null pointer or other exception bugs.
This commit is contained in:
parent
a35abd7f8c
commit
0ef94a588c
10 changed files with 47 additions and 45 deletions
|
|
@ -28,6 +28,7 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -42,6 +43,7 @@ import mage.constants.TargetController;
|
|||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
|
@ -215,9 +217,13 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
if (this.controllerId != null && this.controllerId.equals(playerId)) {
|
||||
return true;
|
||||
} else {
|
||||
Card card = (Card) game.getObject(this.sourceId);
|
||||
if (card != null && game.getState().getZone(this.sourceId) != Zone.BATTLEFIELD) {
|
||||
return card.getOwnerId().equals(playerId);
|
||||
MageObject mageObject = game.getObject(this.sourceId);
|
||||
if (mageObject instanceof Emblem) {
|
||||
return ((Emblem) mageObject).getControllerId().equals(playerId);
|
||||
} else {
|
||||
if (game.getState().getZone(this.sourceId) != Zone.BATTLEFIELD) {
|
||||
return ((Card) mageObject).getOwnerId().equals(playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,6 @@ public class CounterTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "counter target " + (mode.getTargets().get(0) != null ? mode.getTargets().get(0).getTargetName() : "spell");
|
||||
return "counter target " + (!mode.getTargets().isEmpty() ? mode.getTargets().get(0).getTargetName() : "spell");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,9 +109,8 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl {
|
|||
this.discard();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
throw new UnsupportedOperationException("No color set");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -282,20 +282,22 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
if (blocked) {
|
||||
for (UUID blockerId : blockerOrder) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
int lethalDamage;
|
||||
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
|
||||
lethalDamage = 1;
|
||||
} else {
|
||||
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
if (blocker != null) {
|
||||
int lethalDamage;
|
||||
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
|
||||
lethalDamage = 1;
|
||||
} else {
|
||||
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
}
|
||||
if (lethalDamage >= damage) {
|
||||
assigned.put(blockerId, damage);
|
||||
damage = 0;
|
||||
break;
|
||||
}
|
||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
||||
assigned.put(blockerId, damageAssigned);
|
||||
damage -= damageAssigned;
|
||||
}
|
||||
if (lethalDamage >= damage) {
|
||||
assigned.put(blockerId, damage);
|
||||
damage = 0;
|
||||
break;
|
||||
}
|
||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
||||
assigned.put(blockerId, damageAssigned);
|
||||
damage -= damageAssigned;
|
||||
}
|
||||
if (damage > 0 && hasTrample(attacker)) {
|
||||
defenderDamage(attacker, damage, game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue