mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Do not allow soul trapping the same creature more than once (Fixes #3102)
This commit is contained in:
parent
0bec6e5fbe
commit
63b9b075aa
@ -149,14 +149,20 @@ namespace MWMechanics
|
||||
{
|
||||
MWWorld::Ptr mCreature;
|
||||
MWWorld::Ptr mActor;
|
||||
bool mTrapped;
|
||||
public:
|
||||
SoulTrap(MWWorld::Ptr trappedCreature)
|
||||
: mCreature(trappedCreature) {}
|
||||
: mCreature(trappedCreature)
|
||||
, mTrapped(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void visit (MWMechanics::EffectKey key,
|
||||
const std::string& sourceName, const std::string& sourceId, int casterActorId,
|
||||
float magnitude, float remainingTime = -1, float totalTime = -1)
|
||||
{
|
||||
if (mTrapped)
|
||||
return;
|
||||
if (key.mId != ESM::MagicEffect::Soultrap)
|
||||
return;
|
||||
if (magnitude <= 0)
|
||||
@ -203,6 +209,8 @@ namespace MWMechanics
|
||||
gem->getContainerStore()->unstack(*gem, caster);
|
||||
gem->getCellRef().setSoul(mCreature.getCellRef().getRefId());
|
||||
|
||||
mTrapped = true;
|
||||
|
||||
if (caster == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user