# 2. for each player load the roomname_monsters.txt
# 3. execute any current action [flee (maybe later), attack, continue combat, special attack (if enough mp or stamina)]
# 4. Write results of action to the roomname_monsters.txt if the monster is killed or mp / stamina has changed. - Sidenote.. don't store inventory, get a list of possible inventory and randomize on death and drop on the ground (no corpses)
# 5. Process any special commands from the player [spells, special attacks based on stamina]
# 6. Write results of action to the player file [damage, mp use, stamina use]
# 7. Write any new inventory to the room file. Expire any inventory that is old TBD....
# 8. Every minute respawn mobs for any room the players are in.
# def randint(start, stop):
# return randrange(start, stop + 1)
def run_mobs(players, mud):
def get_att(d):
att = 0
if 'd' in d:
dice = d.split('d')
for d in range(int(dice[0])):
att += randrange(int(dice[1])) + 1
else:
att = int(d)
return att
def calc_att(pid, attacks, bank):
v_att = []
att = 0
for attack in attacks:
if attack['cost'] < bank:
v_att.append(attack)
# Select a random attack
if len(v_att) > 0:
attack = v_att[randrange(len(v_att))]
att = get_att(attack['dmg'])
mud.send_message(pid, "%s for %d" % (attack['desc'], att,))
bank -= attack['cost']
return att, bank
def randrange(start, stop=None):
if 'esp' in sys.platform:
if start == 1:
return 0
if stop is None:
stop = start
start = 0
...
...
@@ -38,8 +49,6 @@ def run_mobs(players, mud):
for pid, player in players.items():
if not player['name']:
continue
# print(player)
# print('checking actions in room: ' + player['room'])