Awaken - Fixed a problem with the rule text of cards with Awaken.

This commit is contained in:
LevelX2 2016-06-05 12:35:00 +02:00
parent 89d9762ea1
commit 187866c979

View file

@ -59,7 +59,7 @@ import org.apache.log4j.Logger;
* @author LevelX2 * @author LevelX2
*/ */
public class AwakenAbility extends SpellAbility { public class AwakenAbility extends SpellAbility {
private static final Logger logger = Logger.getLogger(AwakenAbility.class); private static final Logger logger = Logger.getLogger(AwakenAbility.class);
static private String filterMessage = "a land you control to awake"; static private String filterMessage = "a land you control to awake";
@ -87,6 +87,7 @@ public class AwakenAbility extends SpellAbility {
public AwakenAbility(final AwakenAbility ability) { public AwakenAbility(final AwakenAbility ability) {
super(ability); super(ability);
this.awakenValue = ability.awakenValue; this.awakenValue = ability.awakenValue;
this.rule = ability.rule;
} }
@Override @Override
@ -138,16 +139,15 @@ public class AwakenAbility extends SpellAbility {
effect.setTargetPointer(fixedTarget); effect.setTargetPointer(fixedTarget);
return effect.apply(game, source); return effect.apply(game, source);
} }
} else { // source should never be null, but we are seeing a lot of NPEs from this section } else // source should never be null, but we are seeing a lot of NPEs from this section
if (source == null) { if (source == null) {
logger.fatal("Source was null in AwakenAbility: Create a bug report or fix the source code"); logger.fatal("Source was null in AwakenAbility: Create a bug report or fix the source code");
} else if (source.getTargets() == null) { } else if (source.getTargets() == null) {
MageObject sourceObj = source.getSourceObject(game); MageObject sourceObj = source.getSourceObject(game);
if (sourceObj != null) { if (sourceObj != null) {
Class<? extends MageObject> sourceClass = sourceObj.getClass(); Class<? extends MageObject> sourceClass = sourceObj.getClass();
if (sourceClass != null) { if (sourceClass != null) {
logger.fatal("getTargets was null in AwakenAbility for " + sourceClass.toString() + " : Create a bug report or fix the source code"); logger.fatal("getTargets was null in AwakenAbility for " + sourceClass.toString() + " : Create a bug report or fix the source code");
}
} }
} }
} }
@ -169,4 +169,4 @@ class AwakenElementalToken extends Token {
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
} }
} }