<commit_before>

import pygame
import word
from geniewishdisplay import GenieWishDisplay 


class Genie:
	def __init__(self, window, game, player, x, y, message, wishChoices, facingLeft = True):
		self.leftFacing = facingLeft
		self.window = window
		self.player = player
		self.message = message
		self.wishChoices = wishChoices
		self.game = game
		self.width=15*8
		self.height=20*8
		self.rect=pygame.Rect(x, y, self.width, self.height)
		self.interactionDistanceSquared = 16384
		self.growingAnimationFrame = -1
		self.idleAnimation = 0
		self.wishDisplay = GenieWishDisplay(self.window, self, message, wishChoices)

		self.wishesAlpha = 0
		self.chosenWish = -1

	def chooseWish(self, wish):
		self.chosenWish = wish
		self.wishDisplay.chooseWish(wish)
		self.wishDisplay.setWishFlagTrue()

	def isInMenu(self):
		return self.growingAnimationFrame == 4

	def distanceSquared(self, x, y):
		return (x - self.rect.x)**2 + (y-self.rect.y)**2

	def update(self, cameraX, cameraY):
		distance = self.distanceSquared(self.player.rect.x, self.player.rect.y)

		# this determines what frame it should show
		if distance < self.interactionDistanceSquared:
			# then start the appearing animation
			if self.growingAnimationFrame < 4:
				self.growingAnimationFrame += 1
			else:
				self.idleAnimation += 1
				self.idleAnimation %= 4
		else:
			if self.growingAnimationFrame > -1:
				self.growingAnimationFrame -= 1
		#self.window.blit(self.game.genieLamp, (self.rect.x-cameraX, self.rect.y-16-cameraY))
		if self.growingAnimationFrame == 4:
			# then do the idle expanded animation
			if self.leftFacing:
				self.window.blit(self.game.genieIdleL[self.game.animation], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			else:
				self.window.blit(self.game.genieIdleR[self.game.animation], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			if self.chosenWish == -1:
				self.wishDisplay.displayWishes(cameraX, cameraY)
			else:
				self.wishDisplay.displayPosttext(cameraX, cameraY)
		elif self.growingAnimationFrame > -1:
			# then do the expansion frame
			if self.leftFacing:
				self.window.blit(self.game.genieAppearL[self.growingAnimationFrame], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			else:
				self.window.blit(self.game.genieAppearR[self.growingAnimationFrame], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			
		else:
			# do the sitting in the lamp animation/image
			if self.leftFacing:
				self.window.blit(self.game.genieLampL, (self.rect.x-cameraX, self.rect.y-16-cameraY))
			else:
				self.window.blit(self.game.genieLampR, (self.rect.x-cameraX, self.rect.y-16-cameraY))

<commit_msg>fixed stealing a second wish<commit_after>

import pygame
import word
from geniewishdisplay import GenieWishDisplay 


class Genie:
	def __init__(self, window, game, player, x, y, message, wishChoices, facingLeft = True):
		self.leftFacing = facingLeft
		self.window = window
		self.player = player
		self.message = message
		self.wishChoices = wishChoices
		self.game = game
		self.width=15*8
		self.height=20*8
		self.rect=pygame.Rect(x, y, self.width, self.height)
		self.interactionDistanceSquared = 16384
		self.growingAnimationFrame = -1
		self.idleAnimation = 0
		self.wishDisplay = GenieWishDisplay(self.window, self, message, wishChoices)

		self.wishesAlpha = 0
		self.chosenWish = -1

	def chooseWish(self, wish):
		if self.chosenWish == -1:
			self.chosenWish = wish
			self.wishDisplay.chooseWish(wish)
			self.wishDisplay.setWishFlagTrue()

	def isInMenu(self):
		return self.growingAnimationFrame == 4

	def distanceSquared(self, x, y):
		return (x - self.rect.x)**2 + (y-self.rect.y)**2

	def update(self, cameraX, cameraY):
		distance = self.distanceSquared(self.player.rect.x, self.player.rect.y)

		# this determines what frame it should show
		if distance < self.interactionDistanceSquared:
			# then start the appearing animation
			if self.growingAnimationFrame < 4:
				self.growingAnimationFrame += 1
			else:
				self.idleAnimation += 1
				self.idleAnimation %= 4
		else:
			if self.growingAnimationFrame > -1:
				self.growingAnimationFrame -= 1
		#self.window.blit(self.game.genieLamp, (self.rect.x-cameraX, self.rect.y-16-cameraY))
		if self.growingAnimationFrame == 4:
			# then do the idle expanded animation
			if self.leftFacing:
				self.window.blit(self.game.genieIdleL[self.game.animation], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			else:
				self.window.blit(self.game.genieIdleR[self.game.animation], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			if self.chosenWish == -1:
				self.wishDisplay.displayWishes(cameraX, cameraY)
			else:
				self.wishDisplay.displayPosttext(cameraX, cameraY)
		elif self.growingAnimationFrame > -1:
			# then do the expansion frame
			if self.leftFacing:
				self.window.blit(self.game.genieAppearL[self.growingAnimationFrame], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			else:
				self.window.blit(self.game.genieAppearR[self.growingAnimationFrame], (self.rect.x-cameraX, self.rect.y-16-cameraY))
			
		else:
			# do the sitting in the lamp animation/image
			if self.leftFacing:
				self.window.blit(self.game.genieLampL, (self.rect.x-cameraX, self.rect.y-16-cameraY))
			else:
				self.window.blit(self.game.genieLampR, (self.rect.x-cameraX, self.rect.y-16-cameraY))


{'fraction_non_alphanumeric': 0.12163187855787476, 'fraction_numerical': 0.015749525616698293, 'mean_word_length': 3.963276836158192, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6665254', 'n_tokens_mistral': 2169, 'n_tokens_neox': 1876, 'n_words': 359}