<commit_before>(function(LP) {

	LP.behaviors = {
		
		wander: {
			create: function (enemy, player, canvasW, canvasH, speed, radius, changeCallback){
				var myBehavior = {},
			        lastDirectionChangeTime = 0,
	                lastBehaviorChangeTime = 0;

				myBehavior.onEnterState = function(){
					lastBehaviorChangeTime = null;
				};

				myBehavior.update = function (tFrame, dt){
					if (!lastBehaviorChangeTime) lastBehaviorChangeTime = tFrame;

					if (enemy.X - radius <= 0 || enemy.X + radius >= canvasW) enemy.directionX *= -1; 
					if (enemy.Y - radius <= 0 || enemy.Y + radius >= canvasH) enemy.directionY *= -1; 

					if (tFrame - lastDirectionChangeTime > (Math.random () * 5 + 4 ) * 1000){
					enemy.directionY = Math.random ();
					enemy.directionX = Math.random ();
					//if (Math.random() > 0.5) directionX *= -1;
					//if (Math.random() > 0.5) directionY *= -1;
					lastDirectionChangeTime = tFrame;
					}

					enemy.X += speed * enemy.directionX;
					enemy.Y += speed * enemy.directionY;

					if (changeCallback && (tFrame - lastBehaviorChangeTime > 10 * 1000)) changeCallback();
			    };

				myBehavior.onExitState = function(){};

				return myBehavior;
			}
		},

		seekAndBump: {
			create: function (enemy, player, canvasW, canvasH, speed, radius, changeCallback){
				var myBehavior = {};

				myBehavior.onEnterState = function(){};

				myBehavior.update = function (tFrame, dt){
			      var dx = player.X - enemy.X;
			      var dy = player.Y - enemy.Y;
			      var distance = Math.sqrt((dx*dx) + (dy*dy));
			      //this.angle = Math.atan2(this.dy,this.dx) * 180 / Math.PI;

			      // We normalize the vector
			      enemy.directionX = (dx/distance);
			      enemy.directionY = (dy/distance);

			      enemy.X += speed * enemy.directionX;
			      enemy.Y += speed * enemy.directionY;

			      if (changeCallback && LP.helpers.areColliding(player.getHitbox(), enemy.getHitbox())) changeCallback();
			    };

				myBehavior.onExitState = function(){};

				return myBehavior;
			}
		},

		multiFire: {
			create: function (enemy, player, canvasW, canvasH, speed, radius, changeCallback){
				var myBehavior = {
				        isFiring : false,
		                colorPercentage : 0,
	                    bullets : [],
					},
					haveJustFired = false;

				myBehavior.onEnterState = function(){
			        myBehavior.colorPercentage = 0;
			        haveJustFired = false;
			      	myBehavior.isFiring = true;			        
				};

				myBehavior.update = function (tFrame, dt){
<commit_msg>Temporary fix seekAndBump getting stuck<commit_after>(function(LP) {

	LP.behaviors = {
		
		wander: {
			create: function (enemy, player, canvasW, canvasH, speed, radius, changeCallback){
				var myBehavior = {},
			        lastDirectionChangeTime = 0,
	                lastBehaviorChangeTime = 0;

				myBehavior.onEnterState = function(){
					lastBehaviorChangeTime = null;
				};

				myBehavior.update = function (tFrame, dt){
					if (!lastBehaviorChangeTime) lastBehaviorChangeTime = tFrame;

					if (enemy.X - radius <= 0 || enemy.X + radius >= canvasW) enemy.directionX *= -1; 
					if (enemy.Y - radius <= 0 || enemy.Y + radius >= canvasH) enemy.directionY *= -1; 

					if (tFrame - lastDirectionChangeTime > (Math.random () * 5 + 4 ) * 1000){
					enemy.directionY = Math.random ();
					enemy.directionX = Math.random ();
					//if (Math.random() > 0.5) directionX *= -1;
					//if (Math.random() > 0.5) directionY *= -1;
					lastDirectionChangeTime = tFrame;
					}

					enemy.X += speed * enemy.directionX;
					enemy.Y += speed * enemy.directionY;

					if (changeCallback && (tFrame - lastBehaviorChangeTime > 10 * 1000)) changeCallback();
			    };

				myBehavior.onExitState = function(){};

				return myBehavior;
			}
		},

		seekAndBump: {
			create: function (enemy, player, canvasW, canvasH, speed, radius, changeCallback){
				var myBehavior = {};

				myBehavior.onEnterState = function(){};

				myBehavior.update = function (tFrame, dt){
			      var dx = player.X - enemy.X;
			      var dy = player.Y - enemy.Y;
			      var distance = Math.sqrt((dx*dx) + (dy*dy));
			      //this.angle = Math.atan2(this.dy,this.dx) * 180 / Math.PI;

			      // We normalize the vector
			      enemy.directionX = (dx/distance);
			      enemy.directionY = (dy/distance);

			      enemy.X += speed * enemy.directionX;
			      enemy.Y += speed * enemy.directionY;

					// TODO: Fix getting stuck
					// If we have a changeCallback defined and have collided the player or we are touching the path (we are getting stuck)
					// we change behavior
					if (changeCallback && (LP.helpers.areColliding(player.getHitbox(), enemy.getHitbox()) || 
						player.isCollidingPath(enemy.getHitbox()))) changeCallback();
			    };

				myBehavior.onExitState = function(){};

				return myBehavior;
			}
		},

		multiFire: {
			create: function (enemy, player, canvasW, canvasH, speed, radius, changeCallback){
				var myBehavior = {
				        isFiring : false,
		                colorPercentage : 0,
	                    bullets : [],
					},
					haveJustFired = false;

				myBehavior.onEnterState = function(){
			        myBehavior.colorPercentage = 0;
			        haveJustFired = false;
			      	myBehavior.isFiring = true;			        
				};

				myBehavior.update = function (tFrame, dt){

{'fraction_non_alphanumeric': 0.131878380899086, 'fraction_numerical': 0.01119194180190263, 'mean_word_length': 2.3893805309734515, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '5858039', 'n_tokens_mistral': 2069, 'n_tokens_neox': 1596, 'n_words': 385}