Skip to content

Add lua support for creatures returning from abyss - #5185

Open
rainlizard wants to merge 7 commits into
dkfans:masterfrom
rainlizard:return-from-abyss
Open

Add lua support for creatures returning from abyss#5185
rainlizard wants to merge 7 commits into
dkfans:masterfrom
rainlizard:return-from-abyss

Conversation

@rainlizard

@rainlizard rainlizard commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Some people liked my idea of creatures that fall into the abyss being relocated to your portal instead of dying, so here's some lua changes to support that.

  • Adds the CreatureFellIntoAbyss lua event.
  • Teleporting a falling creature will now prevent its default falling death. Using either lua or a creature spell.
  • Adds Creature:remove_from_play(turns) for temporarily placing a creature in limbo. You can use this in any other context (not just for abyss) where you need to take a creature out of play for a while.
function OnGameStart()
    RegisterCreatureFellIntoAbyssEvent(CreatureFellIntoAbyss)
end

function CreatureFellIntoAbyss(event)
    local unit = event.unit
    unit.health = unit.health - 100
    local rooms = GetRoomsOfPlayerAndType(unit.owner, "ENTRANCE")

    if unit.health >= 0 and #rooms > 0 then
        local room = rooms[math.random(#rooms)]
        unit:teleport(room.centerpos, 0)
        unit:remove_from_play(200)
    end
end

In this example I also added 100 falling damage and the creature won't return if it died from the damage taken. But how you use this lua is up to you. Falling can be pretty overpowered:

2026-09-01.15-01-04.mp4

@rainlizard
rainlizard marked this pull request as draft September 1, 2026 05:13
@rainlizard
rainlizard marked this pull request as draft September 2, 2026 12:57
@rainlizard rainlizard changed the title Add rule ReturnFromAbyss Add support for creatures returning from abyss Sep 3, 2026
@rainlizard
rainlizard marked this pull request as ready for review September 3, 2026 14:15
@rainlizard rainlizard changed the title Add support for creatures returning from abyss Add lua support for creatures returning from abyss Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant