Skip to content

Commit

Permalink
elduu flight tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
sayterdarkwynd committed Mar 20, 2020
1 parent 1f358e5 commit 1e79c3e
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 17 deletions.
26 changes: 26 additions & 0 deletions stats/effects/flightRecharge/flightRecharge.animation
Original file line number Diff line number Diff line change
@@ -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" ]
}
}
11 changes: 11 additions & 0 deletions stats/effects/flightRecharge/flightRecharge.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function init()
effect.setParentDirectives("fade=FFFFEE=0.15")
end

function update(dt)

end

function uninit()

end
12 changes: 12 additions & 0 deletions stats/effects/flightRecharge/flightRecharge.statuseffect
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name" : "flightRecharge",

"effectConfig" : {},
"defaultDuration" : 0.15,

"scripts" : [
"flightRecharge.lua"
],

"animationConfig" : "flightRecharge.animation"
}
6 changes: 3 additions & 3 deletions tech/other/flight_elduukhar.tech
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"fallingParameters" : {
"gravityMultiplier" : -0.025,
"airForce" : 35,
"runSpeed" : 15,
"walkSpeed" : 15,
"flySpeed" : 15
"runSpeed" : 35,
"walkSpeed" : 35,
"flySpeed" : 35
}
}
61 changes: 47 additions & 14 deletions tech/other/flighttestelduukhar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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"]
Expand All @@ -77,34 +100,44 @@ 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}
})
end

end
checkForceDeactivate(args.dt) -- force deactivation
else
checkFood()
self.fuelTimer = self.fuelTimer + 1 -- when not active, the stamina to fly regenerates.
end
end

Expand Down

0 comments on commit 1e79c3e

Please sign in to comment.