Unit.GetDamage (Civ5 API)

From Civilization Modding Wiki
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


Function.png This function is a member of Unit.

This is an instance method, invoke it with a colon.


Usage

int Unit:GetDamage()


Returned Value

No description available.


Source code samples

Redundant occurences have been removed.

EnemyUnitPanel.lua

UI/InGame/WorldView/EnemyUnitPanel.lua
0332
iMyDamageInflicted = pMyUnit:GetCombatDamage(iMyStrength, iTheirStrength, pMyUnit:GetDamage() + iTheirFireSupportCombatDamage, false, false, true);
0356
if (pMyUnit:GetDamage() + iTheirDamageInflicted >= maxUnitHitPoints) then
0362
DoUpdateHealthBars(maxUnitHitPoints, maxCityHitPoints, pMyUnit:GetDamage(), pCity:GetDamage(), iMyDamageInflicted, iTheirDamageInflicted)
0387
elseif (pMyUnit:GetDamage() > (maxUnitHitPoints / 2) and iTheirDamageInflicted > 0) then
0616
iMyDamageInflicted = pMyUnit:GetCombatDamage(iMyStrength, iTheirStrength, pMyUnit:GetDamage() + iTheirFireSupportCombatDamage, false, false, false);
0617
iTheirDamageInflicted = pTheirUnit:GetCombatDamage(iTheirStrength, iMyStrength, pTheirUnit:GetDamage(), false, false, false);
0632
DoUpdateHealthBars(maxUnitHitPoints, maxUnitHitPoints, pMyUnit:GetDamage(), pTheirUnit:GetDamage(), iMyDamageInflicted, iTheirDamageInflicted)
0947
if (pTheirUnit:GetDamage() > 0) then
1419
local theirUnitCurHP = theirUnit:GetDamage();


PlotMouseoverInclude.lua

UI/InGame/PlotMouseoverInclude.lua
0303
if (unit:GetDamage() > 0) then
0304
strUnitText = strUnitText .. ", " .. Locale.ConvertTextKey("TXT_KEY_PLOTROLL_UNIT_HP", GameDefines["MAX_HIT_POINTS"] - unit:GetDamage());


TurnsRemaining.lua - DLC_04 DLC

DLC/DLC_04/Scenarios/1066Scenario/TurnsRemaining.lua
0203
iUnitDamage = unit:GetDamage();


UnitPanel.lua

UI/InGame/WorldView/UnitPanel.lua
0651
local damage = unit:GetDamage();



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.