forked from External/mage
* Reworked/Cleaned card movement handling.
This commit is contained in:
parent
0f15f4a808
commit
8b8097878c
54 changed files with 714 additions and 687 deletions
|
|
@ -34,6 +34,7 @@ import mage.MageObject;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -41,6 +42,8 @@ import mage.game.events.GameEvent;
|
|||
*/
|
||||
public class SpellStack extends ArrayDeque<StackObject> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SpellStack.class);
|
||||
|
||||
protected Date dateLastAdded;
|
||||
|
||||
public SpellStack() {
|
||||
|
|
@ -61,18 +64,21 @@ public class SpellStack extends ArrayDeque<StackObject> {
|
|||
top.resolve(game);
|
||||
} finally {
|
||||
if (top != null) {
|
||||
this.remove(top);
|
||||
if (contains(top)) {
|
||||
logger.warn("StackObject was still on the stack after resoving" + top.getName());
|
||||
this.remove(top);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(StackObject object) {
|
||||
public boolean remove(StackObject object) {
|
||||
for (StackObject spell : this) {
|
||||
if (spell.getId().equals(object.getId())) {
|
||||
super.remove(spell);
|
||||
return;
|
||||
return super.remove(spell);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean counter(UUID objectId, UUID sourceId, Game game) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue