Code: Select all
-- If DIAGNOSTICS_ON, data will be collected from defineObject, defineTrait, etc. calls, and
-- a ScriptComponent named "diagnostics" will be attached to the party with some useful
-- functions that you can use like party.diagnostics.dungeonReport().
--
-- If DIAGNOSTICS_ON is set to false or nil, none of this will happen, and the mod will act
-- as if the diagnostics folder didn't exist at all, so there is no performance cost.
--
-- This import MUST be first otherwise it won't be able to collect defineObject etc. data.
--
DIAGNOSTICS_ON = true
import "mod_assets/ext/diagnostics/diagnostics.lua"
party.diagnostics.testDamage(champion,slot,special,protection,evasion,backstab,summarize,iterations) - Makes a champion attack a monster with their current weapon. Only works with melee attacks right now. Read the comment in diagnostics_script.lua for details, and be careful with iteration count.
party.diagnostics.computeDamage(champion,slot,special,protection,evasion,backstab,summarize,critChance,critMult) - Attempts to calculate a champion's minimum, maximum, mean, and per-second damage with a weapon, without actually simulating it like testDamage(). Very limited, read the comment in diagnostics_script.lua.
party.diagnostics.rankWeapons(champion,protection,evasion,backstab,critChance,critMult) - Uses computeDamage() to rank all defined weapons by their predicted damage per second.
party.diagnostics.dungeonReport() - This is best used in conjunction with redirecting the game's output to a file ("grimrock2.exe > out.txt"). It iterates through all objects in the dungeon and gets the total number of GameObjects and Components, sorted by save state. In addition, it prints to standard output (this is why you redirect to a file) a full summary of how many times each object and Component is used - again sorted by save state. This tool is useful for finding objects that you should have given minimalSaveState but didn't.