mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
Merge branch 'imnotyourpalbuddy' into 'master'
Reset friendly hits at the end of combat and don't count hits while in combat Closes #5755 See merge request OpenMW/openmw!3839
This commit is contained in:
commit
a54d97669f
@ -26,6 +26,7 @@
|
||||
Bug #5371: Keyframe animation tracks are used for any file that begins with an X
|
||||
Bug #5413: Enemies do a battlecry everytime the player summons a creature
|
||||
Bug #5714: Touch spells cast using ExplodeSpell don't always explode
|
||||
Bug #5755: Reset friendly hit counter
|
||||
Bug #5849: Paralysis breaks landing
|
||||
Bug #5870: Disposing of actors who were selected in the console doesn't deselect them like vanilla
|
||||
Bug #5883: Immobile creatures don't cause water ripples
|
||||
|
@ -82,7 +82,11 @@ namespace MWMechanics
|
||||
void AiSequence::onPackageRemoved(const AiPackage& package)
|
||||
{
|
||||
if (package.getTypeId() == AiPackageTypeId::Combat)
|
||||
{
|
||||
mNumCombatPackages--;
|
||||
if (mNumCombatPackages == 0)
|
||||
mResetFriendlyHits = true;
|
||||
}
|
||||
else if (package.getTypeId() == AiPackageTypeId::Pursue)
|
||||
mNumPursuitPackages--;
|
||||
|
||||
@ -246,6 +250,12 @@ namespace MWMechanics
|
||||
return;
|
||||
}
|
||||
|
||||
if (mResetFriendlyHits)
|
||||
{
|
||||
actor.getClass().getCreatureStats(actor).resetFriendlyHits();
|
||||
mResetFriendlyHits = false;
|
||||
}
|
||||
|
||||
if (mPackages.empty())
|
||||
{
|
||||
mLastAiPackage = AiPackageTypeId::None;
|
||||
|
@ -39,6 +39,7 @@ namespace MWMechanics
|
||||
|
||||
/// Finished with top AIPackage, set for one frame
|
||||
bool mDone{};
|
||||
bool mResetFriendlyHits{};
|
||||
|
||||
int mNumCombatPackages{};
|
||||
int mNumPursuitPackages{};
|
||||
|
@ -674,6 +674,8 @@ namespace MWMechanics
|
||||
return false;
|
||||
|
||||
MWMechanics::CreatureStats& statsTarget = target.getClass().getCreatureStats(target);
|
||||
if (statsTarget.getAiSequence().isInCombat())
|
||||
return true;
|
||||
statsTarget.friendlyHit();
|
||||
if (statsTarget.getFriendlyHits() >= 4)
|
||||
return false;
|
||||
|
@ -319,6 +319,11 @@ namespace MWMechanics
|
||||
++mFriendlyHits;
|
||||
}
|
||||
|
||||
void CreatureStats::resetFriendlyHits()
|
||||
{
|
||||
mFriendlyHits = 0;
|
||||
}
|
||||
|
||||
bool CreatureStats::hasTalkedToPlayer() const
|
||||
{
|
||||
return mTalkedTo;
|
||||
|
@ -200,6 +200,8 @@ namespace MWMechanics
|
||||
void friendlyHit();
|
||||
///< Increase number of friendly hits by one.
|
||||
|
||||
void resetFriendlyHits();
|
||||
|
||||
bool hasTalkedToPlayer() const;
|
||||
///< Has this creature talked with the player before?
|
||||
|
||||
@ -294,7 +296,7 @@ namespace MWMechanics
|
||||
bool wasTeleported() const { return mTeleported; }
|
||||
void setTeleported(bool v) { mTeleported = v; }
|
||||
|
||||
const std::map<ESM::RefId, AttributeValue> getAttributes() const { return mAttributes; }
|
||||
const std::map<ESM::RefId, AttributeValue>& getAttributes() const { return mAttributes; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1703,6 +1703,8 @@ namespace MWMechanics
|
||||
// We don't care about dialogue filters since the target is invalid.
|
||||
// We still want to play the combat taunt.
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, ESM::RefId::stringRefId("attack"));
|
||||
if (!stats.getAiSequence().isInCombat())
|
||||
stats.resetFriendlyHits();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user