MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / PunaHit

Function PunaHit

TombEngine/Objects/TR3/Entity/PunaBoss.cpp:509–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507 }
508
509 void PunaHit(ItemInfo& target, ItemInfo& source, std::optional<GameVector> pos, int damage, bool isExplosive, int jointIndex)
510 {
511 if (target.TestFlags((int)BossItemFlags::Object, (short)BossFlagValue::Shield) &&
512 target.TestFlagField((int)BossItemFlags::ShieldIsEnabled, 1))
513 {
514 auto color = Vector4(
515 0.0f,
516 Random::GenerateFloat(0.0f, 0.5f),
517 Random::GenerateFloat(0.0f, 0.5f),
518 Random::GenerateFloat(0.5f, 0.8f));
519
520 if (pos.has_value() && !isExplosive)
521 {
522 SpawnShieldAndRichochetSparks(target, pos->ToVector3(), color);
523 }
524 else if (isExplosive)
525 {
526 SpawnShield(target, color);
527 }
528 }
529 else
530 {
531 if (target.HitStatus)
532 SoundEffect(SFX_TR3_PUNA_BOSS_TAKE_HIT, &target.Pose);
533
534 if (pos.has_value())
535 DoBloodSplat(pos->x, pos->y, pos->z, 5, source.Pose.Orientation.y, pos->RoomNumber);
536
537 DoItemHit(&target, damage, isExplosive, false);
538 }
539 }
540}

Callers

nothing calls this directly

Calls 11

GenerateFloatFunction · 0.85
SpawnShieldFunction · 0.85
SoundEffectFunction · 0.85
DoBloodSplatFunction · 0.85
DoItemHitFunction · 0.85
TestFlagsMethod · 0.80
TestFlagFieldMethod · 0.80
Vector4Function · 0.50
has_valueMethod · 0.45
ToVector3Method · 0.45

Tested by

no test coverage detected