laser push
tech: relativistic momentum - laser beams push mobs away
This commit is contained in:
56
js/bullet.js
56
js/bullet.js
@@ -1125,7 +1125,7 @@ const b = {
|
|||||||
}, whereEnd = {
|
}, whereEnd = {
|
||||||
x: where.x + 3000 * Math.cos(mech.angle),
|
x: where.x + 3000 * Math.cos(mech.angle),
|
||||||
y: where.y + 3000 * Math.sin(mech.angle)
|
y: where.y + 3000 * Math.sin(mech.angle)
|
||||||
}, dmg = tech.laserDamage, reflections = tech.laserReflections, isThickBeam = false) {
|
}, dmg = tech.laserDamage, reflections = tech.laserReflections, isThickBeam = false, push = 1) {
|
||||||
const reflectivity = 1 - 1 / (reflections * 1.5)
|
const reflectivity = 1 - 1 / (reflections * 1.5)
|
||||||
let damage = b.dmgScale * dmg
|
let damage = b.dmgScale * dmg
|
||||||
let best = {
|
let best = {
|
||||||
@@ -1211,6 +1211,21 @@ const b = {
|
|||||||
color: "rgba(255,0,0,0.5)",
|
color: "rgba(255,0,0,0.5)",
|
||||||
time: simulation.drawTime
|
time: simulation.drawTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tech.isLaserPush) { //push mobs away
|
||||||
|
console.log(-0.003 * Math.min(4, best.who.mass), dmg)
|
||||||
|
const index = path.length - 1
|
||||||
|
// const force = Vector.mult(Vector.normalise(Vector.sub(path[Math.max(0, index - 1)], path[index])), -0.003 * Math.min(4, best.who.mass))
|
||||||
|
// const push = -0.004 / (1 + tech.beamSplitter + tech.wideLaser + tech.historyLaser)
|
||||||
|
// console.log(push)
|
||||||
|
const force = Vector.mult(Vector.normalise(Vector.sub(path[index], path[Math.max(0, index - 1)])), 0.004 * push * Math.min(4, best.who.mass))
|
||||||
|
Matter.Body.applyForce(best.who, path[index], force)
|
||||||
|
// Matter.Body.setVelocity(best.who, { //friction
|
||||||
|
// x: best.who.velocity.x * 0.7,
|
||||||
|
// y: best.who.velocity.y * 0.7
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// ctx.fillStyle = color; //draw mob damage circle
|
// ctx.fillStyle = color; //draw mob damage circle
|
||||||
// ctx.beginPath();
|
// ctx.beginPath();
|
||||||
@@ -2224,7 +2239,14 @@ const b = {
|
|||||||
//hit target with laser
|
//hit target with laser
|
||||||
if (this.lockedOn && this.lockedOn.alive && mech.energy > this.drainThreshold) {
|
if (this.lockedOn && this.lockedOn.alive && mech.energy > this.drainThreshold) {
|
||||||
mech.energy -= tech.laserFieldDrain * tech.isLaserDiode
|
mech.energy -= tech.laserFieldDrain * tech.isLaserDiode
|
||||||
b.laser(this.vertices[0], this.lockedOn.position, b.dmgScale * (0.38 * tech.laserDamage + this.isUpgraded * 0.21)) //tech.laserDamage = 0.16
|
b.laser(this.vertices[0], this.lockedOn.position, b.dmgScale * (0.38 * tech.laserDamage + this.isUpgraded * 0.21), tech.laserReflections, false, 0.4) //tech.laserDamage = 0.16
|
||||||
|
// laser(where = {
|
||||||
|
// x: mech.pos.x + 20 * Math.cos(mech.angle),
|
||||||
|
// y: mech.pos.y + 20 * Math.sin(mech.angle)
|
||||||
|
// }, whereEnd = {
|
||||||
|
// x: where.x + 3000 * Math.cos(mech.angle),
|
||||||
|
// y: where.y + 3000 * Math.sin(mech.angle)
|
||||||
|
// }, dmg = tech.laserDamage, reflections = tech.laserReflections, isThickBeam = false, push = 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -3908,7 +3930,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "laser",
|
name: "laser",
|
||||||
description: "emit a <strong>beam</strong> of collimated coherent <strong>light</strong><br>drains <strong class='color-f'>energy</strong> instead of ammunition",
|
description: "emit a <strong>beam</strong> of collimated coherent <strong class='color-laser'>light</strong><br>drains <strong class='color-f'>energy</strong> instead of ammunition",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: Infinity,
|
ammoPack: Infinity,
|
||||||
have: false,
|
have: false,
|
||||||
@@ -3938,6 +3960,14 @@ const b = {
|
|||||||
b.laser();
|
b.laser();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// laser(where = {
|
||||||
|
// x: mech.pos.x + 20 * Math.cos(mech.angle),
|
||||||
|
// y: mech.pos.y + 20 * Math.sin(mech.angle)
|
||||||
|
// }, whereEnd = {
|
||||||
|
// x: where.x + 3000 * Math.cos(mech.angle),
|
||||||
|
// y: where.y + 3000 * Math.sin(mech.angle)
|
||||||
|
// }, dmg = tech.laserDamage, reflections = tech.laserReflections, isThickBeam = false, push = 1) {
|
||||||
fireSplit() {
|
fireSplit() {
|
||||||
if (mech.energy < tech.laserFieldDrain) {
|
if (mech.energy < tech.laserFieldDrain) {
|
||||||
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
|
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
|
||||||
@@ -3945,7 +3975,9 @@ const b = {
|
|||||||
mech.fireCDcycle = mech.cycle
|
mech.fireCDcycle = mech.cycle
|
||||||
mech.energy -= mech.fieldRegen + tech.laserFieldDrain * tech.isLaserDiode
|
mech.energy -= mech.fieldRegen + tech.laserFieldDrain * tech.isLaserDiode
|
||||||
const divergence = mech.crouch ? 0.15 : 0.2
|
const divergence = mech.crouch ? 0.15 : 0.2
|
||||||
let dmg = tech.laserDamage * Math.pow(0.9, tech.beamSplitter) //Math.pow(0.9, tech.laserDamage)
|
const scale = Math.pow(0.9, tech.beamSplitter)
|
||||||
|
const pushScale = scale * scale
|
||||||
|
let dmg = tech.laserDamage * scale //Math.pow(0.9, tech.laserDamage)
|
||||||
const where = {
|
const where = {
|
||||||
x: mech.pos.x + 20 * Math.cos(mech.angle),
|
x: mech.pos.x + 20 * Math.cos(mech.angle),
|
||||||
y: mech.pos.y + 20 * Math.sin(mech.angle)
|
y: mech.pos.y + 20 * Math.sin(mech.angle)
|
||||||
@@ -3953,16 +3985,16 @@ const b = {
|
|||||||
b.laser(where, {
|
b.laser(where, {
|
||||||
x: where.x + 3000 * Math.cos(mech.angle),
|
x: where.x + 3000 * Math.cos(mech.angle),
|
||||||
y: where.y + 3000 * Math.sin(mech.angle)
|
y: where.y + 3000 * Math.sin(mech.angle)
|
||||||
}, dmg)
|
}, dmg, tech.laserReflections, false, pushScale)
|
||||||
for (let i = 1; i < 1 + tech.beamSplitter; i++) {
|
for (let i = 1; i < 1 + tech.beamSplitter; i++) {
|
||||||
b.laser(where, {
|
b.laser(where, {
|
||||||
x: where.x + 3000 * Math.cos(mech.angle + i * divergence),
|
x: where.x + 3000 * Math.cos(mech.angle + i * divergence),
|
||||||
y: where.y + 3000 * Math.sin(mech.angle + i * divergence)
|
y: where.y + 3000 * Math.sin(mech.angle + i * divergence)
|
||||||
}, dmg)
|
}, dmg, tech.laserReflections, false, pushScale)
|
||||||
b.laser(where, {
|
b.laser(where, {
|
||||||
x: where.x + 3000 * Math.cos(mech.angle - i * divergence),
|
x: where.x + 3000 * Math.cos(mech.angle - i * divergence),
|
||||||
y: where.y + 3000 * Math.sin(mech.angle - i * divergence)
|
y: where.y + 3000 * Math.sin(mech.angle - i * divergence)
|
||||||
}, dmg)
|
}, dmg, tech.laserReflections, false, pushScale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3985,7 +4017,7 @@ const b = {
|
|||||||
b.laser(where, {
|
b.laser(where, {
|
||||||
x: where.x + 3000 * Math.cos(angle),
|
x: where.x + 3000 * Math.cos(angle),
|
||||||
y: where.y + 3000 * Math.sin(angle)
|
y: where.y + 3000 * Math.sin(angle)
|
||||||
}, dmg, 0, true)
|
}, dmg, 0, true, 0.4)
|
||||||
for (let i = 1; i < tech.wideLaser; i++) {
|
for (let i = 1; i < tech.wideLaser; i++) {
|
||||||
let whereOff = Vector.add(where, {
|
let whereOff = Vector.add(where, {
|
||||||
x: i * off * Math.cos(angle + Math.PI / 2),
|
x: i * off * Math.cos(angle + Math.PI / 2),
|
||||||
@@ -3994,7 +4026,7 @@ const b = {
|
|||||||
b.laser(whereOff, {
|
b.laser(whereOff, {
|
||||||
x: whereOff.x + 3000 * Math.cos(angle),
|
x: whereOff.x + 3000 * Math.cos(angle),
|
||||||
y: whereOff.y + 3000 * Math.sin(angle)
|
y: whereOff.y + 3000 * Math.sin(angle)
|
||||||
}, dmg, 0, true)
|
}, dmg, 0, true, 0.4)
|
||||||
whereOff = Vector.add(where, {
|
whereOff = Vector.add(where, {
|
||||||
x: i * off * Math.cos(angle - Math.PI / 2),
|
x: i * off * Math.cos(angle - Math.PI / 2),
|
||||||
y: i * off * Math.sin(angle - Math.PI / 2)
|
y: i * off * Math.sin(angle - Math.PI / 2)
|
||||||
@@ -4002,7 +4034,7 @@ const b = {
|
|||||||
b.laser(whereOff, {
|
b.laser(whereOff, {
|
||||||
x: whereOff.x + 3000 * Math.cos(angle),
|
x: whereOff.x + 3000 * Math.cos(angle),
|
||||||
y: whereOff.y + 3000 * Math.sin(angle)
|
y: whereOff.y + 3000 * Math.sin(angle)
|
||||||
}, dmg, 0, true)
|
}, dmg, 0, true, 0.4)
|
||||||
}
|
}
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
@@ -4039,7 +4071,7 @@ const b = {
|
|||||||
}, {
|
}, {
|
||||||
x: mech.pos.x + 3000 * Math.cos(mech.angle),
|
x: mech.pos.x + 3000 * Math.cos(mech.angle),
|
||||||
y: mech.pos.y + 3000 * Math.sin(mech.angle)
|
y: mech.pos.y + 3000 * Math.sin(mech.angle)
|
||||||
}, dmg, 0, true);
|
}, dmg, 0, true, 0.3);
|
||||||
for (let i = 1; i < len; i++) {
|
for (let i = 1; i < len; i++) {
|
||||||
const history = mech.history[(mech.cycle - i * spacing) % 600]
|
const history = mech.history[(mech.cycle - i * spacing) % 600]
|
||||||
b.laser({
|
b.laser({
|
||||||
@@ -4048,7 +4080,7 @@ const b = {
|
|||||||
}, {
|
}, {
|
||||||
x: history.position.x + 3000 * Math.cos(history.angle),
|
x: history.position.x + 3000 * Math.cos(history.angle),
|
||||||
y: history.position.y + 3000 * Math.sin(history.angle) - mech.yPosDifference
|
y: history.position.y + 3000 * Math.sin(history.angle) - mech.yPosDifference
|
||||||
}, dmg, 0, true);
|
}, dmg, 0, true, 0.3);
|
||||||
}
|
}
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const level = {
|
|||||||
// simulation.zoomScale = 1000;
|
// simulation.zoomScale = 1000;
|
||||||
// simulation.setZoom();
|
// simulation.setZoom();
|
||||||
// mech.setField("plasma torch")
|
// mech.setField("plasma torch")
|
||||||
// b.giveGuns("missiles")
|
b.giveGuns("laser")
|
||||||
// tech.isMineSentry = true
|
// tech.isMineSentry = true
|
||||||
// tech.giveTech("foam fractionation")
|
// tech.giveTech("foam fractionation")
|
||||||
// tech.giveTech("missile-bot")
|
// tech.giveTech("missile-bot")
|
||||||
|
|||||||
@@ -2269,7 +2269,7 @@ const spawn = {
|
|||||||
this.explode(this.mass * 20);
|
this.explode(this.mass * 20);
|
||||||
};
|
};
|
||||||
Matter.Body.setDensity(me, 0.000015); //normal is 0.001
|
Matter.Body.setDensity(me, 0.000015); //normal is 0.001
|
||||||
me.timeLeft = 420 * (0.8 + 0.4 * Math.random());
|
me.timeLeft = 420 //* (0.8 + 0.4 * Math.random());
|
||||||
me.accelMag = 0.00017 * simulation.accelScale; //* (0.8 + 0.4 * Math.random())
|
me.accelMag = 0.00017 * simulation.accelScale; //* (0.8 + 0.4 * Math.random())
|
||||||
me.frictionAir = 0.01 //* (0.8 + 0.4 * Math.random());
|
me.frictionAir = 0.01 //* (0.8 + 0.4 * Math.random());
|
||||||
me.restitution = 0.5;
|
me.restitution = 0.5;
|
||||||
|
|||||||
824
js/tech.js
824
js/tech.js
File diff suppressed because it is too large
Load Diff
@@ -543,6 +543,14 @@ summary {
|
|||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.color-laser {
|
||||||
|
color: #f02;
|
||||||
|
/* text-shadow: 0px 0px 2px rgba(255, 0, 119, 0.3); */
|
||||||
|
/* text-shadow: 0px 0px 1.5px rgba(0, 0, 0, 1), 0px 0px 5px rgba(255, 0, 0, 1); */
|
||||||
|
font-weight: 100;
|
||||||
|
letter-spacing: -0.8px;
|
||||||
|
}
|
||||||
|
|
||||||
.color-plasma {
|
.color-plasma {
|
||||||
color: #c0e;
|
color: #c0e;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
|
|||||||
20
todo.txt
20
todo.txt
@@ -1,16 +1,6 @@
|
|||||||
******************************************************** NEXT PATCH ********************************************************
|
******************************************************** NEXT PATCH ********************************************************
|
||||||
|
|
||||||
reroll renamed -> research
|
tech: relativistic momentum - laser beams push mobs away
|
||||||
|
|
||||||
spore damage increased 25%
|
|
||||||
|
|
||||||
ice IX has it's damage buffed by 50%, and freeze effect lasts 2s (up from 1s)
|
|
||||||
ice IX is no longer a gun
|
|
||||||
but you can still get it for nano-scale field (and it's pretty strong)
|
|
||||||
tech: heavy water was removed
|
|
||||||
|
|
||||||
tech: correlated damage - duplication chance also gives % damage
|
|
||||||
(also added some minor nerfs to other duplication tech for balance)
|
|
||||||
|
|
||||||
******************************************************** BUGS ********************************************************
|
******************************************************** BUGS ********************************************************
|
||||||
|
|
||||||
@@ -48,9 +38,9 @@ tech: dodge chance for cloaking, harmonic fields, also pilot wave
|
|||||||
set to 100% harm reduction randomly
|
set to 100% harm reduction randomly
|
||||||
if (Math.random() < 0.2) damage *= 0;
|
if (Math.random() < 0.2) damage *= 0;
|
||||||
|
|
||||||
rename
|
rename ?
|
||||||
health > integrity, unity
|
health -> integrity, unity
|
||||||
heal > also integrity, unity
|
heal -> also integrity, unity
|
||||||
|
|
||||||
in game console
|
in game console
|
||||||
set highlighting rules
|
set highlighting rules
|
||||||
@@ -79,7 +69,7 @@ mob ability bombs/bullets that suck in player
|
|||||||
|
|
||||||
tech where you can't stop firing, how to code?
|
tech where you can't stop firing, how to code?
|
||||||
|
|
||||||
tech: laser beams push like plasma torch pushes with directional force
|
tech: translational invariance - laser beams push like plasma torch pushes with directional force
|
||||||
|
|
||||||
mechanic: technological dead end - add tech to the tech pool with a dumb effect
|
mechanic: technological dead end - add tech to the tech pool with a dumb effect
|
||||||
don't show up in custom?
|
don't show up in custom?
|
||||||
|
|||||||
Reference in New Issue
Block a user