Properties

$db

$db : resource

Type

resource — Database connection.

$id

$id : integer

Type

integer — Unit identifier.

$family

$family : integer

Type

integer — Unit family id.

$name

$name : string

Type

string — Unit name.

$element

$element : integer

Type

integer — Unit element id.

$element_name

$element_name : string

Type

string — Element name (title case)

$archetype

$archetype : integer

Type

integer — Unit archetype id.

$archetype_name

$archetype_name : string

Type

string — Archetype name (title case).

$base_stars

$base_stars : integer

Type

integer — Default star level.

$natural_stars

$natural_stars : integer

Type

integer — Default star level.

$obtainable

$obtainable : boolean

Type

boolean — Indicates if the unit is obtainable.

$can_awaken

$can_awaken : boolean

Type

boolean — Indicates if the unit can be awakened.

$awaken_bonus

$awaken_bonus : string

Type

string — Bonus when awakening.

$skill_ups_to_max

$skill_ups_to_max : integer

Type

integer — Required skill-ups.

$leader_skill

$leader_skill : \K_Leader_Skill

Type

\K_Leader_Skill — Unit's leader skill.

$hp

$hp : integer

Type

integer — Base HP.

$atk

$atk : integer

Type

integer — Base attack.

$defense

$defense : integer

Type

integer — Base defense.

$speed

$speed : integer

Type

integer — Speed.

$crit_rate

$crit_rate : integer

Type

integer — Critical rate.

$crit_damage

$crit_damage : integer

Type

integer — Critical damage.

$resistance

$resistance : integer

Type

integer — Resistance

$accuracy

$accuracy : integer

Type

integer — Accuracy.

$raw_hp

$raw_hp : integer

Type

integer — Raw HP.

$raw_atk

$raw_atk : integer

Type

integer — Raw attack.

$raw_defense

$raw_defense : integer

Type

integer — Raw Defense.

$max_lvl_hp

$max_lvl_hp : integer

Type

integer — HP at max_level.

$max_lvl_atk

$max_lvl_atk : integer

Type

integer — Attack at max_level.

$max_lvl_defense

$max_lvl_defense : integer

Type

integer — Defense at max_level.

$awakens_from

$awakens_from : \K_Unit

Type

\K_Unit — Unit it awakens from.

$awakens_to

$awakens_to : \K_Unit

Type

\K_Unit — Unit it awakens to.

$fusion_food

$fusion_food : boolean

Type

boolean — Indicates if the unit is a fusion ingredient.

$homunculus

$homunculus : boolean

Type

boolean — Indicates if the unit is homunculus.

$craft_cost

$craft_cost : integer

Type

integer — The crafting cost (homunculus only).

$skill

$skill : array<mixed,\K_Unit_Skill>

Type

array<mixed,\K_Unit_Skill> — Unit skills.

$essences

$essences : array<mixed,mixed>

Type

array<mixed,mixed> — Required essences to awaken the unit. Formed by arrays of: [ "element" => "", "grade" => "", "amount" => ]

$sources

$sources : integer

Type

integer — \K_Source[] Sources the unit can be get from.

$title

$title : string

Type

string — Unit title. If awakened, it will be the awakened from name. If unawakened, it will be <element> <name>.

$transformation

$transformation : \K_Unit_Transformation

Type

\K_Unit_Transformation — The transformation the unit can undergo.

Methods

__construct()

__construct(\resouce  $db, integer  $id, boolean  $complete = true) 

Constructor.

Searches the database and retrieves the information about the unit, populating it and it's items.

Parameters

\resouce $db

Connection to the database.

integer $id

Unit identifier.

boolean $complete

If false, query only k_unit.

load_essences()

load_essences() 

Loads the information about the essences to awake the unit.

It is autoatically called at construction time if the $complete parameter is true (by default). No point in calling it twice.

load_transformation()

load_transformation() 

Loads the unit transformation.

It is automatically called at construction time if the $complete parameter is true (by default). No point in calling it twice.

load_skills()

load_skills() 

Loads the information about the unit skills.

It is autoatically called at construction time if the $complete parameter is true (by default). No point in calling it twice.

load_sources()

load_sources() 

Loads the information about the unit sources.

It is autoatically called at construction time if the $complete parameter is true (by default). No point in calling it twice.

get_image()

get_image() : string

Gets the path to the unit image. The image must be in the img/unit/ directory, and it's name must be the unit id, padded with '0' to 8 digits, and the extension must be '.png'.

Returns

string —

Image URL, or a fixed unknown image.