a
    iP                     @   s   d Z ddlZddlmZmZmZ d'ddZd(dd	Zd)d
dZd*ddZ	d+ddZ
d,ddZd-ddZd.ddZd/ddZd0ddZd1ddZd2ddZd3ddZd4d d!Zd5d"d#Zd6d$d%Zg d&ZdS )7aT  
Health Events
Health-related events, injuries, illnesses, and conditions

Events:
- minorInjury: Minor scrapes and injuries
- minorSickness: Common colds and illnesses
- breakArm: Breaking an arm
- healthCondition: Developing a health condition
- lowEnergyEvent: Low energy consequences
- negativeHabitEvent: Negative habit manifestations
    N)messageFunctionquestionFunctionanswerOptionmessageFc                 C   s   d}|| j vo0| jjdko0| jjdk o0t dk }d}|dkrVddg}t||| ||S |dkr|d	 dkrx| jd
 n| jd | j jd7  _dS )zMinor scrapes and injuriesminorInjury      ư>zuYou are playing outside with your friends and you fall down. You scrape your knee and it is bleeding. What do you do?answerzGo home and tell your parentszIgnore it and keep playingoptionzlYou walk home and show your parents your knee. They clean it up and put a bandaid on it. You are good to go!z$You ignore the pain and keep playingN)askedQuestionscageYearsrandomr   messageQueueappendsocialplayertyper   responsefnamecheckanswerOptions r   5/var/www/lichun.app/lichun/ws/events/health/events.pyr      s    .r   c                 C   s   d}|| j vo0| jjdko0| jjdk o0t dk }d}|dkrr|rrddg}| j jtd	d
8  _t||| ||S |dkr|d dkr| jd | j jtd	d7  _n| jd | j j	d8  _	dS )zCommon colds and illnessesZsicnkessr   r   r	   zKYou have caught a pretty bad cold, you feel weak are coughing and sneezing.r
   zStay home and restzGo to school anyways   
   r   z;You stay home and rest. You feel a bit better the next day.   z:You go to school anyways and spread your germs to everyoneN)
r   r   r   r   energyrandintr   r   r   r   r   r   r   r   minorSickness"   s    .r!   c                 C   s8   d}|| j vo$| jjdko$t dk }d}t||| |S )zBreaking an armbreakArm   -C6?zYou fell and broke your arm)eventsr   r   r   r   r   r   r   r   r   r   r   r   r"   4   s    "r"   c           
      C   s   d}d}|| j j|  }t |krt| j jdkrt| dd}|rt|dkr|jdd dd	 t| j jt|d
 }t|d|d
  }	| j	|	_	| j j
