-
Notifications
You must be signed in to change notification settings - Fork 0
/
item_uses.py
39 lines (31 loc) · 1.51 KB
/
item_uses.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import generators
import components
import events
# item use effects
def cast_heal(actor):
injuries = actor.creature.injured_body_parts()
if len(injuries) < 1:
#if actor.creature.hp == actor.creature.max_hp:
events.notify(events.GameEvent("MESSAGE", ("You are already fully healed!", "red")))
#GAME.game_message("You are already fully healed!", "red")
return 'cancelled'
heal = generators.roll(1,8)
events.notify(events.GameEvent("MESSAGE", ("You healed " + str(heal) + " damage", "violet")))
#GAME.game_message("You healed " + str(heal) + " damage", "violet")
actor.creature.heal(heal)
def cast_strength(actor):
str_buff = components.Effect("Strength", "green", 4, 2)
str_buff.apply_effect(actor.creature)
events.notify(events.GameEvent("MESSAGE", ("You cast strength!", "pink")))
def eat_food(actor):
if actor.creature.player and actor.creature.player.nutrition < 500:
events.notify(events.GameEvent("MESSAGE", ("You ate your food", "light green")))
actor.creature.player.nutrition += 150
else:
events.notify(events.GameEvent("MESSAGE", ("You are full, you cannot eat any more", "light yellow")))
def drink(actor):
if actor.creature.player and actor.creature.player.thirst < 300:
events.notify(events.GameEvent("MESSAGE", ("You drank from the flask", "light blue")))
actor.creature.player.thirst += 150
else:
events.notify(events.GameEvent("MESSAGE", ("You are full, you cannot drink any more", "light yellow")))