Skip to content

Commit

Permalink
Mana new status disconnected fighters guild (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
EstatoDeviato authored Apr 19, 2024
1 parent 6df57ed commit e846b67
Show file tree
Hide file tree
Showing 4 changed files with 839 additions and 163 deletions.
30 changes: 19 additions & 11 deletions server/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def __init__(self, area_manager, name):
self.battle_started = False
self.fighters = []
self.num_selected_move = 0
self.battle_guilds = {}

# Battle system customization
self.battle_paralysis_rate = 3
Expand All @@ -271,6 +272,13 @@ def __init__(self, area_manager, name):
self.battle_bonus_malus = 1.5
self.battle_poison_damage = 16
self.battle_show_hp = True
self.battle_min_multishot = 2
self.battle_max_multishot = 5
self.battle_burn_damage = 8
self.battle_freeze_damage = 8
self.battle_confusion_rate = 3
self.battle_enraged_bonus = 2.25
self.battle_stolen_stat = 10

@property
def name(self):
Expand Down Expand Up @@ -775,22 +783,22 @@ def remove_client(self, client):

#Battle system
if client in client.area.fighters:
if client.battle.selected_move == -1:
client.area.fighters.remove(client)
if client.area.battle_started:
client.battle.current_client = None
else:
client.battle.hp = 0
client.battle.selected_move = -1
client.battle.target = None
client.area.fighters.remove(client)
if client.battle.guild is not None:
guild = client.battle.guild
client.battle.guild = None
client.area.battle_guilds[guild].remove(client)
if client.battle.selected_move != -1:
client.area.num_selected_move += -1
client.area.send_ic(
pre=client.last_sprite,
msg=f"~{client.battle.fighter}~ suddenly ran out of hp! (disconnected)",
pos=client.pos,
flip=client.flip,
msg=f"~{client.battle.fighter}~ disconnected",
anim=client.last_sprite,
color=3,
offset_pair=100,
)
if len(client.area.fighters) == 0:
client.area.battle_started = False

# Update everyone's available characters list
# Commented out due to potentially causing clientside lag...
Expand Down
4 changes: 4 additions & 0 deletions server/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2118,18 +2118,22 @@ def __init__(self, client, fighter_name, fighter):
self.hp = float(fighter["HP"])
self.maxhp = self.hp
self.atk = float(fighter["ATK"])
self.mana = float(fighter["MANA"])
self.defe = float(fighter["DEF"])
self.spa = float(fighter["SPA"])
self.spd = float(fighter["SPD"])
self.spe = float(fighter["SPE"])
self.target = None
self.selected_move = -1
self.status = None
self.current_client = client
self.guild = None
self.moves = [ClientManager.Move(move) for move in fighter["Moves"]]

class Move:
def __init__(self, move):
self.name = move["Name"]
self.cost = move["ManaCost"]
self.type = move["MovesType"]
self.power = float(move["Power"])
self.effect = move["Effects"]
Expand Down
Loading

0 comments on commit e846b67

Please sign in to comment.