* Landfall - Fixed a bug that the check if a land was player did not work always correctly.

This commit is contained in:
LevelX2 2015-09-05 12:13:05 +02:00
parent 411ea27772
commit 67969e9f80
2 changed files with 12 additions and 14 deletions

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.worldwake;
import java.util.HashSet;
@ -45,7 +44,6 @@ import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.watchers.Watcher;
import mage.watchers.common.LandfallWatcher;
/**
@ -140,10 +138,10 @@ class SearingBlazeTarget extends TargetPermanent {
Set<UUID> possibleTargets = new HashSet<>();
MageObject object = game.getObject(sourceId);
if (object instanceof StackObject) {
UUID playerId = ((StackObject)object).getStackAbility().getFirstTarget();
UUID playerId = ((StackObject) object).getStackAbility().getFirstTarget();
for (UUID targetId : availablePossibleTargets) {
Permanent permanent = game.getPermanent(targetId);
if(permanent != null && permanent.getControllerId().equals(playerId)){
if (permanent != null && permanent.getControllerId().equals(playerId)) {
possibleTargets.add(targetId);
}
}
@ -155,4 +153,4 @@ class SearingBlazeTarget extends TargetPermanent {
public SearingBlazeTarget copy() {
return new SearingBlazeTarget(this);
}
}
}

View file

@ -17,14 +17,14 @@ import mage.watchers.Watcher;
public class LandfallWatcher extends Watcher {
Set<UUID> playerPlayedLand = new HashSet<>();
public LandfallWatcher() {
super("LandPlayed", WatcherScope.GAME);
}
public LandfallWatcher(final LandfallWatcher watcher) {
super(watcher);
playerPlayedLand.addAll(playerPlayedLand);
playerPlayedLand.addAll(watcher.playerPlayedLand);
}
@Override
@ -45,9 +45,9 @@ public class LandfallWatcher extends Watcher {
@Override
public void reset() {
playerPlayedLand.clear();
super.reset();
super.reset();
}
public boolean landPlayed(UUID playerId) {
return playerPlayedLand.contains(playerId);
}