| 1001 | } |
| 1002 | |
| 1003 | void DoItemHit(ItemInfo* target, int damage, bool isExplosive, bool allowBurn) |
| 1004 | { |
| 1005 | const auto& object = Objects[target->ObjectNumber]; |
| 1006 | |
| 1007 | if ((object.damageType == DamageMode::Any) || |
| 1008 | (object.damageType == DamageMode::Explosion && isExplosive)) |
| 1009 | { |
| 1010 | if (target->HitPoints > 0) |
| 1011 | { |
| 1012 | SaveGame::Statistics.Game.AmmoHits++; |
| 1013 | SaveGame::Statistics.Level.AmmoHits++; |
| 1014 | DoDamage(target, damage); |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | if (isExplosive && allowBurn && Random::TestProbability(1 / 2.0f)) |
| 1019 | ItemBurn(target); |
| 1020 | |
| 1021 | if (!target->Callbacks.OnHit.empty()) |
| 1022 | { |
| 1023 | short index = g_GameScriptEntities->GetIndexByName(target->Name); |
| 1024 | |
| 1025 | if (index != NO_VALUE) |
| 1026 | g_GameScript->ExecuteFunction(target->Callbacks.OnHit, index); |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | void DefaultItemHit(ItemInfo& target, ItemInfo& source, std::optional<GameVector> pos, int damage, bool isExplosive, int jointIndex) |
| 1031 | { |
no test coverage detected