Skip to content

Commit

Permalink
Merge pull request #186 from malnjayz/178/skip-attack-menu
Browse files Browse the repository at this point in the history
skip attack menu
  • Loading branch information
lxgr-linux committed Jul 7, 2022
2 parents 3a6065d + f3c53da commit e6fea3a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pokete.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,8 @@ def main():

ver_change = check_version(session_info)
# hotkeys
hotkeys_from_save(session_info.get("hotkeys", {}), loading_screen.map, ver_change)
hotkeys_from_save(session_info.get("hotkeys", {}),
loading_screen.map, ver_change)
if figure.name == "DEFAULT":
intro()
game.game(figure.map)
Expand Down
14 changes: 13 additions & 1 deletion pokete_classes/fightmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,25 @@ def get_figure_attack(self, figure, enem):
ARGS:
figure: The players provider
enem: The enemys provider"""
quick_attacks = [
Action.QUICK_ATC_1, Action.QUICK_ATC_2,
Action.QUICK_ATC_3, Action.QUICK_ATC_4
][:len(figure.curr.attack_obs)]
self.outp.append(se.Text(("\n" if "\n" not in self.outp.text
else "") +
"What do you want to do?",
state="float"))
while True: # Inputloop for general options
action = get_action()
if action.triggers(Action.CHOOSE_ATTACK, Action.ACCEPT):
if action.triggers(*quick_attacks):
attack = figure.curr.attack_obs[
quick_attacks.index(
next(i for i in action if i in quick_attacks)
)
]
if attack.ap > 0:
return attack
elif action.triggers(Action.CHOOSE_ATTACK, Action.ACCEPT):
attack = self.get_attack(figure.curr.attack_obs)
if attack != "":
return attack
Expand Down
13 changes: 11 additions & 2 deletions pokete_classes/hotkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class Action(Enum):
ACT_8 = auto()
ACT_9 = auto()

QUICK_ATC_1 = auto()
QUICK_ATC_2 = auto()
QUICK_ATC_3 = auto()
QUICK_ATC_4 = auto()

@property
def mapping(self):
"""Returns the current mapped char"""
Expand Down Expand Up @@ -118,7 +123,7 @@ def get_X_strength(self) -> int:

'Key.space': ActionList([Action.ACCEPT]),
'Key.enter': ActionList([Action.ACCEPT]),
'y': ActionList([Action.ACCEPT]),
'y': ActionList([Action.ACCEPT, Action.QUICK_ATC_1]),
'o': ActionList([Action.ACCEPT]),
'q': ActionList([Action.CANCEL]),
'n': ActionList([Action.CANCEL]),
Expand All @@ -130,10 +135,14 @@ def get_X_strength(self) -> int:
'p': ActionList([Action.POKEDEX]),
'f': ActionList([Action.FREE_POKETE]),
'm': ActionList([Action.MAP, Action.MOVE_POKETE]),
'c': ActionList([Action.CLOCK]),
'c': ActionList([Action.CLOCK, Action.QUICK_ATC_3]),
'?': ActionList([Action.HELP, Action.INFO]),
'e': ActionList([Action.MENU]),
':': ActionList([Action.CONSOLE]),

'z': ActionList([Action.QUICK_ATC_1]),
'x': ActionList([Action.QUICK_ATC_2]),
'v': ActionList([Action.QUICK_ATC_4]),
}

def get_mapping(action, keys):
Expand Down
1 change: 0 additions & 1 deletion pokete_classes/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def ask_bool(_map, text):
ret = False
break
std_loop(_map.name == "movemap")
_ev.clear()
return ret


Expand Down

0 comments on commit e6fea3a

Please sign in to comment.