mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-16 16:20:53 +00:00
Make Set/Mod[DynamicStat] work with negative values as in vanilla
This commit is contained in:
parent
5aef14eccd
commit
4e52c96cf5
@ -179,7 +179,7 @@ namespace MWGui
|
||||
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||
{
|
||||
int current = static_cast<int>(value.getCurrent());
|
||||
int modified = static_cast<int>(value.getModified());
|
||||
int modified = static_cast<int>(value.getModified(false));
|
||||
|
||||
// Fatigue can be negative
|
||||
if (id != "FBar")
|
||||
|
@ -218,8 +218,8 @@ namespace MWScript
|
||||
MWMechanics::DynamicStat<float> stat (ptr.getClass().getCreatureStats (ptr)
|
||||
.getDynamic (mIndex));
|
||||
|
||||
stat.setModified (value, 0);
|
||||
stat.setCurrent(value);
|
||||
stat.setBase(value);
|
||||
stat.setCurrent(value, true);
|
||||
|
||||
ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat);
|
||||
}
|
||||
@ -259,19 +259,18 @@ namespace MWScript
|
||||
}
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
|
||||
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||
|
||||
Interpreter::Type_Float current = stats.getDynamic(mIndex).getCurrent();
|
||||
MWMechanics::DynamicStat<float> stat = stats.getDynamic(mIndex);
|
||||
|
||||
MWMechanics::DynamicStat<float> stat (ptr.getClass().getCreatureStats (ptr)
|
||||
.getDynamic (mIndex));
|
||||
float current = stat.getCurrent();
|
||||
float base = diff + stat.getBase();
|
||||
if(mIndex != 2)
|
||||
base = std::max(base, 0.f);
|
||||
stat.setBase(base);
|
||||
stat.setCurrent(diff + current, true);
|
||||
|
||||
stat.setModified (diff + stat.getModified(), 0);
|
||||
stat.setCurrentModified (diff + stat.getCurrentModified());
|
||||
|
||||
stat.setCurrent (diff + current);
|
||||
|
||||
ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat);
|
||||
stats.setDynamic (mIndex, stat);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user