couple of sonar fixes

This commit is contained in:
Ingmar Goudt 2019-01-17 12:03:14 +01:00
parent 63fc53e0f0
commit 7c2f55eda0
28 changed files with 53 additions and 134 deletions

View file

@ -631,7 +631,7 @@ public class Commander extends Constructed {
|| cn.equals("krark-clan ironworks") || cn.equals("krenko, mob boss")
|| cn.equals("krosan restorer") || cn.equals("laboratory maniac")
|| cn.equals("leonin relic-warder") || cn.equals("leyline of the void")
|| cn.equals("memnarch") || cn.equals("memnarch")
|| cn.equals("memnarch")
|| cn.equals("meren of clan nel toth") || cn.equals("mikaeus, the unhallowed")
|| cn.equals("mindcrank") || cn.equals("mindslaver")
|| cn.equals("minion reflector") || cn.equals("mycosynth lattice")
@ -649,7 +649,7 @@ public class Commander extends Constructed {
|| cn.equals("sunder")
|| cn.equals("storm cauldron") || cn.equals("teferi's puzzle box")
|| cn.equals("tangle wire")
|| cn.equals("teferi, mage of zhalfir") || cn.equals("teferi, mage of zhalfir")
|| cn.equals("teferi, mage of zhalfir")
|| cn.equals("tezzeret the seeker") || cn.equals("time stretch")
|| cn.equals("time warp") || cn.equals("training grounds")
|| cn.equals("triskelavus") || cn.equals("triskelion")

View file

@ -627,7 +627,7 @@ public class GameController implements GameCallback {
for (MatchPlayer p : TableManager.instance.getTable(tableId).getMatch().getPlayers()) {
if (p.getPlayer().getId().equals(userIdRequester)) {
Optional<User> u = UserManager.instance.getUser(origId);
if (u != null && u.isPresent() && p.getDeck() != null) {
if (u.isPresent() && p.getDeck() != null) {
u.get().ccViewLimitedDeck(p.getDeck(), tableId, requestsOpen, true);
}
}

View file

@ -85,55 +85,4 @@ class AvatarOfFuryAdjustingCostsAbility extends SimpleStaticAbility implements A
}
}
}
}
//class AvatarOfFuryAdjustingCostsEffect extends CostModificationEffectImpl {
//
// public AvatarOfFuryAdjustingCostsEffect() {
// super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
// }
//
// public AvatarOfFuryAdjustingCostsEffect(final AvatarOfFuryAdjustingCostsEffect effect) {
// super(effect);
// }
//
// @Override
// public boolean apply(Game game, Ability source, Ability abilityToModify) {
// SpellAbility spellAbility = (SpellAbility)abilityToModify;
// Mana mana = spellAbility.getManaCostsToPay().getMana();
//
// boolean condition = false;
// FilterPermanent filter = new FilterLandPermanent();
// for (UUID playerId: game.getOpponents(source.getControllerId())) {
// if (game.getBattlefield().countAll(filter, playerId, game) > 6) {
// condition = true;
// break;
// }
// }
//
// if (mana.getColorless() > 0 && condition) {
// int newCount = mana.getColorless() - 6;
// if (newCount < 0) {
// newCount = 0;
// }
// mana.setColorless(newCount);
// spellAbility.getManaCostsToPay().load(mana.toString());
// return true;
// }
// return false;
// }
//
// @Override
// public boolean applies(Ability abilityToModify, Ability source, Game game) {
// if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility || abilityToModify instanceof RetraceAbility)
// && abilityToModify.getSourceId().equals(source.getSourceId())) {
// return true;
// }
// return false;
// }
//
// @Override
// public AvatarOfFuryAdjustingCostsEffect copy() {
// return new AvatarOfFuryAdjustingCostsEffect(this);
// }
//}
}

View file

