void set_abstinent(CHAR_DATA *ch) { AFFECT_DATA af; int duration = pc_duration(ch, 2, MAX(0, GET_DRUNK_STATE(ch) - CHAR_DRUNKED), 4, 2, 5); if (can_use_feat(ch, DRUNKARD_FEAT)) duration /= 2; af.type = SPELL_ABSTINENT; af.bitvector = AFF_ABSTINENT; af.duration = duration; af.location = APPLY_AC; af.modifier = 20; affect_join(ch, &af, 0,0,0,0); af.location = APPLY_HITROLL; af.modifier = -2; affect_join(ch, &af, 0,0,0,0); af.location = APPLY_DAMROLL; af.modifier = -2; affect_join(ch, &af, 0,0,0,0); }
void gain_condition(CHAR_DATA * ch, unsigned condition, int value) { if (condition >= ch->player_specials->saved.conditions.size()) { log("SYSERROR : condition=%d (%s:%d)", condition, __FILE__, __LINE__); return; } if (IS_NPC(ch) || GET_COND(ch, condition) == -1) { return; } bool intoxicated = (GET_COND(ch, DRUNK) >= CHAR_DRUNKED); GET_COND(ch, condition) += value; GET_COND(ch, condition) = MAX(0, GET_COND(ch, condition)); GET_COND(ch, condition) = MIN(MAX_COND_VALUE, GET_COND(ch, condition)); if (GET_COND(ch, condition) || PLR_FLAGGED(ch, PLR_WRITING)) return; switch (condition) { case FULL: send_to_char("Вы голодны.\r\n", ch); return; case THIRST: send_to_char("Вас мучает жажда.\r\n", ch); return; case DRUNK: if (intoxicated && GET_COND(ch, DRUNK) < CHAR_DRUNKED) send_to_char("Наконец-то вы протрезвели.\r\n", ch); GET_DRUNK_STATE(ch) = 0; return; default: break; } }