51 lines
		
	
	
		
			No EOL
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			No EOL
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| //unitdata = new unit();
 | |
| pos = new vec2(0, 0);
 | |
| state = st_standing;
 | |
| drawstate = c_null;
 | |
| hspd = 0;
 | |
| vspd = 0;
 | |
| returnpos = new vec2(0, 0);
 | |
| dir = DIR.NONE;
 | |
| attacks = 0;
 | |
| attacked = 0;
 | |
| inventory = [];
 | |
| c_addweapon(id, wp.nothing);
 | |
| equippedweapon = noone;
 | |
| waiting = false;
 | |
| targeting = new vec2(0, 0);
 | |
| hitpos = new vec2(0, 0);
 | |
| marked = false;
 | |
| hitting = noone;
 | |
| 
 | |
| continuecombat = function(me, them) {
 | |
| 	//if stamina returnable = true stamina-- return true
 | |
| 	if them.data.str.val < 0 || me.data.hp.val <= 0 {
 | |
| 		return false;
 | |
| 	}
 | |
| 	if !(attacks-(me.data.spd.val > them.data.spd.val+5)) { //DONT USE FIVE, OR ANY OF THIS
 | |
| 		attacks++;
 | |
| 		return true;
 | |
| 	}
 | |
| 	return false;
 | |
| }
 | |
| 
 | |
| action = {
 | |
| 	effect: function(me, them) {
 | |
| 		var guy = instance_create(them.x, them.y, o_damage);
 | |
| 		guy.hspd = random(3)-1.5;
 | |
| 		guy.vspd = -random(1)-3;
 | |
| 		if irandom(99) < (me.data.hit.val) { //add avo
 | |
| 			them.data.hp.val = min(them.data.hp.val - (me.data.str.val-them.data.def.val), them.data.hp.cap);
 | |
| 			guy.amount = (me.data.str.val-them.data.def.val);
 | |
| 			return me.data.str.val;
 | |
| 		} else {
 | |
| 			guy.amount = "Miss!";
 | |
| 			return 0;
 | |
| 			
 | |
| 		}
 | |
| 	}
 | |
| 	//animation: new actionanim()
 | |
| 	
 | |
| }
 | |
| image_speed = .15;
 | |
| hooks = {}; |