Inside the onDrawGui hooK:
Code: Select all
if context.keyDown("shift") and functions.script.keypressDelayGet() == 0 then
-- Shift + U -> Advance day time by 1/6th
if context.keyDown("U") then
GameMode.setTimeOfDay((GameMode.getTimeOfDay() + 0.33) % 2)
print("Time of Day set to " .. GameMode.getTimeOfDay())
functions.script.keypressDelaySet(20)
end
-- Shift + M -> Reveal current map
if context.keyDown("M") then
functions.script.revealMap()
print("Map revealed")
functions.script.keypressDelaySet(20)
end
-- Shift + L -> Level up
if context.keyDown("L") then
for i = 1,4 do
party.party:getChampion(i):levelUp()
functions.script.keypressDelaySet(20)
end
end
-- Shift + X -> Moves the party 1 square forward
if context.keyDown("X") then
local dx,dy = getForward(party.facing)
party:setPosition(party.x + dx, party.y + dy, party.facing, party.elevation, party.level)
functions.script.keypressDelaySet(20)
end
-- Shift + K -> Kills monster in front of party
if context.keyDown("K") then
local dx,dy = getForward(party.facing)
for e in Dungeon.getMap(party.level):entitiesAt(party.x + dx, party.y + dy) do
if e.monster and e.monster:isAlive() then
e.monster:die()
end
end
functions.script.keypressDelaySet(20)
end
-- Shift + Z -> Toggles door in front of party
if context.keyDown("Z") then
functions.script.keypressDelaySet(20)
local dx,dy = getForward(party.facing)
for e in Dungeon.getMap(party.level):entitiesAt(party.x, party.y) do
if e.facing == party.facing and e.door then
e.door:toggle()
end
end
for e in Dungeon.getMap(party.level):entitiesAt(party.x + dx, party.y + dy) do
if (e.facing + 2) % 4 == party.facing and e.door then
e.door:toggle()
end
end
end
-- Shift + H -> Full Heal party
if context.keyDown("H") then
local negative_conditions = {
"cursed",
"diseased",
"paralyzed",
"petrified",
"poison",
"slow",
"chest_wound",
"feet_wound",
"head_wound",
"left_hand_wound",
"leg_wound",
"right_hand_wound",
"blind",
}
for i = 1,4 do
local champion = party.party:getChampion(i)
for _,v in ipairs(negative_conditions) do
if champion:getConditionValue(v) ~= 0 then
champion:setConditionValue(v, 0)
champion:playHealingIndicator()
end
end
champion:setBaseStat("health", champion:getCurrentStat("max_health"))
champion:setBaseStat("energy", champion:getCurrentStat("max_energy"))
playSound("heal_party")
functions.script.keypressDelaySet(20)
end
end
end
Code: Select all
function revealMap()
local startx, starty = party.x, party.y
for x=0,31 do
for y=0,31 do
local zfloor = Dungeon.getMap(party.level):getElevation(x, y)
if not Dungeon.getMap(party.level):isBlocked(x, y, zfloor) then
party:setPosition(x, y, party.facing, zfloor, party.level)
end
end
end
party:setPosition(startx, starty, party.facing, party.elevation, party.level)
end
Code: Select all
keypressDelay = 0
function keypressDelaySet(n)
keypressDelay = n
end
function keypressDelayGet()
return keypressDelay
end
Code: Select all
functions.script.keypressDelaySet(math.max(functions.script.keypressDelayGet() - 2, 0))