2f3e968d by Barry

Added cast for players to cast spells

1 parent bfcc117a
...@@ -13,5 +13,7 @@ ...@@ -13,5 +13,7 @@
13 "aa": "1d2", 13 "aa": "1d2",
14 "mpr": 0.25, 14 "mpr": 0.25,
15 "star": 0.4, 15 "star": 0.4,
16 "weapon": null 16 "weapon": null,
17 "sp": {},
18 "at": {}
17 } 19 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -64,7 +64,8 @@ while True: ...@@ -64,7 +64,8 @@ while True:
64 print('spawner error:') 64 print('spawner error:')
65 print(e) 65 print(e)
66 if tick >= 1: 66 if tick >= 1:
67 print(mem_free()) 67 if 'esp' in platform:
68 print(mem_free())
68 spawn += tick 69 spawn += tick
69 tick = 0 70 tick = 0
70 # try: 71 # try:
......
1 {"name": "test", "room": "Outside", "inventory": {"candle": 1}, "prompt": "%hp> ", "aliases": {}, "hp": 593, "mp": 100, "sta": 10, "aa": "1d2", "mpr": 0.25, "star": 0.4, "maxhp": 953, "maxmp": 100, "maxsta": 10, "weapon": "sword"}
...\ No newline at end of file ...\ No newline at end of file
1 {"name": "test", "room": "Tavern", "inventory": {"candle": 1}, "prompt": "hp %hp mp %mp> ", "aliases": {}, "hp": 461, "mp": 50, "sta": 10, "aa": "1d2", "mpr": 0.25, "star": 0.4, "maxhp": 953, "maxmp": 100, "maxsta": 10, "weapon": "sword", "sp": {"fireball": {"cost": 5, "dmg": "2d4", "desc": "A fireball blasts from your fingertips striking the target"}}, "at": {}}
...\ No newline at end of file ...\ No newline at end of file
......
1 {"cricket": {"max": 1, "active": [{"hp": 100, "mp": 2.0, "sta": 4.550000000000075, "maxhp": 100, "maxmp": 10, "maxsta": 10, "action": "attack", "target": "test"}]}}
...\ No newline at end of file ...\ No newline at end of file
1 {"cricket": {"max": 1, "active": [{"hp": 48, "mp": 5.0, "sta": 0.35000000000008313, "maxhp": 100, "maxmp": 10, "maxsta": 10, "action": "attack", "target": "test"}]}}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -48,12 +48,15 @@ def get_att(d): ...@@ -48,12 +48,15 @@ def get_att(d):
48 else: 48 else:
49 att = int(d) 49 att = int(d)
50 return att 50 return att
51 def calc_att(mud, pid, attacks, bank): 51 def calc_att(mud, pid, attacks, bank, attack=None):
52 v_att = [] 52 v_att = []
53 att = 0 53 att = 0
54 for attack in attacks: 54 if attack:
55 if attack['cost'] < bank: 55 v_att.append(attack)
56 v_att.append(attack) 56 else:
57 for attack in attacks:
58 if attack['cost'] < bank:
59 v_att.append(attack)
57 # Select a random attack 60 # Select a random attack
58 if len(v_att) > 0: 61 if len(v_att) > 0:
59 attack = v_att[randrange(len(v_att))] 62 attack = v_att[randrange(len(v_att))]
......