Fixed some possible exceptions.

This commit is contained in:
LevelX2 2018-06-21 22:49:15 +02:00
parent 083d4cee6d
commit 46d61a1ebc
4 changed files with 10 additions and 12 deletions

View file

@ -55,7 +55,7 @@ class ComboAttackEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (source.getTargets().size() < 2) {
if (source.getTargets().size() < 2 || source.getTargets().get(0).getTargets().size() < 2) {
return false;
}
Permanent permanent1 = game.getPermanent(source.getTargets().get(0).getTargets().get(0));

View file

@ -1,4 +1,3 @@
package mage.cards.s;
import java.util.UUID;
@ -11,8 +10,8 @@ import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
@ -75,7 +74,7 @@ class SelflessSquireTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(getControllerId())) {
if (getControllerId().equals(event.getTargetId())) {
getEffects().clear();
getEffects().add(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount())));
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -21,12 +20,12 @@ import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Jason E. Wall
*
*/
public final class TreetopBracers extends CardImpl {
public TreetopBracers(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -37,7 +36,7 @@ public final class TreetopBracers extends CardImpl {
this.addAbility(ability);
// Enchanted creature gets +1/+1 and can't be blocked except by creatures with flying.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1,1, Duration.WhileOnBattlefield));
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield));
ability.addEffect(new TreetopBracersRestrictEffect());
this.addAbility(ability);
}
@ -52,7 +51,6 @@ public final class TreetopBracers extends CardImpl {
}
}
class TreetopBracersRestrictEffect extends RestrictionEffect {
public TreetopBracersRestrictEffect() {
@ -69,7 +67,7 @@ class TreetopBracersRestrictEffect extends RestrictionEffect {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
if (permanent.getId().equals(equipped.getId())) {
if (permanent != null && permanent.getId().equals(equipped.getId())) {
return true;
}
}

View file

@ -1,4 +1,3 @@
package mage.target.common;
import java.util.HashSet;
@ -178,7 +177,9 @@ public class TargetAnyTargetAmount extends TargetAmount {
sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") ");
} else {
Player player = game.getPlayer(targetId);
sb.append(player.getLogName()).append('(').append(getTargetAmount(targetId)).append(") ");
if (player != null) {
sb.append(player.getLogName()).append('(').append(getTargetAmount(targetId)).append(") ");
}
}
}
return sb.toString();