-
Notifications
You must be signed in to change notification settings - Fork 0
2. 基础使用
REME-easy edited this page Sep 21, 2023
·
2 revisions
该mod基本遵循mod开发的逻辑。
直接调用addListener
函数以订阅事件。event
表示需要订阅事件的id,func
表示该事件触发时执行的函数。
-- 订阅打出卡牌时事件。e为携带的一些参数,此处事件携带了card参数,即为打出的卡牌
addListener('OnCardUse', function(e)
-- 打印打出卡牌的id
print(e.card.cardID)
end)
以下的例子表示战斗开始时将一张小刀加入手中。
addListener('OnBattleStart', function(e)
local shiv = sts.newCard('Shiv')
print(shiv)
local action = sts.newAction('MakeTempCardInHandAction', shiv)
sts.addToBot(action)
end)
更高级的用法可以查看unlockAscension.lua
。