orthocyclic winding

tech: brushless motor - drones rush more often and do 44% more damage
  requires torque bursts
tech: orthocyclic winding - irradiated drones are faster and do more damage
  requires irradiated drones

automatic aiming systems (bots, drones, missiles) will ignore the pink seeking mob bullets

safari is super buggy, I'm guessing no one that reports bugs uses it.
  fixed scroll bar covering up pause right side text on safari and firefox
  fixed issue with ctx.setLineDash sometimes making the player dashed on safari

various other bug fixes
This commit is contained in:
landgreen
2021-08-11 20:40:17 -07:00
parent 72c3ef2d04
commit 2e406c5264
11 changed files with 139 additions and 94 deletions

View File

@@ -1589,7 +1589,7 @@ const b = {
ctx.stroke();
ctx.globalAlpha *= reflectivity; //reflections are less intense
}
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
ctx.globalAlpha = 1;
}
},
@@ -2052,7 +2052,7 @@ const b = {
Composite.add(engine.world, bullet[bIndex]); //add bullet to world
if (tech.isMutualism && m.health > 0.01) {
m.health -= 0.005
m.health -= 0.005
m.displayHealth();
bullet[bIndex].isMutualismActive = true
}
@@ -2132,7 +2132,7 @@ const b = {
},
drone(where = { x: m.pos.x + 30 * Math.cos(m.angle) + 20 * (Math.random() - 0.5), y: m.pos.y + 30 * Math.sin(m.angle) + 20 * (Math.random() - 0.5) }, speed = 1) {
const me = bullet.length;
const THRUST = tech.isFastDrones ? 0.0023 : 0.0015
const THRUST = 0.0015
// const FRICTION = tech.isFastDrones ? 0.008 : 0.0005
const dir = m.angle + 0.4 * (Math.random() - 0.5);
const RADIUS = (4.5 + 3 * Math.random())
@@ -2142,8 +2142,10 @@ const b = {
friction: 0.05,
frictionAir: 0,
restitution: 1,
dmg: 0.24 + 0.12 * tech.isDroneTeleport, //damage done in addition to the damage from momentum
lookFrequency: 70 + Math.floor(17 * Math.random()),
density: 0.0005, // 0.001 is normal density
//total 0.24 + 0.3 average
dmg: 0.34 + 0.12 * tech.isDroneTeleport + 0.15 * tech.isDroneFastLook, //damage done in addition to the damage from momentum
lookFrequency: (tech.isDroneFastLook ? 20 : 70) + Math.floor(17 * Math.random()),
endCycle: simulation.cycle + Math.floor((950 + 420 * Math.random()) * tech.isBulletsLastLonger * tech.droneCycleReduction) + 140 + RADIUS * 5,
classType: "bullet",
collisionFilter: {
@@ -2331,7 +2333,7 @@ const b = {
},
droneRadioactive(where = { x: m.pos.x + 30 * Math.cos(m.angle) + 20 * (Math.random() - 0.5), y: m.pos.y + 30 * Math.sin(m.angle) + 20 * (Math.random() - 0.5) }, speed = 1) {
const me = bullet.length;
const THRUST = tech.isFastDrones ? 0.002 : 0.0012 + 0.0004 * (Math.random() - 0.5)
const THRUST = (tech.isFastDrones ? 0.003 : 0.0012) + 0.0005 * (Math.random() - 0.5)
const dir = m.angle + 0.4 * (Math.random() - 0.5);
const RADIUS = 3
bullet[me] = Bodies.polygon(where.x, where.y, 8, RADIUS, {
@@ -2357,12 +2359,13 @@ const b = {
radioRadius: 0,
maxRadioRadius: 300 + Math.floor(100 * Math.random()),
beforeDmg(who) {
const unit = Vector.mult(Vector.normalise(Vector.sub(this.position, who.position)), -20) //move away from target after hitting
Matter.Body.setVelocity(this, {
x: unit.x,
y: unit.y
});
this.lockedOn = null
// const unit = Vector.mult(Vector.normalise(Vector.sub(this.position, who.position)), -20) //move away from target after hitting
// Matter.Body.setVelocity(this, {
// x: unit.x,
// y: unit.y
// });
// this.lockedOn = null
// if (this.endCycle > simulation.cycle + this.deathCycles) {
// this.endCycle -= 60
// if (simulation.cycle + this.deathCycles > this.endCycle) this.endCycle = simulation.cycle + this.deathCycles
@@ -2396,7 +2399,7 @@ const b = {
//aoe damage to mobs
for (let i = 0, len = mob.length; i < len; i++) {
if (Vector.magnitude(Vector.sub(mob[i].position, this.position)) < this.radioRadius + mob[i].radius) {
let dmg = 0.11 * b.dmgScale * tech.droneRadioDamage //neutron bombs dmg = 0.09
let dmg = (0.12 + 0.04 * tech.isFastDrones) * b.dmgScale * tech.droneRadioDamage //neutron bombs dmg = 0.09
if (Matter.Query.ray(map, mob[i].position, this.position).length > 0) dmg *= 0.25 //reduce damage if a wall is in the way
if (mob[i].shield) dmg *= 3 // to make up for the /5 that shields normally take
mob[i].damage(dmg);
@@ -5165,7 +5168,7 @@ const b = {
ctx.lineWidth = this.charge * 1
ctx.setLineDash([10, 20]);
ctx.stroke();
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
//draw magnetic field
const X = m.pos.x

View File

@@ -175,6 +175,7 @@ function collisionChecks(event) {
if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) {
obj.beforeDmg(mob[k]); //some bullets do actions when they hits things, like despawn //forces don't seem to work here
let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
// console.log(obj.dmg, 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
if (tech.isCrit && mob[k].isStunned) dmg *= 4
mob[k].damage(dmg);
if (mob[k].alive) mob[k].foundPlayer();

View File

@@ -202,6 +202,7 @@ const build = {
// }
// },
pauseGrid() {
//right side
let botText = ""
if (tech.nailBotCount) botText += `<br>nail-bots: ${tech.nailBotCount}`
if (tech.orbitBotCount) botText += `<br>orbital-bots: ${tech.orbitBotCount}`
@@ -243,13 +244,13 @@ const build = {
for (let i = 0, len = b.inventory.length; i < len; i++) {
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid gun"></div> &nbsp; ${b.guns[b.inventory[i]].name} - <span style="font-size:100%;font-weight: 100;">${b.guns[b.inventory[i]].ammo}</span></div> ${b.guns[b.inventory[i]].description}</div>`
}
let el = document.getElementById("pause-grid-left")
el.style.display = "grid"
el.innerHTML = text
//left side
text = "";
text += `<div class="pause-grid-module" id ="pause-field"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[m.fieldMode].name}</div> ${m.fieldUpgrades[m.fieldMode].description}</div>`
let countTech = 0
for (let i = 0, len = tech.tech.length; i < len; i++) {
if (tech.tech[i].count > 0 && !tech.tech[i].isNonRefundable) {
const isCount = tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : "";
@@ -274,23 +275,13 @@ const build = {
} else {
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid tech"></div> &nbsp; ${tech.tech[i].name} ${isCount}</div>${tech.tech[i].description}</div></div>`
}
countTech++
} else if (tech.tech[i].isLost) {
text += `<div class="pause-grid-module" style="text-decoration: line-through;"><div class="grid-title">${tech.tech[i].name}</div>${tech.tech[i].description}</div></div>`
}
}
//show in game console with scroll bar?
// text +=``
el = document.getElementById("pause-grid-right")
el.style.display = "grid"
el.innerHTML = text
// if (countTech > 5 || b.inventory.length > 6) {
// document.body.style.overflowY = "scroll";
// document.body.style.overflowX = "hidden";
// }
},
unPauseGrid() {
// document.body.style.overflow = "hidden"

View File

@@ -12,19 +12,17 @@ const level = {
start() {
if (level.levelsCleared === 0) { //this code only runs on the first level
// localSettings.levelsClearedLastGame = 10
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.isHorizontalFlipped = true
// tech.isFieldFree = true
// m.setField("perfect diamagnetism")
// b.giveGuns("rail gun")
// b.giveGuns("drones")
// tech.missileBotCount++;
// b.missileBot();
// tech.giveTech("half-wave rectifier")
// b.giveGuns("nail gun")
// tech.giveTech("Lenz's law")
// for (let i = 0; i < 9; i++) tech.giveTech("MIRV")
// for (let i = 0; i < 4; i++) tech.giveTech()
level.intro(); //starting level
// level.testing(); //not in rotation, used for testing
@@ -2271,8 +2269,8 @@ const level = {
spawn.mapRect(5050, -100, 50, 150);
spawn.mapRect(4850, -275, 50, 175);
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// spawn.starter(1900, -500, 200) //big boy
spawn.growBossCulture(1900, -500)
spawn.starter(1900, -500, 200) //big boy
// spawn.growBossCulture(1900, -500)
// spawn.blinkBoss(1900, -500)
// spawn.snakeSpitBoss(1900, -500)
// spawn.growBossCulture(1900, -500)

View File

@@ -314,21 +314,23 @@ const mobs = {
this.foundPlayer();
} else if (this.seePlayer.recall) {
this.lostPlayer();
for (let i = 0; i < depth; i++) { //if lost player lock onto a player location in history
let history = m.history[(m.cycle - 10 * i) % 600]
if (Matter.Query.ray(map, this.position, history.position).length === 0) {
this.seePlayer.recall = this.memory + Math.round(this.memory * Math.random()); //cycles before mob falls a sleep
this.seePlayer.position.x = history.position.x;
this.seePlayer.position.y = history.position.y;
this.seePlayer.yes = true;
//draw the history location found for testing purposes
// ctx.beginPath();
// ctx.moveTo(this.position.x, this.position.y);
// ctx.lineTo(history.position.x, history.position.y);
// ctx.lineWidth = 5;
// ctx.strokeStyle = "#000";
// ctx.stroke();
break
if (!m.isCloak) {
for (let i = 0; i < depth; i++) { //if lost player lock onto a player location in history
let history = m.history[(m.cycle - 10 * i) % 600]
if (Matter.Query.ray(map, this.position, history.position).length === 0) {
this.seePlayer.recall = this.memory + Math.round(this.memory * Math.random()); //cycles before mob falls a sleep
this.seePlayer.position.x = history.position.x;
this.seePlayer.position.y = history.position.y;
this.seePlayer.yes = true;
//draw the history location found for testing purposes
// ctx.beginPath();
// ctx.moveTo(this.position.x, this.position.y);
// ctx.lineTo(history.position.x, history.position.y);
// ctx.lineWidth = 5;
// ctx.strokeStyle = "#000";
// ctx.stroke();
break
}
}
}
}
@@ -552,7 +554,7 @@ const mobs = {
ctx.lineWidth = 1;
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
}
},
searchSpring() {

View File

@@ -670,6 +670,7 @@ const m = {
if (tech.isDeathAvoid && powerUps.research.count > 0 && !tech.isDeathAvoidedThisLevel) { //&& Math.random() < 0.5
tech.isDeathAvoidedThisLevel = true
m.health = 0.05
m.displayHealth();
powerUps.research.changeRerolls(-1)
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-r'>research</span><span class='color-symbol'>--</span>
<br>${powerUps.research.count}`)
@@ -687,11 +688,11 @@ const m = {
}, 3000);
} else {
m.health = 0;
m.displayHealth();
m.death();
return;
}
}
m.displayHealth();
document.getElementById("dmg").style.transition = "opacity 0s";
document.getElementById("dmg").style.opacity = 0.1 + Math.min(0.6, dmg * 4);
}

View File

@@ -563,7 +563,7 @@ const spawn = {
ctx.lineWidth = 1.5 * scale;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
ctx.lineWidth = 20;
ctx.strokeStyle = `rgba(80,0,255,${0.07*scale})`;
ctx.stroke(); // Draw it
@@ -579,7 +579,7 @@ const spawn = {
ctx.lineWidth = 1.5;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
ctx.lineWidth = 20;
ctx.strokeStyle = "rgba(80,0,255,0.07)";
ctx.stroke(); // Draw it
@@ -1319,7 +1319,7 @@ const spawn = {
}
// this.seePlayerCheckByDistance()
if (!(simulation.cycle % this.seePlayerFreq)) {
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !m.isCloak ignore cloak for black holes
if (this.distanceToPlayer2() < this.seeAtDistance2) { // ignore cloak for black holes
this.locatePlayer();
if (!this.seePlayer.yes) this.seePlayer.yes = true;
} else if (this.seePlayer.recall) {
@@ -1987,7 +1987,7 @@ const spawn = {
ctx.lineWidth = 3;
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
ctx.stroke();
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
}
};
},
@@ -2143,7 +2143,7 @@ const spawn = {
ctx.lineWidth = 2;
ctx.strokeStyle = "rgba(120,0,255,0.3)";
ctx.stroke();
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
}
} else { //aim at player
this.fireCycle++
@@ -2266,7 +2266,7 @@ const spawn = {
ctx.lineWidth = 2;
ctx.strokeStyle = "rgba(255,0,100,0.3)";
ctx.stroke();
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
}
} else { //aim at player
this.fireCycle++
@@ -2382,7 +2382,7 @@ const spawn = {
ctx.lineWidth = 1.5;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.setLineDash([]);
ctx.lineWidth = 20;
ctx.strokeStyle = "rgba(80,0,255,0.07)";
ctx.stroke(); // Draw it
@@ -3524,6 +3524,7 @@ const spawn = {
me.restitution = 0.5;
me.leaveBody = false;
me.isDropPowerUp = false;
me.isBadTarget = true;
me.showHealthBar = false;
me.collisionFilter.category = cat.mobBullet;
me.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet;
@@ -3648,7 +3649,7 @@ const spawn = {
let angle = Math.PI
let mag = 300
const color1 = "rgb(245,180,255)"
const color1 = "rgb(235,180,255)"
mobs.spawn(x + mag * Math.cos(angle), y + mag * Math.sin(angle), 8, radius, color1); //"rgb(55,170,170)"
let me = mob[mob.length - 1];
me.isBoss = true;

View File

@@ -871,9 +871,9 @@
frequency: 1,
frequencyDefault: 1,
allowed() {
return ((m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isDroneRadioactive || tech.isSporeField || tech.isMissileField || tech.isIceField)) || (tech.haveGunCheck("drones") && !tech.isDroneRadioactive) || tech.haveGunCheck("super balls") || tech.haveGunCheck("shotgun")) && !tech.isNailShot && !tech.isIceShot && !tech.isFoamShot && !tech.isWormShot
return ((m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isDroneTeleport || tech.isDroneRadioactive || tech.isSporeField || tech.isMissileField || tech.isIceField)) || (tech.haveGunCheck("drones") && !tech.isDroneRadioactive && !tech.isDroneTeleport) || tech.haveGunCheck("super balls") || tech.haveGunCheck("shotgun")) && !tech.isNailShot && !tech.isIceShot && !tech.isFoamShot && !tech.isWormShot
},
requires: "super balls, basic or slug shotgun, drones, not irradiated drones",
requires: "super balls, basic or slug shotgun, drones, not irradiated drones or burst drones",
effect() {
tech.isIncendiary = true
},
@@ -3448,7 +3448,7 @@
level.difficultyDecrease(simulation.difficultyMode)
// simulation.difficulty<span class='color-symbol'>-=</span>
simulation.makeTextLog(`level.difficultyDecrease(simulation.difficultyMode)`)
tech.addJunkTechToPool(21)
tech.addJunkTechToPool(31)
// for (let i = 0; i < tech.junk.length; i++) tech.tech.push(tech.junk[i])
},
remove() {
@@ -4614,8 +4614,8 @@
isGunTech: true,
maxCount: 1,
count: 0,
frequency: 3,
frequencyDefault: 3,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.isSporeWorm || tech.isWormShot
},
@@ -4657,25 +4657,6 @@
}
}
},
{
name: "brushless motor",
description: "<strong>drones</strong> accelerate <strong>50%</strong> faster",
isGunTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.haveGunCheck("drones") || (m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField))
},
requires: "drones",
effect() {
tech.isFastDrones = true
},
remove() {
tech.isFastDrones = false
}
},
{
name: "delivery drone",
description: "if a <strong>drone</strong> picks up a <strong>power up</strong>,<br>it becomes <strong>larger</strong>, <strong>faster</strong>, and more <strong>durable</strong>",
@@ -4723,9 +4704,9 @@
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.haveGunCheck("drones") && !tech.isDroneRadioactive
return tech.haveGunCheck("drones") && !tech.isDroneRadioactive && !tech.isIncendiary
},
requires: "drone gun, not irradiated drones",
requires: "drone gun, not irradiated drones, incendiary",
effect() {
tech.isDroneTeleport = true
},
@@ -4733,6 +4714,25 @@
tech.isDroneTeleport = false
}
},
{
name: "brushless motor",
description: "<strong>drones</strong> can <strong>rush</strong> <strong>66%</strong> more often<br>increase <strong>drone</strong> collision <strong class='color-d'>damage</strong> by <strong>44%</strong>",
isGunTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.isDroneTeleport
},
requires: "torque bursts",
effect() {
tech.isDroneFastLook = true
},
remove() {
tech.isDroneFastLook = false
}
},
{
name: "irradiated drones",
description: "the space around <strong>drones</strong> is <strong class='color-p'>irradiated</strong><br>reduce <strong class='color-g'>ammo</strong>/<strong class='color-f'>efficiency</strong> by <strong>75%</strong>",
@@ -4785,6 +4785,25 @@
tech.droneRadioDamage = 1
}
},
{
name: "orthocyclic winding",
description: "<strong>drones</strong> accelerate <strong>66%</strong> faster<br>increase <strong class='color-p'>radiation</strong> <strong class='color-d'>damage</strong> by <strong>33%</strong>",
isGunTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.isDroneRadioactive
},
requires: "irradiated drones",
effect() {
tech.isFastDrones = true
},
remove() {
tech.isFastDrones = false
}
},
{
name: "electrostatic induction",
description: "<strong>foam</strong> bubbles are electrically charged<br>causing <strong>attraction</strong> to nearby <strong>mobs</strong>",
@@ -5881,7 +5900,7 @@
},
{
name: "ambush",
description: "metamaterial cloaking field <strong class='color-d'>damage</strong> effect<br>is increased from <span style = 'text-decoration: line-through;'>300%</span> to <strong>500%</strong>",
description: "metamaterial cloaking field <strong class='color-d'>damage</strong> effect<br>is increased from <span style = 'text-decoration: line-through;'>300%</span> to <strong>600%</strong>",
isFieldTech: true,
maxCount: 1,
count: 0,
@@ -5892,7 +5911,7 @@
},
requires: "metamaterial cloaking",
effect() {
tech.sneakAttackDmg = 6
tech.sneakAttackDmg = 7
},
remove() {
tech.sneakAttackDmg = 4
@@ -7819,6 +7838,8 @@
isOverHeal: null,
isDroneRadioactive: null,
droneRadioDamage: null,
isDroneTeleport: null,
isDroneFastLook: null,
isFoamTeleport: null,
isResearchBoss: null,
isJunkResearch: null,
@@ -7833,7 +7854,6 @@
harmonicEnergy: null,
isFieldHarmReduction: null,
isFastTime: null,
isDroneTeleport: null,
isAnthropicTech: null,
isSporeWorm: null,
isWormShot: null,