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; }
void x_rayer::apply(patient & p) const { if (random_num() <= APPLY_RANGE) { p.modify_health(); } return; }
void patientList::del(patient p) { list<patient>::iterator it; for(it=pList.begin(); it!=pList.end(); it++) { if( (*it).getPnum() == p.getPnum() ) break; } pList.erase(it); }
void x_rayer::charge_patient(patient & p) const { p.pay_out(m_cost_per_use); return; }
// DESC: will charge patient for use of x-ray machine // PRE: patient must have a money member variable // POST: cost_per_use will be subtracted from patient.money, returns // nothing void x_rayer::charge_patient(patient & user) { user.pay_out(m_cost); return; }
void organ_donor::charge_patient(patient & user) { user.pay_out(m_cost); return; }