Sonar fixes

This commit is contained in:
Ingmar Goudt 2019-07-09 21:57:55 +02:00
parent 1621704b12
commit 178da75e4d
39 changed files with 97 additions and 79 deletions

View file

@ -3,6 +3,7 @@
package mage.abilities;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
/**
@ -24,7 +25,7 @@ public class SpecialActions extends AbilitiesImpl<SpecialAction> {
* false = only non mana actions get returned
* @return
*/
public LinkedHashMap<UUID, SpecialAction> getControlledBy(UUID controllerId, boolean manaAction) {
public Map<UUID, SpecialAction> getControlledBy(UUID controllerId, boolean manaAction) {
LinkedHashMap<UUID, SpecialAction> controlledBy = new LinkedHashMap<>();
for (SpecialAction action: this) {
if (action.isControlledBy(controllerId) && action.isManaAction() == manaAction) {

View file

@ -19,6 +19,7 @@ public enum RaidCondition implements Condition {
return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) > 0;
}
@Override
public String toString() {
return "if you attacked with a creature this turn";
}

View file

@ -27,7 +27,7 @@ public class AlternativeCost2Impl<T extends AlternativeCost2Impl<T>> extends Cos
this.name = name;
this.delimiter = delimiter;
if (reminderText != null) {
this.reminderText = new StringBuilder("<i>").append(reminderText).append("</i>").toString();
this.reminderText = "<i>" + reminderText + "</i>";
}
this.add(cost);
}

View file

@ -22,7 +22,7 @@ import mage.util.CardUtil;
*/
public class AlternativeCostSourceAbility extends StaticAbility implements AlternativeSourceCosts {
Costs<AlternativeCost2> alternateCosts = new CostsImpl<>();
private Costs<AlternativeCost2> alternateCosts = new CostsImpl<>();
protected Condition condition;
protected String rule;
protected FilterCard filter;
@ -149,8 +149,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
if (!onlyMana) {
ability.getCosts().clear();
}
for (Cost cost : alternativeCostsToCheck) {
AlternativeCost2 alternateCost = (AlternativeCost2) cost;
for (AlternativeCost2 alternateCost : alternativeCostsToCheck) {
alternateCost.activate();
for (Iterator it = ((Costs) alternateCost).iterator(); it.hasNext();) {
Cost costDeailed = (Cost) it.next();

View file

@ -6,6 +6,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
@ -140,7 +141,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
if (permanent != null) {
// handle copies of copies
Permanent copyFromPermanent = permanent;
for (Effect effect : game.getState().getContinuousEffects().getLayeredEffects(game)) {
for (ContinuousEffect effect : game.getState().getContinuousEffects().getLayeredEffects(game)) {
if (effect instanceof CopyEffect) {
CopyEffect copyEffect = (CopyEffect) effect;
// there is another copy effect that our targetPermanent copies stats from

View file

@ -2,6 +2,7 @@
package mage.abilities.effects.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
@ -84,7 +85,7 @@ public class CreateTokenEffect extends OneShotEffect {
return lastAddedTokenId;
}
public ArrayList<UUID> getLastAddedTokenIds() {
public List<UUID> getLastAddedTokenIds() {
return lastAddedTokenIds;
}

View file

@ -64,8 +64,8 @@ public class UntapLandsEffect extends OneShotEffect {
}
}
if (target.choose(Outcome.Untap, source.getControllerId(), source.getSourceId(), game)) {
for (Object targetId : target.getTargets()) {
Permanent p = game.getPermanent((UUID) targetId);
for (UUID targetId : target.getTargets()) {
Permanent p = game.getPermanent(targetId);
if (p != null) {
p.untap(game);
}

View file

@ -132,8 +132,8 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
if (numberToDiscard > 0) {
TargetCard target = new TargetCard(numberToDiscard, Zone.HAND, filter);
if (controller.choose(Outcome.Benefit, revealedCards, target, game)) {
for (Object targetId : target.getTargets()) {
Card card = revealedCards.get((UUID) targetId, game);
for (UUID targetId : target.getTargets()) {
Card card = revealedCards.get(targetId, game);
if (card != null) {
if (!player.discard(card, source, game)) {
result = false;