Remove most "unchecked conversion" errors

This commit is contained in:
Luna Skyrise 2015-05-18 19:53:34 -03:00
parent d82b57d6bb
commit 4f079286ec
18 changed files with 35 additions and 24 deletions

View file

@ -36,6 +36,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.SacrificeTargetCost;
@ -81,7 +82,7 @@ public class KnightOfTheReliquary extends CardImpl {
// {T}, Sacrifice a Forest or Plains: Search your library for a land card, put it onto the battlefield, then shuffle your library.
TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard());
Costs costs = new CostsImpl();
Costs<Cost> costs = new CostsImpl<>();
costs.add(new TapSourceCost());
costs.add(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, false)));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(target, false, Outcome.PutLandInPlay), costs));

View file

@ -62,7 +62,7 @@ public class Derelor extends CardImpl {
this.toughness = new MageInt(4);
// Black spells you cast cost {B} more to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl("B"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostIncreasementControllerEffect(filter, new ManaCostsImpl<>("{B}"))));
}
public Derelor(final Derelor card) {

View file

@ -102,7 +102,7 @@ class KinTreeInvocationCreateTokenEffect extends OneShotEffect {
objectColor.setBlack(true);
objectColor.setGreen(true);
Token token = new Token("Spirit Warrior", "X/X black and green Spirit Warrior creature token onto the battlefield, where X is the greatest toughness among creatures you control",
objectColor, list, value, value, new AbilitiesImpl());
objectColor, list, value, value, new AbilitiesImpl<>());
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true;

View file

@ -104,7 +104,7 @@ class StreetSweeperDestroyEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if(permanent != null)
{
LinkedList<UUID> attachments = new LinkedList();
LinkedList<UUID> attachments = new LinkedList<>();
attachments.addAll(permanent.getAttachments());
for(UUID uuid : attachments)
{

View file

@ -45,6 +45,7 @@ import mage.counters.CounterType;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
/**
@ -58,7 +59,7 @@ public class TrigonOfMending extends CardImpl {
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), ""));
Costs costs = new CostsImpl();
Costs<Cost> costs = new CostsImpl<>();
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
costs.add(new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), costs);

View file

@ -108,7 +108,7 @@ class OozeGardenCreateTokenEffect extends OneShotEffect {
}
ArrayList<String> list = new ArrayList<>();
list.add("Ooze");
Token token = new Token("Ooze", "X/X green Ooze creature token onto the battlefield, where X is the sacrificed creature's power", ObjectColor.GREEN, list, value, value, new AbilitiesImpl()) {
Token token = new Token("Ooze", "X/X green Ooze creature token onto the battlefield, where X is the sacrificed creature's power", ObjectColor.GREEN, list, value, value, new AbilitiesImpl<>()) {
};

View file

@ -59,7 +59,7 @@ public class DeepAnalysis extends CardImpl {
this.getSpellAbility().addTarget(new TargetPlayer());
// Flashback-{1}{U}, Pay 3 life.
CostsImpl costs = new CostsImpl();
Costs<Cost> costs = new CostsImpl<>();
costs.add(new ManaCostsImpl("{1}{U}"));
costs.add(new PayLifeCost(3));
this.addAbility(new FlashbackAbility(costs, TimingRule.SORCERY));

View file

@ -120,12 +120,12 @@ class NoRestForTheWickedWatcher extends Watcher {
public NoRestForTheWickedWatcher() {
super("NoRestForTheWickedWatcher", WatcherScope.GAME);
this.cards = new ArrayList();
this.cards = new ArrayList<>();
}
public NoRestForTheWickedWatcher(final NoRestForTheWickedWatcher watcher) {
super(watcher);
this.cards = new ArrayList();
this.cards = new ArrayList<>();
this.cards.addAll(watcher.cards);
}

View file

@ -34,6 +34,7 @@ import mage.constants.Rarity;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
@ -115,7 +116,7 @@ class PermafrostTrapWatcher extends Watcher {
}
}
class PermafrostTrapAlternativeCost extends AlternativeCostImpl {
class PermafrostTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public PermafrostTrapAlternativeCost() {
super("you may pay {U} rather than pay Permafrost Trap's mana cost");

View file

@ -34,6 +34,7 @@ import mage.constants.Rarity;
import mage.constants.WatcherScope;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.effects.common.ChooseNewTargetsTargetEffect;
import mage.cards.CardImpl;
@ -123,7 +124,7 @@ class RicochetTrapWatcher extends Watcher {
}
}
class RicochetTrapAlternativeCost extends AlternativeCostImpl {
class RicochetTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public RicochetTrapAlternativeCost() {
super("You may pay {R} rather than pay Ricochet Trap's mana cost");

View file

@ -33,6 +33,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
@ -80,7 +81,7 @@ public class SlingbowTrap extends CardImpl {
}
}
class SlingbowTrapAlternativeCost extends AlternativeCostImpl {
class SlingbowTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public SlingbowTrapAlternativeCost() {
super("you may pay {G} rather than pay {this}'s mana cost");

View file

@ -35,6 +35,7 @@ import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
@ -113,7 +114,7 @@ class CobraTrapWatcher extends Watcher {
}
}
class CobraTrapAlternativeCost extends AlternativeCostImpl {
class CobraTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public CobraTrapAlternativeCost() {
super("you may pay {G} rather than pay Cobra Trap's mana cost");

View file

@ -35,6 +35,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
@ -83,7 +84,7 @@ public class LavaballTrap extends CardImpl {
class LavaballTrapWatcher extends Watcher {
private Map<UUID, Integer> amountOfLandsPlayedThisTurn = new HashMap<UUID, Integer>();
private Map<UUID, Integer> amountOfLandsPlayedThisTurn = new HashMap<>();
public LavaballTrapWatcher() {
super("LavaballTrapWatcher", WatcherScope.GAME);
@ -108,7 +109,7 @@ class LavaballTrapWatcher extends Watcher {
if (perm.getCardType().contains(CardType.LAND)) {
Integer amount = amountOfLandsPlayedThisTurn.get(perm.getControllerId());
if (amount == null) {
amount = Integer.valueOf(1);
amount = 1;
} else {
++amount;
}
@ -121,8 +122,8 @@ class LavaballTrapWatcher extends Watcher {
int maxLands = 0;
for (UUID opponentId : game.getOpponents(playerId)) {
Integer amount = amountOfLandsPlayedThisTurn.get(opponentId);
if (amount != null && amount.intValue() > maxLands) {
maxLands = amount.intValue();
if (amount != null && amount > maxLands) {
maxLands = amount;
}
}
return maxLands;
@ -135,7 +136,7 @@ class LavaballTrapWatcher extends Watcher {
}
}
class LavaballTrapAlternativeCost extends AlternativeCostImpl {
class LavaballTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public LavaballTrapAlternativeCost() {
super("you may pay {3}{R}{R} rather than pay Lavaball Trap's mana cost");

View file

@ -33,6 +33,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
@ -78,7 +79,7 @@ public class LethargyTrap extends CardImpl {
}
}
class LethargyTrapAlternativeCost extends AlternativeCostImpl {
class LethargyTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public LethargyTrapAlternativeCost() {
super("you may pay {U} rather than pay Lethargy Trap's mana cost");

View file

@ -44,6 +44,7 @@ import mage.target.TargetPlayer;
import mage.watchers.Watcher;
import java.util.UUID;
import mage.abilities.costs.Cost;
/**
*
@ -142,7 +143,7 @@ class CardsDrawnOpponentWatcher extends Watcher {
}
}
class RuneflareTrapAlternativeCost extends AlternativeCostImpl {
class RuneflareTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public RuneflareTrapAlternativeCost() {
super("you may pay {R} rather than pay Runeflare Trap's mana cost");

View file

@ -36,6 +36,7 @@ import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -126,7 +127,7 @@ class SummoningTrapWatcher extends Watcher {
}
}
class SummoningTrapAlternativeCost extends AlternativeCostImpl {
class SummoningTrapAlternativeCost extends AlternativeCostImpl<Cost> {
public SummoningTrapAlternativeCost() {
super("you may pay {0} rather than pay Summoning Trap's mana cost");

View file

@ -35,6 +35,7 @@ import mage.constants.Zone;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.LandfallAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.common.RemoveCountersSourceCost;
@ -56,7 +57,7 @@ public class SunspringExpedition extends CardImpl {
this.color.setWhite(true);
this.addAbility(new LandfallAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true));
Costs costs = new CostsImpl();
Costs<Cost> costs = new CostsImpl<>();
costs.add(new RemoveCountersSourceCost(CounterType.QUEST.createInstance(3)));
costs.add(new SacrificeSourceCost());
ActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(8), costs);

View file

@ -3,7 +3,7 @@ package mage.abilities.costs;
import mage.abilities.Ability;
import mage.game.Game;
public class AlternativeCostImpl extends CostsImpl implements AlternativeCost {
public class AlternativeCostImpl<T extends Cost> extends CostsImpl<T> implements AlternativeCost {
protected String name;
@ -13,7 +13,7 @@ public class AlternativeCostImpl extends CostsImpl implements AlternativeCost {
public AlternativeCostImpl(String name, Cost cost) {
this.name = name;
this.add(cost);
this.add((T)cost);
}
public AlternativeCostImpl(final AlternativeCostImpl cost) {