MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / knockOut

Method knockOut

src/Savegame/BattleUnit.cpp:1026–1042  ·  view source on GitHub ↗

* Raises a unit's stun level sufficiently so that the unit is ready to become unconscious. * Used when another unit falls on top of this unit. * Zombified units first convert to their spawn unit. * @param battle Pointer to the battlescape game. */

Source from the content-addressed store, hash-verified

1024 * @param battle Pointer to the battlescape game.
1025 */
1026void BattleUnit::knockOut(BattlescapeGame *battle)
1027{
1028 if (getArmor()->getSize() > 1) // large units die
1029 {
1030 _health = 0;
1031 }
1032 else if (_spawnUnit != "")
1033 {
1034 setSpecialAbility(SPECAB_NONE);
1035 BattleUnit *newUnit = battle->convertUnit(this, _spawnUnit);
1036 newUnit->knockOut(battle);
1037 }
1038 else
1039 {
1040 _stunlevel = _health;
1041 }
1042}
1043
1044/**
1045 * Intialises the falling sequence. Occurs after death or stunned.

Callers 1

thinkMethod · 0.80

Calls 2

convertUnitMethod · 0.80
getSizeMethod · 0.45

Tested by

no test coverage detected