monrovia.game.commands
Class GameWalk

java.lang.Object
  |
  +--monrovia.server.platform.GameObject
        |
        +--monrovia.server.platform.Command
              |
              +--monrovia.server.platform.commands.Walk
                    |
                    +--monrovia.game.commands.GameWalk

public class GameWalk
extends Walk

GameWalk class implements the game specific walk, that includes fleeing from battle and engaging battle


Fields inherited from class monrovia.server.platform.Command
DIRADDS, DIRTEXTS
 
Constructor Summary
GameWalk()
          Default constructor
 
Method Summary
 void execute()
          Place to do the actual execution.
 boolean tryExecution()
          Check and set marks to see whether this command conflicts with any other command.
 
Methods inherited from class monrovia.server.platform.commands.Walk
postExecute
 
Methods inherited from class monrovia.server.platform.Command
addParameters, getCommander, getIntArgs, getStringArg, isExecute, preExecute, setExecute, setIntArgs, setStringArg
 
Methods inherited from class monrovia.server.platform.GameObject
addParameter, checkParameters, clearCommandMarks, create, getArea, getCommandMark, getGI, getID, getLocation, getName, getNeededParameters, getOptionalParameters, getParameter, initialize, removeParameter, resetObject, resetParameters, setCommandMark, setParameter, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameWalk

public GameWalk()
Default constructor
Method Detail

tryExecution

public boolean tryExecution()
Description copied from class: Command
Check and set marks to see whether this command conflicts with any other command.

First check whether the mark is already there. If it is our mark, then it is fine. If it is someone others mark, then we have a conflict. If there is no mark, just put the mark there.

With conflict there first find out which one is the stronger. If it is us, then we must override the mark. If it is not us, then we can't do what we wanted to.

There are also other kind of things that can conflict with a command. For example, if we are moving, someone or something can be in the way. To cope with conflicts you can also add new commands. In the case of previous example, we can for example add a new command to move the guy in front of us out of our way.

You should use setExecute() to tell whether the execution of the command is successful.

Overrides:
tryExecution in class Walk
Following copied from class: monrovia.server.platform.Command
Returns:
True, if some mark was changed. If this method is called twice when no mark changes between those two calls, this must return false.

execute

public void execute()
Description copied from class: Command
Place to do the actual execution. Called only when execute is set.
Overrides:
execute in class Walk