mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 17:26:42 +00:00 
			
		
		
		
	Merge remote-tracking branch 'scrawl/magic'
This commit is contained in:
		
						commit
						a198751f21
					
				
					 4 changed files with 20 additions and 1 deletions
				
			
		|  | @ -69,7 +69,7 @@ add_openmw_dir (mwclass | |||
| add_openmw_dir (mwmechanics | ||||
|     mechanicsmanagerimp stat character creaturestats magiceffects movement actors objects | ||||
|     drawstate spells activespells npcstats aipackage aisequence alchemy aiwander aitravel aifollow | ||||
|     aiescort aiactivate repair enchanting pathfinding security | ||||
|     aiescort aiactivate repair enchanting pathfinding security spellsuccess | ||||
|     ) | ||||
| 
 | ||||
| add_openmw_dir (mwbase | ||||
|  |  | |||
|  | @ -47,6 +47,7 @@ namespace MWMechanics | |||
|         if(!paused) | ||||
|         { | ||||
|             updateDrowning(ptr, duration); | ||||
|             calculateNpcStatModifiers(ptr); | ||||
|             updateEquippedLight(ptr, duration); | ||||
|         } | ||||
|     } | ||||
|  | @ -170,6 +171,20 @@ namespace MWMechanics | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr) | ||||
|     { | ||||
|         NpcStats &npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr); | ||||
|         const MagicEffects &effects = npcStats.getMagicEffects(); | ||||
| 
 | ||||
|         // skills
 | ||||
|         for(int i = 0;i < ESM::Skill::Length;++i) | ||||
|         { | ||||
|             Stat<float>& skill = npcStats.getSkill(i); | ||||
|             skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).mMagnitude - | ||||
|                              effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).mMagnitude); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     void Actors::updateDrowning(const MWWorld::Ptr& ptr, float duration) | ||||
|     { | ||||
|         MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||
|  |  | |||
|  | @ -34,11 +34,14 @@ namespace MWMechanics | |||
| 
 | ||||
|         void updateNpc(const MWWorld::Ptr &ptr, float duration, bool paused); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|             void adjustMagicEffects (const MWWorld::Ptr& creature); | ||||
| 
 | ||||
|             void calculateDynamicStats (const MWWorld::Ptr& ptr); | ||||
| 
 | ||||
|             void calculateCreatureStatModifiers (const MWWorld::Ptr& ptr); | ||||
|             void calculateNpcStatModifiers (const MWWorld::Ptr& ptr); | ||||
| 
 | ||||
|             void calculateRestoration (const MWWorld::Ptr& ptr, float duration); | ||||
| 
 | ||||
|  |  | |||
|  | @ -2077,6 +2077,7 @@ namespace MWWorld | |||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             actor.getClass().skillUsageSucceeded(actor, MWMechanics::spellSchoolToSkill(MWMechanics::getSpellSchool(selectedSpell, actor)), 0); | ||||
| 
 | ||||
|             actor.getClass().getCreatureStats(actor).getActiveSpells().addSpell(selectedSpell, actor, ESM::RT_Self); | ||||
|             // TODO: RT_Range, RT_Touch
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue