Polish Team Deathmatch streaks and comeback hints
This commit is contained in:
1 parent
7a1c80c22a
commit
6bb5fba771
8 files changed
+56
-4
No files matched your search
BIN
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
--!strict
|
||||
local rs=game:GetService("ReplicatedStorage")
|
||||
local H=require(rs.Hunter.Hints)
|
||||
local Rules=require(rs.Hunter.TeamDeathmatchRules)
|
||||
local S=require(rs.Hunter.Strings).teamDeathmatch
|
||||
return {candidates=function(match: Instance, player: Player): {H.Hint}
|
||||
if match:GetAttribute("RoundStage")~="FinalPush" then return {} end
|
||||
local own=player:GetAttribute("ArenaTeam")
|
||||
if own~="Blue" and own~="Orange" then return {} end
|
||||
local rival=if own=="Blue" then "Orange" else "Blue"
|
||||
local n=Rules.chaseGap((match:GetAttribute(own.."Score") :: number?) or 0,(match:GetAttribute(rival.."Score") :: number?) or 0)
|
||||
if n then return {{key="tdm_gap",text=string.format(S.chase,n),priority=60,ttl=.4}} end
|
||||
return {}
|
||||
end}
|
||||
@@ -62,6 +62,12 @@ local function event(kind: string, p: any)
|
||||
elseif p.side == player:GetAttribute("ArenaTeam") then S.flagHints.picked else S.flagHints.enemyPicked
|
||||
bannerUntil = workspace:GetServerTimeNow() + 2.7
|
||||
end
|
||||
if id == "TeamDeathmatch" and kind == Kinds.Streak then
|
||||
contour:SetAttribute("Accent",tone)
|
||||
title.Text=string.format(S.teamDeathmatch.streak,p.text or "",p.value or 0)
|
||||
bannerUntil=workspace:GetServerTimeNow()+2.7
|
||||
if p.userId~=player.UserId then Sounds.sound("RoundStart") end
|
||||
end
|
||||
if id == "HuntLeader" and (kind == Kinds.LeaderAssigned or kind == Kinds.LeaderDown) then
|
||||
local now=workspace:GetServerTimeNow()
|
||||
if kind == Kinds.LeaderDown or now>=bannerUntil then
|
||||
|
||||
@@ -77,6 +77,10 @@ local leaderHints = table.freeze({
|
||||
self="Вы лидер — за вас дают 3 очка.", ally="Прикройте лидера: %s", enemy="Лидер соперников: %s",
|
||||
new="НОВЫЙ ЛИДЕР · %s", down="ЛИДЕР УСТРАНЁН +3",
|
||||
})
|
||||
local teamDeathmatch = table.freeze({
|
||||
chase="Отставание %d — время рисковать!",
|
||||
streak="%s · СЕРИЯ %d",
|
||||
})
|
||||
local function flagCarrier(name: string): string return name .. " несёт флаг" end
|
||||
local round = table.freeze({
|
||||
mode = "РЕЖИМ", fight = "В БОЙ!", final = "ФИНАЛЬНЫЙ РЫВОК", swap = "СМЕНА РОЛЕЙ",
|
||||
@@ -114,6 +118,7 @@ return table.freeze({
|
||||
trophyHints = trophyHints,
|
||||
lifeHints = lifeHints,
|
||||
leaderHints = leaderHints,
|
||||
teamDeathmatch = teamDeathmatch,
|
||||
hint = table.freeze({Siege = siegeHints}),
|
||||
team = team, clock = clock,
|
||||
bases = table.freeze({Blue = "БАЗА СИНИХ", Orange = "БАЗА ОРАНЖЕВЫХ"}),
|
||||
@@ -150,5 +155,6 @@ return table.freeze({
|
||||
TokensBanked = function(p: any) return string.format("%s сдали жетоны ×%d", team(p.side), p.value or 0) end,
|
||||
LeaderDown = function(p: any) return team(p.side) .. " устранили лидера (+3)" end,
|
||||
RoleSwap = function(_: any) return "Команды меняются ролями" end,
|
||||
Streak = function(p: any) return string.format(teamDeathmatch.streak,p.text or "Игрок",p.value or 0) end,
|
||||
}),
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
--!strict
|
||||
local Rules={}
|
||||
local STREAK={[3]=true,[5]=true,[7]=true}
|
||||
local CHASE_GAP=5
|
||||
function Rules.announce(kills: number): boolean
|
||||
return STREAK[kills]==true
|
||||
end
|
||||
function Rules.chaseGap(own: number, rival: number): number?
|
||||
local gap=rival-own
|
||||
return if gap>=CHASE_GAP then gap else nil
|
||||
end
|
||||
return table.freeze(Rules)
|
||||
@@ -1,11 +1,19 @@
|
||||
--!strict
|
||||
local Types = require(script.Parent.Parent.Types)
|
||||
local Common = require(script.Parent.Parent.Common)
|
||||
local Hunter=game.ReplicatedStorage.Hunter
|
||||
local Rules=require(Hunter.TeamDeathmatchRules)
|
||||
local Kinds=require(Hunter.EventKinds)
|
||||
|
||||
local function start(ctx: Types.ModeContext): Types.ModeInstance
|
||||
return Common.instance(ctx, {kill = function(player: Player)
|
||||
local side = Common.sideOf(player)
|
||||
if side then ctx.scoring.add(side, 1, "Elimination", player) end
|
||||
if not side then return end
|
||||
ctx.scoring.add(side, 1, "Elimination", player)
|
||||
local streak=player:GetAttribute("StreakKills")
|
||||
if typeof(streak)=="number" and Rules.announce(streak) then
|
||||
ctx.events.fire(Kinds.Streak,{side=side,userId=player.UserId,text=player.DisplayName,value=streak})
|
||||
end
|
||||
end})
|
||||
end
|
||||
|
||||
|
||||
@@ -75,13 +75,13 @@ local function recordArenaKill(player: Player, victim: Player, origin: Vector3,
|
||||
Stats.add(player, "kills", 1)
|
||||
player:SetAttribute("RoundKills", ((player:GetAttribute("RoundKills") :: number?) or 0) + 1)
|
||||
state:SetAttribute(scoreAttribute, ((state:GetAttribute(scoreAttribute) :: number?) or 0) + 1)
|
||||
local streak = ((player:GetAttribute("StreakKills") :: number?) or 0) + 1
|
||||
player:SetAttribute("StreakUntil", now + (round:GetAttribute("StreakWindow") :: number))
|
||||
player:SetAttribute("StreakKills", streak)
|
||||
local match = Objectives.current(mode)
|
||||
if match then match.kill(player, victim, origin, now) end
|
||||
TrophyDrops.spawn(player, origin)
|
||||
PowerDrops.spawn(origin, nil, mode)
|
||||
local streak = ((player:GetAttribute("StreakKills") :: number?) or 0) + 1
|
||||
player:SetAttribute("StreakUntil", now + (round:GetAttribute("StreakWindow") :: number))
|
||||
player:SetAttribute("StreakKills", streak)
|
||||
return streak
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
--!strict
|
||||
return function(rules: any)
|
||||
for i=0,9 do assert(rules.announce(i)==(i==3 or i==5 or i==7)) end
|
||||
assert(rules.chaseGap(10,14)==nil and rules.chaseGap(10,15)==5)
|
||||
assert(rules.chaseGap(0,17)==17 and rules.chaseGap(8,1)==nil)
|
||||
end
|
||||
Reference in new issue
Block a user