mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-30 02:56:44 +00:00 
			
		
		
		
	Merge pull request #1146 from Allofich/fortify
Fix fortify maximum magicka expiration
This commit is contained in:
		
						commit
						5f92cc413d
					
				
					 3 changed files with 14 additions and 7 deletions
				
			
		|  | @ -512,8 +512,8 @@ namespace MWMechanics | ||||||
|                 if (magnitude > 0 && remainingTime > 0 && remainingTime < mDuration) |                 if (magnitude > 0 && remainingTime > 0 && remainingTime < mDuration) | ||||||
|                 { |                 { | ||||||
|                     CreatureStats& creatureStats = mActor.getClass().getCreatureStats(mActor); |                     CreatureStats& creatureStats = mActor.getClass().getCreatureStats(mActor); | ||||||
|                     effectTick(creatureStats, mActor, key, magnitude * remainingTime); |                     if (effectTick(creatureStats, mActor, key, magnitude * remainingTime)) | ||||||
|                     creatureStats.getMagicEffects().add(key, -magnitude); |                         creatureStats.getMagicEffects().add(key, -magnitude); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|     }; |     }; | ||||||
|  | @ -527,8 +527,10 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|         if (duration > 0) |         if (duration > 0) | ||||||
|         { |         { | ||||||
|             // apply correct magnitude for tickable effects that have just expired,
 |             // Apply correct magnitude for tickable effects that have just expired,
 | ||||||
|             // in case duration > remaining time of effect
 |             // in case duration > remaining time of effect.
 | ||||||
|  |             // One case where this will happen is when the player uses the rest/wait command
 | ||||||
|  |             // while there is a tickable effect active that should expire before the end of the rest/wait.
 | ||||||
|             ExpiryVisitor visitor(ptr, duration); |             ExpiryVisitor visitor(ptr, duration); | ||||||
|             creatureStats.getActiveSpells().visitEffectSources(visitor); |             creatureStats.getActiveSpells().visitEffectSources(visitor); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1009,10 +1009,10 @@ namespace MWMechanics | ||||||
|         creatureStats.setDynamic(index, stat); |         creatureStats.setDynamic(index, stat); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const EffectKey &effectKey, float magnitude) |     bool effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const EffectKey &effectKey, float magnitude) | ||||||
|     { |     { | ||||||
|         if (magnitude == 0.f) |         if (magnitude == 0.f) | ||||||
|             return; |             return false; | ||||||
| 
 | 
 | ||||||
|         bool receivedMagicDamage = false; |         bool receivedMagicDamage = false; | ||||||
| 
 | 
 | ||||||
|  | @ -1144,10 +1144,13 @@ namespace MWMechanics | ||||||
|         case ESM::MagicEffect::RemoveCurse: |         case ESM::MagicEffect::RemoveCurse: | ||||||
|             actor.getClass().getCreatureStats(actor).getSpells().purgeCurses(); |             actor.getClass().getCreatureStats(actor).getSpells().purgeCurses(); | ||||||
|             break; |             break; | ||||||
|  |         default: | ||||||
|  |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (receivedMagicDamage && actor == getPlayer()) |         if (receivedMagicDamage && actor == getPlayer()) | ||||||
|             MWBase::Environment::get().getWindowManager()->activateHitOverlay(false); |             MWBase::Environment::get().getWindowManager()->activateHitOverlay(false); | ||||||
|  |         return true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -63,7 +63,9 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|     int getEffectiveEnchantmentCastCost (float castCost, const MWWorld::Ptr& actor); |     int getEffectiveEnchantmentCastCost (float castCost, const MWWorld::Ptr& actor); | ||||||
| 
 | 
 | ||||||
|     void effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const MWMechanics::EffectKey& effectKey, float magnitude); |     /// Apply a magic effect that is applied in tick intervals until its remaining time ends or it is removed
 | ||||||
|  |     /// @return Was the effect a tickable effect with a magnitude?
 | ||||||
|  |     bool effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const MWMechanics::EffectKey& effectKey, float magnitude); | ||||||
| 
 | 
 | ||||||
|     class CastSpell |     class CastSpell | ||||||
|     { |     { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue