class testMini:

	def Initialize(self, item):
		self.myTTI = item
		self.myTTI.ContextMenuFunciton("Attack", "ButtonAttack")
		self.myTTI.ContextMenuFunciton("Move", "ButtonMove")
		self.myTTI.ContextMenuFunciton("Get Coin", "Coin")
		self.myTTI.ContextMenuFunciton("Anim Reset", "ResetAnim")
		log(self.myTTI.itemName + ", Initialized!")
		
	def ButtonAttack(self):
		Character._instance.nextClickFunction = "TTI"+str(self.myTTI.keyNetID) + ".Attack(mouseHover)"
		
	def Attack(self, Defender):
		Damage = self.myTTI.stats["Combat/Attack/Melee Bonus"]
		self.myTTI.AnimateHumanoid("NonCombat", False)
		self.myTTI.AnimateHumanoid("Use", True)
		Defender.TakeDamage(Damage)
		self.myTTI.FloatNote("<color=Blue>Hit " + Defender.myTTI.itemName + "</color>", 0.25, 0.75, 0, 66)
		self.myTTI.ConsoleCommand("FAM SFX attack.ogg")

	def TakeDamage(self, damage):
		log("damage " + str(damage))
		oldHP = self.myTTI.stats["Combat/Hit Points"]
		newHP = oldHP - damage
		self.myTTI.StatCallback("Combat/Hit Points", newHP)
		if newHP <= 0:
			self.Die()
			self.myTTI.FloatNote("<b>" + self.myTTI.itemName + " Died!</b>", 5, 5, 0, 100)
		else:
			log("Ouch! That hurt")
			self.myTTI.FloatNote("<color=red>" + str(damage) + " damage</color>", 0.25, 1.25, 0, 66)
			self.myTTI.ConsoleCommand("FAM SFX hit.ogg")
			self.myTTI.AnimateHumanoid("Pain", True)
					
	def Die(self):
		log(self.myTTI.itemName + " died. How sad")
		self.myTTI.ConsoleCommand("FAM SFX wilhelmScream.ogg")
		self.myTTI.AnimateHumanoid("Death", 1)
		
	def ButtonMove(self):
		Character._instance.nextClickFunction = "TTI"+str(self.myTTI.keyNetID) + ".Move(cursorPos)"

	def Move(self, pos):
		log("Move command was called :D")
		self.myTTI.AnimateHumanoid("Idling", False)
		self.myTTI.SetDown(pos.x, pos.y, pos.z, engine.Quaternion.identity, "GRD:0")
		
	def Coin(self):
		self.myTTI.FloatNote("<color=yellow>1 Gold</color>", 0.25, 0.25, 0, 66)
		gold = 0
		if self.myTTI.stats.ContainsKey("Gold"):
			gold = self.myTTI.stats["Gold"]
			log("not none")
		gold += 1		
		self.myTTI.StatCallback("Gold", gold)
		self.myTTI.ConsoleCommand("FAM SFX Coin.wav")
				
	def ResetAnim(self):
		self.myTTI.AnimateHumanoid("Reset", True)
		