From 1e79c3e94faa89955ba302036b71e6f9df49ad57 Mon Sep 17 00:00:00 2001 From: sayterdarkwynd Date: Fri, 20 Mar 2020 14:52:23 -0400 Subject: [PATCH] elduu flight tuning --- .../flightRecharge/flightRecharge.animation | 26 ++++++++ .../effects/flightRecharge/flightRecharge.lua | 11 ++++ .../flightRecharge.statuseffect | 12 ++++ tech/other/flight_elduukhar.tech | 6 +- tech/other/flighttestelduukhar.lua | 61 ++++++++++++++----- 5 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 stats/effects/flightRecharge/flightRecharge.animation create mode 100644 stats/effects/flightRecharge/flightRecharge.lua create mode 100644 stats/effects/flightRecharge/flightRecharge.statuseffect diff --git a/stats/effects/flightRecharge/flightRecharge.animation b/stats/effects/flightRecharge/flightRecharge.animation new file mode 100644 index 00000000..9eeb3f99 --- /dev/null +++ b/stats/effects/flightRecharge/flightRecharge.animation @@ -0,0 +1,26 @@ +{ + "particleEmitters" : { + "sparks" : { + "enabled" : true, + "emissionRate" : 5.0, + "particles" : [ + { + "particle" : "electricswoosh1" + }, + { + "particle" : "electricswoosh2" + } + ] + } + }, + "lights" : { + "glow" : { + "active" : true, + "position" : [0, 0], + "color" : [100, 50, 150] + } + }, + "sounds" : { + "bolt" : [ "/sfx/projectiles/electric_barrier_shock1.ogg" ] + } +} \ No newline at end of file diff --git a/stats/effects/flightRecharge/flightRecharge.lua b/stats/effects/flightRecharge/flightRecharge.lua new file mode 100644 index 00000000..f25d5896 --- /dev/null +++ b/stats/effects/flightRecharge/flightRecharge.lua @@ -0,0 +1,11 @@ +function init() + effect.setParentDirectives("fade=FFFFEE=0.15") +end + +function update(dt) + +end + +function uninit() + +end diff --git a/stats/effects/flightRecharge/flightRecharge.statuseffect b/stats/effects/flightRecharge/flightRecharge.statuseffect new file mode 100644 index 00000000..4ef9250a --- /dev/null +++ b/stats/effects/flightRecharge/flightRecharge.statuseffect @@ -0,0 +1,12 @@ +{ + "name" : "flightRecharge", + + "effectConfig" : {}, + "defaultDuration" : 0.15, + + "scripts" : [ + "flightRecharge.lua" + ], + + "animationConfig" : "flightRecharge.animation" +} diff --git a/tech/other/flight_elduukhar.tech b/tech/other/flight_elduukhar.tech index 5a36f215..aad28d48 100644 --- a/tech/other/flight_elduukhar.tech +++ b/tech/other/flight_elduukhar.tech @@ -17,8 +17,8 @@ "fallingParameters" : { "gravityMultiplier" : -0.025, "airForce" : 35, - "runSpeed" : 15, - "walkSpeed" : 15, - "flySpeed" : 15 + "runSpeed" : 35, + "walkSpeed" : 35, + "flySpeed" : 35 } } diff --git a/tech/other/flighttestelduukhar.lua b/tech/other/flighttestelduukhar.lua index d8752d40..1793226d 100644 --- a/tech/other/flighttestelduukhar.lua +++ b/tech/other/flighttestelduukhar.lua @@ -6,10 +6,12 @@ function init() self.available = true self.species = world.entitySpecies(entity.id()) self.timer = 0 - self.boostSpeed = 8 + self.boostSpeed = 12 self.active=false self.available = true self.forceDeactivateTime = 3 + self.fuelTimer = 0 --failsafe value. default to no stamina so elduukhar have to wait before they can fly. + self.soundTimer = 60 end function uninit() @@ -19,21 +21,43 @@ function uninit() end function checkFood() - if status.isResource("food") then - self.foodValue = status.resource("food") + -- make sure flight stamina never exceeds limits + if not self.fuelTimer then self.fuelTimer = 0 end + if self.fuelTimer == 300 then + animator.playSound("recharge") + status.addEphemeralEffects{{effect = "flightRecharge", duration = 0.15}} + animator.setParticleEmitterActive("feathers", true) + self.soundTimer = 60 else - self.foodValue = 15 + animator.setParticleEmitterActive("feathers", false) + self.soundTimer = 60 + end + if self.fuelTimer < 0 then + self.fuelTimer = 0 + end + if self.fuelTimer > 300 then + self.fuelTimer = 300 end + -- end flight stamina check end function boost(direction) self.boostVelocity = vec2.mul(vec2.norm(direction), self.boostSpeed) - if self.boostSpeed > 25 then -- prevent super-rapid movement - self.boostSpeed = 25 - end + if self.boostSpeed > 55 then -- prevent super-rapid movement + self.boostSpeed = 55 + end end function update(args) + + --fuel stamina check + --sb.logInfo(self.fuelTimer) + if self.soundTimer <= 0 then --sound effect timer for flight timer + self.soundTimer = 60 + else + self.soundTimer = self.soundTimer - 1 + end + if not self.specialLast and args.moves["special1"] then --toggle on attemptActivation() end @@ -51,7 +75,6 @@ function update(args) if self.active and status.overConsumeResource("energy", 0.0001) and not mcontroller.zeroG() and not mcontroller.liquidMovement() then -- do we have energy and the ability is active? checkFood() status.addEphemeralEffects{{effect = "elduukharflight", duration = 2}} - self.upVal = args.moves["up"] --set core movement variables self.downVal = args.moves["down"] self.leftVal = args.moves["right"] @@ -77,27 +100,34 @@ function update(args) mcontroller.controlApproachVelocity(self.boostVelocity, 30) -- end boost - if self.foodValue > 15 then + -- stamina cost for flight, based on current speed / 100, plus a modifier value + self.fuelCostLesser = ((self.boostSpeed/100) + 0.01) - config.getParameter("bonusFlightTime",0) + self.fuelCostGreater = ((self.boostSpeed/100) + 0.05) - config.getParameter("bonusFlightTime",0) + self.fuelCostExhausted = ((self.boostSpeed/100) + 0.55) - config.getParameter("bonusFlightTime",0) + + if self.fuelTimer < 0 then self.fuelTimer = 0 end + if self.fuelTimer > 0 then + self.fuelTimer = self.fuelTimer - 1 + status.overConsumeResource("energy", self.fuelCostGreater) if self.runVal and not self.downVal and not self.leftVal and not self.rightVal and not self.upVal then status.setPersistentEffects("glide", { - {stat = "gliding", amount = 1}, + --{stat = "gliding", amount = 1}, {stat = "fallDamageResistance", effectiveMultiplier = 1.65} }) else status.setPersistentEffects("glide", { {stat = "gliding", amount = 0}, - {stat = "foodDelta", amount = -5}, {stat = "fallDamageResistance", effectiveMultiplier = 1.65} - }) + }) end else if self.runVal and not self.downVal and not self.leftVal and not self.rightVal and not self.upVal then - status.overConsumeResource("energy", 0.01) + status.overConsumeResource("energy", self.fuelCostLesser) status.setPersistentEffects("glide", { {stat = "fallDamageResistance", effectiveMultiplier = 1.65} }) else - status.overConsumeResource("energy", 0.65) + status.overConsumeResource("energy", self.fuelCostExhausted) status.setPersistentEffects("glide", { {stat = "fallDamageResistance", effectiveMultiplier = 1.65} }) @@ -105,6 +135,9 @@ function update(args) end checkForceDeactivate(args.dt) -- force deactivation + else + checkFood() + self.fuelTimer = self.fuelTimer + 1 -- when not active, the stamina to fly regenerates. end end