plasma bot bug fixes and balance
This commit is contained in:
20
js/bullet.js
20
js/bullet.js
@@ -1079,7 +1079,7 @@ const b = {
|
|||||||
plasmaBot(position = mech.pos) {
|
plasmaBot(position = mech.pos) {
|
||||||
const me = bullet.length;
|
const me = bullet.length;
|
||||||
const dir = mech.angle;
|
const dir = mech.angle;
|
||||||
const RADIUS = 18
|
const RADIUS = 20
|
||||||
bullet[me] = Bodies.polygon(position.x, position.y, 5, RADIUS, {
|
bullet[me] = Bodies.polygon(position.x, position.y, 5, RADIUS, {
|
||||||
angle: dir,
|
angle: dir,
|
||||||
friction: 0,
|
friction: 0,
|
||||||
@@ -1088,9 +1088,9 @@ const b = {
|
|||||||
restitution: 1,
|
restitution: 1,
|
||||||
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
|
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
|
||||||
minDmgSpeed: 2,
|
minDmgSpeed: 2,
|
||||||
lookFrequency: 15,
|
lookFrequency: 25,
|
||||||
cd: 0,
|
cd: 0,
|
||||||
acceleration: 0.0085,
|
acceleration: 0.009,
|
||||||
endCycle: Infinity,
|
endCycle: Infinity,
|
||||||
classType: "bullet",
|
classType: "bullet",
|
||||||
collisionFilter: {
|
collisionFilter: {
|
||||||
@@ -1104,7 +1104,7 @@ const b = {
|
|||||||
onEnd() {},
|
onEnd() {},
|
||||||
do() {
|
do() {
|
||||||
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
|
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
|
||||||
if (distanceToPlayer > 100) { //if far away move towards player
|
if (distanceToPlayer > 150) { //if far away move towards player
|
||||||
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * this.acceleration)
|
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * this.acceleration)
|
||||||
}
|
}
|
||||||
Matter.Body.setVelocity(this, Vector.add(Vector.mult(this.velocity, 0.90), Vector.mult(player.velocity, 0.17))); //add player's velocity
|
Matter.Body.setVelocity(this, Vector.add(Vector.mult(this.velocity, 0.90), Vector.mult(player.velocity, 0.17))); //add player's velocity
|
||||||
@@ -1126,7 +1126,7 @@ const b = {
|
|||||||
|
|
||||||
//fire plasma at target
|
//fire plasma at target
|
||||||
|
|
||||||
const DRAIN = 0.0014
|
const DRAIN = 0.0017
|
||||||
if (this.lockedOn && this.lockedOn.alive && mech.energy > DRAIN && mech.fieldCDcycle < mech.cycle) {
|
if (this.lockedOn && this.lockedOn.alive && mech.energy > DRAIN && mech.fieldCDcycle < mech.cycle) {
|
||||||
mech.energy -= DRAIN;
|
mech.energy -= DRAIN;
|
||||||
if (mech.energy < 0) {
|
if (mech.energy < 0) {
|
||||||
@@ -1247,16 +1247,14 @@ const b = {
|
|||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
||||||
//draw electricity
|
//draw electricity
|
||||||
const Dx = Math.cos(mech.angle);
|
let x = this.position.x + 20 * unit.x;
|
||||||
const Dy = Math.sin(mech.angle);
|
let y = this.position.y + 20 * unit.y;
|
||||||
let x = this.position.x + 20 * Dx;
|
|
||||||
let y = this.position.y + 20 * Dy;
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(x, y);
|
ctx.moveTo(x, y);
|
||||||
const step = Vector.magnitude(Vector.sub(path[0], path[1])) / 5
|
const step = Vector.magnitude(Vector.sub(path[0], path[1])) / 5
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
x += step * (Dx + 1.5 * (Math.random() - 0.5))
|
x += step * (unit.x + 1.5 * (Math.random() - 0.5))
|
||||||
y += step * (Dy + 1.5 * (Math.random() - 0.5))
|
y += step * (unit.y + 1.5 * (Math.random() - 0.5))
|
||||||
ctx.lineTo(x, y);
|
ctx.lineTo(x, y);
|
||||||
}
|
}
|
||||||
ctx.lineWidth = 2 * Math.random();
|
ctx.lineWidth = 2 * Math.random();
|
||||||
|
|||||||
@@ -1000,7 +1000,9 @@ const mobs = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Math.random() < mod.isBotSpawner) {
|
if (Math.random() < mod.isBotSpawner) {
|
||||||
if (Math.random() < 0.25) {
|
if (Math.random() < 0.2) { //very low chance of plasma bot
|
||||||
|
b.plasmaBot(this.position)
|
||||||
|
} else if (Math.random() < 0.25) {
|
||||||
b.nailBot(this.position)
|
b.nailBot(this.position)
|
||||||
} else if (Math.random() < 0.33) {
|
} else if (Math.random() < 0.33) {
|
||||||
b.laserBot(this.position)
|
b.laserBot(this.position)
|
||||||
|
|||||||
5
todo.txt
5
todo.txt
@@ -1,9 +1,4 @@
|
|||||||
|
|
||||||
mod - boomBot: explodes on mobs in close range
|
|
||||||
mod - plasma-bot: bot that fires your plasma torch
|
|
||||||
(limit 1 bot) (requires plasma torch)
|
|
||||||
(you can get 2 plasma-bots with bot replication)
|
|
||||||
(you can switch to a new field after getting plasma-bot)
|
|
||||||
|
|
||||||
************** TODO - n-gon **************
|
************** TODO - n-gon **************
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user