Skip to content
Rubens de Oliveira Moraes Filho edited this page Apr 29, 2021 · 3 revisions

This command sends units, of a specific type, to move in direction of the farthest player's base.

Stand-alone application

MoveAway sends free units of type <type> to move in the direction of the farthest player’s base. MoveAway can be interpreted (composed) as:

moveaway(<type>)

If the player has more than one base in-game, the command will send the units to move in direction of the base that has the farthest euclidian distance. To define this distance the command iterate over each players' unit, and measure the current distance between the unit and each base in-game, selecting the base that has the greatest distance between the unit and the base. If the player doesn't have any base in-game, the command won't return any command for any unit. If not exists a path between the unit and the selected base, the command won't return any command, either.

Used in a Loop (For)

MoveAway can be used inside of the for structure by adding a <unit> parameter into the parameter list. It changes the command like the example below:

moveaway(<type>,<unit>)

When moveaway receives a <unit> as a parameter, the command will just try to set up an action for the unit that is iterated by the loop.


In code (how to creat one)

CommandDSL ast_example = new CommandDSL("moveaway(Light)");

By translate method

ast_example.translate() --> print in Java console--> moveaway(Light)

By friendly translate method

ast_example.friendly_translate() --> print in Java console--> moveaway(Light)

By formated Structured DSL Tree Pre-Order Print method

BuilderDSLTreeSingleton.formatedStructuredDSLTreePreOrderPrint((iNodeDSLTree) ast_example); --> print in Java console--> c->moveaway(Light)

Clone this wiki locally