spherical harmonics

tech removed: frequency resonance
standing wave tech: spherical harmonics - standing wave oscillates in a 3rd dimension, increasing deflecting efficiency by 60%
standing wave tech: expansion - using standing wave field drains energy to temporarily expand its radius
This commit is contained in:
landgreen
2021-06-05 07:22:41 -07:00
parent b307a50a72
commit d9f17ec2db
6 changed files with 144 additions and 40 deletions

View File

@@ -41,8 +41,8 @@ function playerOnGroundCheck(event) {
m.yOff = m.yOffWhen.jump;
m.hardLandCD = m.cycle + Math.min(momentum / 6.5 - 6, 40)
//falling damage
if (tech.isFallingDamage) {
m.damage(Math.min(Math.sqrt(momentum - 125) * 0.01, 0.25));
if (tech.isFallingDamage && m.immuneCycle < m.cycle) {
m.damage(Math.min(Math.sqrt(momentum - 123) * 0.01, 0.25));
m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to damage for 30 cycles
}
} else {

View File

@@ -15,10 +15,11 @@ const level = {
// simulation.zoomScale = 1000;
// simulation.setZoom();
// simulation.enableConstructMode() //used to build maps in testing mode
// m.setField("metamaterial cloaking")
// m.setField("standing wave harmonics")
// b.giveGuns("laser")
// tech.isExplodeRadio = true
// tech.giveTech("WIMPs")
// for (let i = 0; i < 5; i++) tech.giveTech("spherical harmonics")
// tech.giveTech("expansion")
// tech.giveTech("MACHO")
// tech.giveTech("potential well")
// for (let i = 0; i < 3; i++) tech.giveTech("packet length")
@@ -36,7 +37,7 @@ const level = {
// level.gauntlet(); //before final boss level
// level.testChamber()
// level.sewers();
// level.satellite();
// level.satellite();
// level.skyscrapers();
// level.aerie();
// level.rooftops();

View File

@@ -1501,8 +1501,76 @@ const m = {
m.fieldBlockCD = 0;
m.fieldHarmReduction = 0.75;
m.blockingRecoil = 1 //4 is normal
m.fieldRange = 175 + 175 * 0.25 * tech.frequencyResonance
m.fieldShieldingScale = Math.pow(0.5, tech.frequencyResonance)
m.fieldRange = 175
m.fieldShieldingScale = Math.pow(0.5, (tech.harmonics - 3))
m.harmonicRadius = 1 //for smoothing function when player holds mouse (for harmonicAtomic)
m.harmonic3Phase = () => { //normal standard 3 different 2-d circles
if (tech.isStandingWaveExpand) {
if (input.field) {
const oldHarmonicRadius = m.harmonicRadius
m.harmonicRadius = 0.985 * m.harmonicRadius + 0.015 * 2.5
m.energy -= 0.3 * (m.harmonicRadius - oldHarmonicRadius)
} else {
m.harmonicRadius = 0.998 * m.harmonicRadius + 0.002 * 1
}
}
const fieldRange1 = (0.7 + 0.3 * Math.sin(m.cycle / 23)) * m.fieldRange * m.harmonicRadius
const fieldRange2 = (0.63 + 0.37 * Math.sin(m.cycle / 37)) * m.fieldRange * m.harmonicRadius
const fieldRange3 = (0.65 + 0.35 * Math.sin(m.cycle / 47)) * m.fieldRange * m.harmonicRadius
const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3)
ctx.fillStyle = "rgba(110,170,200," + Math.min(0.73, (0.04 + m.energy * (0.11 + 0.13 * Math.random()))) + ")";
ctx.beginPath();
ctx.arc(m.pos.x, m.pos.y, fieldRange1, 0, 2 * Math.PI);
ctx.fill();
ctx.beginPath();
ctx.arc(m.pos.x, m.pos.y, fieldRange2, 0, 2 * Math.PI);
ctx.fill();
ctx.beginPath();
ctx.arc(m.pos.x, m.pos.y, fieldRange3, 0, 2 * Math.PI);
ctx.fill();
m.pushMobs360(netfieldRange);
}
m.harmonicAtomic = () => { //several ellipses spinning about different axises
const rotation = simulation.cycle * 0.002
const phase = simulation.cycle * 0.03
if (tech.isStandingWaveExpand) {
if (input.field) {
const oldHarmonicRadius = m.harmonicRadius
m.harmonicRadius = 0.985 * m.harmonicRadius + 0.015 * 2.5
m.energy -= 0.3 * (m.harmonicRadius - oldHarmonicRadius)
} else {
m.harmonicRadius = 0.998 * m.harmonicRadius + 0.002 * 1
}
}
const radius = m.fieldRange * m.harmonicRadius //+ 20 * Math.sin(m.cycle * 0.05)
ctx.lineWidth = 1;
ctx.strokeStyle = "rgba(110,170,200,0.9)"
ctx.fillStyle = "rgba(110,170,200," + Math.min(0.7, m.energy * (0.13 + 0.15 * Math.random()) * (3 / tech.harmonics)) + ")";
// ctx.fillStyle = "rgba(110,170,200," + Math.min(0.7, m.energy * (0.22 - 0.01 * tech.harmonics) * (0.5 + 0.5 * Math.random())) + ")";
for (let i = 0; i < tech.harmonics; i++) {
ctx.beginPath();
ctx.ellipse(m.pos.x, m.pos.y, radius * Math.abs(Math.sin(phase + i / tech.harmonics * Math.PI)), radius, rotation + i / tech.harmonics * Math.PI, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
}
m.pushMobs360(radius);
}
// m.harmonicSameAxis = () => { //several ellipses spinning about the same axis
// const radius = m.fieldRange
// const rotation = simulation.cycle * 0.025
// const phase = simulation.cycle * 0.031
// ctx.lineWidth = 1;
// ctx.fillStyle = "rgba(0,0,0,0.25)"
// ctx.strokeStyle = "#000"
// for (let i = 0, len = 4; i < len; i++) {
// ctx.beginPath();
// ctx.ellipse(m.pos.x, m.pos.y, radius * Math.abs(Math.sin(phase + i / len * Math.PI)), radius, rotation, 0, 2 * Math.PI);
// ctx.fill();
// ctx.stroke();
// }
// m.pushMobs360(radius);
// }
m.harmonicShield = m.harmonic3Phase
m.hold = function() {
if (m.isHolding) {
m.drawHold(m.holdingTarget);
@@ -1517,23 +1585,10 @@ const m = {
m.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
if (m.energy > 0.1 && m.fieldCDcycle < m.cycle) {
const fieldRange1 = (0.7 + 0.3 * Math.sin(m.cycle / 23)) * m.fieldRange
const fieldRange2 = (0.63 + 0.37 * Math.sin(m.cycle / 37)) * m.fieldRange
const fieldRange3 = (0.65 + 0.35 * Math.sin(m.cycle / 47)) * m.fieldRange
const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3)
ctx.fillStyle = "rgba(110,170,200," + Math.min(0.73, (0.04 + m.energy * (0.11 + 0.13 * Math.random()))) + ")";
ctx.beginPath();
ctx.arc(m.pos.x, m.pos.y, fieldRange1, 0, 2 * Math.PI);
ctx.fill();
ctx.beginPath();
ctx.arc(m.pos.x, m.pos.y, fieldRange2, 0, 2 * Math.PI);
ctx.fill();
ctx.beginPath();
ctx.arc(m.pos.x, m.pos.y, fieldRange3, 0, 2 * Math.PI);
ctx.fill();
m.pushMobs360(netfieldRange);
// m.pushBody360(netfieldRange); //can't throw block when pushhing blocks away
m.harmonicShield()
}
m.drawFieldMeter()
}
}

View File

@@ -4613,26 +4613,68 @@
//************************************************** field
//************************************************** tech
//**************************************************
// {
// name: "frequency resonance",
// description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>deflecting</strong> efficiency by <strong>50%</strong>",
// isFieldTech: true,
// maxCount: 9,
// count: 0,
// frequency: 2,
// allowed() {
// return m.fieldUpgrades[m.fieldMode].name === "standing wave harmonics"
// },
// requires: "standing wave harmonics",
// effect() {
// tech.frequencyResonance = this.count + 1 // +1 because count updates later
// m.fieldRange = 175 + 175 * 0.25 * tech.frequencyResonance
// m.fieldShieldingScale = Math.pow(0.5, tech.frequencyResonance)
// },
// remove() {
// m.fieldRange = 175;
// m.fieldShieldingScale = 1;
// tech.frequencyResonance = 0
// }
// },
{
name: "frequency resonance",
description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>deflecting</strong> efficiency by <strong>50%</strong>",
name: "spherical harmonics",
description: "<strong>standing wave</strong> oscillates in a 3rd dimension<br>increasing <strong>deflecting</strong> efficiency by <strong>40%</strong>",
isFieldTech: true,
maxCount: 9,
count: 0,
frequency: 4,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "standing wave harmonics"
},
requires: "standing wave harmonics",
effect() {
tech.harmonics++
m.fieldShieldingScale = Math.pow(0.6, (tech.harmonics - 2))
m.harmonicShield = m.harmonicAtomic
},
remove() {
tech.harmonics = 2
m.fieldShieldingScale = Math.pow(0.6, (tech.harmonics - 2))
m.harmonicShield = m.harmonic3Phase
}
},
{
name: "expansion",
description: "using <strong>standing wave</strong> field drains <strong class='color-f'>energy</strong><br>to temporarily <strong>expand</strong> its <strong>radius</strong>",
// description: "use <strong class='color-f'>energy</strong> to <strong>expand</strong> <strong>standing wave</strong><br>the field slowly <strong>contracts</strong> when not used",
isFieldTech: true,
maxCount: 1,
count: 0,
frequency: 2,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "standing wave harmonics"
},
requires: "standing wave harmonics",
effect() {
tech.frequencyResonance = this.count + 1 // +1 because count updates later
m.fieldRange = 175 + 175 * 0.25 * tech.frequencyResonance
m.fieldShieldingScale = Math.pow(0.5, tech.frequencyResonance)
tech.isStandingWaveExpand = true
},
remove() {
m.fieldRange = 175;
m.fieldShieldingScale = 1;
tech.frequencyResonance = 0
tech.isStandingWaveExpand = false
m.harmonicRadius = 1
}
},
{
@@ -6834,7 +6876,7 @@
droneCycleReduction: null,
droneEnergyReduction: null,
isNoHeals: null,
frequencyResonance: null,
// frequencyResonance: null,
isAlwaysFire: null,
isDroneRespawn: null,
deathSpawns: null,
@@ -6853,5 +6895,7 @@
isMACHO: null,
isHarmMACHO: null,
isSneakAttack: null,
isFallingDamage: null
isFallingDamage: null,
harmonics: null,
isStandingWaveExpand: null
}