|	 d|	j d }t||| dS dS )zDeveloping a health conditiongHz>g:0yE>r   healthConditionsNc                 S   s   | j S )N)ZhealthModifier)xr   r   r   <lambda>H       z!healthCondition.<locals>.<lambda>T)keyreverser   zYou have been diagnosed with .)r   r   r   lenr'   getattrsortminchoicedater   titler   )
r   r   r   r   Zbase_chanceZage_multiplierZtrigger_chance
conditionsZageIndex	conditionr   r   r   healthCondition<   s    r7   c                 C   s\   d}t   dk rX| jjdk rX| jdkrX| jdk rXd}g d}|t |7 }t||| dS d	S )
zLow energy consequenceslowEnergyEventg?r         z+After a long day, you're feeling exhausted.)z= To cope you end up scrolling through social media for hours.z* To cope you end up watching TV for hours.z2 To cope you end up playing video games for hours.z/ To cope you end up eating junk food for hours.z- To cope you end up drinking too much alcoholz) To cope you end up lighting a cigarette.TN)r   r   r   	hourOfDayr2   r   )r   r   r   r   r   ZappendOptionsr   r   r   r8   U   s    ,r8   c                 C   s|  d}t   dk rxdd | jjD }| jjdk r>dd |D }| jjdkrXdd |D }|rxt |}d	d
gg dg dg dg dg dg dg dg dg dg dddgg dg dg dg dd}|j| v rt ||j }nd}|jdv r| j jd8  _nZ|jdv r>| j j	d8  _	| j jd8  _n,|jd v rj| j j
d8  _
| j jd8  _t||| d!S d"S )#zNegative habit manifestationsnegativeHabitEventgMbP?c                 S   s   g | ]}|j d kr|qS )negative)Z	habitType.0habitr   r   r   
<listcomp>c   r*   z&negativeHabitEvent.<locals>.<listcomp>r9   c                 S   s   g | ]}|j d vr|qS ))excessive_alcohol_consumptionsmokingnamer>   r   r   r   rA   g   r*   studentc                 S   s   g | ]}|j d kr|qS )	tardinessrD   r>   r   r   r   rA   i   r*   z@You are late for school again. Your teacher gives you a warning.z8You missed the start of the movie due to your tardiness.)z;You've been biting your nails again. Your fingers are sore.z+Your friends notice your nail biting habit.z:You've bitten your nails to the quick, causing discomfort.)zEYou spend hours overthinking a decision and end up feeling exhausted.z2Your overthinking is causing you sleepless nights.zQYou overthink a situation to the point where it paralyzes you from taking action.)zKYou procrastinate on an important task and now have to rush to complete it.z:Your procrastination has resulted in a late fee on a bill.zIYou procrastinated and now you're stuck with the least desirable options.)zEYou find yourself dwelling on negative thoughts, affecting your mood.z7Your negative thinking is affecting your relationships.zQYou're caught in a loop of negative thinking, making it hard to see the positive.)z:You give in to emotional eating and feel guilty afterward.z2You overeat at dinner and feel uncomfortably full.z:You keep eating past the point of fullness out of boredom.)zWYou haven't been getting much exercise lately, and you're starting to feel the effects.zPYou've been missing your exercise routine, and your energy levels are suffering.z@Your lack of exercise is affecting your mood and overall health.)z.Your eyes are tired from too much screen time.z2You've been on screens all day, causing headaches.z;Your excessive screen time is affecting your sleep pattern.)z2Your impulsive action had unintended consequences.z3Your impulsiveness led to a poor purchase decision.z1Your impulsive behavior led to a risky situation.)zHYou've spent all day trying to make a decision, and it's causing stress.z?Your indecisiveness is causing delays and missed opportunities.z:Your indecisiveness made others make the decision for you.)zHYou've been neglecting your self-care routine and it's starting to show.z9Your lack of self-care is affecting your energy and mood.z1You feel rundown from neglecting basic self-care.zBYou're scrambling to finish a project due to poor time management.z@Your leisure time is cut short due to your poor time management.)zBYou've been stress eating, and it's making you feel uncomfortable.zMYou eat more than usual when you're stressed, and it's affecting your health.z6Your stress eating is leading to discomfort and guilt.)zCThe excessive caffeine is making it hard for you to sleep at night.z6You're feeling jittery from excessive caffeine intake.z2You have a caffeine crash from consuming too much.)zFYou notice a smoker's cough developing. It's a reminder of your habit.zRYou're short of breath during physical activities, a result of your smoking habit.z=Your sense of taste and smell are compromised due to smoking.)zJYour frequent alcohol consumption is leading to regular morning hangovers.z5You're using alcohol as a crutch to deal with stress.z?Your excessive drinking is leading to forgetfulness and regret.)rG   nail_bitingoverthinkingprocrastinationnegative_thinking
overeatingZunder_exercisingexcessive_screen_timeimpulsivenessindecisivenessneglecting_self_carepoor_time_managementovereating_when_stressedexcessive_caffeine_intakerC   rB   z"Your habit is causing some issues.)rH   rK   r   )rI   rJ   rM   rN   rO   rP   rQ   rS   )rL   rR   rB   rC   TN)r   r   habitsr   
occupationr2   rE   keys	happinessr   healthr   )r   r   r   r   r   Znegative_habitsr@   Zhabit_messagesr   r   r   r<   _   sT    
Qr<   c                 C   s   d}|| j vo$| jjdko$t dk }d}|dkr\tdddtd	td
g}t||| ||S |dkr|d dkr| jd | j jd7  _| j j	d7  _	nV|d d	kr| jd | j jd8  _| j j	d8  _	n| jd | j jd8  _dS )z#Routine annual doctor's appointmentannualCheckupr9   h㈵>z-It's time for your annual checkup. Do you go?r
   zYes, schedule itd   	moneyCostzNo, skip itzGo only if sickr   zHYou schedule your annual checkup. The doctor says everything looks good!r   zGYou decide to skip your checkup this year. You hope everything is fine.r   z7You decide to only go to the doctor when you feel sick.N)
