Skip to content

Commit

Permalink
feat(#267): Rempved cycling imports so remote_fight can import fight
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed Oct 14, 2024
1 parent da96c82 commit d2a71ea
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 18 deletions.
5 changes: 4 additions & 1 deletion pokete.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def set_args(self, _si):
PlayMap())
mvp.movemap.name_label.rechar(self.name, esccode=Color.thicc)
mvp.movemap.code_label.rechar(self.map.pretty_name)
mvp.movemap.balls_label_rechar(self.pokes)
self.balls_label_rechar()
mvp.movemap.add_obs()

def set(self, x, y):
Expand Down Expand Up @@ -225,6 +225,9 @@ def remove_item(self, item, amount=1):
self.inv[item] -= amount
logging.info("[Figure] %d %s(s) removed", amount, item)

def balls_label_rechar(self):
mvp.movemap.balls_label_rechar(self.pokes)


class Debug:
"""Debug class"""
Expand Down
3 changes: 1 addition & 2 deletions pokete_classes/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .input import (
ACTION_DIRECTIONS, Action, get_action, _ev
)
import pokete_classes.movemap as mvp
from .input_loops import ask_bool, ask_ok
from .color import Color
from .poke import Poke
Expand Down Expand Up @@ -181,7 +180,7 @@ def __call__(self, ctx: Context, p_len, label="Your full deck",
+ len(self.pokes[self.index.index].text_name.text)
+ 1,
self.pokes[self.index.index].text_name.y)
mvp.movemap.balls_label_rechar(self.figure.pokes)
self.figure.balls_label_rechar()
elif action.triggers(Action.ACCEPT):
if len(self.pokes) == 0 or \
self.pokes[self.index.index].identifier == "__fallback__":
Expand Down
4 changes: 2 additions & 2 deletions pokete_classes/fight/fight.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from ..inv import InvItem
from ..poke import EvoMap
from ..tss import tss
from .. import movemap as mvp


class Fight:
Expand All @@ -33,6 +32,7 @@ def __call__(self, ctx: Context, providers: list[Provider]):
)
audio.switch("xDeviruchi - Decisive Battle (Loop).mp3")
self.providers = providers
self.fightmap.set_overview(ctx.overview)
self.fightmap.set_providers(providers)
logging.info(
"[Fight] Started between %s",
Expand Down Expand Up @@ -156,7 +156,7 @@ def __call__(self, ctx: Context, providers: list[Provider]):

self.fightmap.death_animation(loser)
self.fightmap.clean_up(winner)
mvp.movemap.balls_label_rechar(winner.pokes)
winner.balls_label_rechar()
logging.info(
"[Fight] Ended, %s(%s) won",
winner.curr.name, "player" if winner.curr.player else "enemy"
Expand Down
3 changes: 1 addition & 2 deletions pokete_classes/fight/fight_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pokete_classes.fight import FightMap
from pokete_classes.fight.providers import NatureProvider, Provider
from release import SPEED_OF_TIME
from .. import movemap as mvp
from ..asset_service.service import asset_service


Expand Down Expand Up @@ -59,7 +58,7 @@ def __throw(fightmap: FightMap, obj, enem: Provider, chance, name):
time.sleep(SPEED_OF_TIME * 2)
fightmap.pball.remove()
fightmap.clean_up(obj, enem)
mvp.movemap.balls_label_rechar(obj.pokes)
obj.balls_label_rechar()
logging.info("[Fighitem][%s] Caught %s", name, enem.curr.name)
achievements.achieve("first_poke")
if all(poke in obj.caught_pokes for poke in
Expand Down
8 changes: 6 additions & 2 deletions pokete_classes/fight/fightmap/fightmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ...inv import invitems, InvItem
from ...settings import settings
from ...tss import tss
from ... import movemap as mvp, loops
from ... import loops
from .attack import AttackBox
from .inv import InvBox

Expand All @@ -32,6 +32,7 @@ def __init__(self, height, width):
self.box = AttackBox()
self.invbox = InvBox(height - 3, 35, "Inventory", overview=self)
self.providers: list[Provider] = []
self.overview: Overview
# icos
self.deadico1 = se.Text(r"""
\ /
Expand Down Expand Up @@ -65,6 +66,9 @@ def __init__(self, height, width):
self.e_sideline.add(self, len(self.e_underline.text), 1)
self.add_base_boxes()

def set_overview(self, overview: Overview):
self.overview = overview

def add_base_boxes(self):
"""Adds the basic map layout"""
self.outp.add(self, 1, self.height - 4)
Expand All @@ -90,7 +94,7 @@ def resize_view(self):
self.resize(tss.height - 1, tss.width, background=" ")
self.frame_big.resize(self.height - 5, self.width)
self.frame_small.resize(4, self.width)
mvp.movemap.resize_view()
self.overview.resize_view()

self.add_base_boxes()
if player_added:
Expand Down
3 changes: 1 addition & 2 deletions pokete_classes/fight/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import random
import time
from abc import ABC, abstractmethod
from pokete_classes import movemap as mvp
from .attack_result import AttackResult
from ..context import Context
from ..poke import Poke
Expand Down Expand Up @@ -32,7 +31,7 @@ def heal(self):
poke.set_vars()
poke.hp_bar.make(poke.hp)
if poke.player:
mvp.movemap.balls_label_rechar(self.pokes)
self.balls_label_rechar()

@property
def curr(self) -> Poke:
Expand Down
2 changes: 0 additions & 2 deletions pokete_classes/inv/box.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..ui.elements import Box
from .. import movemap as mvp


class InvBox(Box):
Expand All @@ -10,4 +9,3 @@ def resize_view(self):
self.remove()
self.overview.resize_view()
self.add(self.map, self.overview.box.x - 19, 3)
mvp.movemap.full_show()
3 changes: 1 addition & 2 deletions pokete_classes/inv/buy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..ui import Overview
from ..input import ACTION_UP_DOWN, Action, get_action
from ..ui.elements import ChooseBox
from .. import movemap as mvp, loops
from .. import loops


class Buy(Overview):
Expand All @@ -36,7 +36,6 @@ def resize_view(self):
self.box.map.resize_view()
self.box.resize(self.box.map.height - 3, 35)
self.box.add(self.box.map, self.box.map.width - self.box.width, 0)
mvp.movemap.full_show()

def __call__(self, ctx: Context):
"""Opens the buy menu"""
Expand Down
2 changes: 1 addition & 1 deletion pokete_classes/map_additions/center.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def action(self, ob):
while "__fallback__" in [p.identifier for p in ob.pokes]:
ob.pokes.pop([p.identifier for p in
ob.pokes].index("__fallback__"))
mvp.movemap.balls_label_rechar(ob.pokes)
ob.balls_label_rechar()
deck.deck(self.ctx, len(ob.pokes))
break
elif action.triggers(Action.ACT_2):
Expand Down
2 changes: 1 addition & 1 deletion pokete_classes/multiplayer/pc_manager/remote_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...color import Color
from ...interactions import Interactor, MultiTextChooseBox
from ...landscape import MapInteract
from ... import movemap as mvp
#from ... import movemap as mvp


class RemotePlayer(se.Object, MapInteract, Interactor):
Expand Down
2 changes: 1 addition & 1 deletion pokete_classes/multiplayer/remote_fight/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#from .provider import RemoteProvider
from .provider import RemoteProvider
from .fight import RemoteFight, remote_fight

0 comments on commit d2a71ea

Please sign in to comment.