@ -2,14 +2,9 @@ package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.AbilityImpl;
import mage.abilities.SpellAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventCombatDamageBySourceEffect;
import mage.abilities.effects.common.PreventDamageByTargetEffect;
import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -46,7 +41,7 @@ public final class AzoriusPloy extends CardImpl {
}
public AzoriusPloy(final AzoriusPloy card) {
private AzoriusPloy(final AzoriusPloy card) {
super(card);
}

View file

@ -11,8 +11,6 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
@ -43,7 +41,7 @@ public final class BalduvianConjurer extends CardImpl {
this.addAbility(ability);
}
public BalduvianConjurer(final BalduvianConjurer card) {
private BalduvianConjurer(final BalduvianConjurer card) {
super(card);
}

View file

@ -3,8 +3,6 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.Duration;
import mage.constants.SubType;
@ -38,7 +36,7 @@ public final class BalduvianFallen extends CardImpl {
this.addAbility(new BalduvianFallenAbility());
}
public BalduvianFallen(final BalduvianFallen card) {
private BalduvianFallen(final BalduvianFallen card) {
super(card);
}
@ -54,7 +52,7 @@ class BalduvianFallenAbility extends TriggeredAbilityImpl {
super(Zone.BATTLEFIELD, null, false);
}
public BalduvianFallenAbility(final BalduvianFallenAbility ability) {
private BalduvianFallenAbility(final BalduvianFallenAbility ability) {
super(ability);
}

View file

@ -15,7 +15,6 @@ import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.target.TargetPermanent;
/**
@ -44,7 +43,7 @@ public final class BalduvianFrostwaker extends CardImpl {
this.addAbility(ability);
}
public BalduvianFrostwaker(final BalduvianFrostwaker card) {
private BalduvianFrostwaker(final BalduvianFrostwaker card) {
super(card);
}
@ -65,7 +64,7 @@ class BalduvianFrostwakerToken extends TokenImpl {
this.toughness = new MageInt(2);
this.addAbility(FlyingAbility.getInstance());
}
public BalduvianFrostwakerToken(final BalduvianFrostwakerToken token) {
private BalduvianFrostwakerToken(final BalduvianFrostwakerToken token) {
super(token);
}

View file

@ -51,7 +51,7 @@ public final class BalduvianWarlord extends CardImpl {
this.addAbility(ability, new BlockedByOnlyOneCreatureThisCombatWatcher());
}
public BalduvianWarlord(final BalduvianWarlord card) {
private BalduvianWarlord(final BalduvianWarlord card) {
super(card);
}
@ -69,7 +69,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect {
this.staticText = " Remove target blocking creature from combat. Creatures it was blocking that hadn't become blocked by another creature this combat become unblocked, then it blocks an attacking creature of your choice";
}
public BalduvianWarlordUnblockEffect(final BalduvianWarlordUnblockEffect effect) {
private BalduvianWarlordUnblockEffect(final BalduvianWarlordUnblockEffect effect) {
super(effect);
}

View file

@ -2,9 +2,7 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.combat.CantBlockAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -12,8 +10,6 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -28,7 +24,7 @@ public final class Bedlam extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES, Duration.WhileOnBattlefield)));
}
public Bedlam(final Bedlam card) {
private Bedlam(final Bedlam card) {
super(card);
}

View file

@ -82,7 +82,7 @@ class BendOrBreakEffect extends OneShotEffect {
Player nextPlayer;
UUID firstNextPlayer = null;
while (!getNextPlayerInDirection(true, playerList, game).equals(firstNextPlayer) && controller.canRespond()) {
while (!getNextPlayerInDirection(true, playerList).equals(firstNextPlayer) && controller.canRespond()) {
nextPlayer = game.getPlayer(playerList.get());
if (nextPlayer == null) {
return false;
@ -187,7 +187,7 @@ class BendOrBreakEffect extends OneShotEffect {
return false;
}
private UUID getNextPlayerInDirection(boolean left, PlayerList playerList, Game game) {
private UUID getNextPlayerInDirection(boolean left, PlayerList playerList) {
UUID nextPlayerId;
if (left) {
nextPlayerId = playerList.getNext();

View file

@ -1,22 +1,13 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroyAllAttachedEquipmentEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
@ -35,7 +26,7 @@ public final class BlastfireBolt extends CardImpl {
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public BlastfireBolt(final BlastfireBolt card) {
private BlastfireBolt(final BlastfireBolt card) {
super(card);
}

View file

@ -4,7 +4,6 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -21,8 +20,6 @@ import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
@ -59,7 +56,7 @@ public final class BlinkmothNexus extends CardImpl {
}
public BlinkmothNexus(final BlinkmothNexus card) {
private BlinkmothNexus(final BlinkmothNexus card) {
super(card);
}

View file

@ -1,7 +1,6 @@
package mage.cards.b;
import java.util.Iterator;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -14,7 +13,6 @@ import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
@ -39,7 +37,7 @@ public final class BloodSun extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BloodSunEffect(Duration.WhileOnBattlefield)));
}
public BloodSun(final BloodSun card) {
private BloodSun(final BloodSun card) {
super(card);
}
@ -56,7 +54,7 @@ class BloodSunEffect extends ContinuousEffectImpl {
staticText = "all lands lose all abilities except mana abilities";
}
public BloodSunEffect(final BloodSunEffect effect) {
private BloodSunEffect(final BloodSunEffect effect) {
super(effect);
}

View file

@ -6,13 +6,9 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
@ -39,7 +35,7 @@ public final class BloodtallowCandle extends CardImpl {
this.addAbility(ability);
}
public BloodtallowCandle(final BloodtallowCandle card) {
private BloodtallowCandle(final BloodtallowCandle card) {
super(card);
}

View file

@ -12,7 +12,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
@ -23,18 +23,15 @@ public final class CryptOfTheEternals extends CardImpl {
// When Crypt of the Eternals enters the battlefield, you gain 1 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(1)));
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {1}, {T}: Add {U}, {B}, or {R}.
List<Mana> list = new ArrayList<Mana>() {{
add(Mana.BlueMana(1));
add(Mana.BlackMana(1));
add(Mana.RedMana(1));
}};
for(Mana m: list) {
List<Mana> list = Arrays.asList(Mana.BlueMana(1), Mana.BlackMana(1), Mana.RedMana(1));
for (Mana m : list) {
SimpleManaAbility uAbility = new SimpleManaAbility(Zone.BATTLEFIELD, m, new ManaCostsImpl("{1}"));
uAbility.addCost(new TapSourceCost());
this.addAbility(uAbility);

View file

@ -70,9 +70,9 @@ class ForesightEffect extends SearchEffect {
card.moveToExile(null, null, targetId, game);
}
}
player.shuffleLibrary(source, game);
return true;
}
player.shuffleLibrary(source, game);
return false;
}

View file

@ -86,7 +86,7 @@ class GrinningTotemSearchAndExileEffect extends OneShotEffect {
Card card = targetOpponent.getLibrary().remove(targetCard.getFirstTarget(), game);
if (card != null) {
UUID exileZoneId = CardUtil.getCardExileZoneId(game, source);
you.moveCardToExileWithInfo(card, exileZoneId, sourceObject != null ? sourceObject.getIdName() : "", source.getSourceId(), game, Zone.LIBRARY, true);
you.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
ContinuousEffect effect = new GrinningTotemMayPlayEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);

View file

@ -59,9 +59,11 @@ class KayasWrathEffect extends OneShotEffect {
StaticFilters.FILTER_PERMANENT_CREATURE,
source.getControllerId(), source.getSourceId(), game
)) {
boolean isMine = permanent != null && permanent.isControlledBy(source.getControllerId());
if (permanent.destroy(source.getSourceId(), game, false) && isMine) {
counter++;
if (permanent != null) {
boolean isMine = permanent.isControlledBy(source.getControllerId());
if (permanent.destroy(source.getSourceId(), game, false) && isMine) {
counter++;
}
}
}
return new GainLifeEffect(counter).apply(game, source);

View file

@ -74,12 +74,14 @@ class SaplingOfColfenorEffect extends OneShotEffect {
if (controller != null && sourceObject != null) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isCreature()) {
controller.gainLife(card.getToughness().getValue(), game, source);
controller.loseLife(card.getPower().getValue(), game, false);
return controller.moveCards(cards.getCards(game), Zone.HAND, source, game);
if(card != null) {
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isCreature()) {
controller.gainLife(card.getToughness().getValue(), game, source);
controller.loseLife(card.getPower().getValue(), game, false);
return controller.moveCards(cards.getCards(game), Zone.HAND, source, game);
}
}
}
return true;

View file

@ -196,7 +196,7 @@ public class CursesTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Curse of Bloodletting");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Bloodletting", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Thirst", playerB);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Curse of Thirst", playerB);
setStopAt(2, PhaseStep.DRAW);
execute();
@ -284,9 +284,9 @@ public class CursesTest extends CardTestPlayerBase {
// {2}{G/U}{G/U}: Put the top two cards of your library into your graveyard, then return a nonland card of an opponent's choice from your graveyard to your hand.
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{G/U}{G/U}: Put the top two cards");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of Death's Hold", playerB);
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Curse of Death's Hold", playerB);
setStopAt(3, PhaseStep.END_COMBAT);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);

View file

@ -192,9 +192,9 @@ public class BloodMoonTest extends CardTestPlayerBase {
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Pithing Needle");
setChoice(playerB, "Blood Moon");
playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Ghost Quarter");
playLand(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ghost Quarter");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
setStopAt(2, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Blood Moon", 1);

View file

@ -59,7 +59,7 @@ public class DackFaydenTest extends CardTestPlayerBase {
castSpell(10, PhaseStep.PRECOMBAT_MAIN, playerA, "Gut Shot", "Ornithopter");
castSpell(10, PhaseStep.PRECOMBAT_MAIN, playerA, "Unsummon", "Ornithopter", "Gut Shot", StackClause.WHILE_NOT_ON_STACK);
castSpell(10, PhaseStep.PRECOMBAT_MAIN, playerB, "Ornithopter");
castSpell(10, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter");
setStopAt(10, PhaseStep.END_TURN);
execute();

View file

@ -800,7 +800,7 @@ public class TestPlayer implements Player {
}
private void printCards(Set<Card> cards) {
printCards(cards.stream().collect(Collectors.toList()));
printCards(new ArrayList<>(cards));
}
private void printCards(List<Card> cards) {

View file

@ -99,7 +99,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
Target target = mode.getTargets().get(0);
StringBuilder sb = new StringBuilder();
if (target.getMaxNumberOfTargets() > 1) {
if (target.getNumberOfTargets() < target.getNumberOfTargets()) {
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
sb.append("up to ");
}
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" get ");

View file

@ -69,7 +69,7 @@ class SplitSecondEffect extends ContinuousRuleModifyingEffectImpl {
}
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
Optional<Ability> ability = game.getAbility(event.getTargetId(), event.getSourceId());
if (ability != null && !(ability.get() instanceof ActivatedManaAbilityImpl)) {
if (ability.isPresent() && !(ability.get() instanceof ActivatedManaAbilityImpl)) {
return true;
}
}

View file

@ -89,7 +89,7 @@ class StormEffect extends OneShotEffect {
}
}
} else {
Logger.getLogger(StormEffect.class).fatal("CastSpellLastTurnWatcher not found. game = " + game == null ? "NULL" : game.getGameType().toString());
Logger.getLogger(StormEffect.class).fatal("CastSpellLastTurnWatcher not found. game = " +game.getGameType().toString());
}
return true;
}

View file

@ -50,6 +50,7 @@ public class TargetActivatedAbility extends TargetObject {
return stackObject != null
&& stackObject.getStackAbility() != null
&& stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED
&& source != null
&& filter.match(stackObject, source.getSourceId(), source.getControllerId(), game);
}

View file

@ -42,7 +42,7 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject {
}
StackObject stackObject = game.getStack().getStackObject(id);
return isActivatedOrTriggeredAbility(stackObject) && filter.match(stackObject, source.getSourceId(), source.getControllerId(), game);
return isActivatedOrTriggeredAbility(stackObject) && source != null && filter.match(stackObject, source.getSourceId(), source.getControllerId(), game);
}
@Override