* Standardize - Fixe bug that prevented the effect to work.

This commit is contained in:
LevelX2 2016-03-20 15:04:57 +01:00
parent 916836d0c9
commit c82a68d1a2

View file

@ -29,6 +29,7 @@ package mage.sets.onslaught;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -43,7 +44,6 @@ import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
/** /**
@ -70,8 +70,6 @@ public class Standardize extends CardImpl {
} }
} }
class StandardizeEffect extends OneShotEffect { class StandardizeEffect extends OneShotEffect {
public StandardizeEffect() { public StandardizeEffect() {
@ -87,9 +85,9 @@ class StandardizeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
String chosenType = ""; String chosenType = "";
if (player != null && permanent != null) { if (player != null && sourceObject != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type other than Wall"); typeChoice.setMessage("Choose a creature type other than Wall");
Set<String> types = CardRepository.instance.getCreatureTypes(); Set<String> types = CardRepository.instance.getCreatureTypes();
@ -100,7 +98,7 @@ class StandardizeEffect extends OneShotEffect {
return false; return false;
} }
} }
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice()); game.informPlayers(sourceObject.getLogName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
chosenType = typeChoice.getChoice(); chosenType = typeChoice.getChoice();
if (chosenType != null && !chosenType.isEmpty()) { if (chosenType != null && !chosenType.isEmpty()) {
// ADD TYPE TO TARGET // ADD TYPE TO TARGET