anchor.diff:  	desc = "Does not support Pinball."
   	icon_state = "arcade"
   	circuit = /obj/item/circuitboard/computer/arcade/battle
  +
   	var/enemy_name = "Space Villain"
  -	var/temp = "Winners don't use space drugs" //Temporary message, for attack messages, etc
  -	var/player_hp = 30 //Player health/attack points
  -	var/player_mp = 10
  -	var/enemy_hp = 45 //Enemy health/attack points
  -	var/enemy_mp = 20
  +	///Enemy health/attack points
  +	var/enemy_hp = 100
  +	var/enemy_mp = 40
  +	///Temporary message, for attack messages, etc
  +	var/temp = "<br><center><h3>Winners don't use space drugs<center><h3>"
  +	///the list of passive skill the enemy currently has. the actual passives are added in the enemy_setup() proc
  +	var/list/enemy_passive
  +	///if all the enemy's weakpoints have been triggered becomes TRUE
  +	var/finishing_move = FALSE
  +	///linked to passives, when it's equal or above the max_passive finishing move will become TRUE
  +	var/pissed_off = 0
  +	///the number of passives the enemy will start with
  +	var/max_passive = 3
  +	///weapon wielded by the enemy, the shotgun doesn't count.
  +	var/chosen_weapon
  +
  +	///Player health
  +	var/player_hp = 85
  +	///player magic points
  +	var/player_mp = 20
  +	///used to remember the last three move of the player before this turn.
  +	var/list/last_three_move
  +	///if the enemy or player died. restart the game when TRUE
   	var/gameover = FALSE
  -	var/blocked = FALSE //Player cannot attack/heal while set
  -	var/turtle = 0
  -	var/list/weapons = list()
  +	///the player cannot make any move while this is set to TRUE. should only TRUE during enemy turns.
  +	var/blocked = FALSE
  +	///used to clear the enemy_action proc timer when the game is restarted
  +	var/timer_id
  +	///weapon used by the enemy, pure fluff.for certain actions
  +	var/list/weapons
  +	///unique to the emag mode, acts as a time limit where the player dies when it reaches 0.
  +	var/bomb_cooldown = 19
  +
  +
  +///creates the enemy base stats for a new round along with the enemy passives
  +/obj/machinery/computer/arcade/battle/proc/enemy_setup(player_skill)
  +	player_hp = 85
  +	player_mp = 20
  +	enemy_hp = 100
  +	enemy_mp = 40
  +	gameover = FALSE
  +	blocked = FALSE
  +	finishing_move = FALSE
  +	pissed_off = 0
  +	last_three_move = null
  +
  +	enemy_passive = list("short_temper" = TRUE, "poisonous" = TRUE, "smart" = TRUE, "shotgun" = TRUE, "magical" = TRUE, "chonker" = TRUE)
  +	for(var/i = LAZYLEN(enemy_passive); i > max_passive; i--) //we'll remove passives from the list until we have the number of passive we want
  +		var/picked_passive = pick(enemy_passive)
  +		LAZYREMOVE(enemy_passive, picked_passive)
  +
  +	if(LAZYACCESS(enemy_passive, "chonker"))
  +		enemy_hp += 20
  +
  +	if(LAZYACCESS(enemy_passive, "shotgun"))
  +		chosen_weapon = "shotgun"
  +	else if(weapons)
  +		chosen_weapon = pick(weapons)
  +	else
  +		chosen_weapon = "null gun" //if the weapons list is somehow empty, shouldn't happen but runtimes are sneaky bastards.
  +
  +	if(player_skill)
  +		player_hp += player_skill * 2
  +
   
   /obj/machinery/computer/arcade/battle/Reset()
  +	max_passive = 3
   	var/name_action
   	var/name_part1
   	var/name_part2
  
positive.code: 				xp_gained += 50
  			SSblackbox.record_feedback("nested tally", "arcade_results", 1, list("win", (obj_flags & EMAGGED ? "emagged":"normal")))
  
  
  	else if ((obj_flags & EMAGGED) && (turtle >= 4))
  		var/boomamt = rand(5,10)
  		temp = "[enemy_name] throws a bomb, exploding you for [boomamt] damage!"
  		playsound(loc, 'sound/arcade/boom.ogg', 50, TRUE, extrarange = -3, falloff = 10)
  		player_hp -= boomamt
  
  	else if ((enemy_mp <= 5) && (prob(70)))
  		var/stealamt = rand(2,3)
  		temp = "[enemy_name] steals [stealamt] of your power!"
  		playsound(loc, 'sound/arcade/steal.ogg', 50, TRUE, extrarange = -3, falloff = 10)
  		player_mp -= stealamt
  		updateUsrDialog()
  
  		if (player_mp <= 0)
  			gameover = TRUE
  			sleep(10)
  			temp = "You have been drained! GAME OVER"
  			playsound(loc, 'sound/arcade/lose.ogg', 50, TRUE, extrarange = -3, falloff = 10)
  			if(obj_flags & EMAGGED)
  				usr.gib()
  			SSblackbox.record_feedback("nested tally", "arcade_results", 1, list("loss", "mana", (obj_flags & EMAGGED ? "emagged":"normal")))
  
  	else if ((enemy_hp <= 10) && (enemy_mp > 4))
  		temp = "[enemy_name] heals for 4 health!"
  		playsound(loc, 'sound/arcade/heal.ogg', 50, TRUE, extrarange = -3, falloff = 10)
  		enemy_hp += 4
  		enemy_mp -= 4
  
  	else
  		var/attackamt = rand(3,6)
  		temp = "[enemy_name] attacks for [attackamt] damage!"
  		playsound(loc, 'sound/arcade/hit.ogg', 50, TRUE, extrarange = -3, falloff = 10)
  		player_hp -= attackamt
  
  	if ((player_mp <= 0) || (player_hp <= 0))
  		gameover = TRUE
  		temp = "You have been crushed! GAME OVER"
  		playsound(loc, 'sound/arcade/lose.ogg', 50, TRUE, extrarange = -3, falloff = 10)
  		xp_gained += 10//pity points
  		if(obj_flags & EMAGGED)
  			usr.gib()
  		SSblackbox.record_feedback("nested tally", "arcade_results", 1, list("loss", "hp", (obj_flags & EMAGGED ? "emagged":"normal")))
  
  	user?.mind?.adjust_experience(/datum/skill/gaming, xp_gained+1)//always gain at least 1 point of XP
  	blocked = FALSE
  	return
  
  
  /obj/machinery/computer/arcade/battle/emag_act(mob/user)
  	if(obj_flags & EMAGGED)
  		return
  	to_chat(user, "<span class='warning'>A mesmerizing Rhumba beat starts playing from the arcade machine's speakers!</span>")
  	temp = "If you die in the game, you die for real!"
  	player_hp = 30
  	player_mp = 10
  	enemy_hp = 45
  	enemy_mp = 20
  	gameover = FALSE
  	blocked = FALSE
  
  	obj_flags |= EMAGGED
  
  	enemy_name = "Cuban Pete"
  	name = "Outbomb Cuban Pete"
  
  
  	updateUsrDialog()
  
  
  
  // *** THE ORION TRAIL ** //
  
negative.code: 		to_chat(user, "<span class='notice'>You turn in 2 tickets to the [src] and claim a prize!</span>")
  		return
  
  
  // ** BATTLE ** //
  
  
  