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

This command is responsible for build structures as Base and Barracks.

Stand-alone application

Used as a single command, build sends free units (units that have not received actions) to build a <quantity> of structures of type <type> in the cell located on the <direction> next to the unit. Build can be interpreted (composed) as:

build(<type>,<quantity>,<direction>)

The option Type defines if you want to build a Base or a Barrack. The command will try to build how many structures the quantity parameter defines, considering how many resources your player has. The option direction is based on the position of the worker that will be selected to perform the action. The picture below shows one worker building a Barrack in the UP direction.

Build Work

Combined with Loop (For)

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

build(<type>,<quantity>,<direction>,<unit>)

When build receives a <unit> as a parameter, the command will try to use the specified unit to construct a new structure of the type defined by <type>. If the build command is able to set up the action for the specific unit, it will return a command for the unit. If not, any action will be returned.

Examples of how build can be presented

In code (how to creat one)

CommandDSL ast_example = new CommandDSL("build(Base,1,Down)");

By translate method

ast_example.translate() --> print in Java console--> build(Base,1,Down)

By friendly translate method

ast_example.friendly_translate() --> print in Java console--> build(Base,1,Down)

By formated Structured DSL Tree Pre-Order Print method

BuilderDSLTreeSingleton.formatedStructuredDSLTreePreOrderPrint((iNodeDSLTree) ast_example); --> print in Java console--> c->build(Base,1,Down)

Clone this wiki locally