Here’s the equations for getting wet (for those not too code savvy || means “or”, && means “and”, and ! means “not” [so != means “not equal to”]. The “one_in(X)” function just means a one in X chance of being true):
Light wet (drizzles)
if ((!g->u.is_wearing("coat_rain") || one_in(50)) &&
(!g->u.weapon.has_flag("RAIN_PROTECT") || one_in(10)) && !g->u.has_trait("FEATHERS") &&
(g->u.warmth(bp_torso) * 4/5 + g->u.warmth(bp_head) / 5) < 30 && PLAYER_OUTSIDE &&
one_in(2)) {
g->u.drench(g, 30 - (g->u.warmth(bp_torso) * 4/5 + g->u.warmth(bp_head) / 5),
mfb(bp_torso)|mfb(bp_arms)|mfb(bp_head));
}
Very wet things (rain/storms)
if ((!g->u.is_wearing("coat_rain") || one_in(25)) &&
(!g->u.weapon.has_flag("RAIN_PROTECT") || one_in(5)) && !g->u.has_trait("FEATHERS") &&
(g->u.warmth(bp_torso) * 4/5 + g->u.warmth(bp_head) / 5) < 60 && PLAYER_OUTSIDE) {
g->u.drench(g, 60 - (g->u.warmth(bp_torso) * 4/5 + g->u.warmth(bp_head) / 5),
mfb(bp_torso)|mfb(bp_arms)|mfb(bp_head));
}
The drench() function then modifies the morale bonus/penalty you receive based on your mutations and clothing on a body part specific basis.
The equations for the morale cap (tot_xxxx all are mutation based, saturation = the first number argument of drench(), “wants_drench” is true if you have all waterproof/water friendly clothing on a body part):
[code] if (wants_drench) {
morale_cap = g->get_temperature() - std::min(65, 65 + (tot_ignored - tot_good) / 2) * saturation / 100;
} else {
morale_cap = -(saturation / 2);
}
// Good increases pos and cancels neg, neut cancels neg, ignored cancels both
if (morale_cap > 0) {
morale_cap = morale_cap * (effected - tot_ignored + tot_good) / effected;
} else if (morale_cap < 0) {
morale_cap = morale_cap * (effected - tot_ignored - tot_neut - tot_good) / effected;
}[/code]
The amount your morale changes with each time you get wet is then calculated as:
int morale_effect = morale_cap / 8;
if (morale_effect == 0) {
if (morale_cap > 0) {
morale_effect = 1;
} else {
morale_effect = -1;
}
}
[hr]
[hr]
Smoke, on the other hand, is much simpler.
- If the smoke density is 1 it does a 50/50, with it stopping right here 50% of the time and proceeding on to 2 the other 50%.
- It rolls either 1d3, 2d3, or 4d3, for smoke densities of 1, 2, and 3 respectively.
- It rolls Xd3 dice, where ‘X’ is the amount of environmental protection you have on your mouth.
- If the first roll is greater then the protection roll if infects you with the smoke disease for 2/7/15 turns depending on smoke density.