drone repair

tech: automatic - always fire, but get 2.5x ammo
  requires inertial frame

tech: drone repair - while drones are your active gun, drones respawn with a 50% chance to consume ammo
This commit is contained in:
landgreen
2021-04-02 10:53:44 -07:00
parent 94314f7a59
commit 45fb86189b
8 changed files with 480 additions and 282 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -10,7 +10,11 @@ const b = {
if (tech.isFireMoveLock) {
b.fire = b.fireFloat
} else if (tech.isFireNotMove) {
b.fire = b.fireNotMove
if (tech.isAlwaysFire) {
b.fire = b.fireNotMoveAlwaysFire
} else {
b.fire = b.fireNotMove
}
} else {
b.fire = b.fireNormal
}
@@ -19,92 +23,40 @@ const b = {
fireNormal() {
if (input.fire && m.fireCDcycle < m.cycle && (!input.field || m.fieldFire) && b.inventory.length) {
if (b.guns[b.activeGun].ammo > 0) {
b.guns[b.activeGun].fire();
if (tech.isCrouchAmmo && m.crouch) {
if (tech.isCrouchAmmo % 2) {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
tech.isCrouchAmmo++ //makes the no ammo toggle off and on
} else {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
b.fireWithAmmo()
} else {
if (tech.isAmmoFromHealth) {
if (m.health > 0.05) {
m.damage(0.05 / m.harmReduction()); // /m.harmReduction() undoes damage increase from difficulty
if (!(tech.isRewindAvoidDeath && m.energy > 0.66)) { //don't give ammo if CPT triggered
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x, m.pos.y, "ammo");
}
}
} else {
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
}
m.fireCDcycle = m.cycle + 30; //fire cooldown
b.outOfAmmo()
}
if (m.holdingTarget) m.drop();
}
},
fireNotMove() {
//added && player.speed < 0.5 && m.onGround *************************
fireNotMove() { //added && player.speed < 0.5 && m.onGround
if (input.fire && m.fireCDcycle < m.cycle && (!input.field || m.fieldFire) && b.inventory.length && player.speed < 0.5 && m.onGround && Math.abs(m.yOff - m.yOffGoal) < 1) {
if (b.guns[b.activeGun].ammo > 0) {
b.guns[b.activeGun].fire();
if (tech.isCrouchAmmo && m.crouch) {
if (tech.isCrouchAmmo % 2) {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
tech.isCrouchAmmo++ //makes the no ammo toggle off and on
} else {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
b.fireWithAmmo()
} else {
if (tech.isAmmoFromHealth) {
if (m.health > 0.05) {
m.damage(0.05 / m.harmReduction()); // /m.harmReduction() undoes damage increase from difficulty
if (!(tech.isRewindAvoidDeath && m.energy > 0.66)) { //don't give ammo if CPT triggered
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x, m.pos.y, "ammo");
}
}
} else {
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
}
m.fireCDcycle = m.cycle + 30; //fire cooldown
b.outOfAmmo()
}
if (m.holdingTarget) m.drop();
}
},
fireFloat() {
//added && player.speed < 0.5 && m.onGround *************************
fireNotMoveAlwaysFire() { //added && player.speed < 0.5 && m.onGround //removed input.fire && (!input.field || m.fieldFire)
if (m.fireCDcycle < m.cycle && b.inventory.length && player.speed < 0.5 && m.onGround && Math.abs(m.yOff - m.yOffGoal) < 1) {
if (b.guns[b.activeGun].ammo > 0) {
b.fireWithAmmo()
} else {
b.outOfAmmo()
}
if (m.holdingTarget) m.drop();
}
},
fireFloat() { //added && player.speed < 0.5 && m.onGround
if (input.fire && (!input.field || m.fieldFire) && b.inventory.length) {
if (m.fireCDcycle < m.cycle) {
if (b.guns[b.activeGun].ammo > 0) {
b.guns[b.activeGun].fire();
if (tech.isCrouchAmmo && m.crouch) {
if (tech.isCrouchAmmo % 2) {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
tech.isCrouchAmmo++ //makes the no ammo toggle off and on
} else {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
b.fireWithAmmo()
} else {
if (tech.isAmmoFromHealth) {
if (m.health > 0.05) {
m.damage(0.05 / m.harmReduction()); // /m.harmReduction() undoes damage increase from difficulty
if (!(tech.isRewindAvoidDeath && m.energy > 0.66)) { //don't give ammo if CPT triggered
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x, m.pos.y, "ammo");
}
}
} else {
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
}
m.fireCDcycle = m.cycle + 30; //fire cooldown
b.outOfAmmo()
}
if (m.holdingTarget) m.drop();
}
@@ -116,6 +68,31 @@ const b = {
player.force.y = 0
}
},
fireWithAmmo() { //triggers after firing when you have ammo
b.guns[b.activeGun].fire();
if (tech.isCrouchAmmo && m.crouch) {
if (tech.isCrouchAmmo % 2) {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
tech.isCrouchAmmo++ //makes the no ammo toggle off and on
} else {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
},
outOfAmmo() { //triggers after firing when you have NO ammo
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
m.fireCDcycle = m.cycle + 30; //fire cooldown
if (tech.isAmmoFromHealth) {
if (m.health > 0.05) {
m.damage(0.05 / m.harmReduction()); // /m.harmReduction() undoes damage increase from difficulty
if (!(tech.isRewindAvoidDeath && m.energy > 0.66)) { //don't give ammo if CPT triggered
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x, m.pos.y, "ammo");
}
}
}
},
giveGuns(gun = "random", ammoPacks = 10) {
if (tech.isOneGun) b.removeAllGuns();
if (gun === "random") {
@@ -2049,8 +2026,8 @@ const b = {
deathCycles: 110 + RADIUS * 5,
isImproved: false,
beforeDmg(who) {
if (tech.isIncendiary) {
const max = Math.max(Math.min(this.endCycle - simulation.cycle, 1500), 0)
if (tech.isIncendiary && simulation.cycle + this.deathCycles < this.endCycle) {
const max = Math.max(Math.min(this.endCycle - simulation.cycle - this.deathCycles, 1500), 0)
b.explosion(this.position, max * 0.08 + this.isImproved * 100 + 60 * Math.random()); //makes bullet do explosive damage at end
this.endCycle -= max
} else {
@@ -2067,12 +2044,23 @@ const b = {
}
}
},
onEnd() {},
onEnd() {
if (tech.isDroneRespawn) {
const who = b.guns[b.activeGun]
if (who.name === "drones" && who.ammo > 0 && mob.length) {
b.drone({ x: this.position.x, y: this.position.y }, 0)
if (Math.random() < 0.33) {
b.guns[b.activeGun].ammo--;
simulation.updateGunHUD();
}
}
}
},
do() {
if (simulation.cycle + this.deathCycles > this.endCycle) { //fall shrink and die
this.force.y += this.mass * 0.0012;
this.restitution = 0.2;
const scale = 0.99;
const scale = 0.995;
Matter.Body.scale(this, scale, scale);
} else {
this.force.y += this.mass * 0.0002;

View File

@@ -917,7 +917,6 @@ const mobs = {
this.torque -= 0.000004 * this.inertia;
} else if (this.noseLength > 1.5 && dot > 0 && dot < 0.03) {
//fire
console.log(dot)
spawn.bullet(this.vertices[1].x, this.vertices[1].y, 9 + Math.ceil(this.radius / 15));
const v = 15;
Matter.Body.setVelocity(mob[mob.length - 1], {

View File

@@ -513,7 +513,7 @@ const m = {
let dmg = 1
dmg *= m.fieldHarmReduction
if (tech.isImmortal) dmg *= 0.79
if (tech.isHarmReduceAfterKill) dmg *= (m.lastKillCycle + 300 > m.cycle) ? 0.25 : 1.25
if (tech.isHarmReduceAfterKill) dmg *= (m.lastKillCycle + 300 > m.cycle) ? 0.50 : 1.1
if (tech.healthDrain) dmg *= 1 + 2.667 * tech.healthDrain //tech.healthDrain = 0.03 at one stack //cause more damage
if (tech.squirrelFx !== 1) dmg *= 1 + (tech.squirrelFx - 1) / 5 //cause more damage
if (tech.isBlockHarm && m.isHolding) dmg *= 0.15
@@ -1487,6 +1487,8 @@ const m = {
// m.fieldHarmReduction = 0.80;
m.fieldBlockCD = 0;
m.fieldHarmReduction = 0.8;
m.fieldRange = 175 + 175 * 0.25 * tech.frequencyResonance
m.fieldShieldingScale = Math.pow(0.5, tech.frequencyResonance)
m.hold = function() {
if (m.isHolding) {
m.drawHold(m.holdingTarget);

View File

@@ -187,7 +187,7 @@ const powerUps = {
if (tech.isAmmoForGun && b.inventory.length > 0 && b.activeGun) {
const target = b.guns[b.activeGun]
if (target.ammo !== Infinity) {
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(0.7 * Math.random() * target.ammoPack)
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(0.7 * Math.random() * target.ammoPack) * (tech.isAlwaysFire ? 3 : 1)
target.ammo += ammoAdded
simulation.makeTextLog(`${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`)
}
@@ -195,7 +195,7 @@ const powerUps = {
for (let i = 0, len = b.inventory.length; i < len; i++) {
const target = b.guns[b.inventory[i]]
if (target.ammo !== Infinity) {
const ammoAdded = Math.ceil(Math.random() * target.ammoPack)
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) * (tech.isAlwaysFire ? 3 : 1)
target.ammo += ammoAdded
simulation.makeTextLog(`${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`)
}

View File

@@ -563,6 +563,7 @@ const simulation = {
b.setFireMethod()
b.setFireCD();
// simulation.updateTechHUD();
powerUps.tech.choiceLog = []
powerUps.totalPowerUps = 0;
powerUps.research.count = 0;
m.setFillColors();
@@ -785,7 +786,7 @@ const simulation = {
// }
// },
checks() {
if (!(m.cycle % 60)) { //once a second
if (!(simulation.cycle % 60) && !m.isBodiesAsleep) { //once a second
//energy overfill
if (m.energy > m.maxEnergy) m.energy = m.maxEnergy + (m.energy - m.maxEnergy) * tech.overfillDrain //every second energy above max energy loses 25%
if (tech.isFlipFlopEnergy) {
@@ -839,7 +840,7 @@ const simulation = {
// }
// }
if (m.lastKillCycle + 300 > m.cycle) { //effects active for 5 seconds after killing a mob
if (m.lastKillCycle + 300 > simulation.cycle) { //effects active for 5 seconds after killing a mob
if (tech.isEnergyRecovery) m.energy += m.maxEnergy * 0.05
if (tech.isHealthRecovery) m.addHealth(0.01 * m.maxHealth)
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,9 @@
******************************************************** NEXT PATCH ********************************************************
added new graphics to several maps
tech: automatic - always fire, but get 2.5x ammo
requires inertial frame
to level developers: level.fillBG and level.fill no longer work,
you should draw backgrounds directly in level.custom like this:
level.custom = () => {
ctx.fillStyle = "rgba(0,255,255,0.1)";
ctx.fillRect(6400, -550, 300, 350);
level.playerExitCheck();
level.exit.draw();
level.enter.draw();
};
tech: drone repair - while drones are your active gun, drones respawn with a 50% chance to consume ammo
******************************************************** BUGS ********************************************************
@@ -43,19 +36,14 @@ fix door.isOpen actually meaning isClosed?
******************************************************** TODO ********************************************************
flipflop, but toggles after a kill
tech shotgun - crouching makes your spread very small
remove spread reduction on nail shot
doesn't apply to slug
add water drops to sewers
move power ups in front of blocks, make blocks not transparent?
consider adding canvas path shadows to levels in level.custom for non squared lighting
convert all level.BG into canvas draw in level.custom
draw exit and entrance in level
new level: procedural generation
several small rooms are linked by portals
the portals have a randomized pattern