Skip to content

Commit

Permalink
elduu flight
Browse files Browse the repository at this point in the history
  • Loading branch information
sayterdarkwynd committed Mar 20, 2020
1 parent b633b2b commit 1f358e5
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 24 deletions.
2 changes: 2 additions & 0 deletions items/active/raceEffectEnabler/raceEffectEnabler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ function activate(fireMode, shiftHeld)
player.makeTechAvailable("elduukharburst")
player.enableTech("elduukharburst")
player.equipTech("elduukharburst")
player.enableTech("flight_elduukhar")
player.equipTech("flight_elduukhar")
elseif self.species == "nightar" then
player.makeTechAvailable("nightarconshak")
player.enableTech("nightarconshak")
Expand Down
25 changes: 12 additions & 13 deletions species/elduukhar.raceeffect
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"stats": [
{ "stat": "protection", "amount": 2 },
{ "stat": "maxEnergy", "effectiveMultiplier": 1.10 },
{ "stat": "maxFood", "effectiveMultiplier": 1.30 },
{ "stat": "protection", "amount": 5 },
{ "stat": "poisonResistance", "amount": -0.2 },
{ "stat": "electricResistance", "amount": -0.2 },
{ "stat": "shadowResistance", "amount": 0.2 },
{ "stat": "fireResistance", "amount": 0.2 },
{ "stat": "iceResistance", "amount": 0.2 }
{ "stat": "shadowResistance", "amount": -0.1 },
{ "stat": "physicalResistance", "amount": 0.20 },
{ "stat": "iceResistance", "amount": 0.25 }
],
"diet" : "entity",
"envEffects": [
Expand All @@ -32,14 +31,14 @@
{
"biomes": "hot",
"stats": [
{ "stat": "maxHealth", "effectiveMultiplier": 1.25 },
{ "stat": "maxHealth", "effectiveMultiplier": 0.75 },
{ "stat": "protection", "effectiveMultiplier": 1.15 }
]
},
{
"biomes": "cold",
"stats": [
{ "stat": "maxHealth", "effectiveMultiplier": 0.75 },
{ "stat": "maxHealth", "effectiveMultiplier": 1.25 },
{ "stat": "protection", "effectiveMultiplier": 0.85 }
]
}
Expand All @@ -48,22 +47,22 @@
{
"weapons": [ "longsword", "axe", "greataxe" ],
"stats": [
{ "stat": "maxHealth", "effectiveMultiplier": 1.15 },
{ "stat": "protection", "effectiveMultiplier": 1.15 }
{ "stat": "maxHealth", "effectiveMultiplier": 1.12 },
{ "stat": "protection", "effectiveMultiplier": 1.12 }
]
},
{
"weapons": [ "whip", "chakram", "boomerang" ],
"stats": [
{ "stat": "powerMultiplier", "effectiveMultiplier": 1.20 },
{ "stat": "maxEnergy", "effectiveMultiplier": 1.15 }
{ "stat": "powerMultiplier", "effectiveMultiplier": 1.12 },
{ "stat": "maxEnergy", "effectiveMultiplier": 1.12 }
]
},
{
"weapons": [ "lunari" ],
"stats": [
{ "stat": "powerMultiplier", "effectiveMultiplier": 1.12 },
{ "stat": "maxEnergy", "effectiveMultiplier": 1.25 }
{ "stat": "maxEnergy", "effectiveMultiplier": 1.12 }
]
}
],
Expand All @@ -80,5 +79,5 @@
}
}
],
"tech" : [ "elduukharburst" ]
"tech" : [ "elduukharburst","flight_elduukhar" ]
}
20 changes: 10 additions & 10 deletions species/elduukhar.species.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
Diet: Can eat almost anything

^orange;Perks^reset;:
+^green;10%^reset; Energy, +^green;2^reset; Protection
+^green;5^reset; Protection
Advantages: When at 50% HP, emit slowing ice clouds. +30% Max Food
Resist: ^green;20%^reset; Fire, ^green;20%^reset; Shadow, ^green;20%^reset; Ice
Tech: ^green;Crystal Breath^reset;
Resist: ^green;25%^reset; Ice, ^green;20%^reset; Physical
Tech: ^green;Crystal Breath, Elduukhar Flight^reset;

^orange;Environment^reset;:
^green;Aether Sea, Crystal, Chromatic, Red Desert^reset; biomes increase health and crit dmg.
^green;Hot^reset; biomes increase ^green;15% protection^reset; and ^green;25% health^reset;.
^red;Cold^reset; biomes decrease ^red;15% protection^reset; and ^red;25% health^reset;.
^green;Hot^reset; biomes: +^green;15% protection^reset; and -^green;25% health^reset;.
^red;Cold^reset; biomes -^red;15% protection^reset; and +^red;25% health^reset;.

^orange;Weapons^reset;:
Longsword, Axe, Greataxe: +^green;20%^reset; max Health, +^green;15%^reset; Protection
Whip, Chakram, Boomerang: +^green;20%^reset; damage, +^green;15%^reset; Max Energy
Lunari: +^green;12%^reset; damage, +^green;25%^reset; Max Energy
Longsword, Axe, Greataxe: +^green;12%^reset; Max Health, +^green;12%^reset; Protection
Whip, Chakram, Boomerang: +^green;12%^reset; damage, +^green;12%^reset; Max Energy
Lunari: +^green;12%^reset; damage, +^green;12%^reset; Max Energy

^red;Weaknesses^reset;:
^red;High Food Cost^reset; for Crystal Breath attack.
Weak: ^red;20%^reset; Electric, ^red;20%^reset; Poison"
^red;High Food Cost^reset; for Crystal Breath attack and Flight.
Weak: ^red;20%^reset; Electric, ^red;20%^reset; Poison, ^red;10%^reset; Shadow"
}

]
Expand Down
2 changes: 1 addition & 1 deletion species/thelusian.species.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Diet: Carnivore

^orange;Perks^reset;:
+^green;20%^reset; Health, take ^green;-40%^reset; fall damage
+^green;15%^reset; Health, take ^green;-40%^reset; fall damage
Resist: ^green;15%^reset; Physical, ^green;20%^reset; Radiation, ^green;30%^reset; Shadow
Immune: Insanity
Tech: ^green;Warrior Instincts^reset;
Expand Down
42 changes: 42 additions & 0 deletions stats/effects/passive/elduukharflight.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function init()
self.species = world.entitySpecies(entity.id())
if not self.species == "elduukhar" then
effect.die()
end
self.healingRate = 1.01 / config.getParameter("healTime", 220)
hungerLevel = status.resource("food")
baseValue = config.getParameter("healthDown",0)*(status.resourceMax("food"))
self.tickTime = 1.0
self.tickTimePenalty = 5.0
self.tickTimer = self.tickTime
self.tickTimerPenalty = self.tickTimePenalty
end

function getLight()
local position = mcontroller.position()
position[1] = math.floor(position[1])
position[2] = math.floor(position[2])
local lightLevel = world.lightLevel(position)
lightLevel = math.floor(lightLevel * 100)
return lightLevel
end


function update(dt)
if status.isResource("food") then
self.foodValue = status.resource("food")
hungerLevel = status.resource("food")
else
self.foodValue = 50
hungerLevel = 50
end
baseValue = config.getParameter("healthDown",0)*(status.resourceMax("food"))
self.tickTimer = self.tickTimer - dt
self.tickTimerPenalty = self.tickTimerPenalty - dt
self.foodValue = status.resource("food")
end


function uninit()

end
14 changes: 14 additions & 0 deletions stats/effects/passive/elduukharflight.statuseffect
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name" : "elduukharflight",
"effectConfig" : {},
"defaultDuration" : 3,

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

"animationConfig" : "/tech/other/flighttest.animation",

"label" : "Elduukhar Flight",
"icon" : "/interface/statuses/flutter.png"
}
24 changes: 24 additions & 0 deletions tech/other/flight_elduukhar.tech
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name" : "flight_elduukhar",
"type" : "head",

"scripts" : ["flighttestelduukhar.lua"],
"animator" : "flighttest.animation",

"description" : "Moth flight. Best in light.^green;[F]^reset;.",
"shortDescription" : "Elduu'khar Flight",
"rarity" : "Legendary",
"icon" : "/items/active/raceEffectEnabler/raceeffectenabler.png",
"chipCost" : 1,
"energyCostPerSecond" : 1.30,

"maxFallSpeed" : -5,
"removesFallDamage" : 1,
"fallingParameters" : {
"gravityMultiplier" : -0.025,
"airForce" : 35,
"runSpeed" : 15,
"walkSpeed" : 15,
"flySpeed" : 15
}
}
152 changes: 152 additions & 0 deletions tech/other/flighttestelduukhar.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
require "/scripts/vec2.lua"

function init()
self.energyCostPerSecond = config.getParameter("energyCostPerSecond")
self.active=false
self.available = true
self.species = world.entitySpecies(entity.id())
self.timer = 0
self.boostSpeed = 8
self.active=false
self.available = true
self.forceDeactivateTime = 3
end

function uninit()
animator.stopAllSounds("activate")
status.clearPersistentEffects("glide")
animator.setParticleEmitterActive("feathers", false)
end

function checkFood()
if status.isResource("food") then
self.foodValue = status.resource("food")
else
self.foodValue = 15
end
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
end

function update(args)
if not self.specialLast and args.moves["special1"] then --toggle on
attemptActivation()
end

self.specialLast = args.moves["special1"]

if not args.moves["special1"] then
self.forceTimer = nil
end

if status.resource("energy") < 1 then
deactivate()
end

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"]
self.rightVal = args.moves["left"]
self.runVal = args.moves["run"]

--enable air physics
mcontroller.controlParameters(config.getParameter("fallingParameters"))
mcontroller.setYVelocity(math.max(mcontroller.yVelocity(), config.getParameter("maxFallSpeed")))

-- boost in direction pressed
local direction = {0, 0} -- set default
if self.upVal then direction[2] = direction[2] + 1 end
if self.downVal then direction[2] = direction[2] - 1 end
if self.leftVal then direction[1] = direction[1] + 1 end
if self.rightVal then direction[1] = direction[1] - 1 end

self.boostSpeed = self.boostSpeed + args.dt
boost(direction)
if vec2.eq(direction, {0, 0}) then
direction = {0, 0}
end
mcontroller.controlApproachVelocity(self.boostVelocity, 30)
-- end boost

if self.foodValue > 15 then
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 = "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.setPersistentEffects("glide", {
{stat = "fallDamageResistance", effectiveMultiplier = 1.65}
})
else
status.overConsumeResource("energy", 0.65)
status.setPersistentEffects("glide", {
{stat = "fallDamageResistance", effectiveMultiplier = 1.65}
})
end

end
checkForceDeactivate(args.dt) -- force deactivation
end
end

function attemptActivation()
if not self.active then
activate()
elseif self.active then
deactivate()
if not self.forceTimer then
self.forceTimer = 0
end
end
end

function checkForceDeactivate(dt)
if self.forceTimer then
self.forceTimer = self.forceTimer + dt
if self.forceTimer >= self.forceDeactivateTime then
deactivate()
self.forceTimer = nil
else
attemptActivation()
end
return true
else
return false
end
end

function activate()
if not self.active then
animator.playSound("activate")
end
self.active = true
end

function deactivate()
if self.active then
status.clearPersistentEffects("glide")
animator.setParticleEmitterActive("feathers", false)
self.boostSpeed = 8
status.addEphemeralEffects{{effect = "nofalldamage", duration = 2}}
end
self.active = false
end

0 comments on commit 1f358e5

Please sign in to comment.