* Canopy Cover - FIxed possible null pointer exception (fixes #2874).

This commit is contained in:
LevelX2 2017-02-17 23:49:03 +01:00
parent e6be0577bb
commit 88eeb2e0e1

View file

@ -59,7 +59,7 @@ public class CanopyCover extends CardImpl {
private static final FilterObject filter = new FilterStackObject("spells or abilities your opponents control");
public CanopyCover(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("Aura");
// Enchant creature
@ -70,7 +70,7 @@ public class CanopyCover extends CardImpl {
this.addAbility(ability);
// Enchanted creature can't be blocked except by creatures with flying or reach. (!this is a static ability of the enchantment)
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OrchardSpiritEffect()));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CanopyCoverEffect()));
// Enchanted creature can't be the target of spells or abilities your opponents control.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeTargetedAttachedEffect(filter, Duration.WhileOnBattlefield, AttachmentType.AURA, TargetController.OPPONENT)));
@ -86,14 +86,14 @@ public class CanopyCover extends CardImpl {
}
}
class OrchardSpiritEffect extends RestrictionEffect {
class CanopyCoverEffect extends RestrictionEffect {
public OrchardSpiritEffect() {
public CanopyCoverEffect() {
super(Duration.WhileOnBattlefield);
staticText = "Enchanted creature can't be blocked except by creatures with flying or reach";
}
public OrchardSpiritEffect(final OrchardSpiritEffect effect) {
public CanopyCoverEffect(final CanopyCoverEffect effect) {
super(effect);
}
@ -102,7 +102,7 @@ class OrchardSpiritEffect 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 (equipped != null && permanent.getId().equals(equipped.getId())) {
return true;
}
}
@ -115,7 +115,7 @@ class OrchardSpiritEffect extends RestrictionEffect {
}
@Override
public OrchardSpiritEffect copy() {
return new OrchardSpiritEffect(this);
public CanopyCoverEffect copy() {
return new CanopyCoverEffect(this);
}
}