Advertisement
BetaZavr

1.12.2 Fire Pprotection v.1.2

Dec 13th, 2019
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Fire Protection:
  2. need mods:
  3.             CustomNPCs v 1.12.2
  4.             Varied Commodities v 1.12.2
  5. NPC set up work - Puppet*/
  6. var npc,wr,x,y,z,rot=0,angleStep=20,impulse,shY=1.2,pi=3.141592653589793,
  7.     gH=5.656854249, rph=4.7, cnt=4000, dam=25, damage, timeF=300,
  8.     timeStep=0, doub,targ,home=[24.5,4,42.5],speed=1.7,mess=0;
  9. /*angleStep - how fast it will rotate around the circle (offset in degrees);
  10. impulse     - how fast it will fly tangentially to the circle (block speed per tick);
  11. fPA Fire Protection:
  12.     [0]     - circle radius;
  13.     [1][0]  - horizontal circle in the plane XZ [x,y,z,angleH,null]
  14.     [1][1]  - vertical circle in the plane YZ   [x,y,z,angleV,plase]
  15.     [1][2]  - vertical circle in the plane YX   [x,y,z,angleV,plase]
  16.     [1][3]  - oblique circle to the left                    [x,y,z,angleH,angleV]
  17.     [1][4]  - oblique circle to the right                   [x,y,z,angleH,angleV]
  18. rot - angle for calculating the movement of shells in the main mode;
  19. shY - center of the sphere of fire;
  20. dam - default damage;
  21. damage - estimated damage
  22. cnt - coefficient to create the amount of fire when creating a fire sphere;
  23. rad - sphere segment radius;
  24. val - number of shells in a segment;
  25. rts - angle of rotation of each projectile in a segment;
  26. rph - sphere radius;
  27. timeF - the duration of the Fire Defense (at least 3 seconds!);
  28. pi - circular number;
  29. gH - acceleration of gravity;
  30. targ - attack target;
  31. */
  32. 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]]]
  33. function init(ev) {
  34.     npc=ev.npc,x=npc.getX(),y=npc.getY(),z=npc.getZ();
  35.     npc.timers.clear();
  36. }
  37. function interact(ev) {
  38.     npc=ev.npc,wr=npc.world,x=npc.getX(),y=npc.getY(),z=npc.getZ();
  39.     npc.setHealth(npc.getMaxHealth());
  40.     if (npc.getRotation() < 0) { // NPC rotation is always from 0 to 360:
  41.         npc.setRotation((Math.floor(npc.getRotation()/(-360))*360+npc.getRotation())+360);
  42.     } else {
  43.         npc.setRotation(npc.getRotation()-Math.floor(npc.getRotation()/360)*360);
  44.     }
  45.     impulse=0.7*pi*fPA[0]*angleStep/360; // circumferential speed
  46.     // Fire Protection Launch:
  47.     if (!npc.timers.has(1) && !npc.timers.has(2) && !npc.timers.has(3) && !npc.timers.has(4) && !npc.timers.has(5)) {
  48.         actionSkill(npc,[0.5,2,2,2]);
  49.         npc.say('Is not enough fire here!');
  50.         npc.getDisplay().setTitle('<§cFire Protection §e- Activation§r> §4BOSS§r lv. 45');
  51.         npc.getJob().getPart(1).setRotation(180,180,180);
  52.         npc.getJob().getPart(2).setRotation(106,149,136);
  53.         npc.timers.forceStart(1,50,false);
  54.     }
  55. }
  56. function timer(ev) {
  57.     npc=ev.npc,x=npc.getX(),y=npc.getY(),z=npc.getZ();
  58.     var temp,ax=0,ay=0,az=0,nx,ny,nz,size=2,targ,dist,entArr;
  59.     if (ev.id==1 && !npc.timers.has(5)) { // create a fireball:
  60.         npc.say('Appear low fire!');
  61.         npc.getJob().getPart(1).setRotation(300,290,180);
  62.         npc.getJob().getPart(2).setRotation(60,250,180);
  63.         npc.getAi().setRetaliateType(3); // do nothing when he sees the enemy
  64.         if (npc.getAttackDamage) {}
  65.         var rad, val, rts;
  66.         for (var n=0;n<=9;n++) { // creation of sphere segments
  67.             val= Math.round(n*cnt)/1000;
  68.             if (!val) {
  69.                 val=1, rad=0, rts=0;
  70.             } else {
  71.                 rad = Math.round((Math.cos((90-n*10)*pi/180)*rph)*1000)/1000;
  72.                 rts = Math.round(360000/val)/1000;
  73.             }
  74.             for (var f=0;f<val;f++) { // creation of shells in the segment
  75.                 nx = Math.round((x+Math.sin(f*rts*pi/180)*rad*(-1))*1000)/1000;
  76.                 ny = Math.round((y+shY+Math.cos(n*10*pi/180)*rph)*1000)/1000;
  77.                 nz = Math.round((z+Math.cos(f*rts*pi/180)*rad)*1000)/1000;
  78.                 if (n==9 && f!==0 && f!==9 && f!==18 && f!==27) {
  79.                     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}';
  80.                 } else if (n!==9) {
  81.                     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}';
  82.                 }
  83.                 ev.API.executeCommand(npc.world,temp);
  84.                 if (n!==9) { // mirror
  85.                     ny = Math.round((y+shY-Math.cos(n*10*pi/180)*rph)*1000)/1000;
  86.                     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}';
  87.                     ev.API.executeCommand(npc.world,temp);
  88.                 }
  89.             }
  90.         }
  91.         npc.timers.forceStart(2,40,false);
  92.     }
  93.     if (ev.id==2 && !npc.timers.has(5)) { // fireball movement to npc:
  94.         npc.say('May the fire be filled from me.');
  95.         npc.getJob().getPart(1).setRotation(90,200,180);
  96.         npc.getJob().getPart(2).setRotation(90,160,180);
  97.         temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
  98.         for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
  99.         var rad, val, rts;
  100.         for (var n=0;n<=9;n++) { // creation of sphere segments
  101.             val= Math.round(n*cnt)/1000;
  102.             if (!val) {
  103.                 val=1, rad=0, rts=0;
  104.             } else {
  105.                 rad = Math.round((Math.cos((90-n*10)*pi/180)*rph)*1000)/1000;
  106.                 rts = Math.round(360000/val)/1000;
  107.             }
  108.             for (var f=0;f<val;f++) { // the creation of shells in the segment
  109.                 nx = Math.round((x+Math.sin(f*rts*pi/180)*rad*(-1))*1000)/1000;
  110.                 ny = Math.round((y+shY+Math.cos(n*10*pi/180)*rph)*1000)/1000;
  111.                 nz = Math.round((z+Math.cos(f*rts*pi/180)*rad)*1000)/1000;
  112.                 ax = Math.round((x-nx)*1000)/100000;
  113.                 ay = Math.round((y-ny+shY)*1000)/100000;
  114.                 az = Math.round((z-nz)*1000)/100000;
  115.                 if (n==9 && f!==0 && f!==9 && f!==18 && f!==27) {
  116.                     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}';
  117.                 } else if (n!==9) {
  118.                     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}';
  119.                 }
  120.                 ev.API.executeCommand(npc.world,temp);
  121.                 if (n!==9) { // mirror
  122.                     ny = Math.round((y+shY-Math.cos(n*10*pi/180)*rph)*1000)/1000;
  123.                     ax = Math.round((x-nx)*1000)/100000;
  124.                     ay = Math.round((y-ny+shY)*1000)/100000;
  125.                     az = Math.round((z-nz)*1000)/100000;
  126.                     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}';
  127.                     ev.API.executeCommand(npc.world,temp);
  128.                 }
  129.             }
  130.         }
  131.         size=5;
  132.         npc.timers.forceStart(3,60,false);
  133.     }
  134.     if (ev.id==3 && !npc.timers.has(5)) { // creating a base for fire protection
  135.         npc.getJob().getPart(1).setRotation(180,180,180);
  136.         npc.getJob().getPart(2).setRotation(180,180,180);
  137.         temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
  138.         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".
  139.         for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
  140.         // The coordinates for the appearance of the first shells:
  141.         // horizontal circle (in front of you)
  142.         fPA[1][0][0] = x;
  143.         fPA[1][0][1] = y+shY;
  144.         fPA[1][0][2] = z+fPA[0];
  145.         fPA[1][0][3] = 0;
  146.         fPA[1][0][4] = 0;
  147.         // vertical circle XZ (behind you)
  148.         fPA[1][1][0] = x;
  149.         fPA[1][1][1] = y+shY;
  150.         fPA[1][1][2] = z-fPA[0];
  151.         fPA[1][1][3] = 0;
  152.         fPA[1][1][4] = 0;
  153.         // vertical circle YX (to your left)
  154.         fPA[1][2][0] = x-fPA[0];
  155.         fPA[1][2][1] = y+shY;
  156.         fPA[1][2][2] = z;
  157.         fPA[1][2][3] = 0;
  158.         fPA[1][2][4] = 0;
  159.         // oblique circle to the left (underneath)
  160.         fPA[1][3][0] = x;
  161.         fPA[1][3][1] = y+shY-fPA[0];
  162.         fPA[1][3][2] = z;
  163.         fPA[1][3][3] = 0;
  164.         fPA[1][3][4] = 0;
  165.         // oblique circle to the right (above itself)
  166.         fPA[1][4][0] = x;
  167.         fPA[1][4][1] = y+shY+fPA[0];
  168.         fPA[1][4][2] = z;
  169.         fPA[1][4][3] = 0;
  170.         fPA[1][4][4] = 0;
  171.         npc.say('Raced!');
  172.         npc.timers.forceStart(4,1,true);
  173.         npc.timers.forceStart(5,20,false);
  174.         npc.getDisplay().setTitle('<§cFire Protection §e- '+Math.floor(timeF/20)+' sec.§r> §4BOSS§r lv. 45');
  175.         timeStep = timeF-20;
  176.         npc.timers.forceStart(6,timeF,false);
  177.     }
  178.     if (ev.id==4 && npc.timers.has(5)) { // fire protection work
  179.         temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
  180.         for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
  181.     // horizontal circle:
  182.         if (fPA[1][0][3]+90>360) {rot=fPA[1][0][3]-270} else {rot=fPA[1][0][3]+90}
  183.         ax = Math.round(Math.sin(rot*pi/180)*impulse*(-10000))/10000;
  184.         az = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
  185.         nx=fPA[1][0][0],ny=fPA[1][0][1],nz=fPA[1][0][2];
  186.         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}';
  187.         if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
  188.         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
  189.         fPA[1][0][0] = Math.round((x+Math.sin(fPA[1][0][3]*pi/180)*fPA[0]*(-1))*10000)/10000; // x
  190.         fPA[1][0][2] = Math.round((z+Math.cos(fPA[1][0][3]*pi/180)*fPA[0]*1)*10000)/10000; // z
  191.     // vertical circle XZ:
  192.         if (fPA[1][1][3]+90>180) {rot=fPA[1][1][3]-90} else {rot=fPA[1][1][3]+90}
  193.         if (fPA[1][1][4]) {
  194.             ay = Math.round(Math.sin(rot*pi/180)*impulse*(-10000))/10000;
  195.             az = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
  196.         } else {
  197.             ay = Math.round(Math.sin(rot*pi/180)*impulse*10000)/10000;
  198.             az = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
  199.         }
  200.         nx=fPA[1][1][0],ny=fPA[1][1][1],nz=fPA[1][1][2];
  201.         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}';
  202.         if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
  203.         if (fPA[1][1][4]) { // angle
  204.             if (fPA[1][1][3]+angleStep>90) {
  205.                 fPA[1][1][4] = 0;
  206.                 fPA[1][1][3] = fPA[1][1][3]-angleStep;
  207.                 fPA[1][1][2] = Math.round((z-Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
  208.             } else {
  209.                 fPA[1][1][3] = fPA[1][1][3]+angleStep;
  210.                 fPA[1][1][2] = Math.round((z+Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
  211.             }
  212.         } else {
  213.             if (fPA[1][1][3]-angleStep<(-90)) {
  214.                 fPA[1][1][4] = 1;
  215.                 fPA[1][1][3] = fPA[1][1][3]+angleStep;
  216.                 fPA[1][1][2] = Math.round((z+Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
  217.             } else {
  218.                 fPA[1][1][3] = fPA[1][1][3]-angleStep;
  219.                 fPA[1][1][2] = Math.round((z-Math.cos(fPA[1][1][3]*pi/180)*fPA[0]*1)*10000)/10000;
  220.             }
  221.         }
  222.         fPA[1][1][1] = Math.round((y+shY+Math.sin(fPA[1][1][3]*pi/180)*fPA[0]*(-1))*10000)/10000;
  223.     // vertical circle YX:
  224.         if (fPA[1][2][3]+90>180) {rot=fPA[1][2][3]-90} else {rot=fPA[1][2][3]+90}
  225.         if (fPA[1][2][4]) {
  226.             ay = Math.round(Math.sin(rot*pi/180)*impulse*(-10000))/10000;
  227.             ax = Math.round(Math.cos(rot*pi/180)*impulse*(-10000))/10000;
  228.         } else {
  229.             ay = Math.round(Math.sin(rot*pi/180)*impulse*10000)/10000;
  230.             ax = Math.round(Math.cos(rot*pi/180)*impulse*10000)/10000;
  231.         }
  232.         nx=fPA[1][2][0],ny=fPA[1][2][1],nz=fPA[1][2][2];
  233.         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}';
  234.         if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
  235.         if (fPA[1][2][4]) { // angle
  236.             if (fPA[1][2][3]+angleStep>90) {
  237.                 fPA[1][2][4] = 0;
  238.                 fPA[1][2][3] = fPA[1][2][3]+angleStep;
  239.                 fPA[1][2][0] = Math.round((x+Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
  240.             } else {
  241.                 fPA[1][2][3] = fPA[1][2][3]-angleStep;
  242.                 fPA[1][2][0] = Math.round((x-Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
  243.             }
  244.         } else {
  245.             if (fPA[1][2][3]-angleStep<(-90)) {
  246.                 fPA[1][2][4] = 1;
  247.                 fPA[1][2][3] = fPA[1][2][3]-angleStep;
  248.                 fPA[1][2][0] = Math.round((x+Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
  249.             } else {
  250.                 fPA[1][2][3] = fPA[1][2][3]+angleStep;
  251.                 fPA[1][2][0] = Math.round((x-Math.cos(fPA[1][2][3]*pi/180)*fPA[0]*1)*10000)/10000;
  252.             }
  253.         }
  254.         fPA[1][2][1] = Math.round((y+shY+Math.sin(fPA[1][2][3]*pi/180)*fPA[0]*(-1))*10000)/10000;
  255.     // oblique circle to the left:
  256.         rot=[0,0];
  257.         if (fPA[1][3][3]+90>360) {rot[0]=fPA[1][3][3]-270} else {rot[0]=fPA[1][3][3]+90} // angles
  258.         if (fPA[1][3][4]+90>360) {rot[1]=fPA[1][3][4]-270} else {rot[1]=fPA[1][3][4]+90}
  259.         ay = Math.round((Math.cos(rot[1]*pi/180)*impulse/10*(-1))*10000)/10000; // y
  260.         temp = Math.sin(rot[0]*pi/180)*impulse/10;
  261.         if (temp<0) {temp=temp*(-1)} // get a small impulse
  262.         ax = Math.round((Math.cos(rot[0]*pi/180)*temp)*10000)/10000; // x
  263.         az = Math.round((Math.sin(rot[0]*pi/180)*temp)*10000)/10000; // z
  264.         nx=fPA[1][3][0],ny=fPA[1][3][1],nz=fPA[1][3][2];
  265.         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}';
  266.         if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
  267.         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
  268.         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}
  269.         fPA[1][3][1] = Math.round((y+shY+Math.cos(fPA[1][3][4]*pi/180)*fPA[0]*(-1))*10000)/10000; // y
  270.         temp = Math.sin(fPA[1][3][3]*pi/180)*fPA[0];
  271.         if (temp<0) {temp=temp*(-1)} // get a small radius
  272.         fPA[1][3][0] = Math.round((x+Math.cos(fPA[1][3][3]*pi/180)*temp)*10000)/10000; // x on small
  273.         fPA[1][3][2] = Math.round((z+Math.sin(fPA[1][3][3]*pi/180)*temp)*10000)/10000; // z on small
  274.     // oblique circle to the right:
  275.         rot=[0,0];
  276.         if (fPA[1][4][3]+90>360) {rot[0]=fPA[1][4][3]-270} else {rot[0]=fPA[1][4][3]+90} // angles
  277.         if (fPA[1][4][4]+90>360) {rot[1]=fPA[1][4][4]-270} else {rot[1]=fPA[1][4][4]+90}
  278.         ay = Math.round((Math.cos(rot[1]*pi/180)*impulse/10*(-1))*10000)/10000; // y
  279.         temp = Math.sin(rot[0]*pi/180)*impulse/10;
  280.         if (temp<0) {temp=temp*(-1)} // get a small impulse
  281.         ax = Math.round((Math.cos(rot[0]*pi/180)*temp)*10000)/10000; // x
  282.         az = Math.round((Math.sin(rot[0]*pi/180)*temp)*10000)/10000; // z
  283.         nx=fPA[1][4][0],ny=fPA[1][4][1],nz=fPA[1][4][2];
  284.         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}';
  285.         if (npc.world.getBlock(nx,ny,nz).getName()=='minecraft:air') {ev.API.executeCommand(npc.world,temp)}
  286.         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
  287.         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}
  288.         fPA[1][4][1] = Math.round((y+shY+Math.cos(fPA[1][4][4]*pi/180)*fPA[0]*(-1))*10000)/10000; // y
  289.         temp = Math.sin(fPA[1][4][3]*pi/180)*fPA[0];
  290.         if (temp<0) {temp=temp*(-1)} // get a small radius
  291.         fPA[1][4][0] = Math.round((x+Math.cos(fPA[1][4][3]*pi/180)*temp)*10000)/10000; // x on small
  292.         fPA[1][4][2] = Math.round((z+Math.sin(fPA[1][4][3]*pi/180)*temp)*10000)/10000; // z on small
  293.     }
  294.     if (ev.id==5) { // fire protection description
  295.         if (timeStep>=20) {
  296.             npc.getDisplay().setTitle('<§cFire Protection §e- '+Math.floor(timeStep/20)+' sec.§r> §4BOSS§r lv. 45');
  297.             npc.timers.forceStart(5,20,false);
  298.             timeStep = timeStep-20;
  299.         }
  300.     }
  301.     if (ev.id==6) { // ending of fire protection
  302.         npc.say("It's a pity, the match didn't burn for long.");
  303.         npc.getDisplay().setTitle('§4BOSS§r lv. 45');
  304.         temp=npc.world.getNearbyEntities(npc.getPos(),2+rph,0);
  305.         for (var i=0;i<temp.length;i++) {if (temp[i].getName().indexOf('VCProjectile')!==(-1)) {temp[i].despawn()}} // remove old shells
  306.         npc.timers.stop(4);
  307.         for (var f=0;f<20;f++) { // making fire particles
  308.             nx = Math.round((x+Math.sin(f*pi/10)*1.25*(-1))*1000)/1000;
  309.             ny = Math.round((y+shY+Math.random()/3)*1000)/1000;
  310.             nz = Math.round((z+Math.cos(f*pi/10)*1.25)*1000)/1000;
  311.             temp = '/particle flame '+nx+' '+ny+' '+nz+' 0.01 0.01 0.01 0.0002 3';
  312.             ev.npc.executeCommand(temp); // particle challenge to the world
  313.         }
  314.         for (var f=0;f<10;f++) {
  315.             nx = Math.round((x+Math.sin(f*pi/5)*0.75*(-1))*1000)/1000;
  316.             ny = Math.round((y+shY+0.75+Math.random()/3)*1000)/1000;
  317.             nz = Math.round((z+Math.cos(f*pi/5)*0.75)*1000)/1000;
  318.             temp = '/particle flame '+nx+' '+ny+' '+nz+' 0.01 0.01 0.01 0.0002 3';
  319.             ev.npc.executeCommand(temp);
  320.             ny = Math.round((y+shY-0.75-Math.random()/3)*1000)/1000;
  321.             temp = '/particle flame '+nx+' '+ny+' '+nz+' 0.01 0.01 0.01 0.0002 3';
  322.             ev.npc.executeCommand(temp);
  323.         }
  324.     }
  325. }
  326. function actionSkill(npc,resist) {
  327.     var temp, angle, entArr=npc.world.getNearbyEntities(npc.getPos(),3,0);
  328.     npc.timers.clear();
  329.     for (var i=0;i<entArr.length;i++) { // dropping all creatures from oneself
  330.         temp = [npc.getX()-entArr[i].getX(),npc.getZ()-entArr[i].getZ()];
  331.         if (temp[0]<0 && temp[1]>0) { // get the angle of rotation for recoil:
  332.             angle=Math.atan(temp[1]/temp[0])*180/pi-90;
  333.         } else if (temp[0]>0 && temp[1]<0) {
  334.             angle=90+Math.atan(temp[1]/temp[0])*180/pi;
  335.         } else if (temp[0]<0 && temp[1]<0) {
  336.             angle=Math.atan(temp[1]/temp[0])*180/pi-90;
  337.         } else {
  338.             angle=90+Math.atan(temp[1]/temp[0])*180/pi;
  339.         }
  340.         if (entArr[i] != npc) {entArr[i].knockback(3,angle)}
  341.     }
  342.     for (var r=0;r<4;r++) {npc.getStats().setResistance(r,resist[r])} // change damage resistance settings
  343. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement