mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-03 23:56:47 +00:00 
			
		
		
		
	Fixes bug #2031
This commit is contained in:
		
							parent
							
								
									9c5f156793
								
							
						
					
					
						commit
						6741fbe7a9
					
				
					 1 changed files with 29 additions and 1 deletions
				
			
		| 
						 | 
					@ -434,7 +434,8 @@ namespace MWMechanics
 | 
				
			||||||
                float magnitude = effectIt->mMagnMin + (effectIt->mMagnMax - effectIt->mMagnMin) * random;
 | 
					                float magnitude = effectIt->mMagnMin + (effectIt->mMagnMax - effectIt->mMagnMin) * random;
 | 
				
			||||||
                magnitude *= magnitudeMult;
 | 
					                magnitude *= magnitudeMult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration);
 | 
					                bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration) && effectIt->mDuration > 0;
 | 
				
			||||||
 | 
					                std::cout << (hasDuration == true ? "true" : "false") << std::endl;
 | 
				
			||||||
                if (target.getClass().isActor() && hasDuration)
 | 
					                if (target.getClass().isActor() && hasDuration)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    ActiveSpells::ActiveEffect effect;
 | 
					                    ActiveSpells::ActiveEffect effect;
 | 
				
			||||||
| 
						 | 
					@ -578,6 +579,33 @@ namespace MWMechanics
 | 
				
			||||||
                    value.restore(magnitude);
 | 
					                    value.restore(magnitude);
 | 
				
			||||||
                target.getClass().getCreatureStats(target).setAttribute(attribute, value);
 | 
					                target.getClass().getCreatureStats(target).setAttribute(attribute, value);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            else if (effectId == ESM::MagicEffect::DamageHealth || effectId == ESM::MagicEffect::RestoreHealth)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                MWMechanics::DynamicStat<float> health = target.getClass().getCreatureStats(target).getHealth();
 | 
				
			||||||
 | 
					                if (effectId == ESM::MagicEffect::DamageHealth)
 | 
				
			||||||
 | 
					                    health.setCurrent(health.getCurrent() - magnitude);
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    health.setCurrent(health.getCurrent() + magnitude);
 | 
				
			||||||
 | 
					                target.getClass().getCreatureStats(target).setHealth(health);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else if (effectId == ESM::MagicEffect::DamageFatigue || effectId == ESM::MagicEffect::RestoreFatigue)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                MWMechanics::DynamicStat<float> fatigue = target.getClass().getCreatureStats(target).getFatigue();
 | 
				
			||||||
 | 
					                if (effectId == ESM::MagicEffect::DamageFatigue)
 | 
				
			||||||
 | 
					                    fatigue.setCurrent(fatigue.getCurrent() - magnitude);
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    fatigue.setCurrent(fatigue.getCurrent() + magnitude);
 | 
				
			||||||
 | 
					                target.getClass().getCreatureStats(target).setHealth(fatigue);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else if (effectId == ESM::MagicEffect::DamageMagicka || effectId == ESM::MagicEffect::RestoreMagicka)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                MWMechanics::DynamicStat<float> magicka = target.getClass().getCreatureStats(target).getMagicka();
 | 
				
			||||||
 | 
					                if (effectId == ESM::MagicEffect::DamageMagicka)
 | 
				
			||||||
 | 
					                    magicka.setCurrent(magicka.getCurrent() - magnitude);
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    magicka.setCurrent(magicka.getCurrent() + magnitude);
 | 
				
			||||||
 | 
					                target.getClass().getCreatureStats(target).setHealth(magicka);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            else if (effectId == ESM::MagicEffect::DamageSkill || effectId == ESM::MagicEffect::RestoreSkill)
 | 
					            else if (effectId == ESM::MagicEffect::DamageSkill || effectId == ESM::MagicEffect::RestoreSkill)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (target.getTypeName() != typeid(ESM::NPC).name())
 | 
					                if (target.getTypeName() != typeid(ESM::NPC).name())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue