12 changed files with 125 additions and 26 deletions
@ -0,0 +1,14 @@
|
||||
#pragma once |
||||
|
||||
#include <string_view> |
||||
|
||||
namespace devilution { |
||||
|
||||
/**
|
||||
* @brief Triggers a Lua event by name. |
||||
* This is a minimal header for code that only needs to trigger events. |
||||
*/ |
||||
void LuaEvent(std::string_view name); |
||||
void LuaEvent(std::string_view name, std::string_view arg); |
||||
|
||||
} // namespace devilution
|
||||
@ -0,0 +1,23 @@
|
||||
-- Adria Refills Mana Mod |
||||
-- When you visit Adria's shop, your mana is restored to full. |
||||
|
||||
local events = require("devilutionx.events") |
||||
local player = require("devilutionx.player") |
||||
local audio = require("devilutionx.audio") |
||||
|
||||
events.StoreOpened.add(function(townerName) |
||||
if townerName ~= "adria" then |
||||
return |
||||
end |
||||
|
||||
local p = player.self() |
||||
if p == nil then |
||||
return |
||||
end |
||||
|
||||
-- Restore mana if player has mana capacity and it's not already full |
||||
if p.maxMana > 0 and p.mana < p.maxMana then |
||||
audio.playSfx(audio.SfxID.CastHealing) |
||||
p:restoreFullMana() |
||||
end |
||||
end) |
||||
Loading…
Reference in new issue