* Vampire Hexmage - Fixed possible ConcurrentModificationException.

This commit is contained in:
LevelX2 2017-08-26 13:33:44 +02:00
parent e7a3fee8d7
commit 58627bfcf6

View file

@ -51,7 +51,7 @@ import mage.target.TargetPermanent;
public class VampireHexmage extends CardImpl {
public VampireHexmage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}");
this.subtype.add("Vampire");
this.subtype.add("Shaman");
@ -77,12 +77,12 @@ public class VampireHexmage extends CardImpl {
class VampireHexmageEffect extends OneShotEffect {
VampireHexmageEffect ( ) {
VampireHexmageEffect() {
super(Outcome.Benefit);
staticText = "Remove all counters from target permanent";
}
VampireHexmageEffect ( VampireHexmageEffect effect ) {
VampireHexmageEffect(VampireHexmageEffect effect) {
super(effect);
}
@ -93,18 +93,13 @@ class VampireHexmageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
TargetPermanent target = (TargetPermanent)source.getTargets().get(0);
Permanent permanent = game.getPermanent(target.getFirstTarget());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
for(Counter counter : permanent.getCounters(game).values()){
for (Counter counter : permanent.getCounters(game).copy().values()) { // copy to prevent ConcurrentModificationException
permanent.removeCounters(counter, game);
}
return true;
}
return false;
}