package hmggirlfront.entity;

import gvclib.entity.living.AI_EntityWeapon_new;
import gvclib.event.GVCSoundEvent;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.Vec3d;

public class DollAI_Skill {
	public static void load(EntityDoll doll) {
		if(doll == null)return;
		if(!doll.doll_skill_can)return;
		if(doll.doll_skill == 1 || doll.doll_skill == 2 || doll.doll_skill == 3|| doll.doll_skill == 4){
			boolean fire = false;
			boolean smoke = false;
			boolean flash = false;
			int power = 30;
			int time = 80;
			if(doll.doll_skill == 2){
				fire = true;
				power = 1;
				time = 80;
			}
			if(doll.doll_skill == 3){
				smoke = true;
				power = 1;
				time = 40;
			}
			if(doll.doll_skill == 4){
				flash = true;
				power = 1;
				time = 20;
			}
			Vec3d looked = doll.getLookVec();
    		if(doll.getRemain_R() > 0){
    			SoundEvent sounds = SoundEvents.ENTITY_SKELETON_SHOOT;
    			int bulletid = 0;
    			String model = "gvclib:textures/entity/grenade.mqo";
    			String tex = "gvclib:textures/entity/grenade.png";
    			String modelf = "gvclib:textures/entity/grenade.mqo";
    			String texf = "gvclib:textures/entity/grenade.png";
					AI_EntityWeapon_new we = new AI_EntityWeapon_new(doll, doll);
					we.id = 9;
					we.model = model;
					we.tex = tex;
					we.modelf = model;
					we.texf = tex;
					we.ftime = 0;
					we.sound = sounds;
					we.f = 0F;
					we.w = 0;
					we.h = 1.5;
					we.z = 0;
					we.bx = doll.posX;
					we.by = doll.posY;
					we.bz = doll.posZ;
					we.follow_rote = false;
					we.xoffset = 0;
					we.yoffset = 0;
					we.px = doll.posX;
					we.py = doll.posY;
					we.pz = doll.posZ;
					we.lock = looked;
					we.rote = doll.rotationYawHead;
					we.maxy = 10;
					we.miny = 10;
					
					we.power = power;
					we.speed = 1.2F;
					we.bure = 1F;
					we.ex = 2.0F;
					we.extrue = false;
					we.exfire = fire;
					we.exsmoke = smoke;
					we.exflash = flash;
					we.kazu = 1;
					we.gra = 0.0;
					we.maxtime = time;
					we.dameid = 0;
					we.Attacktask(doll, doll, 20);
				if(doll.firetrue){
					doll.setRemain_R(doll.getRemain_R() - 1);
				}
			}
    	}
		if(doll.doll_skill == 10){
			boolean fire = false;
			int power = doll.power * 6;
			Vec3d looked = doll.getLookVec();
    		if(doll.getRemain_R() > 0){
    			SoundEvent sounds = GVCSoundEvent.fire_grenade;
    			int bulletid = 0;
    			String model = "gvclib:textures/entity/bulletgb.obj";
    			String tex = "gvclib:textures/entity/bulletgb.png";
    			String modelf = "gvclib:textures/entity/mflash.mqo";
    			String texf = "gvclib:textures/entity/mflash.png";
					AI_EntityWeapon_new we = new AI_EntityWeapon_new(doll, doll);
					we.id = 2;
					we.model = model;
					we.tex = tex;
					we.modelf = model;
					we.texf = tex;
					we.ftime = 0;
					we.sound = sounds;
					we.f = 0F;
					we.w = 0;
					we.h = 1.5;
					we.z = 1.0;
					we.bx = doll.posX;
					we.by = doll.posY;
					we.bz = doll.posZ;
					we.follow_rote = false;
					we.xoffset = 0;
					we.yoffset = 0;
					we.px = doll.posX;
					we.py = doll.posY;
					we.pz = doll.posZ;
					we.lock = looked;
					we.rote = doll.rotationYawHead;
					we.maxy = 10;
					we.miny = 10;
					
					we.power = power;
					we.speed = 1.8F;
					we.bure = 1F;
					we.ex = 2.0F;
					we.extrue = false;
					we.exfire = fire;
					we.kazu = 1;
					we.gra = 0.01;
					we.maxtime = 80;
					we.dameid = 0;
					we.Attacktask(doll, doll, 30);
				if(doll.firetrue){
					doll.setRemain_R(doll.getRemain_R() - 1);
				}
			}
    	}
	}
	
}
