Skip to content

Has Unit Within Distance From Opponent

Rubens de Oliveira Moraes Filho edited this page Apr 29, 2021 · 2 revisions

This boolean is responsible by evaluate if a player unit is within a distance from an opponent unit.

Stand-alone application

This method returns true if any unit of type <type> controlled by the player is within a distance of <distance> from an opponent unit; returns false otherwise. The <distance> is considered as the bound for a euclidian distance between the units. HasUnitWithinDistanceFromOpponent can be interpreted (composed) as:

HasUnitWithinDistanceFromOpponent(<type>, <distance>)

Used in a Loop (For)

HasUnitWithinDistanceFromOpponent can appear inside of a loop/if structure. This method returns true if unit <unit> of type controlled by the player is within a distance offrom an opponent unit; returns false otherwise. Note that the method also returns false if the type of the unitprovided as input isn't of type. The parameter ` changes the command like the example below:

HasUnitWithinDistanceFromOpponent(<type>, <distance>, <unit>)


In code (how to creat one)

BooleanDSL bool_example = new BooleanDSL("HasUnitWithinDistanceFromOpponent(Light,3)");

By translate method

bool_example.translate() --> print in Java console--> HasUnitWithinDistanceFromOpponent(Light,3)

By friendly translate method

bool_example.friendly_translate() --> print in Java console--> HasUnitWithinDistanceFromOpponent(Light,3)

By formated Structured DSL Tree Pre-Order Print method

BuilderDSLTreeSingleton.formatedStructuredDSLTreePreOrderPrint((iNodeDSLTree) bool_example); --> print in Java console--> b->HasUnitWithinDistanceFromOpponent(Light,3)

Clone this wiki locally