mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-30 02:56:44 +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:
		
							parent
							
								
									71a2424500
								
							
						
					
					
						commit
						9e0d5dc28a
					
				
					 2 changed files with 40 additions and 0 deletions
				
			
		|  | @ -874,6 +874,12 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|     bool MechanicsManager::sleepInBed(const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed) |     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()) { |         if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { | ||||||
|             MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}"); |             MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage2}"); | ||||||
|             return true; |             return true; | ||||||
|  | @ -1301,6 +1307,14 @@ namespace MWMechanics | ||||||
|                 + ((50 - disposition)  * fFightDispMult)) |                 + ((50 - disposition)  * fFightDispMult)) | ||||||
|                 + bias; |                 + 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); |         return (fight >= 100); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -390,6 +390,7 @@ namespace MWWorld | ||||||
|         // vanilla Morrowind does not define dayspassed.
 |         // vanilla Morrowind does not define dayspassed.
 | ||||||
|         globals["dayspassed"] = ESM::Variant(1); // but the addons start counting at 1 :(
 |         globals["dayspassed"] = ESM::Variant(1); // but the addons start counting at 1 :(
 | ||||||
|         globals["WerewolfClawMult"] = ESM::Variant(1.f); |         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) |         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_Inventory); | ||||||
|                 windowManager->unsetForceHide(MWGui::GW_Magic); |                 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); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue