Allow immobile actors to initiate combat when attacked

This commit is contained in:
Aussiemon 2025-04-15 20:02:24 -06:00 committed by Aussiemon
parent 3df695df4a
commit 09ed5bb234

View File

@ -360,16 +360,12 @@ namespace MWClass
{ {
stats.setAttacked(true); stats.setAttacked(true);
// No retaliation for totally static creatures (they have no movement or attacks anyway) bool complain = sourceType == MWMechanics::DamageSourceType::Melee;
if (isMobile(ptr)) bool supportFriendlyFire = sourceType != MWMechanics::DamageSourceType::Ranged;
{ if (supportFriendlyFire && MWMechanics::friendlyHit(attacker, ptr, complain))
bool complain = sourceType == MWMechanics::DamageSourceType::Melee; setOnPcHitMe = false;
bool supportFriendlyFire = sourceType != MWMechanics::DamageSourceType::Ranged; else
if (supportFriendlyFire && MWMechanics::friendlyHit(attacker, ptr, complain)) setOnPcHitMe = MWBase::Environment::get().getMechanicsManager()->actorAttacked(ptr, attacker);
setOnPcHitMe = false;
else
setOnPcHitMe = MWBase::Environment::get().getMechanicsManager()->actorAttacked(ptr, attacker);
}
} }
// Attacker and target store each other as hitattemptactor if they have no one stored yet // Attacker and target store each other as hitattemptactor if they have no one stored yet