private void UpdateMentalState() { MentalType newMentalType = GetMentalType(character.CharacterHealth.GetAffliction("psychosis")); bool createdCombat = false; switch (newMentalType) { case MentalType.Normal: case MentalType.Confused: // remove combat if we became normal again mentalBehaviorTimer = 0f; break; case MentalType.Afraid: case MentalType.Desperate: case MentalType.Berserk: // berserk is not removed unless we drop to normal behavior again if (CurrentMentalType == MentalType.Berserk) { newMentalType = MentalType.Berserk; } // give players a full interval to react to mental changes if (newMentalType == CurrentMentalType) { createdCombat = CreateCombatBehavior(CurrentMentalType); } break; } if (!createdCombat) { CreateDialogueBehavior(newMentalType); } if (newMentalType != MentalType.Berserk) { character.TryRemoveTeamChange(MentalTeamChange); } CurrentMentalType = newMentalType; }