From: Jaka K. <lyn...@us...> - 2012-02-14 23:08:24
|
gemrb: Infinity Engine emulator The branch master has been updated via 829c8f695ec8b801c3da9aa3f03ade08e19f33d4 (commit) Summary of changes: gemrb/core/Scriptable/Actor.cpp | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) from 5c6ec477d342bcc4c07c7e538654029353ed5050 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=829c8f695ec8b801c3da9aa3f03ade08e19f33d4 commit 829c8f695ec8b801c3da9aa3f03ade08e19f33d4 Author: Jaka Kranjc <lyn...@us...> Date: Wed Feb 15 00:04:10 2012 +0100 GetHpAdjustment: try harder not to kill actors diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index a6a0af3..7737c32 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -4518,23 +4518,21 @@ int Actor::GetHpAdjustment(int multiplier) const { int val; - // only player classes get this bonus - if (BaseStats[IE_CLASS] == 0 || BaseStats[IE_CLASS] >= (ieDword) classcount) { - return 0; - } - // some p&p mods make the hpconbon much more strict, screwing low hp npcs like Prism - if (BaseStats[IE_EA] >= EA_NOTGOOD || BaseStats[IE_EA] < EA_NOTNEUTRAL) { - return 0; - } - - // GetClassLevel/IsWarrior takes into consideration inactive dual-classes, so those would fail here if (IsWarrior()) { val = core->GetConstitutionBonus(STAT_CON_HP_WARRIOR,Modified[IE_CON]); } else { val = core->GetConstitutionBonus(STAT_CON_HP_NORMAL,Modified[IE_CON]); } - return val * multiplier; + + // ensure the change does not kill the actor + if (BaseStats[IE_HITPOINTS] + val*multiplier <= 0) { + // leave them with 1hp/level worth of hp + // note: we return the adjustment and the actual setting of hp happens later + return multiplier - BaseStats[IE_HITPOINTS]; + } else { + return val * multiplier; + } } void Actor::InitStatsOnLoad() ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |