|
|
|
@ -123,7 +123,7 @@ namespace MWScript
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWMechanics::AttributeValue attribute = ptr.getClass().getCreatureStats(ptr).getAttribute(mIndex);
|
|
|
|
|
attribute.setBase (value - (attribute.getModified() - attribute.getBase()));
|
|
|
|
|
attribute.setBase (value);
|
|
|
|
|
ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -148,7 +148,18 @@ namespace MWScript
|
|
|
|
|
.getCreatureStats(ptr)
|
|
|
|
|
.getAttribute(mIndex);
|
|
|
|
|
|
|
|
|
|
attribute.setBase (std::min(100, attribute.getBase() + value));
|
|
|
|
|
if (value == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (((attribute.getBase() <= 0) && (value < 0))
|
|
|
|
|
|| ((attribute.getBase() >= 100) && (value > 0)))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (value < 0)
|
|
|
|
|
attribute.setBase(std::max(0, attribute.getBase() + value));
|
|
|
|
|
else
|
|
|
|
|
attribute.setBase(std::min(100, attribute.getBase() + value));
|
|
|
|
|
|
|
|
|
|
ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -350,12 +361,7 @@ namespace MWScript
|
|
|
|
|
|
|
|
|
|
MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats (ptr);
|
|
|
|
|
|
|
|
|
|
int newLevel = value - (stats.getSkill(mIndex).getModified() - stats.getSkill(mIndex).getBase());
|
|
|
|
|
|
|
|
|
|
if (newLevel<0)
|
|
|
|
|
newLevel = 0;
|
|
|
|
|
|
|
|
|
|
stats.getSkill (mIndex).setBase (newLevel);
|
|
|
|
|
stats.getSkill (mIndex).setBase (value);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -375,10 +381,21 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats(ptr);
|
|
|
|
|
MWMechanics::SkillValue &skill = ptr.getClass()
|
|
|
|
|
.getNpcStats(ptr)
|
|
|
|
|
.getSkill(mIndex);
|
|
|
|
|
|
|
|
|
|
if (value == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (((skill.getBase() <= 0) && (value < 0))
|
|
|
|
|
|| ((skill.getBase() >= 100) && (value > 0)))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
stats.getSkill(mIndex).
|
|
|
|
|
setBase (std::min(100, stats.getSkill(mIndex).getBase() + value));
|
|
|
|
|
if (value < 0)
|
|
|
|
|
skill.setBase(std::max(0, skill.getBase() + value));
|
|
|
|
|
else
|
|
|
|
|
skill.setBase(std::min(100, skill.getBase() + value));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|