bug fixes

This commit is contained in:
landgreen
2020-07-15 11:12:51 -07:00
parent cef5f4d8d0
commit c63d0ac5f0
8 changed files with 73 additions and 59 deletions

View File

@@ -973,19 +973,19 @@ const mobs = {
if (!this.isShielded || isBypassShield) {
dmg *= mod.damageFromMods()
//mobs specific damage changes
dmg /= Math.sqrt(this.mass)
if (this.shield) dmg *= 0.05
if (mod.isFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
if (this.shield) dmg *= 0.05
//energy and heal drain should be calculated after damage boosts
if (mod.energySiphon && dmg !== Infinity) {
if (mod.energySiphon && dmg !== Infinity && this.dropPowerUp) {
mech.energy += Math.min(this.health, dmg) * mod.energySiphon
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy
}
if (mod.healthDrain && dmg !== Infinity) {
if (mod.healthDrain && dmg !== Infinity && this.dropPowerUp) {
mech.addHealth(Math.min(this.health, dmg) * mod.healthDrain)
if (mech.health > mech.maxHealth) mech.health = mech.maxHealth
}
dmg /= Math.sqrt(this.mass)
this.health -= dmg
//this.fill = this.color + this.health + ')';
this.onDamage(dmg); //custom damage effects