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

Function HitGetDamage

OsiInterface/Functions/DamageFunctions.cpp:569–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567 }
568
569 bool HitGetDamage(OsiArgumentDesc & args)
570 {
571 auto helper = HelperHandleToHelper(args[0].Int64);
572 auto damageTypeStr = args[1].String;
573 auto & damageAmount = args[2].Int32;
574
575 if (helper == nullptr) return false;
576
577 auto damageType = EnumInfo<DamageType>::Find(damageTypeStr);
578 if (!damageType) {
579 OsiError("Not a valid DamageType: " << damageTypeStr);
580 return false;
581 }
582
583 auto & dmgList = *helper->DamageList;
584 int32_t amount = 0;
585 for (uint32_t i = 0; i < dmgList.Size; i++) {
586 if (dmgList.Buf[i].DamageType == *damageType) {
587 amount += dmgList.Buf[i].Amount;
588 }
589 }
590
591 damageAmount = amount;
592 return true;
593 }
594
595 void HitAddDamage(OsiArgumentDesc const & args)
596 {

Callers

nothing calls this directly

Calls 1

HelperHandleToHelperFunction · 0.85

Tested by

no test coverage detected