1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Werewolf: can't sleep in beds anymore, actors will attack you on sight, and if you are seen transforming, you will be marked for death

This commit is contained in:
MiroslavR 2014-09-05 01:58:57 +02:00
parent 71a2424500
commit 9e0d5dc28a
2 changed files with 40 additions and 0 deletions

View File

@ -874,6 +874,12 @@ namespace MWMechanics
bool MechanicsManager::sleepInBed(const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed)
{
if (ptr.getClass().getNpcStats(ptr).isWerewolf())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
return true;
}
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) {
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}");
return true;
@ -1301,6 +1307,14 @@ namespace MWMechanics
+ ((50 - disposition) * fFightDispMult))
+ bias;
if (target.getClass().getNpcStats(target).isWerewolf() ||
(target == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
MWBase::Environment::get().getWorld()->getGlobalInt("pcknownwerewolf")))
{
const ESM::GameSetting * iWerewolfFightMod = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search("iWerewolfFightMod");
fight += iWerewolfFightMod->getInt();
}
return (fight >= 100);
}
}

View File

@ -390,6 +390,7 @@ namespace MWWorld
// vanilla Morrowind does not define dayspassed.
globals["dayspassed"] = ESM::Variant(1); // but the addons start counting at 1 :(
globals["WerewolfClawMult"] = ESM::Variant(1.f);
globals["PCKnownWerewolf"] = ESM::Variant(0);
for (std::map<std::string, ESM::Variant>::iterator it = gmst.begin(); it != gmst.end(); ++it)
{
@ -2330,6 +2331,31 @@ namespace MWWorld
windowManager->unsetForceHide(MWGui::GW_Inventory);
windowManager->unsetForceHide(MWGui::GW_Magic);
}
// Witnesses of the player's transformation will make them a globally known werewolf
std::vector<MWWorld::Ptr> closeActors;
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(actor.getRefData().getPosition().pos),
getStore().get<ESM::GameSetting>().search("fAlarmRadius")->getFloat(),
closeActors);
bool detected = false;
for (std::vector<MWWorld::Ptr>::const_iterator it = closeActors.begin(); it != closeActors.end(); ++it)
{
if (*it == actor)
continue;
if (getLOS(*it, actor) && MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor, *it))
{
detected = true;
break;
}
}
if (detected)
{
windowManager->messageBox("#{sWerewolfAlarmMessage}");
setGlobalInt("pcknownwerewolf", 1);
}
}
}