mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Beginning Command Zone / Emblem work
This commit is contained in:
parent
a30782fbb1
commit
4ac54673ee
4 changed files with 112 additions and 1 deletions
|
@ -341,7 +341,7 @@ public final class Constants {
|
|||
}
|
||||
|
||||
public enum Zone {
|
||||
HAND, GRAVEYARD, LIBRARY, BATTLEFIELD, STACK, EXILED, ALL, OUTSIDE, PICK;
|
||||
HAND, GRAVEYARD, LIBRARY, BATTLEFIELD, STACK, EXILED, ALL, OUTSIDE, PICK, COMMAND;
|
||||
|
||||
public boolean match(Zone zone) {
|
||||
if (this == zone || this == ALL || zone == ALL)
|
||||
|
|
|
@ -44,6 +44,7 @@ import mage.abilities.TriggeredAbilities;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffects;
|
||||
import mage.game.combat.Combat;
|
||||
import mage.game.command.Command;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Battlefield;
|
||||
|
@ -76,6 +77,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private UUID priorityPlayerId;
|
||||
private Turn turn;
|
||||
private SpellStack stack;
|
||||
private Command command;
|
||||
private Exile exile;
|
||||
private Revealed revealed;
|
||||
private Map<UUID, LookedAt> lookedAt = new HashMap<UUID, LookedAt>();
|
||||
|
@ -98,6 +100,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
playerList = new PlayerList();
|
||||
turn = new Turn();
|
||||
stack = new SpellStack();
|
||||
command = new Command();
|
||||
exile = new Exile();
|
||||
revealed = new Revealed();
|
||||
lookedAt = new HashMap<UUID, LookedAt>();
|
||||
|
@ -118,6 +121,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
this.priorityPlayerId = state.priorityPlayerId;
|
||||
this.turn = state.turn.copy();
|
||||
this.stack = state.stack.copy();
|
||||
this.command = state.command.copy();
|
||||
this.exile = state.exile.copy();
|
||||
this.revealed = state.revealed.copy();
|
||||
for (UUID key: state.lookedAt.keySet()) {
|
||||
|
@ -314,6 +318,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
|
||||
public void restore(GameState state) {
|
||||
this.stack = state.stack;
|
||||
this.command = state.command;
|
||||
this.effects = state.effects;
|
||||
this.triggers = state.triggers;
|
||||
this.combat = state.combat;
|
||||
|
@ -347,6 +352,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
battlefield.checkTriggers(event, game);
|
||||
stack.checkTriggers(event, game);
|
||||
command.checkTriggers(event, game);
|
||||
delayed.checkTriggers(event, game);
|
||||
exile.checkTriggers(event, game);
|
||||
}
|
||||
|
|
56
Mage/src/mage/game/command/Command.java
Normal file
56
Mage/src/mage/game/command/Command.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* 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.game.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Viserion
|
||||
*/
|
||||
public class Command extends ArrayList<CommandObject> {
|
||||
|
||||
public Command () {}
|
||||
|
||||
public Command(final Command command) {
|
||||
//
|
||||
}
|
||||
|
||||
public void checkTriggers(GameEvent event, Game game) {
|
||||
for (CommandObject commandObject: this) {
|
||||
commandObject.checkTriggers(event, game);
|
||||
}
|
||||
}
|
||||
|
||||
public Command copy() {
|
||||
return new Command(this);
|
||||
}
|
||||
}
|
49
Mage/src/mage/game/command/CommandObject.java
Normal file
49
Mage/src/mage/game/command/CommandObject.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* 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.game.command;
|
||||
|
||||
import mage.game.*;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Viserion
|
||||
*/
|
||||
|
||||
public interface CommandObject extends MageObject {
|
||||
|
||||
public UUID getSourceId();
|
||||
public UUID getControllerId();
|
||||
public void checkTriggers(GameEvent event, Game game);
|
||||
|
||||
@Override
|
||||
public CommandObject copy();
|
||||
}
|
Loading…
Reference in a new issue