duplication animation

blackhole mobs can no longer see past stealth
adding dup chance has graphics now

bug fixes
This commit is contained in:
landgreen
2021-09-29 06:27:40 -07:00
parent 1eb58afb9d
commit 62b9d974b4
11 changed files with 77 additions and 39 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -1108,6 +1108,7 @@ const b = {
},
harpoon(where, target, angle = m.angle, harpoonLength = 1, isReturn = false, totalCycles = 15) {
const me = bullet.length;
const returnRadius = 100 * Math.sqrt(harpoonLength)
bullet[me] = Bodies.fromVertices(where.x, where.y, [{ x: -40 * harpoonLength, y: 2, index: 0, isInternal: false }, { x: -40 * harpoonLength, y: -2, index: 1, isInternal: false }, { x: 50 * harpoonLength, y: -3, index: 3, isInternal: false }, { x: 30 * harpoonLength, y: 2, index: 4, isInternal: false }], {
cycle: 0,
angle: angle,
@@ -1192,7 +1193,7 @@ const b = {
}
},
returnToPlayer() {
if (Vector.magnitude(Vector.sub(this.position, m.pos)) < 100) { //near player
if (Vector.magnitude(Vector.sub(this.position, m.pos)) < returnRadius) { //near player
this.endCycle = 0;
if (m.cycle + 25 * b.fireCDscale < m.fireCDcycle) m.fireCDcycle = m.cycle + 25 * b.fireCDscale //lower cd to 25 if it is above 25
//recoil on catching
@@ -2793,7 +2794,7 @@ const b = {
inertia: Infinity,
frictionAir: 0.003,
dmg: 0, //damage on impact
damage: (tech.isFastFoam ? 0.039 : 0.011) * (tech.isBulletTeleport ? 1.5 : 1), //damage done over time
damage: (tech.isFastFoam ? 0.039 : 0.011) * (tech.isBulletTeleport ? 1.43 : 1), //damage done over time
scale: 1 - 0.006 / tech.isBulletsLastLonger * (tech.isFastFoam ? 1.65 : 1),
classType: "bullet",
collisionFilter: {
@@ -4416,7 +4417,7 @@ const b = {
ctx.lineWidth = 2 * tech.wavePacketDamage
ctx.beginPath();
const end = 700 * Math.sqrt(tech.isBulletsLastLonger) / Math.sqrt(tech.waveReflections * 0.5) //should equal about 1060
const damage = 2 * b.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.5 : 1) //damage is lower for large radius mobs, since they feel the waves longer
const damage = 2 * b.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.43 : 1) //damage is lower for large radius mobs, since they feel the waves longer
for (let i = this.waves.length - 1; i > -1; i--) {
//draw wave
@@ -4506,7 +4507,7 @@ const b = {
ctx.lineWidth = 2 * tech.wavePacketDamage
ctx.beginPath();
const end = 1100 * tech.isBulletsLastLonger / Math.sqrt(tech.waveReflections * 0.5) //should equal about 1767
const damage = 2 * b.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.5 : 1) //damage is lower for large radius mobs, since they feel the waves longer
const damage = 2 * b.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.43 : 1) //damage is lower for large radius mobs, since they feel the waves longer
for (let i = this.waves.length - 1; i > -1; i--) {
const v1 = Vector.add(this.waves[i].position, Vector.mult(this.waves[i].unit1, this.waves[i].radius))
@@ -4621,7 +4622,7 @@ const b = {
slow: 0,
amplitude: (input.down ? 5 : 10) * ((this.wavePacketCycle % 2) ? -1 : 1) * Math.sin((this.wavePacketCycle + 1) * 0.088), //0.0968 //0.1012 //0.11 //0.088 //shorten wave packet
minDmgSpeed: 0,
dmg: b.dmgScale * tech.waveBeamDamage * tech.wavePacketDamage * (tech.isBulletTeleport ? 1.5 : 1), //also control damage when you divide by mob.mass
dmg: b.dmgScale * tech.waveBeamDamage * tech.wavePacketDamage * (tech.isBulletTeleport ? 1.43 : 1), //also control damage when you divide by mob.mass
classType: "bullet",
collisionFilter: {
category: 0,
@@ -5088,7 +5089,7 @@ const b = {
//look for closest mob in player's LoS
const dir = { x: Math.cos(m.angle), y: Math.sin(m.angle) }; //make a vector for the player's direction of length 1; used in dot product
const length = tech.isLargeHarpoon ? 1 + 0.09 * Math.sqrt(this.ammo) : 1
const totalCycles = 7 * (tech.isFilament ? 1 + 0.009 * Math.min(100, this.ammo) : 1)
const totalCycles = 7 * (tech.isFilament ? 1 + 0.009 * Math.min(100, this.ammo) : 1) * Math.sqrt(length)
if (input.down) {
for (let i = 0, len = mob.length; i < len; ++i) {
if (mob[i].alive && !mob[i].isBadTarget && Matter.Query.ray(map, m.pos, mob[i].position).length === 0) {

View File

@@ -695,6 +695,7 @@ const input = {
function cleanText(text) {
return text.replace('Key', '').replace('Digit', '')
}
if (!input.key.fire) input.key.fire = "KeyF"
document.getElementById("key-fire").innerHTML = cleanText(input.key.fire)
document.getElementById("key-field").innerHTML = cleanText(input.key.field)
document.getElementById("key-up").innerHTML = cleanText(input.key.up)

View File

@@ -23,6 +23,7 @@ const level = {
// tech.giveTech("all-stars")
// for (let i = 0; i < 3; i++) tech.giveTech("super sized")
// for (let i = 0; i < 9; i++) tech.giveTech("MIRV")
// tech.isCancelDuplication = true
level.intro(); //starting level
// level.testing(); //not in rotation, used for testing
@@ -2293,7 +2294,7 @@ 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.starter(1900, -500, 200) //big boy
// spawn.blockGroup(1900, -500)
// for (let i = 0; i < 10; ++i) spawn.bodyRect(1600 + 5, -500, 30, 40);
// spawn.laserBombingBoss(1900, -500)
@@ -2312,11 +2313,11 @@ const level = {
// spawn.laserBombingBoss(1600, -500)
// spawn.laserTargetingBoss(1600, -500)
// spawn.laserBoss(1600, -500)
// spawn.cellBossCulture(1600, -500)
spawn.cellBossCulture(1600, -500)
// spawn.nodeGroup(1200, -500, "grenadier")
// spawn.nodeGroup(1800, -500, "grenadier")
// spawn.nodeGroup(1200, 0, "grenadier")
spawn.snakeBoss(1200, -500)
// spawn.snakeBoss(1200, -500)
// spawn.suckerBoss(2900, -500)
// spawn.randomMob(1600, -500)
},

View File

@@ -1141,7 +1141,7 @@ const mobs = {
this.leaveBody = false; // no body since it turned into the bot
}
if (tech.isAddRemoveMaxHealth) {
if (this.isBoss) {
if (this.isBoss && this.isDropPowerUp) {
for (let i = 0; i < 2; i++) powerUps.spawn(this.position.x, this.position.y, "tech", false) //exit
} else {
const amount = 0.01

View File

@@ -2027,7 +2027,7 @@ const m = {
},
{
name: "time dilation",
description: "use <strong class='color-f'>energy</strong> to <strong style='letter-spacing: 1px;'>stop time</strong><br><strong>move</strong> and <strong>fire</strong> while time is stopped<br>mobs do <strong>50%</strong> <strong class='color-harm'>harm</strong> while time is stopped",
description: "use <strong class='color-f'>energy</strong> to <strong style='letter-spacing: 1px;'>stop time</strong><br>while time is stopped you can <strong>move</strong> and <strong>fire</strong><br>and <strong>collisions</strong> do <strong>50%</strong> less <strong class='color-harm'>harm</strong>",
effect: () => {
// m.fieldMeterColor = "#000"
m.fieldFire = true;
@@ -2108,7 +2108,7 @@ const m = {
},
{
name: "metamaterial cloaking", //"weak photonic coupling" "electromagnetically induced transparency" "optical non-coupling" "slow light field" "electro-optic transparency"
description: "when not firing activate a <strong class='color-cloaked'>cloaking</strong> effect<br><strong>+333%</strong> <strong class='color-d'>damage</strong> if a mob hasn't recently <strong>died</strong><br>mobs do <strong>50%</strong> <strong class='color-harm'>harm</strong> while you're <strong class='color-cloaked'>cloaked</strong>",
description: "when not firing activate a <strong class='color-cloaked'>cloaking</strong> effect<br><strong>+333%</strong> <strong class='color-d'>damage</strong> if a mob hasn't recently <strong>died</strong><br><strong>collisions</strong> do <strong>50%</strong> less <strong class='color-harm'>harm</strong> when <strong class='color-cloaked'>cloaked</strong>",
effect: () => {
m.fieldFire = true;
m.fieldMeterColor = "#333";
@@ -2156,12 +2156,12 @@ const m = {
}
if (tech.isCloakStun) { //stun nearby mobs after exiting cloak
let isMobsAround = false
const stunRange = m.fieldDrawRadius * 1.4
const drain = 0.1
const stunRange = m.fieldDrawRadius * 1.5
const drain = 0.15
const stunTime = 180
if (m.energy > drain) {
for (let i = 0, len = mob.length; i < len; ++i) {
if (Vector.magnitude(Vector.sub(mob[i].position, m.pos)) < stunRange && Matter.Query.ray(map, mob[i].position, m.pos).length === 0) {
if (Vector.magnitude(Vector.sub(mob[i].position, m.pos)) < stunRange && Matter.Query.ray(map, mob[i].position, m.pos).length === 0 && !mob[i].isBadTarget) {
isMobsAround = true
mobs.statusStun(mob[i], stunTime)
}
@@ -2172,7 +2172,7 @@ const m = {
x: m.pos.x,
y: m.pos.y,
radius: stunRange,
color: "hsla(0,50%,100%,0.8)",
color: "hsla(0,50%,100%,0.7)",
time: 7
});
}
@@ -2213,7 +2213,7 @@ const m = {
let inPlayer = Matter.Query.region(mob, player.bounds)
if (inPlayer.length > 0) {
for (let i = 0; i < inPlayer.length; i++) {
if (m.energy > 0 && inPlayer[i].shield) m.energy -= 0.012;
if (m.energy > 0 && inPlayer[i].shield) m.energy -= 0.014;
}
}
} else {

View File

@@ -173,7 +173,6 @@ const powerUps = {
break
}
}
ctx.globalAlpha = 0.4 * Math.sin(m.cycle * 0.25) + 0.6
for (let i = 0, len = powerUp.length; i < len; ++i) {
ctx.beginPath();
@@ -258,6 +257,8 @@ const powerUps = {
if (tech.isCancelDuplication) {
tech.cancelCount++
tech.maxDuplicationEvent()
simulation.makeTextLog(`tech.duplicationChance() <span class='color-symbol'>+=</span> ${0.045}`)
simulation.circleFlare(0.045);
}
if (tech.isCancelRerolls) {
for (let i = 0, len = 5 + 5 * Math.random(); i < len; i++) {

View File

@@ -256,7 +256,41 @@ const simulation = {
}
}
},
lastLogTime: 0,
circleFlare(dup, loops = 100) {
boltNum = dup * 300
const bolts = []
colors = [powerUps.research.color, powerUps.ammo.color, powerUps.heal.color, powerUps.tech.color, powerUps.field.color, powerUps.gun.color]
for (let i = 0; i < boltNum; ++i) {
const mag = 4 + 20 * Math.random()
const angle = 2 * Math.PI * Math.random()
bolts.push({
x: m.pos.x,
y: m.pos.y,
Vx: mag * Math.cos(angle),
Vy: mag * Math.sin(angle),
color: colors[Math.floor(Math.random() * colors.length)]
})
}
let count = 0
loop = () => { //draw electricity
if (count++ < loops) requestAnimationFrame(loop)
for (let i = 0, len = bolts.length; i < len; ++i) {
bolts[i].x += bolts[i].Vx
bolts[i].y += bolts[i].Vy
if (Math.random() < 0.2) {
simulation.drawList.push({
x: bolts[i].x,
y: bolts[i].y,
radius: 1.5 + 5 * Math.random(),
// color: "rgba(0,155,155,0.7)",
color: bolts[i].color,
time: Math.floor(9 + 25 * Math.random() * Math.random())
});
}
}
}
requestAnimationFrame(loop)
},
// lastLogTimeBig: 0,
boldActiveGunHUD() {
if (b.inventory.length > 0) {
@@ -314,6 +348,7 @@ const simulation = {
}
document.getElementById("tech").innerHTML = text
},
lastLogTime: 0,
isTextLogOpen: true,
// <!-- <path d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="#789" stroke="none" />
// <path d="M827,112 h30 a140,140,0,0,1,140,140 v68 h-167 z" fill="#7ce" stroke="none" /> -->

View File

@@ -1477,15 +1477,15 @@ const spawn = {
y: this.velocity.y * 0.99
});
}
// this.seePlayerCheckByDistance()
if (!(simulation.cycle % this.seePlayerFreq)) {
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) {
this.lostPlayer();
}
}
this.seePlayerCheckByDistance()
// if (!(simulation.cycle % this.seePlayerFreq)) {
// 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) {
// this.lostPlayer();
// }
// }
this.checkStatus();
if (this.seePlayer.recall) {
//eventHorizon waves in and out

View File

@@ -3079,6 +3079,7 @@
effect() {
tech.duplicateChance += 0.1
powerUps.setDupChance(); //needed after adjusting duplication chance
if (!build.isExperimentSelection) simulation.circleFlare(0.1);
tech.addJunkTechToPool(30)
},
remove() {
@@ -3100,7 +3101,8 @@
requires: "below 100% duplication chance",
effect: () => {
tech.isStimulatedEmission = true
powerUps.setDupChance(); //needed after adjusting duplication chance
powerUps.setDupChance(0.17); //needed after adjusting duplication chance
if (!build.isExperimentSelection) simulation.circleFlare(0.17);
},
remove() {
tech.isStimulatedEmission = false
@@ -3121,6 +3123,7 @@
effect: () => {
tech.isPowerUpsVanish = true
powerUps.setDupChance(); //needed after adjusting duplication chance
if (!build.isExperimentSelection) simulation.circleFlare(0.13);
},
remove() {
tech.isPowerUpsVanish = false
@@ -4891,7 +4894,7 @@
},
{
name: "uncertainty principle",
description: "<strong>foam</strong> and <strong>wave</strong> particle <strong>positions</strong> are random<br>increase their <strong class='color-d'>damage</strong> by <strong>50%</strong>",
description: "<strong>foam</strong> and <strong>wave</strong> particle <strong>positions</strong> are random<br>increase their <strong class='color-d'>damage</strong> by <strong>43%</strong>",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -6055,7 +6058,7 @@
effect() {
tech.cloakDuplication = 0.42
powerUps.setDupChance(); //needed after adjusting duplication chance
if (!build.isExperimentSelection) simulation.circleFlare(0.42);
},
remove() {
tech.cloakDuplication = 0
@@ -6304,6 +6307,7 @@
effect() {
tech.wormDuplicate = 0.14
powerUps.setDupChance(); //needed after adjusting duplication chance
if (!build.isExperimentSelection) simulation.circleFlare(0.14);
for (let i = 0; i < 4; i++) {
if (powerUps.research.count > 0) powerUps.research.changeRerolls(-1)
}

View File

@@ -1,14 +1,9 @@
******************************************************** NEXT PATCH **************************************************
pausing time or being cloaked gives you 50% harm reduction from mob collisions
no-cloning theorem duplication => down to 42%, but no longer removes 1% on bosses
dazzler => drains 25%->10% energy, and it has a 15% bigger radius
boson composite => only drains energy when you touch shields
'F' key lets you fire, and it can be rebound to other keys
might be some bugs here, I didn't do much testing
blackhole mobs can no longer see past stealth
adding dup chance has graphics now
bug fixes
******************************************************** TODO ********************************************************