def give_power_up(self, player): rand = random.random() if rand < self.kamakazi: select = 37 else: select = self.selections[random.randrange(self.length)] if player.id in self.med_used: self.med_used.remove(player.id) if player.id in self.power_used: self.power_used.remove(player.id) minqlx.set_holdable(player.id, select) self.player_hold[player.id] = select self.holding_med[player.id] = False if select == 34: player.flight(fuel=10000, max_fuel=10000, thrust=2500, refuel=0)
def execute_power(self, player): held = player.state.holdable if self.holding_med[player.id]: self.holding_med[player.id] = False if held is None: self.med_used.append(player.id) if player.id not in self.power_used: minqlx.set_holdable(player.id, 0) minqlx.set_holdable(player.id, self.player_hold[player.id]) else: self.holding_med[player.id] = True if held is None: self.power_used.append(player.id) if player.id not in self.med_used: minqlx.set_holdable(player.id, 0) minqlx.set_holdable(player.id, 28)
def holdable(self, value): if not value: minqlx.set_holdable(self.id, 0) elif value == "teleporter": minqlx.set_holdable(self.id, 27) elif value == "medkit": minqlx.set_holdable(self.id, 28) elif value == "flight": minqlx.set_holdable(self.id, 34) self.flight(reset=True) elif value == "kamikaze": minqlx.set_holdable(self.id, 37) elif value == "portal": minqlx.set_holdable(self.id, 38) elif value == "invulnerability": minqlx.set_holdable(self.id, 39) else: raise ValueError("Invalid holdable item.")