void organ_donor::apply(patient & user) { user.modify_ment_health(ORGAN_MENT_CHANGE); user.modify_weight(-ORGAN_WEIGHT);//adds parameter to weight user.modify_phys_health(-rand_num(0,20)); if(rand_chance(ORGAN_CHANCE))//odds are ORGAN_CHACE/100 user.modify_phys_health(-PAT_MAX_HEALTH);//sets phys health to 0 m_num_uses+=1; }
// DESC: modifies health of patient if machine happens to harm user // PRE: patient must have modify_help member function // POST: patient.condition will be modified to reflect damage, returns // nothing void x_rayer::apply(patient & user) { // halve patient condition randomly. odds are 1 in DAMAGE_CHANCE if (rand_num(0,X_RAYER_DAMAGE_CHANCE) == 0) user.modify_phys_health(-user.get_phys_health()/2); m_num_uses += 1; return; }