bug fixes

This commit is contained in:
landgreen
2020-07-15 11:12:51 -07:00
parent cef5f4d8d0
commit c63d0ac5f0
8 changed files with 73 additions and 59 deletions

View File

@@ -1143,18 +1143,19 @@ const b = {
//fire plasma at target
const DRAIN = 0.002
if (this.lockedOn && this.lockedOn.alive && mech.energy > DRAIN && mech.fieldCDcycle < mech.cycle) {
mech.energy -= DRAIN;
if (mech.energy < 0) {
mech.fieldCDcycle = mech.cycle + 120;
mech.energy = 0;
}
if (this.lockedOn && this.lockedOn.alive && mech.fieldCDcycle < mech.cycle) {
const sub = Vector.sub(this.lockedOn.position, this.position)
const DIST = Vector.magnitude(sub);
const unit = Vector.normalise(sub)
if (DIST < mod.isPlasmaRange * 600) {
const DRAIN = 0.0022
if (DIST < mod.isPlasmaRange * 550 && mech.energy > DRAIN) {
mech.energy -= DRAIN;
if (mech.energy < 0) {
mech.fieldCDcycle = mech.cycle + 120;
mech.energy = 0;
}
//calculate laser collision
let best;
let range = mod.isPlasmaRange * (140 + 300 * Math.sqrt(Math.random()))