"use strict";
function normalize(p1,p2){
	var d = Math.sqrt( (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y) );
	var unitVector = {};
	unitVector.x = (p1.x-p2.x)/d;
	unitVector.y = (p1.y-p2.y)/d;
	return unitVector;

}
module.exports = function(entity,data) { // eslint-disable-line no-unused-vars
	
	var timers = data.entities.get(entity,"timers");
	var match = data.entities.get(entity,"match");
	var animation = data.entities.get(match.id,"animation");

	//select attack
	var x = Math.floor(Math.random() * (3))+1;
	animation.name = "bear-attack";
	switch(x){
		case 3:
			timers.attack1.time= 0;
			timers.attack1.running= true;
			
			//change animation/do something
			break;
		case 2:
			console.log("Attack 2");
			timers.attack2.time= 0;
			timers.attack2.running= true;
			
			//change animation/ do something
			break;
		case 1:
			console.log("aslkdladflna;slkdnflkasdlflkasdfl");
			timers.attack3.time= 0;
			timers.attack3.running= true;
			//change animation/ do something
			break;
		default:
			console.error("missed random:" + x);
	}
	
};
@@ -506,17 +506,17 @@
 om() * (
-3
+2
 ))+1;%0A%09a
@@ -560,16 +560,19 @@
 h(x)%7B%0A%09%09
+// 
 case 3:%0A
@@ -573,16 +573,19 @@
 se 3:%0A%09%09
+// 
 %09timers.
@@ -595,32 +595,35 @@
 ack1.time= 0;%0A%09%09
+// 
 %09timers.attack1.
@@ -635,32 +635,35 @@
 ng= true;%0A%09%09%09%0A%09%09
+// 
 %09//change animat
@@ -673,32 +673,35 @@
 /do something%0A%09%09
+// 
 %09break;%0A%09%09case 2
@@ -706,36 +706,8 @@
  2:%0A
-%09%09%09console.log(%22Attack 2%22);%0A
 %09%09%09t
@@ -762,19 +762,16 @@
 = true;%0A
-%09%09%09
 %0A%09%09%09//ch
@@ -823,61 +823,8 @@
  1:%0A
-%09%09%09console.log(%22aslkdladflna;slkdnflkasdlflkasdfl%22);%0A
 %09%09%09t
@@ -835,17 +835,17 @@
 s.attack
-3
+1
 .time= 0
@@ -862,17 +862,17 @@
 s.attack
-3
+1
 .running

change to only two attacks