Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Fire Protection:
- need mods:
- CustomNPCs v 1.12.2
- Varied Commodities v 1.12.2
- NPC set up work - Puppet*/
- var npc,wr,x,y,z,rot=0,angleStep=20,impulse,shY=1.2,pi=3.141592653589793,
- gH=5.656854249, rph=4.7, cnt=4000, dam=25, damage, timeF=300,
- timeStep=0, doub,targ,home=[24.5,4,42.5],speed=1.7,mess=0;
- /*angleStep - how fast it will rotate around the circle (offset in degrees);
- impulse - how fast it will fly tangentially to the circle (block speed per tick);
- fPA Fire Protection:
- [0] - circle radius;
- [1][0] - horizontal circle in the plane XZ [x,y,z,angleH,null]
- [1][1] - vertical circle in the plane YZ [x,y,z,angleV,plase]
- [1][2] - vertical circle in the plane YX [x,y,z,angleV,plase]
- [1][3] - oblique circle to the left [x,y,z,angleH,angleV]
- [1][4] - oblique circle to the right [x,y,z,angleH,angleV]
- rot - angle for calculating the movement of shells in the main mode;
- shY - center of the sphere of fire;
- dam - default damage;
- damage - estimated damage
- cnt - coefficient to create the amount of fire when creating a fire sphere;
- rad - sphere segment radius;
- val - number of shells in a segment;
- rts - angle of rotation of each projectile in a segment;
- rph - sphere radius;
- timeF - the duration of the Fire Defense (at least 3 seconds!);
- pi - circular number;
- gH - acceleration of gravity;
- targ - attack target;
- */
- var fPA=[2,[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]]
- function init(ev) {
- npc=ev.npc,x=npc.getX(),y=npc.getY(),z=npc.getZ();
- npc.timers.clear();
- }
- function interact(ev) {
- npc=ev.npc,wr=npc.world,x=npc.getX(),y=npc.getY(),z=npc.getZ();
- npc.setHealth(npc.getMaxHealth());
- if (npc.getRotation() < 0) { // NPC rotation is always from 0 to 360:
- npc.setRotation((Math.floor(npc.getRotation()/(-360))*360+npc.getRotation())+360);
- } else {
- npc.setRotation(npc.getRotation()-Math.floor(npc.getRotation()/360)*360);
- }
- impulse=0.7*pi*fPA[0]*angleStep/360; // circumferential speed
- // Fire Protection Launch:
- if (!npc.timers.has(1) && !npc.timers.has(2) && !npc.timers.has(3) && !npc.timers.has(4) && !npc.timers.has(5)) {
- actionSkill(npc,[0.5,2,2,2]);
- npc.say('Is not enough fire here!');
- npc.getDisplay().setTitle('<§cFire Protection §e- Activation§r> §4BOSS§r lv. 45');
- npc.getJob().getPart(1).setRotation(180,180,180);
- npc.getJob().getPart(2).setRotation(106,149,136);
- npc.timers.forceStart(1,50,false);
- }
- }
- function timer(ev) {
- npc=ev.npc,x=npc.getX(),y=npc.getY(),z=npc.getZ();
- var temp,ax=0,ay=0,az=0,nx,ny,nz,size=2,targ,dist,entArr;
- if (ev.id==1 && !npc.timers.has(5)) { // create a fireball:
- npc.say('Appear low fire!');
- npc.getJob().getPart(1).setRotation(300,290,180);
- npc.getJob().getPart(2).setRotation(60,250,180);
- npc.getAi().setRetaliateType(3); // do nothing when he sees the enemy
- if (npc.getAttackDamage) {}
- var rad, val, rts;
- for (var n=0;n<=9;n++) { // creation of sphere segments
- val= Math.round(n*cnt)/1000;
- if (!val) {
- val=1, rad=0, rts=0;
- } else {
- rad = Math.round((Math.cos((90-n*10)*pi/180)*rph)*1000)/1000;
- rts = Math.round(360000/val)/1000;
- }
- for (var f=0;f<val;f++) { // creation of shells in the segment
- nx = Math.round((x+Math.sin(f*rts*pi/180)*rad*(-1))*1000)/1000;
- ny = Math.round((y+shY+Math.cos(n*10*pi/180)*rph)*1000)/1000;
- nz = Math.round((z+Math.cos(f*rts*pi/180)*rad)*1000)/1000;
- if (n==9 && f!==0 && f!==9 && f!==18 && f!==27) {
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:1.0f,ownerName:"'+npc.getUUID()+'",glows:1b,id:"customnpcs:customnpcprojectile",size:2,Fire:60s,effectDuration:5,Render3D:1b}';
- } else if (n!==9) {
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:1.0f,ownerName:"'+npc.getUUID()+'",glows:1b,id:"customnpcs:customnpcprojectile",size:2,Fire:60s,effectDuration:5,Render3D:1b}';
- }
- ev.API.executeCommand(npc.world,temp);
- if (n!==9) { // mirror
- ny = Math.round((y+shY-Math.cos(n*10*pi/180)*rph)*1000)/1000;
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:1.0f,ownerName:"'+npc.getUUID()+'",glows:1b,id:"customnpcs:customnpcprojectile",size:2,Fire:60s,effectDuration:5,Render3D:1b}';
- ev.API.executeCommand(npc.world,temp);
- }
- }
- }
- npc.timers.forceStart(2,40,false);
- }
- if (ev.id==2 && !npc.timers.has(5)) { // fireball movement to npc:
- npc.say('May the fire be filled from me.');
- npc.getJob().getPart(1).setRotation(90,200,180);
- npc.getJob().getPart(2).setRotation(90,160,180);
- temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
- for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
- var rad, val, rts;
- for (var n=0;n<=9;n++) { // creation of sphere segments
- val= Math.round(n*cnt)/1000;
- if (!val) {
- val=1, rad=0, rts=0;
- } else {
- rad = Math.round((Math.cos((90-n*10)*pi/180)*rph)*1000)/1000;
- rts = Math.round(360000/val)/1000;
- }
- for (var f=0;f<val;f++) { // the creation of shells in the segment
- nx = Math.round((x+Math.sin(f*rts*pi/180)*rad*(-1))*1000)/1000;
- ny = Math.round((y+shY+Math.cos(n*10*pi/180)*rph)*1000)/1000;
- nz = Math.round((z+Math.cos(f*rts*pi/180)*rad)*1000)/1000;
- ax = Math.round((x-nx)*1000)/100000;
- ay = Math.round((y-ny+shY)*1000)/100000;
- az = Math.round((z-nz)*1000)/100000;
- if (n==9 && f!==0 && f!==9 && f!==18 && f!==27) {
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:1.0f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- } else if (n!==9) {
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:1.0f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- }
- ev.API.executeCommand(npc.world,temp);
- if (n!==9) { // mirror
- ny = Math.round((y+shY-Math.cos(n*10*pi/180)*rph)*1000)/1000;
- ax = Math.round((x-nx)*1000)/100000;
- ay = Math.round((y-ny+shY)*1000)/100000;
- az = Math.round((z-nz)*1000)/100000;
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:1.0f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- ev.API.executeCommand(npc.world,temp);
- }
- }
- }
- size=5;
- npc.timers.forceStart(3,60,false);
- }
- if (ev.id==3 && !npc.timers.has(5)) { // creating a base for fire protection
- npc.getJob().getPart(1).setRotation(180,180,180);
- npc.getJob().getPart(2).setRotation(180,180,180);
- temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
- damage = Math.round((dam*5 + dam*(temp.length+300)/1200)*10)/10; // the more fire from the sphere the NPC collects, the higher the damage, but not lower than 50% of the default var "dam".
- for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
- // The coordinates for the appearance of the first shells:
- // horizontal circle (in front of you)
- fPA[1][0][0] = x;
- fPA[1][0][1] = y+shY;
- fPA[1][0][2] = z+fPA[0];
- fPA[1][0][3] = 0;
- fPA[1][0][4] = 0;
- // vertical circle XZ (behind you)
- fPA[1][1][0] = x;
- fPA[1][1][1] = y+shY;
- fPA[1][1][2] = z-fPA[0];
- fPA[1][1][3] = 0;
- fPA[1][1][4] = 0;
- // vertical circle YX (to your left)
- fPA[1][2][0] = x-fPA[0];
- fPA[1][2][1] = y+shY;
- fPA[1][2][2] = z;
- fPA[1][2][3] = 0;
- fPA[1][2][4] = 0;
- // oblique circle to the left (underneath)
- fPA[1][3][0] = x;
- fPA[1][3][1] = y+shY-fPA[0];
- fPA[1][3][2] = z;
- fPA[1][3][3] = 0;
- fPA[1][3][4] = 0;
- // oblique circle to the right (above itself)
- fPA[1][4][0] = x;
- fPA[1][4][1] = y+shY+fPA[0];
- fPA[1][4][2] = z;
- fPA[1][4][3] = 0;
- fPA[1][4][4] = 0;
- npc.say('Raced!');
- npc.timers.forceStart(4,1,true);
- npc.timers.forceStart(5,20,false);
- npc.getDisplay().setTitle('<§cFire Protection §e- '+Math.floor(timeF/20)+' sec.§r> §4BOSS§r lv. 45');
- timeStep = timeF-20;
- npc.timers.forceStart(6,timeF,false);
- }
- if (ev.id==4 && npc.timers.has(5)) { // fire protection work
- temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
- for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
- // horizontal circle:
- if (fPA[1][0][3]+90>360) {rot=fPA[1][0][3]-270} else {rot=fPA[1][0][3]+90}
- ax = Math.round(Math.sin(rot*pi/180)*impulse*(-10000))/10000;
- az = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
- nx=fPA[1][0][0],ny=fPA[1][0][1],nz=fPA[1][0][2];
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:'+damage+'f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],UUIDLeast:-'+Math.random()*Math.pow(10,19)+'L,Rotation:[86.341965f,0.4638253f],UUIDMost:'+Math.random()*Math.pow(10,19)+'L,size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
- if ((fPA[1][0][3]+angleStep)>360) {fPA[1][0][3] = 360-fPA[1][0][3]+angleStep} else {fPA[1][0][3] = fPA[1][0][3]+angleStep} // angle
- fPA[1][0][0] = Math.round((x+Math.sin(fPA[1][0][3]*pi/180)*fPA[0]*(-1))*10000)/10000; // x
- fPA[1][0][2] = Math.round((z+Math.cos(fPA[1][0][3]*pi/180)*fPA[0]*1)*10000)/10000; // z
- // vertical circle XZ:
- if (fPA[1][1][3]+90>180) {rot=fPA[1][1][3]-90} else {rot=fPA[1][1][3]+90}
- if (fPA[1][1][4]) {
- ay = Math.round(Math.sin(rot*pi/180)*impulse*(-10000))/10000;
- az = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
- } else {
- ay = Math.round(Math.sin(rot*pi/180)*impulse*10000)/10000;
- az = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
- }
- nx=fPA[1][1][0],ny=fPA[1][1][1],nz=fPA[1][1][2];
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:'+damage+'f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],UUIDLeast:-'+Math.random()*Math.pow(10,19)+'L,Rotation:[86.341965f,0.4638253f],UUIDMost:'+Math.random()*Math.pow(10,19)+'L,size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
- if (fPA[1][1][4]) { // angle
- if (fPA[1][1][3]+angleStep>90) {
- fPA[1][1][4] = 0;
- fPA[1][1][3] = fPA[1][1][3]-angleStep;
- fPA[1][1][2] = Math.round((z-Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
- } else {
- fPA[1][1][3] = fPA[1][1][3]+angleStep;
- fPA[1][1][2] = Math.round((z+Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
- }
- } else {
- if (fPA[1][1][3]-angleStep<(-90)) {
- fPA[1][1][4] = 1;
- fPA[1][1][3] = fPA[1][1][3]+angleStep;
- fPA[1][1][2] = Math.round((z+Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
- } else {
- fPA[1][1][3] = fPA[1][1][3]-angleStep;
- fPA[1][1][2] = Math.round((z-Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
- }
- }
- fPA[1][1][1] = Math.round((y+shY+Math.sin(fPA[1][1][3]*pi/180)*fPA[0]*(-1))*10000)/10000;
- // vertical circle YX:
- if (fPA[1][2][3]+90>180) {rot=fPA[1][2][3]-90} else {rot=fPA[1][2][3]+90}
- if (fPA[1][2][4]) {
- ay = Math.round(Math.sin(rot*pi/180)*impulse*(-10000))/10000;
- ax = Math.round(Math.cos(rot*pi/180)*impulse*(-10000))/10000;
- } else {
- ay = Math.round(Math.sin(rot*pi/180)*impulse*10000)/10000;
- ax = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
- }
- nx=fPA[1][2][0],ny=fPA[1][2][1],nz=fPA[1][2][2];
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:'+damage+'f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],UUIDLeast:-'+Math.random()*Math.pow(10,19)+'L,Rotation:[86.341965f,0.4638253f],UUIDMost:'+Math.random()*Math.pow(10,19)+'L,size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
- if (fPA[1][2][4]) { // angle
- if (fPA[1][2][3]+angleStep>90) {
- fPA[1][2][4] = 0;
- fPA[1][2][3] = fPA[1][2][3]+angleStep;
- fPA[1][2][0] = Math.round((x+Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
- } else {
- fPA[1][2][3] = fPA[1][2][3]-angleStep;
- fPA[1][2][0] = Math.round((x-Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
- }
- } else {
- if (fPA[1][2][3]-angleStep<(-90)) {
- fPA[1][2][4] = 1;
- fPA[1][2][3] = fPA[1][2][3]-angleStep;
- fPA[1][2][0] = Math.round((x+Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
- } else {
- fPA[1][2][3] = fPA[1][2][3]+angleStep;
- fPA[1][2][0] = Math.round((x-Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
- }
- }
- fPA[1][2][1] = Math.round((y+shY+Math.sin(fPA[1][2][3]*pi/180)*fPA[0]*(-1))*10000)/10000;
- // oblique circle to the left:
- rot=[0,0];
- if (fPA[1][3][3]+90>360) {rot[0]=fPA[1][3][3]-270} else {rot[0]=fPA[1][3][3]+90} // angles
- if (fPA[1][3][4]+90>360) {rot[1]=fPA[1][3][4]-270} else {rot[1]=fPA[1][3][4]+90}
- ay = Math.round((Math.cos(rot[1]*pi/180)*impulse/10*(-1))*10000)/10000; // y
- temp = Math.sin(rot[0]*pi/180)*impulse/10;
- if (temp<0) {temp=temp*(-1)} // get a small impulse
- ax = Math.round((Math.cos(rot[0]*pi/180)*temp)*10000)/10000; // x
- az = Math.round((Math.sin(rot[0]*pi/180)*temp)*10000)/10000; // z
- nx=fPA[1][3][0],ny=fPA[1][3][1],nz=fPA[1][3][2];
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,tag:{proj:1b},Damage:0s},damagev2:'+damage+'f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],UUIDLeast:-'+Math.random()*Math.pow(10,19)+'L,Rotation:[86.341965f,0.4638253f],UUIDMost:'+Math.random()*Math.pow(10,19)+'L,size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
- if (fPA[1][3][3]+angleStep>360) {fPA[1][3][3] = 360-fPA[1][3][3]+angleStep} else {fPA[1][3][3] = fPA[1][3][3]+angleStep} // angles
- if (fPA[1][3][4]+angleStep>360) {fPA[1][3][4] = 360-fPA[1][3][4]+angleStep/2} else {fPA[1][3][4] = fPA[1][3][4]+angleStep/2}
- fPA[1][3][1] = Math.round((y+shY+Math.cos(fPA[1][3][4]*pi/180)*fPA[0]*(-1))*10000)/10000; // y
- temp = Math.sin(fPA[1][3][3]*pi/180)*fPA[0];
- if (temp<0) {temp=temp*(-1)} // get a small radius
- fPA[1][3][0] = Math.round((x+Math.cos(fPA[1][3][3]*pi/180)*temp)*10000)/10000; // x on small
- fPA[1][3][2] = Math.round((z+Math.sin(fPA[1][3][3]*pi/180)*temp)*10000)/10000; // z on small
- // oblique circle to the right:
- rot=[0,0];
- if (fPA[1][4][3]+90>360) {rot[0]=fPA[1][4][3]-270} else {rot[0]=fPA[1][4][3]+90} // angles
- if (fPA[1][4][4]+90>360) {rot[1]=fPA[1][4][4]-270} else {rot[1]=fPA[1][4][4]+90}
- ay = Math.round((Math.cos(rot[1]*pi/180)*impulse/10*(-1))*10000)/10000; // y
- temp = Math.sin(rot[0]*pi/180)*impulse/10;
- if (temp<0) {temp=temp*(-1)} // get a small impulse
- ax = Math.round((Math.cos(rot[0]*pi/180)*temp)*10000)/10000; // x
- az = Math.round((Math.sin(rot[0]*pi/180)*temp)*10000)/10000; // z
- nx=fPA[1][4][0],ny=fPA[1][4][1],nz=fPA[1][4][2];
- temp = '/summon variedcommodities:vcprojectile '+nx+' '+ny+' '+nz+' {PotionEffect:1,Item:{id:"variedcommodities:element_fire",Count:1b,Damage:0s},damagev2:'+damage+'f,ownerName:"'+npc.getUUID()+'",glows:1b,direction:['+ax+'d,'+ay+'d,'+az+'d],Motion:['+ax+'d,'+ay+'d,'+az+'d],UUIDLeast:-'+Math.random()*Math.pow(10,19)+'L,Rotation:[86.341965f,0.4638253f],UUIDMost:'+Math.random()*Math.pow(10,19)+'L,size:'+size+',Pos:['+nx+'d,'+ny+'d,'+nz+'d],Fire:60s,effectDuration:5,Render3D:1b}';
- if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
- if (fPA[1][4][3]-angleStep<360) {fPA[1][4][3] = 360+fPA[1][4][3]+angleStep} else {fPA[1][4][3] = fPA[1][4][3]-angleStep} // angles
- if (fPA[1][4][4]-angleStep<360) {fPA[1][4][4] = 360+fPA[1][4][4]+angleStep/2} else {fPA[1][4][4] = fPA[1][4][4]-angleStep/2}
- fPA[1][4][1] = Math.round((y+shY+Math.cos(fPA[1][4][4]*pi/180)*fPA[0]*(-1))*10000)/10000; // y
- temp = Math.sin(fPA[1][4][3]*pi/180)*fPA[0];
- if (temp<0) {temp=temp*(-1)} // get a small radius
- fPA[1][4][0] = Math.round((x+Math.cos(fPA[1][4][3]*pi/180)*temp)*10000)/10000; // x on small
- fPA[1][4][2] = Math.round((z+Math.sin(fPA[1][4][3]*pi/180)*temp)*10000)/10000; // z on small
- }
- if (ev.id==5) { // fire protection description
- if (timeStep>=20) {
- npc.getDisplay().setTitle('<§cFire Protection §e- '+Math.floor(timeStep/20)+' sec.§r> §4BOSS§r lv. 45');
- npc.timers.forceStart(5,20,false);
- timeStep = timeStep-20;
- }
- }
- if (ev.id==6) { // ending of fire protection
- npc.say("It's a pity, the match didn't burn for long.");
- npc.getDisplay().setTitle('§4BOSS§r lv. 45');
- temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
- for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
- npc.timers.stop(4);
- for (var f=0;f<20;f++) { // making fire particles
- nx = Math.round((x+Math.sin(f*pi/10)*1.25*(-1))*1000)/1000;
- ny = Math.round((y+shY+Math.random()/3)*1000)/1000;
- nz = Math.round((z+Math.cos(f*pi/10)*1.25)*1000)/1000;
- temp = '/particle flame '+nx+' '+ny+' '+nz+' 0.01 0.01 0.01 0.0002 3';
- ev.npc.executeCommand(temp); // particle challenge to the world
- }
- for (var f=0;f<10;f++) {
- nx = Math.round((x+Math.sin(f*pi/5)*0.75*(-1))*1000)/1000;
- ny = Math.round((y+shY+0.75+Math.random()/3)*1000)/1000;
- nz = Math.round((z+Math.cos(f*pi/5)*0.75)*1000)/1000;
- temp = '/particle flame '+nx+' '+ny+' '+nz+' 0.01 0.01 0.01 0.0002 3';
- ev.npc.executeCommand(temp);
- ny = Math.round((y+shY-0.75-Math.random()/3)*1000)/1000;
- temp = '/particle flame '+nx+' '+ny+' '+nz+' 0.01 0.01 0.01 0.0002 3';
- ev.npc.executeCommand(temp);
- }
- }
- }
- function actionSkill(npc,resist) {
- var temp, angle, entArr=npc.world.getNearbyEntities(npc.getPos(),3,0);
- npc.timers.clear();
- for (var i=0;i<entArr.length;i++) { // dropping all creatures from oneself
- temp = [npc.getX()-entArr[i].getX(),npc.getZ()-entArr[i].getZ()];
- if (temp[0]<0 && temp[1]>0) { // get the angle of rotation for recoil:
- angle=Math.atan(temp[1]/temp[0])*180/pi-90;
- } else if (temp[0]>0 && temp[1]<0) {
- angle=90+Math.atan(temp[1]/temp[0])*180/pi;
- } else if (temp[0]<0 && temp[1]<0) {
- angle=Math.atan(temp[1]/temp[0])*180/pi-90;
- } else {
- angle=90+Math.atan(temp[1]/temp[0])*180/pi;
- }
- if (entArr[i] != npc) {entArr[i].knockback(3,angle)}
- }
- for (var r=0;r<4;r++) {npc.getStats().setResistance(r,resist[r])} // change damage resistance settings
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement