Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions scripts/alter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,60 @@ function SpaceScript(loc, script)
return d
end

local tipImageCallbackMapping = {
Shield = function(loc)
if memedit then
-- Create a shield without animation
Board:SetShield(loc, true, true)
else
Board:AddShield(loc)
end
end,
Sand = function(loc)
Board:SetTerrain(loc, TERRAIN_SAND)
end,
Ice = function(loc)
Board:SetTerrain(loc, TERRAIN_ICE)
end,
Frozen = function(loc)
if memedit then
-- Create frozen without animation
Board:SetFrozen(loc, true, true)
else
Board:SetFrozen(loc, true)
end
end,
Snow = function(loc)
Board:SetCustomTile(loc, "snow.png")
end,
}

local function applyExtendedTipImage(self)
for feature, loc in pairs(self.TipImage) do
-- Remove trailing digits to allow for multiple features of the same type
local feature = feature:match("(.-)%d*$")
local callback = tipImageCallbackMapping[feature]

if callback == nil and self.TipImageCallbacks ~= nil then
callback = self.TipImageCallbacks[feature]
end

if callback ~= nil then
callback(loc)
end
end
end

local function modApiExtGetSkillEffect(self, p1, p2, ...)
-- Dereference to weapon object
if type(self) == "string" then
self = _G[self]
end

if Board:IsTipImage() then
applyExtendedTipImage(self)
end

p1 = p1 or Point(-1,-1)
p2 = p2 or Point(-1,-1)

Expand Down