This repository was archived by the owner on May 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.lua
More file actions
83 lines (74 loc) · 2.11 KB
/
main.lua
File metadata and controls
83 lines (74 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
--- Generated by h-lua(https://github.com/h-lua/h-lua)
require "h-lua" -- h-lua库
require "scripts.alias" -- alias h-lua库别称(参考)
require "scripts.setup" -- setup 游戏准备
require "scripts.eventReaction" -- 事件反应
require "scripts.damaging" -- 伤害流
require "scripts.quest" -- 任务
require "scripts.cmd" -- 指令
require "scripts.ui" -- UI
-- h-lua main function 主函数入口
-- The game starts here 游戏从main函数开始运行
function main()
SETUP()
UI()
-- 初始调试物品
hitem.create({
id = hslk.n2i("双铁剑"),
charges = 2,
x = 400,
y = 400,
})
for _ = 1, 12 do
hitem.create({
id = hslk.n2i("铁剑"),
charges = 1,
x = 156,
y = 785,
})
hitem.create({
id = hslk.n2i("铁盾"),
charges = 1,
x = 872,
y = 551,
})
end
-- 这些ID只要正确使用了slkHelper,就可以根据名称获得ID,极其爽
local uidMe = hslk.n2i("剑士")
local uidEnemy = hslk.n2i("骑士")
-- 创造一个我的剑士打倒敌人骑兵
local me = hunit.create({
whichPlayer = hplayer.players[1],
id = uidMe,
x = 0,
y = 0,
attr = _attr({
move = "=522",
}),
})
table.insert(hhero.player_heroes[1], me)
hevent.onLevelUp(me, function(evtData)
hattr.set(evtData.triggerUnit, 0, {
attack = "+30",
})
end)
hunit.subCurMana(me, 100)
-- 伤害变成经验
hevent.onDamage(me, function(evtData)
haward.forUnitExp(evtData.triggerUnit, evtData.damage)
end)
local knight = henemy.create({
id = uidEnemy,
x = 0,
y = 0,
qty = 1,
})
dump(htime.date())
htime.setInterval(1, function(curTimer)
if (hterrain.isWater(hunit.x(me), hunit.y(me))) then
htextTag.create2Unit(me, "你在水里", 10, "80ffff", 1.0, 1, 200)
else
htextTag.create2Unit(me, "你不在水里", 10, "ffffff", 1.0, 1, 200)
end
end)
end