@@ -109,6 +109,10 @@ def __init__(self, *args, **kwargs):
109109 "Select" ,
110110 )
111111
112+ def __normalize_pokes (self , ob ):
113+ while "__fallback__" in [p .identifier for p in ob .pokes ]:
114+ ob .pokes .pop ([p .identifier for p in ob .pokes ].index ("__fallback__" ))
115+
112116 def action (self , ob ):
113117 """Triggers the interaction in the Pokete center
114118 ARGS:
@@ -124,14 +128,10 @@ def action(self, ob):
124128 "What do you want to do?" ,
125129 ],
126130 )
127- selected = self .menu (self .ctx )[0 ]
128131
129- match selected :
132+ match self . menu ( self . ctx )[ 0 ] :
130133 case 0 :
131- while "__fallback__" in [p .identifier for p in ob .pokes ]:
132- ob .pokes .pop (
133- [p .identifier for p in ob .pokes ].index ("__fallback__" )
134- )
134+ self .__normalize_pokes (ob )
135135 ob .balls_label_rechar ()
136136 deck .deck (self .ctx , len (ob .pokes ))
137137 case 1 :
@@ -144,16 +144,16 @@ def action(self, ob):
144144 ["..." , "Your Poketes are now healed!" ],
145145 )
146146 case 2 :
147- valid_pokes = ob . valid_pokes
148- if valid_pokes :
147+ self . __normalize_pokes ( ob )
148+ if ob . pokes :
149149 selected_idx = deck .deck (
150150 self .ctx ,
151- len (valid_pokes ),
151+ len (ob . pokes ),
152152 label = "Choose a Pokete to cuddle" ,
153153 in_fight = True ,
154154 )
155155 if selected_idx is not None :
156- poke = valid_pokes [selected_idx ]
156+ poke = ob . pokes [selected_idx ]
157157 message = random .choice (CUDDLE_MESSAGES ).format (
158158 name = poke .name
159159 )
0 commit comments