|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcivquest.units.UnitMover
A UnitMover is responsible for calculating moves of groups of units - all located on the same field - to a neighbor-field. It transforms an Action ("move to field X") into one or more GameChanges and applys all relevant rules while doing this. Usually, it will use a MoveCalculator for the low-level-calculation-jobs. The sense of a UnitMover is offering orders for moving units that can easily be executed and that are really up-to-date. You couldn't just use the data in a MovePath calculated last turn because since then, almost everything might have changed.
Constructor Summary | |
UnitMover()
|
Method Summary | |
GameChange[] |
getChangesForMoveAlongPath(PossibleMovePath path)
Returns all GameChanges necessary for moving the unit one step along the given PossibleMovePath. |
abstract GameChange[] |
getUnitMoveChanges(java.util.Collection units,
Field field)
Returns all GameChanges necessary for moving the given unit-group to the given field. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UnitMover()
Method Detail |
public abstract GameChange[] getUnitMoveChanges(java.util.Collection units, Field field)
units
- a Collection of units, all located on the same Field, expected to be non-emptyfield
- a neighbor-field of the units current field
public GameChange[] getChangesForMoveAlongPath(PossibleMovePath path)
In the cases (2.) and (3.), the returned array will be the same as if you had called
getUnitMoveChanges(Collection, Field)
directly with the field mentioned above as argument.
In case (1.), path remains unchanged. In case (2.), the (only) PathStep gets removed,
if the units are located on the dest-field (without any distance-away-property set) afterwards.
In case (3.), the first PathStep gets removed, if all units move until/beyond its Field.
The second PathStep gets treated as the first one in case (2.) (see above), all
subsequent PathSteps remain unchanged in this case.
The path also remains unchanged, if getUnitMoveChanges(Collection, Field)
returns null
because it is not possible any longer (in fact, you can forget about it anyway in this case).
path
- any PossibleMovePath
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |