Polish Hot Point progress and guidance
This commit is contained in:
1 parent
d3648c485b
commit
522344e34b
9 files changed
+88
-16
No files matched your search
@@ -0,0 +1,8 @@
|
||||
--!strict
|
||||
local Credit = {}
|
||||
function Credit.advance(value: number, elapsed: number, underFire: number, decay: number, speed: number, contested: boolean): number
|
||||
if underFire > 0 then value = math.max(0, value - underFire * decay) end
|
||||
if not contested then value += (elapsed - underFire) * speed end
|
||||
return value
|
||||
end
|
||||
return table.freeze(Credit)
|
||||
@@ -9,6 +9,8 @@ local Sites = require(Runtime.Parent.ArenaObjectiveSites)
|
||||
|
||||
local function start(ctx: Types.ModeContext): Types.ModeInstance
|
||||
local path = Sites.hotPath(ctx.arena, assert(ctx.map), HotPoint.Radius)
|
||||
local nowAt = ctx.liveAt
|
||||
local wasContested = false
|
||||
local capture = HotPoint.start({
|
||||
state = ctx.state, geometry = ctx.geometry, sites = path, startedAt = ctx.liveAt,
|
||||
marker = function(site)
|
||||
@@ -17,12 +19,21 @@ local function start(ctx: Types.ModeContext): Types.ModeInstance
|
||||
end,
|
||||
score = function(side, points)
|
||||
ctx.scoring.add(side, points, Kinds.ZoneCaptured)
|
||||
ctx.events.fire(Kinds.ZoneCaptured, {side = side, text = Strings.hotPoint})
|
||||
ctx.events.fire(Kinds.ZoneCaptured, {side = side, text = Strings.hotPoint, value = nowAt - ctx.liveAt})
|
||||
end,
|
||||
status = ctx.status, contribute = ctx.contribute,
|
||||
})
|
||||
return Common.instance(ctx, {
|
||||
step = function(now, dt, fighters, elapsed) capture.step(fighters, now, elapsed or dt); return false end,
|
||||
step = function(now, dt, fighters, elapsed)
|
||||
nowAt = now
|
||||
capture.step(fighters, now, elapsed or dt)
|
||||
local contested = ctx.state:GetAttribute("HotPointPhase") == "Contested"
|
||||
if contested and not wasContested then
|
||||
ctx.events.fire(Kinds.ZoneContested, {text = Strings.hotPoint})
|
||||
end
|
||||
wasContested = contested
|
||||
return false
|
||||
end,
|
||||
hit = capture.hit, death = capture.death, leaving = capture.death, destroy = capture.destroy,
|
||||
})
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user