Fixed some more exception and/or logging problems.

This commit is contained in:
LevelX2 2018-01-27 13:19:20 +01:00
parent 9268281c4b
commit 2f016c8ea6
11 changed files with 63 additions and 47 deletions

View file

@ -27,6 +27,7 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
@ -50,8 +51,6 @@ import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author spjspj
*/
@ -152,7 +151,8 @@ class CurseOfVengeancePlayerLosesTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getPermanent(this.getSourceId()).getAttachedTo().equals(event.getPlayerId());
Permanent sourceObject = game.getPermanentOrLKIBattlefield(this.getSourceId());
return sourceObject != null && sourceObject.getAttachedTo().equals(event.getPlayerId());
}
@Override

View file

@ -113,7 +113,7 @@ class GhostlyFlickerEffect extends OneShotEffect {
for (Card card : toExile) {
Zone currentZone = game.getState().getZone(card.getId());
if (Zone.BATTLEFIELD != currentZone && currentZone.isPublicZone()) {
toBattlefield.add(game.getCard(card.getId()));
toBattlefield.add(card);
}
}
controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);

View file

@ -76,7 +76,12 @@ class JackInTheMoxManaEffect extends ManaEffect {
JackInTheMoxManaEffect() {
super();
staticText = "Roll a six-sided die. If result is 1 - Sacrifice {this} and you lose 5 life. 2 - Add {W} 3 - Add {U} 4 - Add {B} 5 - Add {R} 6 - Add {G} to your mana pool";
staticText = "Roll a six-sided die for {this}. On a 1, sacrifice {this} and lose 5 life. Otherwise, {this} has one of the following effects. Treat this ability as a mana source."
+ "<br/>2 Add {W} to your mana pool.\n"
+ "<br/>3 Add {U} to your mana pool.\n"
+ "<br/>4 Add {B} to your mana pool.\n"
+ "<br/>5 Add {R} to your mana pool.\n"
+ "<br/>6 Add {G} to your mana pool.";
}
JackInTheMoxManaEffect(final JackInTheMoxManaEffect effect) {

View file

@ -57,8 +57,9 @@ import mage.util.CardUtil;
public class TrainingGrounds extends CardImpl {
public TrainingGrounds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
// Activated abilities of creatures you control cost up to {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TrainingGroundsEffect()));
}
@ -107,10 +108,14 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
}
choice.setChoices(set);
choice.setMessage("Reduce ability cost");
if (controller.choose(Outcome.Benefit, choice, game)) {
int reduce = Integer.parseInt(choice.getChoice());
CardUtil.reduceCost(abilityToModify, reduce);
while (!choice.isChosen()) {
controller.choose(Outcome.Benefit, choice, game);
if (!controller.isInGame()) {
return false;
}
}
int reduce = Integer.parseInt(choice.getChoice());
CardUtil.reduceCost(abilityToModify, reduce);
}
return true;
}