Bugfix: Only decrease HP by 1 (and not 3) when full health and having sustenance+food poison

* Apply negative effects first (for example, food poison), so that the positive effect (for example, sustenance) can have some effect.
This commit is contained in:
Oskar Wiksten
2013-07-15 13:49:47 +02:00
parent 44511650a1
commit f207ad3990
2 changed files with 14 additions and 7 deletions

View File

@@ -277,13 +277,20 @@ public final class ActorStatsController {
}
private void applyStatsEffects(Actor actor, boolean isFullRound) {
// Apply negative effects before positive effects
for (ActorCondition c : actor.conditions) {
StatsModifierTraits effect = isFullRound ? c.conditionType.statsEffect_everyFullRound : c.conditionType.statsEffect_everyRound;
boolean hasEffect = applyStatsModifierEffect(actor, effect, c.magnitude);
if (hasEffect) actorConditionListeners.onActorConditionRoundEffectApplied(actor, c);
if (!c.conditionType.isPositive) applyStatsEffects(actor, isFullRound, c);
}
for (ActorCondition c : actor.conditions) {
if (c.conditionType.isPositive) applyStatsEffects(actor, isFullRound, c);
}
controllers.effectController.startEnqueuedEffect(actor.position);
}
private void applyStatsEffects(Actor actor, boolean isFullRound, ActorCondition c) {
StatsModifierTraits effect = isFullRound ? c.conditionType.statsEffect_everyFullRound : c.conditionType.statsEffect_everyRound;
boolean hasEffect = applyStatsModifierEffect(actor, effect, c.magnitude);
if (hasEffect) actorConditionListeners.onActorConditionRoundEffectApplied(actor, c);
}
private void decreaseDurationAndRemoveConditions(Actor actor) {
boolean removedAnyConditions = false;
@@ -351,7 +358,7 @@ public final class ActorStatsController {
}
if (effect.currentHPBoost != null) {
int effectValue = Constants.rollValue(effect.currentHPBoost) * magnitude;
boolean changed = changeActorHealth(actor, effectValue, false, false);
boolean changed = changeActorHealth(actor, effectValue, true, false);
if (changed) {
int visualEffectID = effect.visualEffectID;
if (!effect.hasVisualEffect()) {

View File

@@ -65,15 +65,15 @@ public final class GameRoundController implements TimedMessageTask.Callback {
roundTimer.stop();
world.model.uiSelections.isMainActivityVisible = false;
}
public void onNewFullRound() {
public void onNewFullRound() {
controllers.mapController.resetMapsNotRecentlyVisited();
controllers.actorStatsController.applyConditionsToMonsters(world.model.currentMap, true);
controllers.actorStatsController.applyConditionsToPlayer(world.model.player, true);
gameRoundListeners.onNewFullRound();
}
public void onNewRound() {
private void onNewRound() {
onNewMonsterRound();
onNewPlayerRound();
gameRoundListeners.onNewRound();