MCPcopy Create free account
hub / github.com/Norbyte/ositools / HitStatusGetDamage

Function HitStatusGetDamage

OsiInterface/Functions/DamageFunctions.cpp:661–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659 }
660
661 bool HitStatusGetDamage(OsiArgumentDesc & args)
662 {
663 auto status = HitStatusGet(args);
664 if (status == nullptr) return false;
665
666 auto damageTypeStr = args[2].String;
667 auto damageType = EnumInfo<DamageType>::Find(damageTypeStr);
668 if (!damageType) {
669 OsiError("Not a valid DamageType: " << damageTypeStr);
670 return false;
671 }
672
673 auto & dmgList = status->DamageInfo.DamageList;
674 int32_t amount = 0;
675 for (uint32_t i = 0; i < dmgList.Size; i++) {
676 if (dmgList.Buf[i].DamageType == *damageType) {
677 amount += dmgList.Buf[i].Amount;
678 }
679 }
680
681 args[3].Int32 = amount;
682 return true;
683 }
684
685 void HitStatusAddDamage(OsiArgumentDesc const & args)
686 {

Callers

nothing calls this directly

Calls 1

HitStatusGetFunction · 0.85

Tested by

no test coverage detected