-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmedic.py
More file actions
29 lines (23 loc) · 1.09 KB
/
medic.py
File metadata and controls
29 lines (23 loc) · 1.09 KB
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
"""
Shotgun users can heal teammates with their spades
One possible improvement could be to double healing done to crouching players
"""
from pyspades.constants import SHOTGUN_WEAPON, MELEE_KILL
HEAL_RATE = 5 # Health healed per hit
def apply_script(protocol, connection, config):
class MedicConnection(connection):
def __init__(self, *arg, **kw):
connection.__init__(self, *arg, **kw)
def on_hit(self, hit_amount, hit_player, type, grenade):
if (type == MELEE_KILL
and self.team == hit_player.team
and self.weapon == SHOTGUN_WEAPON):
hit_player.set_hp(hit_player.hp + HEAL_RATE, type = MELEE_KILL)
if (hit_player.hp >= 100): # If the target has full health
connection.send_chat(hit_player.name + ' has %s health'
% hit_player.hp)
else:
connection.send_chat(hit_player.name + ' is all healed up!')
return connection.on_hit(self, hit_amount, hit_player, type
, grenade)
return protocol, MedicConnection