<commit_before>
import sys

import os
os.environ['PANDA_PRC_DIR'] = os.path.join(os.path.dirname(__file__), 'etc')

# This import should be kept near the top to avoid issues with CEF/Chromium hooking malloc
from cefpanda import CEFPanda


from direct.showbase.ShowBase import ShowBase, DirectObject
from direct.interval.LerpInterval import LerpPosInterval

from panda3d.core import *

from combat.terrain import Terrain as CombatTerrain, MAP_SIZE
from combat.player import Player as CombatPlayer
from stance_generator import StanceGenerator, stances_to_json


class GameState(object, DirectObject.DirectObject):
	def __init__(self, _base, ui=None):
		DirectObject.DirectObject.__init__(self)
		self.base = _base

		if self.base.player is None:
			print("Creating default player")
			self.base.player = CombatPlayer("Player", level=3)
		self.player = self.base.player

		self.accept("arrow_up", self.sel_up)
		self.accept("arrow_left", self.sel_left)
		self.accept("arrow_down", self.sel_down)
		self.accept("arrow_right", self.sel_right)
		self.accept("arrow_up-repeat", self.sel_up)
		self.accept("arrow_left-repeat", self.sel_left)
		self.accept("arrow_down-repeat", self.sel_down)
		self.accept("arrow_right-repeat", self.sel_right)
		self.accept("enter", self.accept_selection)
		self.accept("escape", self.escape)

		# Load UI
		if ui is not None:
			self.base.ui.load('ui/' + ui + '.html')

		self.ui_last = self.ui_selection = 0

		# Load UI sounds
		self.base.sfxManagerList[0].setVolume(0.5)  # TODO: Make this user settable
		self.uifx_selection = self.base.loader.loadSfx("audio/MENU_Pick.wav")
		self.uifx_accept = self.base.loader.loadSfx("audio/MENU B_Select.wav")
		self.uifx_back = self.base.loader.loadSfx("audio/MENU B_Back.wav")

	def destroy(self):
		self.ignoreAll()

	def accept_selection(self):
		self.uifx_accept.play()

	def escape(self):
		self.uifx_back.play()

	def sel_up(self):
		self.uifx_selection.play()
		self.ui_selection -= 1

	def sel_down(self):
		self.uifx_selection.play()
		self.ui_selection += 1

	def sel_left(self):
		self.uifx_selection.play()
		self.sel_up()

	def sel_right(self):
		self.uifx_selection.play()
		self.sel_down()

	def main_loop(self):
		pass


class CombatState(GameState):
	def __init__(self, _base):
		super(CombatState, self).__init__(_base, 'combat_ui')
		self.accept("1", self.enter_move_mode)
		self.accept("2", self.enter_attack_mode)
		self.accept("3", self.end_turn)

		self.terrain = CombatTerrain()
		self.player = CombatPlayer("Player")
		self.player.roll_initiative()<commit_msg>Combat: Removing an extra player.<commit_after>
import sys

import os
os.environ['PANDA_PRC_DIR'] = os.path.join(os.path.dirname(__file__), 'etc')

# This import should be kept near the top to avoid issues with CEF/Chromium hooking malloc
from cefpanda import CEFPanda


from direct.showbase.ShowBase import ShowBase, DirectObject
from direct.interval.LerpInterval import LerpPosInterval

from panda3d.core import *

from combat.terrain import Terrain as CombatTerrain, MAP_SIZE
from combat.player import Player as CombatPlayer
from stance_generator import StanceGenerator, stances_to_json


class GameState(object, DirectObject.DirectObject):
	def __init__(self, _base, ui=None):
		DirectObject.DirectObject.__init__(self)
		self.base = _base

		if self.base.player is None:
			print("Creating default player")
			self.base.player = CombatPlayer("Player", level=3)
		self.player = self.base.player

		self.accept("arrow_up", self.sel_up)
		self.accept("arrow_left", self.sel_left)
		self.accept("arrow_down", self.sel_down)
		self.accept("arrow_right", self.sel_right)
		self.accept("arrow_up-repeat", self.sel_up)
		self.accept("arrow_left-repeat", self.sel_left)
		self.accept("arrow_down-repeat", self.sel_down)
		self.accept("arrow_right-repeat", self.sel_right)
		self.accept("enter", self.accept_selection)
		self.accept("escape", self.escape)

		# Load UI
		if ui is not None:
			self.base.ui.load('ui/' + ui + '.html')

		self.ui_last = self.ui_selection = 0

		# Load UI sounds
		self.base.sfxManagerList[0].setVolume(0.5)  # TODO: Make this user settable
		self.uifx_selection = self.base.loader.loadSfx("audio/MENU_Pick.wav")
		self.uifx_accept = self.base.loader.loadSfx("audio/MENU B_Select.wav")
		self.uifx_back = self.base.loader.loadSfx("audio/MENU B_Back.wav")

	def destroy(self):
		self.ignoreAll()

	def accept_selection(self):
		self.uifx_accept.play()

	def escape(self):
		self.uifx_back.play()

	def sel_up(self):
		self.uifx_selection.play()
		self.ui_selection -= 1

	def sel_down(self):
		self.uifx_selection.play()
		self.ui_selection += 1

	def sel_left(self):
		self.uifx_selection.play()
		self.sel_up()

	def sel_right(self):
		self.uifx_selection.play()
		self.sel_down()

	def main_loop(self):
		pass


class CombatState(GameState):
	def __init__(self, _base):
		super(CombatState, self).__init__(_base, 'combat_ui')
		self.accept("1", self.enter_move_mode)
		self.accept("2", self.enter_attack_mode)
		self.accept("3", self.end_turn)

		self.terrain = CombatTerrain()
		self.player.roll_initiative()
{'fraction_non_alphanumeric': 0.12531919072873698, 'fraction_numerical': 0.004321351404439206, 'mean_word_length': 4.934731934731935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '286071', 'n_tokens_mistral': 1975, 'n_tokens_neox': 1804, 'n_words': 357}