From 69fff893ee8f7830b1c9bcf65f6b3566ce058b64 Mon Sep 17 00:00:00 2001 From: Zachary Dziura Date: Mon, 12 Sep 2016 15:29:13 -0400 Subject: [PATCH] Migrated Empathing over to new actions system This new system shall run off of GMCP, rather than pulling information from the prompt. Thus far, Empathing seems to work. --- Dreadnought.xml | 967 +++++++++++++++++++++++------------------------- 1 file changed, 461 insertions(+), 506 deletions(-) diff --git a/Dreadnought.xml b/Dreadnought.xml index 11be126..b6a345d 100644 --- a/Dreadnought.xml +++ b/Dreadnought.xml @@ -17,46 +17,6 @@ #000000 - - Prompt - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - ^\[\d+\-hull, \d+\-power, \w+ damage, \d+\-will \*(\w+)?\*\]$ - - - 1 - - - Module Balance - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - x - - - 3 - - - Locking/Unlocking @@ -77,9 +37,13 @@ @@ -94,10 +58,10 @@ send("\n") #000000 #000000 - You step up to the command chair, locking yourself into the module and linking your mind to the controls of the ship. After a moment, you begin to sense your command of the module in your own brain. + ^You step up to the command (\w+), locking yourself into the module and linking your mind to the controls of the ship\. After a moment, you begin to sense your command of the module in your own brain\.$ - 3 + 1 @@ -105,9 +69,13 @@ send("\n") +send("config shipsight 0", false) +send("config aethermap off", false) + +local reset = dreadnought.pilot.reset() +dreadnought.aetherbeastsTotal = reset.aetherbeastsTotal +dreadnought.currentModule = reset.currentModule +dreadnought.pilot = reset.pilot 0 39 0 @@ -130,14 +98,19 @@ dreadnought.pilot.reset() +send("\n") +deleteLineP() + +send("grid modules") 0 99 0 @@ -149,19 +122,23 @@ send("\n") #000000 #000000 - You step up to the empathic grid, locking yourself into the module and linking your mind to the controls of the ship. After a moment, you begin to sense your command of the module in your own brain. + ^You step up to the empathic (\w+), locking yourself into the module and linking your mind to the controls of the ship\. After a moment, you begin to sense your command of the module in your own brain\.$ - 3 + 1 Grid Unlocked +send("config shipsight 0", false) +send("config aethermap off", false) + +local reset = dreadnought.reset.empath() +dreadnought.aetherbeastsTotal = reset.aetherbeastsTotal +dreadnought.currentModule = "" +dreadnought.empath = reset.empath 0 39 0 @@ -183,14 +160,18 @@ dreadnought.empath.reset() Turret Locked +send("p turret", false) 0 39 0 @@ -202,10 +183,10 @@ send("p turret") #000000 #000000 - You step up to a battle turret, locking yourself into the module and linking your mind to the controls of the ship. After a moment, you begin to sense your command of the module in your own brain. + ^You step up to a battle (\w+), locking yourself into the module and linking your mind to the controls of the ship\. After a moment, you begin to sense your command of the module in your own brain\.$ - 3 + 1 @@ -214,8 +195,10 @@ send("p turret") disableTrigger("Combateer") disableTrigger("Targetting - Auto") disableTrigger("Targetting - Callout") -send("config shipsight 0") -send("config aethermap off") +send("config shipsight 0", false) +send("config aethermap off", false) + +dreadnought.currentModule = "" 0 0 0 @@ -239,8 +222,10 @@ send("config aethermap off") enableTrigger("Collector") disableTrigger("Siphoning - Auto") disableTrigger("Siphoning - Callout") -send("config shipsight 0") -send("config aethermap off") +send("config shipsight 0", false) +send("config aethermap off", false) + +dreadnought.currentModule = matches[2] 0 39 0 @@ -252,10 +237,10 @@ send("config aethermap off") #000000 #000000 - You step up to an energy collector, locking yourself into the module and linking your mind to the controls of the ship. After a moment, you begin to sense your command of the module in your own brain. + ^You step up to an energy (\w+), locking yourself into the module and linking your mind to the controls of the ship\. After a moment, you begin to sense your command of the module in your own brain\.$ - 3 + 1 @@ -264,8 +249,10 @@ send("config aethermap off") disableTrigger("Collector") disableTrigger("Siphoning - Auto") disableTrigger("Siphoning - Callout") -send("config shipsight 0") -send("config aethermap off") +send("config shipsight 0", false) +send("config aethermap off", false) + +dreadnought.currentModule = "" 0 0 0 @@ -672,63 +659,6 @@ resetFormat() #000000 - - Grid Setup - - 0 - 0 - 1 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - ^"(\D+)(\d+)"\s+(?:\w+\s){3}\s+\d+\%\ \/\ \w+ damage - - - 1 - - - Finish Setup - - 0 - 39 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - return isPrompt() - - - 4 - - - Repairing @@ -761,8 +691,7 @@ dmsg("The empathic grid is set up and ready for your control.") Damaged - + 0 0 0 @@ -794,8 +723,8 @@ dreadnought.repairShip(dreadnought.balance, dreadnought.empath.commands) Repaired - 0 0 @@ -815,12 +744,52 @@ end - - Module - + + Repair + 0 0 - 0 + 1 #ff0000 @@ -828,75 +797,27 @@ end #000000 #000000 - - + + "(\D+)(\d+)"\s+(?:\w+\s?){3}\s+\d+\% \/ (\w+) damage(?: \[(\w+)\])?(?: (PARASITE)\!)? + + + 1 + - Damaged - - 0 - 0 - 1 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - ^"(\D+)(\d+)"\s+(?:\w+\s){3}\s+\d+\%\ \/\ (\w+) damage - - - 1 - - - End Damaged - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - return isPrompt() - - - 4 - - - - - Repaired - 0 0 @@ -909,18 +830,46 @@ end #000000 #000000 - ^Crackling energy surges to \w+ \w+ (\w+), fully healing it\.$ + return isPrompt() - 1 + 4 - + + + Repairing + + 0 + 0 + 0 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + ^Crackling energy surges to (?:\w+\s){2}(\w+), (\w+) healing it\.$ + As you attempt to operate the empathic grid, it sputters and gyrates without producing a noticeable result. + + + 1 + 3 + + Already Repaired +dreadnought.heap.extract(dreadnought.actions).postCommand() +dreadnought.repairShip(dreadnought.actions) 0 0 0 @@ -941,123 +890,6 @@ dreadnought.repairShip(dreadnought.balance, dreadnought.empath.commands) - - Slivvens - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - - - Infected - - 0 - 39 - 0 - slvCheck - - #ff0000 - #5500ff - - #000000 - #000000 - - I have been infested by an aetheretic slivven!"$ - ^\(Ship\): (\w+) says, \"Check.\"$ - - - 1 - 1 - - - - Slivven Check - - 0 - 0 - 100 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - "chair - - - 2 - - - Found Slivven - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - ^"(\D+)\d+"\s+(?:\w+\s){3}\s+\d+% \/ \w+ damage\s?(?:\[(\w+)\])?\sPARASITE\!$ - - - 1 - - - - Finish Slivven Check - - 0 - 99 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - return isPrompt() - - - 4 - - - - Clarity @@ -1076,9 +908,10 @@ disableTrigger("Slivven Check") Call 0 99 @@ -1091,7 +924,7 @@ end #000000 #000000 - ^\(Ship\): (\w+) says, \"Clarity.\"$ + ^\(Ship\): \w+ (?:say|says), \"Clarity.\"$ 1 @@ -1100,9 +933,10 @@ end Emergency 0 0 @@ -1123,11 +957,13 @@ end Finish - +if action.name == "emergency clarity" or action == "clarity" then + dreadnought.heap.extract(dreadnought.actions) +end + +action.postCommand() 0 0 0 @@ -1150,8 +986,8 @@ end Aetherbeast Dead 0 0 @@ -1172,9 +1008,9 @@ end - Grid Balance - + Slivven Check + 0 0 0 @@ -1186,12 +1022,68 @@ dreadnought.repairShip(dreadnought.balance, dreadnought.empath.commands)#000000 #000000 - The empathic grid whirrs quietly, ready to be used once again. + ^\(Ship\): \w+ (?:say|says), "Check\."$ - 3 + 1 + + Grid Setup + + 0 + 0 + 1 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + ^"(\D+)(\d+)"\s+(?:\w+\s){3}\s+\d+\%\ \/\ \w+ damage + + + 1 + + + End Setup + + 0 + 0 + 0 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + return isPrompt() + + + 4 + + + Combateer @@ -1485,9 +1377,11 @@ end #000000 You focus your turret on the fabric of aetherspace itself and fire, ripping open a gaping vortex. + A focused blast rips through the fabric of aetherspace, ripping open a gaping vortex. 3 + 3 @@ -2344,20 +2238,15 @@ end Grid Repair - + ^gr(?: (reset))?$ Slivven Check - @@ -2365,8 +2254,9 @@ send("grid modules") Clarity - + ^gc$ @@ -2377,6 +2267,7 @@ dreadnought.repairShip() local resets = dreadnought.reset.empath() dreadnought.aetherbeastsTotal = resets.aetherbeastsTotal + dreadnought.currentModule = "grid" dreadnought.empath = resets.empath dmsg("All empath variables have been reset.") else @@ -2500,17 +2391,20 @@ dmsg("All Dreadnought reflexes have been disabled.") Dreadnought Data Structures - + return x.priority >= y.priority end -dreadnought.ds.heap = { +local exch = function(h, x, y) + assert(type(x) == "number") + assert(type(y) == "number") + + local temp = h.elements[x] + h.elements[x] = h.elements[y] + h.elements[y] = temp +end + +local sink = function(h, parentIndex) + local N = h.size + + while (parentIndex*2) <= N do + local childIndex = parentIndex * 2 + + if childIndex < N and lowerPriority(h.elements[childIndex], + h.elements[childIndex+1]) then + childIndex = childIndex + 1 + end + + if not lowerPriority(h.elements[parentIndex], h.elements[childIndex]) then + break + else + exch(h, parentIndex, childIndex) + parentIndex = childIndex + end + end +end + +local swim = function(h, childIndex) + while childIndex > 1 and lowerPriority(h.elements[math.floor(childIndex/2)], + h.elements[childIndex]) do + local parentIndex = math.floor(childIndex / 2) + exch(h, childIndex, parentIndex) + childIndex = parentIndex + end +end + +dreadnought.heap = { new = function() return { size = 0, @@ -2533,57 +2465,19 @@ dreadnought.ds.heap = { } end, - _exch = function(h, x, y) - assert(type(x) == "number") - assert(type(y) == "number") - - local temp = h.elements[x] - h.elements[x] = h.elements[y] - h.elements[y] = temp - end, - - _sink = function(h, parentIndex) - local N = h.size - - while (parentIndex*2) <= N do - local childIndex = parentIndex * 2 - - if childIndex < N and lowerPriority(h.elements[childIndex], - h.elements[childIndex+1]) then - childIndex = childIndex + 1 - end - - if not lowerPriority(h.elements[parentIndex], h.elements[childIndex]) then - break - else - dreadnought.ds.heap._exch(h, parentIndex, childIndex) - parentIndex = childIndex - end - end - end, - - _swim = function(h, childIndex) - while childIndex > 1 and lowerPriority(h.elements[math.floor(childIndex/2)], - h.elements[childIndex]) do - local parentIndex = math.floor(childIndex / 2) - dreadnought.ds.heap._exch(h, childIndex, parentIndex) - childIndex = parentIndex - end - end, - insert = function(h, element) table.insert(h.elements, element) h.size = h.size + 1 - dreadnought.ds.heap._swim(h, h.size) + swim(h, h.size) end, extract = function(h) - dreadnought.ds.heap._exch(h, 1, h.size) + exch(h, 1, h.size) h.size = h.size - 1 local ret = table.remove(h.elements) - dreadnought.ds.heap._sink(h, 1) + sink(h, 1) return ret end, @@ -2598,40 +2492,43 @@ dreadnought.ds.heap = { - Pilot + Package - + + + Pilot + + function dreadnought.reset.pilot() return { aetherbeastsTotal = 0, + currentModule = "", pilot = { calloutTimer = 0, @@ -2678,11 +2581,11 @@ function dreadnought.reset.pilot() } } end - - return positions.currentPosition end - - - + - - - + return positions end - - - + - - - - - Empath - - + + + Empath + + cube = "" }, - commands = dreadnought.ds.heap.new(), - flags = { - haveClarity = false + haveClarity = false, + checkSlivven = false }, slivvensFound = 0 } function dreadnought.reset.empath() + sendGMCP([[Char.Skills.Get {"group":"aethercraft"}]]) + send("\n") + deleteLineP() + return { aetherbeastsTotal = 0, + currentModule = "", empath = { modules = { @@ -2796,46 +2703,45 @@ function dreadnought.reset.empath() cube = "" }, - commands = dreadnought.ds.heap.new(), + commands = heap.new(), flags = { - haveClarity = false + haveClarity = false, + checkSlivven = false }, slivvensFound = 0 } } end - - - - - + - - - - - Combateer - - + + + + + Combateer + + - - + + - - - - - Collector - - - - + + + Collector - + + + + + + + Listeners + + - - - + + + + + + + - - - + printLine(text) printLine() end - - - + - - + + +