diff --git a/scripts/alter.lua b/scripts/alter.lua index 6a955ad..82e0dcd 100644 --- a/scripts/alter.lua +++ b/scripts/alter.lua @@ -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)