Skip to content

attacktype_placeholders

test edited this page Aug 14, 2024 · 9 revisions

This page contains a list of functions that can be used as PLACEHOLDERS and FILTERS

About Arguments

Some functions here may accept an argument. The brackets imply argument type, you do NOT include them when using the function.

  • <arg> - A required parameter
  • [arg] - An optional parameter
  • <arg1|arg2> - Multiple parameters options
  • <arg=value> - Default or suggested value
  • [-f flag] - A optional command argument flag

About Placeholders

Placeholders in a text, such as in a spreadsheet or message, are replaced with actual values.

Examples:

  • {myFunction}
  • {functionWithArgs(123)}
  • {withNamedArgs(myArg: 123 otherArg: 456)}
  • ({conditional}?{ifTrue}:{ifFalse})
  • 9-({numericalFunction}+5)*3

About filters

Filters are used to modify a selection. i.e. When you are choosing which things to act upon or display, you use filters to narrow down the selection to ones that meet a certain requirement. When the return type is a string, the filter can be compared using regex to the value. When the return type is boolean (true/false), it will be resolved to either 1 or 0

Examples:

  • #myBoolean,#myOtherTrueFalseFunction
  • (#myFunction=5||#myOtherFunction<10)
  • #textFunction=abc123,#regexFunction=efg.*
  • (#myFunction<(#myOtherFunction+5)

Operators

  • TERNARY: ?
  • GREATER_EQUAL: >=
  • GREATER: >
  • LESS_EQUAL: <=
  • LESS: <
  • NOT_EQUAL: !=
  • EQUAL: =
  • PLUS: +
  • MINUS: -
  • MULTIPLY: *
  • DIVIDE: /
  • POWER: ^

attacktype Selectors

  • ATTACKTYPE: One of the entity values Example: GROUND, VICTORY, FORTIFY, A_LOOT, AIRSTRIKE_INFRA, AIRSTRIKE_SOLDIER, AIRSTRIKE_TANK, AIRSTRIKE_MONEY, AIRSTRIKE_SHIP, AIRSTRIKE_AIRCRAFT, NAVAL, PEACE, MISSILE, NUKE

Sheet Columns

A google sheet url with one of the following columns is accepted: attack_type


Placeholders


#canDamage - boolean

This command is public

If this attack is one that can damage the enemy

This command has no arguments


#getAttackerAvgCasualties - int

This command is public

Get the average unit casualties for the attacker.

Arguments:

<unit> - MilitaryUnit Military unit name <attacker> - DBNation nation id, name or url <defender> - DBNation [victory=IMMENSE_TRIUMPH] - SuccessType The success type of an attack [warType=raid] - WarType A war declaration type [defAirControl=false] - boolean [attAirControl=false] - boolean [defFortified=false] - boolean [equipAttackerSoldiers=true] - boolean [equipDefenderSoldiers=true] - boolean


#getAttackerMaxCasualties - int

This command is public

Get the maximum unit casualties for the attacker.

Arguments:

<unit> - MilitaryUnit Military unit name <attacker> - DBNation nation id, name or url <defender> - DBNation [victory=IMMENSE_TRIUMPH] - SuccessType The success type of an attack [warType=raid] - WarType A war declaration type [defAirControl=false] - boolean [attAirControl=false] - boolean [defFortified=false] - boolean [equipAttackerSoldiers=true] - boolean [equipDefenderSoldiers=true] - boolean


#getAttackerMinCasualties - int

This command is public

Get the minimum unit casualties for the attacker.

Arguments:

<unit> - MilitaryUnit Military unit name <attacker> - DBNation nation id, name or url <defender> - DBNation [victory=IMMENSE_TRIUMPH] - SuccessType The success type of an attack [warType=raid] - WarType A war declaration type [defAirControl=false] - boolean [attAirControl=false] - boolean [defFortified=false] - boolean [equipAttackerSoldiers=true] - boolean [equipDefenderSoldiers=true] - boolean


#getDefenderAvgCasualties - int

This command is public

Get the average unit casualties for the defender.

Arguments:

<unit> - MilitaryUnit Military unit name <attacker> - DBNation nation id, name or url <defender> - DBNation [victory=IMMENSE_TRIUMPH] - SuccessType The success type of an attack [warType=raid] - WarType A war declaration type [defAirControl=false] - boolean [attAirControl=false] - boolean [defFortified=false] - boolean [equipAttackerSoldiers=true] - boolean [equipDefenderSoldiers=true] - boolean


#getDefenderMaxCasualties - int

This command is public

Get the maximum unit casualties for the defender.

Arguments:

<unit> - MilitaryUnit Military unit name <attacker> - DBNation nation id, name or url <defender> - DBNation [victory=IMMENSE_TRIUMPH] - SuccessType The success type of an attack [warType=raid] - WarType A war declaration type [defAirControl=false] - boolean [attAirControl=false] - boolean [defFortified=false] - boolean [equipAttackerSoldiers=true] - boolean [equipDefenderSoldiers=true] - boolean


#getDefenderMinCasualties - int

This command is public

Get the minimum unit casualties for the defender.

Arguments:

<unit> - MilitaryUnit Military unit name <attacker> - DBNation nation id, name or url <defender> - DBNation [victory=IMMENSE_TRIUMPH] - SuccessType The success type of an attack [warType=raid] - WarType A war declaration type [defAirControl=false] - boolean [attAirControl=false] - boolean [defFortified=false] - boolean [equipAttackerSoldiers=true] - boolean [equipDefenderSoldiers=true] - boolean


#getMapUsed - int

This command is public

The Military Action Points (MAP) used for this attack type

This command has no arguments


#getName - String

This command is public

The name of this attack type

This command has no arguments


#getResistance - int

This command is public

Resistance points dealt for an attack with the given success types

Arguments:

<success> - SuccessType The success type of an attack


#getResistanceIT - int

This command is public

Resistance points dealt for a successful attack

This command has no arguments


#getResource - double

This command is public

Gets a resource amount from a map of resources

Arguments:

<resources> - Map<ResourceType, Double> A comma separated list of resources and their amounts <resource> - ResourceType The name of a resource


#getResourceValue - double

This command is public

Gets the total resource value for a map of resources

Arguments:

<resources> - Map<ResourceType, Double> A comma separated list of resources and their amounts


#getUnitType - MilitaryUnit

This command is public

Get the unit type at the given index

Arguments:

<index> - int A whole number


#isVictory - boolean

This command is public

If this attack type is a victory

This command has no arguments


Clone this wiki locally