[bug] BG2: Issues with Con bonuses
Split from #171

**Description**

- [ ] Con bonus HP does not immediately update after a level up, often leaving the PC wounded

- [ ] (supertricky) related: Con bonus should (?) raise HP as well as max HP
diff --git a/gemrb/GUIScripts/LUCommon.py b/gemrb/GUIScripts/LUCommon.py
index ce1b0375f..806545b4e 100644
--- a/gemrb/GUIScripts/LUCommon.py
+++ b/gemrb/GUIScripts/LUCommon.py
@@ -458,8 +458,6 @@ def SetupHP (pc, Level=None, LevelDiff=None):
 
 	#update our hp values
 	GemRB.SetPlayerStat (pc, IE_MAXHITPOINTS, CurrentHP+OldHP)
-	# HACK: account also for the new constitution bonus for the current hitpoints
-	GemRB.SetPlayerStat (pc, IE_HITPOINTS, GemRB.GetPlayerStat (pc, IE_HITPOINTS, 1)+CurrentHP+5)
 	return
 
 def ApplyFeats(MyChar):
diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp
index 57c57190d..eaf93ca0d 100644
--- a/gemrb/core/Scriptable/Actor.cpp
+++ b/gemrb/core/Scriptable/Actor.cpp
@@ -1200,7 +1200,9 @@ static void pcf_stat_dex(Actor *actor, ieDword oldValue, ieDword newValue)
 static void pcf_stat_con(Actor *actor, ieDword oldValue, ieDword newValue)
 {
 	pcf_stat(actor, newValue, IE_CON);
-	pcf_hitpoint(actor, 0, actor->BaseStats[IE_HITPOINTS]);
+	if (!actor->checkHP) {
+		pcf_hitpoint(actor, 0, actor->BaseStats[IE_HITPOINTS]);
+	}
 	if (third) {
 		int oldBonus = actor->GetAbilityBonus(IE_CON, oldValue);
 		actor->Modified[IE_SAVEFORTITUDE] += actor->GetAbilityBonus(IE_CON) - oldBonus;
@@ -2945,15 +2947,13 @@ void Actor::RefreshHP() {
 	//we still apply the maximum bonus to dead characters, but don't apply
 	//to current HP, or we'd have dead characters showing as having hp
 	Modified[IE_MAXHITPOINTS]+=bonus;
-	// applying the bonus to the current hitpoints is trickier, since we don't want to cause regeneration
-	/* the following is not reliable, since the hp may become exactly oldmax via other means too
-	ieDword oldmax = Modified[IE_MAXHITPOINTS];
-	if (!(BaseStats[IE_STATE_ID]&STATE_DEAD)) {
-		// for now only apply it to fully healed actors iff the bonus is positive (fixes starting hp)
-		if (BaseStats[IE_HITPOINTS] == oldmax && bonus > 0) {
-			BaseStats[IE_HITPOINTS] += bonus;
-		}
-	}*/
+
+	// temporary con bonuses also modify current HP; this can kill! (EE behavior)
+	// but skip on game load, while old bonuses are still re-applied
+	if (!(BaseStats[IE_STATE_ID]&STATE_DEAD) && checkHP != 2 && bonus != lastConBonus) {
+		BaseStats[IE_HITPOINTS] += bonus - lastConBonus;
+	}
+	lastConBonus = bonus;
 }
 
 // refresh stats on creatures (PC or NPC) with a valid class (not animals etc)
diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h
index 3ff1ca679..5fb46aa96 100644
--- a/gemrb/core/Scriptable/Actor.h
+++ b/gemrb/core/Scriptable/Actor.h
@@ -475,6 +475,7 @@ private:
 	tick_t remainingTalkSoundTime = 0;
 	tick_t lastTalkTimeCheckAt = 0;
 	ieDword lastScriptCheck = 0;
+	int lastConBonus;
 	/** paint the actor itself. Called internally by Draw() */
 	void DrawActorSprite(const Point& p, BlitFlags flags,
 						 const std::vector<AnimationPart>& anims, const Color& tint) const;
['gemrb/core/Scriptable/Actor.h', 'gemrb/GUIScripts/LUCommon.py', 'gemrb/core/Scriptable/Actor.cpp']