Full base-building map against a live Stream bot holding The Algorithm behind a defended base. Building the Mastering Studio triggers a scripted all-in counterattack; silencing The Algorithm wins. Tick scan throttled to 1Hz. SIDE A is now three missions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
60 lines
1.6 KiB
Lua
60 lines
1.6 KiB
Lua
-- 03: THE DROP — finale.
|
|
|
|
CounterattackDone = false
|
|
Ticks = 0
|
|
|
|
WorldLoaded = function()
|
|
Mrp = Player.GetPlayer("Player")
|
|
Stream = Player.GetPlayer("Enemy")
|
|
InitObjectives(Mrp)
|
|
|
|
StudioObjective = Mrp.AddPrimaryObjective("build-the-studio")
|
|
AlgorithmObjective = Mrp.AddPrimaryObjective("silence-the-algorithm")
|
|
ShopObjective = Mrp.AddSecondaryObjective("keep-the-shop-standing")
|
|
|
|
Trigger.OnKilled(TheAlgorithm, function()
|
|
Mrp.MarkCompletedObjective(AlgorithmObjective)
|
|
end)
|
|
|
|
-- losing the HQ costs the secondary, not the mission
|
|
Trigger.OnKilled(TheVan, function()
|
|
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
|
local hq = Utils.Where(Map.ActorsInWorld, function(a)
|
|
return a.Owner == Mrp and a.Type == "popupshop"
|
|
end)
|
|
if #hq == 0 then
|
|
Mrp.MarkFailedObjective(ShopObjective)
|
|
end
|
|
end)
|
|
end)
|
|
end
|
|
|
|
Tick = function()
|
|
Ticks = Ticks + 1
|
|
-- once a second is plenty; scanning every actor every frame is wasteful
|
|
if Ticks % 25 ~= 0 then
|
|
return
|
|
end
|
|
if StudioObjective == nil or Mrp.IsObjectiveCompleted(StudioObjective) then
|
|
return
|
|
end
|
|
|
|
local studios = Utils.Where(Map.ActorsInWorld, function(a)
|
|
return a.Owner == Mrp and a.Type == "mastering"
|
|
end)
|
|
|
|
if #studios > 0 then
|
|
Mrp.MarkCompletedObjective(StudioObjective)
|
|
if not CounterattackDone then
|
|
CounterattackDone = true
|
|
Media.DisplayMessage(UserInterface.GetFluentMessage("it-heard-you"))
|
|
Media.PlaySpeechNotification(Mrp, "BaseAttack")
|
|
Utils.Do(Map.ActorsInWorld, function(a)
|
|
if a.Owner == Stream and a.HasProperty("Hunt") then
|
|
a.Hunt()
|
|
end
|
|
end)
|
|
end
|
|
end
|
|
end
|