pulse is a mod
This commit is contained in:
166
js/bullet.js
166
js/bullet.js
@@ -1545,14 +1545,16 @@ const b = {
|
||||
//find closest
|
||||
if (!(game.cycle % this.lookFrequency)) {
|
||||
this.lockedOn = null;
|
||||
let closeDist = mod.isPlasmaRange * 1000;
|
||||
for (let i = 0, len = mob.length; i < len; ++i) {
|
||||
const DIST = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius;
|
||||
if (DIST < closeDist &&
|
||||
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
|
||||
Matter.Query.ray(body, this.position, mob[i].position).length === 0) {
|
||||
closeDist = DIST;
|
||||
this.lockedOn = mob[i]
|
||||
if (!mech.isCloak) {
|
||||
let closeDist = mod.isPlasmaRange * 1000;
|
||||
for (let i = 0, len = mob.length; i < len; ++i) {
|
||||
const DIST = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius;
|
||||
if (DIST < closeDist &&
|
||||
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
|
||||
Matter.Query.ray(body, this.position, mob[i].position).length === 0) {
|
||||
closeDist = DIST;
|
||||
this.lockedOn = mob[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3154,6 +3156,9 @@ const b = {
|
||||
have: false,
|
||||
nextFireCycle: 0, //use to remember how longs its been since last fire, used to reset count
|
||||
fire() {
|
||||
|
||||
},
|
||||
fireLaser() {
|
||||
if (mech.energy < mod.laserFieldDrain) {
|
||||
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
|
||||
} else {
|
||||
@@ -3220,16 +3225,8 @@ const b = {
|
||||
b.laser()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: "pulse",
|
||||
description: "convert <strong>25%</strong> of your <strong class='color-f'>energy</strong> into a pulsed laser<br>instantly initiates a fusion <strong class='color-e'>explosion</strong>",
|
||||
ammo: 0,
|
||||
ammoPack: Infinity,
|
||||
have: false,
|
||||
fire() {
|
||||
},
|
||||
firePulse() {
|
||||
//calculate laser collision
|
||||
let best, energy, explosionRange;
|
||||
let range = 3000
|
||||
@@ -3282,7 +3279,6 @@ const b = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//check for collisions
|
||||
best = {
|
||||
x: null,
|
||||
@@ -3295,7 +3291,7 @@ const b = {
|
||||
if (mod.isPulseAim) { //find mobs in line of sight
|
||||
let dist = 2200
|
||||
energy = 0.23 * Math.min(mech.energy, 1.5)
|
||||
explosionRange = 1400 * energy
|
||||
explosionRange = 1680 * energy
|
||||
for (let i = 0, len = mob.length; i < len; i++) {
|
||||
const newDist = Vector.magnitude(Vector.sub(path[0], mob[i].position))
|
||||
if (explosionRange < newDist &&
|
||||
@@ -3319,7 +3315,6 @@ const b = {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (mod.isPulseAim) {
|
||||
mech.energy -= energy * mod.isLaserDiode
|
||||
if (best.who) b.explosion(path[1], explosionRange, true)
|
||||
@@ -3327,7 +3322,7 @@ const b = {
|
||||
} else {
|
||||
energy = 0.27 * Math.min(mech.energy, 1.5)
|
||||
mech.energy -= energy * mod.isLaserDiode
|
||||
explosionRange = 1300 * energy
|
||||
explosionRange = 1560 * energy
|
||||
if (best.who) b.explosion(path[1], explosionRange, true)
|
||||
mech.fireCDcycle = mech.cycle + Math.floor(50 * b.fireCD); // cool down
|
||||
}
|
||||
@@ -3340,7 +3335,6 @@ const b = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//draw laser beam
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(path[0].x, path[0].y);
|
||||
@@ -3368,136 +3362,18 @@ const b = {
|
||||
time: Math.floor(2 + 33 * Math.random() * Math.random())
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// name: "maser",
|
||||
// description: "emit a <strong>beam</strong> of collimated coherent <strong>light</strong><br>drains <strong class='color-f'>energy</strong> instead of ammunition",
|
||||
// name: "pulse",
|
||||
// description: "convert <strong>25%</strong> of your <strong class='color-f'>energy</strong> into a pulsed laser<br>instantly initiates a fusion <strong class='color-e'>explosion</strong>",
|
||||
// ammo: 0,
|
||||
// ammoPack: Infinity,
|
||||
// have: false,
|
||||
// fire() {
|
||||
// if (mech.energy < 0.002) {
|
||||
// mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
|
||||
// } else {
|
||||
// // mech.energy -= mech.fieldRegen + 0.002 * mod.isLaserDiode
|
||||
|
||||
// let range = 2000
|
||||
// const looking = Vector.mult(Vector.rotate({
|
||||
// x: 1,
|
||||
// y: 0
|
||||
// }, mech.angle), range)
|
||||
// const endpoint = Matter.Vector.add(mech.pos, looking)
|
||||
// const hits = Matter.Query.ray(body, mech.pos, endpoint, 100)
|
||||
// for (let i = 0; i < hits.length; i++) {
|
||||
|
||||
|
||||
// }
|
||||
// // console.log(hits, target, range)
|
||||
|
||||
|
||||
// //draw beam
|
||||
// ctx.beginPath();
|
||||
// ctx.moveTo(mech.pos.x, mech.pos.y);
|
||||
// ctx.lineTo(endpoint.x, endpoint.y);
|
||||
// ctx.stroke();
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// name: "dwarf star", //14
|
||||
// description: "drop a mine that gravitational pulls in matter",
|
||||
// ammo: 0,
|
||||
// ammoPack: 1000,
|
||||
// have: false,
|
||||
// isStarterGun: false,
|
||||
// fire() {
|
||||
// const me = bullet.length;
|
||||
// const dir = mech.angle
|
||||
// const TOTAL_CYCLES = 1020
|
||||
// bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(dir), mech.pos.y + 30 * Math.sin(dir), 3 , {
|
||||
// density: 0.05,
|
||||
// //frictionAir: 0.01,
|
||||
// restitution: 0,
|
||||
// angle: 0,
|
||||
// friction: 1,
|
||||
// // frictionAir: 1,
|
||||
// endCycle: game.cycle + TOTAL_CYCLES,
|
||||
// dmg: 0, //damage done in addition to the damage from momentum
|
||||
// classType: "bullet",
|
||||
// collisionFilter: {
|
||||
// category: 0x000100,
|
||||
// mask: 0x010011 //mask: 0x000101, //for self collision
|
||||
// },
|
||||
// minDmgSpeed: 5,
|
||||
// range: 0,
|
||||
// beforeDmg() {
|
||||
// this.endCycle = 0;
|
||||
// }, //this.endCycle = 0 //triggers despawn
|
||||
// onEnd() {},
|
||||
// do() {
|
||||
// this.force.y += this.mass * 0.005;
|
||||
// this.range += 0.5
|
||||
|
||||
// //damage nearby mobs
|
||||
// const dmg = b.dmgScale * 0.02
|
||||
// for (let i = 0, len = mob.length; i < len; ++i) {
|
||||
// if (mob[i].alive) {
|
||||
// sub = Vector.sub(this.position, mob[i].position);
|
||||
// dist = Vector.magnitude(sub) - mob[i].radius;
|
||||
// if (dist < this.range) {
|
||||
// mob[i].damage(dmg);
|
||||
// mob[i].locatePlayer();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// //pull in body, and power ups?, and bullets?
|
||||
// for (let i = 0, len = body.length; i < len; ++i) {
|
||||
// sub = Vector.sub(this.position, body[i].position);
|
||||
// dist = Vector.magnitude(sub)
|
||||
// if (dist < this.range) {
|
||||
// this.range += body[i].mass * 2
|
||||
// Matter.World.remove(engine.world, body[i]);
|
||||
// body.splice(i, 1);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //draw
|
||||
// const opacity = (this.endCycle - game.cycle) / TOTAL_CYCLES
|
||||
// ctx.fillStyle = `rgba(170,220,255,${opacity})`;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(this.position.x, this.position.y, this.range, 0, 2 * Math.PI);
|
||||
// ctx.fill();
|
||||
// }
|
||||
// });
|
||||
// b.fireProps(60, 0, dir, me); //cd , speed
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// name: "kinetic slugs", //1
|
||||
// description: "fire a large <strong>rod</strong> that does excessive physical <strong class='color-d'>damage</strong><br><em>high recoil</em>",
|
||||
// ammo: 0,
|
||||
// ammoPack: 5,
|
||||
// have: false,
|
||||
//
|
||||
// fire() {
|
||||
// b.muzzleFlash(45);
|
||||
// // mobs.alert(800);
|
||||
// const me = bullet.length;
|
||||
// const dir = mech.angle;
|
||||
// bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), 70 , 30 , b.fireAttributes(dir));
|
||||
// b.fireProps(mech.crouch ? 55 : 40, 50, dir, me); //cd , speed
|
||||
// bullet[me].endCycle = game.cycle + Math.floor(180 * mod.isBulletsLastLonger);
|
||||
// bullet[me].do = function () {
|
||||
// this.force.y += this.mass * 0.0005;
|
||||
// };
|
||||
|
||||
// //knock back
|
||||
// const KNOCK = ((mech.crouch) ? 0.025 : 0.25)
|
||||
// player.force.x -= KNOCK * Math.cos(dir)
|
||||
// player.force.y -= KNOCK * Math.sin(dir) * 0.3 //reduce knock back in vertical direction to stop super jumps
|
||||
// },
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user