def clearAttacksPlayerDead(victim): """ Remove all attacks against dead player. """ for player in AllPlayers.values(): if player.attacking == victim: endCombat( player )
def doDurationEffectSpells(): """ Apply duration effects of spells. """ for player in AllPlayers.values(): # If player isn't playing. No need to heal if player.status is not PLAYING: continue for spell in player.spells.values(): spell.durationEffect()
def naturalHealing(): """ Natural healing loop. """ healRate = 5 for player in AllPlayers.values(): # If player isn't playing. No need to heal if player.status is not PLAYING: continue healPlayer(player, HP, healRate) player.statLine()
def restHealing(): """ If player resting, rest heal him. """ healRate = 15 for player in AllPlayers.values(): # If player isn't playing. No need to heal if player.status is not PLAYING: continue if player.stats[RESTING]: healPlayer(player, HP, healRate) player.statLine()
def saveAllPlayers(): """ Save all users. """ i = 0 for player in AllPlayers.values(): if player.status is PLAYING or player.status is PURGATORY: i += 1 player.save() logger.gamelogger.logger.log.debug("Saving {0} of {1} players.".format(i, len(AllPlayers)))