r   r   r   r   r   r   r   r   rX   rW   r   r   r   r   rY      s(    "
rY   c                 C   st   d}t | jdd }|dko&|dk}|| jvoL| jjdkoL|oLt dk }d}|rf| j jd8  _t||| |S )	zDiscovering seasonal allergiesallergySymptoms-r   r   r   r   h㈵>zXYour eyes are itchy and you can't stop sneezing. Looks like you have seasonal allergies.)	intr3   splitr%   r   r   r   r   r   )r   r   r   current_monthZ	is_springr   r   r   r   r   r^      s    &r^   c                 C   s  d}|| j vo$| jjdko$t dk }d}|dkr`tdddtd	ddtd
g}t||| ||S |dkr
|d dkr| j jd8  _| jd | j j	d8  _	nf|d d	kr| j jd8  _| jd | j j	d8  _	n,| jd | j j
d8  _
| j j	d8  _	dS )zDentist finds a cavitydentalCavity   r`   z/The dentist found a cavity. You need a filling.r
   zGet it filled now   r\   zSchedule for laterz	Ignore itr   zLYou get the cavity filled. It was uncomfortable but now your tooth is fixed.r   zXYou schedule the filling for next week. At least you have some time to mentally prepare.r   zJYou decide to ignore the cavity. This might cause bigger problems later...r   N)r   r   r   r   r   r   moneyr   r   rW   rX   r   r   r   r   rd      s*    "


rd   c                 C   s0  d}|| j voH| jjdkoH| jjdkoH| jjdk s>| jjdk oHt dk }d}|dkrtd	td
tdddg}t||| ||S |dkr,|d d	kr| j	d | j jd7  _| j jd7  _nh|d d
kr | j	d | j jd8  _| j jd8  _n,| j	d | j jd7  _| j j
d7  _
dS )z(Recognizing need for mental health breakmentalHealthDay   A         r$   zAYou're feeling overwhelmed and anxious. Take a mental health day?r
   zYes, take the day offzNo, push throughzTalk to someoner   )diamondCostr   zdYou take a mental health day. You sleep in, relax, and do things you enjoy. You feel so much better.zXYou force yourself to keep going despite feeling terrible. It makes the day even harder.r   zhYou talk to someone about how you are feeling. They listen and help you feel supported. It really helps.r   N)r   r   r   rW   r   r   r   r   r   r   r   r   r   r   r   rh     s*    F

rh   c                 C   sh   d}|| j vo0| jjdko0| jjdko0t dk }d}|rZ| j jd8  _| j jd8  _t||| |S )zMinor sports/activity injurysprainedAnkler   2   r`   zLYou rolled your ankle. It's not broken, but it hurts to walk for a few days.r   )r%   r   r   r   r   rW   r   r&   r   r   r   rn   .  s    .rn   c                 C   sv   d}t dd | jjD }|| jvo>| jjdko>|o>t dk }d}|rh| j jd8  _| j jd8  _t||| |S )zToo much screen time effects	eyeStrainc                 s   s   | ]}|j d kV  qdS )rM   NrD   r>   r   r   r   	<genexpr>=  r*   zeyeStrain.<locals>.<genexpr>r   rZ   zUYour eyes hurt from staring at screens all day. You should probably take more breaks.r   )	anyr   rT   r%   r   r   r   rX   r   )r   r   r   Zhas_screen_habitr   r   r   r   r   rp   9  s    &rp   c                 C   s\   d}|| j vo$| jjdko$t dk }d}|rN| j jd8  _| j jd8  _t||| |S )zDeveloping back problemsbackPainrk   r`   zcYour back has been hurting lately. Maybe you should exercise more... or sleep on a better mattress.r   )r%   r   r   r   r   rX   r   r&   r   r   r   rs   F  s    "rs   c                 C   sX   d}|| j vo0| jjdko0| jjdko0t dk }d}|rJ| j jd8  _t||| |S )zFinding first gray hairfirstGrayHair   -   r`   z6You found your first gray hair. When did that happen?!r   )r%   r   r   r   rW   r   r&   r   r   r   rt   Q  s    .rt   c                 C   s  d}|| j vo0| jjdko0| jjdk o0t dk }d}|dkrttdddtd	td
dddtdg}t||| ||S |dkr||d dkr| j jd8  _| j	d | j jd7  _| j j
d7  _
n|d d	kr| j	d | j j
d7  _
| j jd7  _nx|d d
krP| j jd8  _| j	d | j jd7  _| j jd7  _n,| j	d | j jd8  _| j j
d8  _
dS )zStruggling with insomniasleepDisorderr9   rk   rZ   z5You've been having trouble sleeping. What do you try?r
   zMelatonin/sleep aidsr\   zBetter sleep schedulezSee a doctor   r   )r]   rm   zSuffer through itr   zFYou try melatonin and it helps you sleep better. You feel more rested.r   zTYou commit to a regular sleep schedule. It takes discipline but your sleep improves.zgThe doctor identifies the root cause and provides treatment. Your sleep quality improves significantly.rl   zLYou continue struggling with poor sleep. It affects everything in your life.N)r   r   r   r   r   r   r   rg   r   r   rW   rX   r   r   r   r   rw   [  s8    .

rw   c                 C   sl   d}|| j vo$| jjdko$t dk }d}|r^| j jd8  _| j jd8  _| j jd8  _t||| |S )zGetting sick from bad foodfoodPoisoningr   r`   zOSomething you ate didn't agree with you. You spend the next 24 hours very sick.rk   rl   )r%   r   r   r   r   rW   rX   r   r&   r   r   r   ry   }  s    "ry   )r   r!   r"   r7   r8   r<   rY   r^   rd   rh   rn   rp   rs   rt   rw   ry   )r   FF)r   FF)r   )r   FF)r   FF)r   FF)r   FF)r   )r   FF)r   FF)r   )r   )r   )r   )r   FF)r   )__doc__r   Zevents.baser   r   r   r   r!   r"   r7   r8   r<   rY   r^   rd   rh   rn   rp   rs   rt   rw   ry   __all__r   r   r   r   <module>   s&   






r









"
