Two observations:
- Your condition system seems to have two orthogonal axes: temperature and poison. Represent them as such.
- When thinking about this you should separate transitionstransitions from statesstates. COLD
COLDand HOTHOTare state transitions in the way you mention them, not states.
Combining those observations would result in something like this:
// These is the representation of the two axes.
int temperature; // can be between -2 and +2, 0 is normal, 1 is hot, 2 is burning, -1 is cold, -2 is frozen
bool poisoned;
// These methods represent state transitions.
void applyHeat() {
if ( temperature <= 32 ) {
++temperature;
}
}
void applyCold() {
if ( temperature >= -32 ) {
--temperature;
}
}
void applyPoison() {
poisoned = true;
}
void removePoison() {
poisoned = false;
}