tianta/project/floors/sample1.js
北海小羊 42ebe1f389 10.20
2022-10-22 04:00:12 +13:00

633 lines
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

main.floors.sample1=
{
"floorId": "sample1",
"title": "样板 1 层",
"name": "1",
"canFlyTo": false,
"canUseQuickShop": true,
"defaultGround": "grass",
"images": [
[
0,
0,
"bg.jpg",
false
]
],
"weather": [
"snow",
6
],
"item_ratio": 1,
"map": [
[ 7,131, 8,152, 9,130, 10,152,166,165,132,165,166],
[ 0, 0, 0, 0, 0, 0, 0,152,165,164, 0,162,165],
[152,152,152,152,121,152,152,152, 0, 0,229, 0, 0],
[ 43, 33, 44,151, 0, 0, 0,152,165,161, 0,163,165],
[ 21, 22, 21,151, 0, 0, 0,152,166,165, 0,165,166],
[151,245,151,151, 0, 87, 0,152,152,152, 85,153,153],
[ 0,246, 0,151, 0, 0, 0,152,152,221, 0,221,153],
[246, 0,246,151, 0, 0, 0,121, 85, 0, 0, 0,153],
[151,246,151,151, 0,153,153,153,153,153,153,153,153],
[ 0, 0, 0, 0, 0, 0, 0,164, 0, 0,163, 0, 0],
[ 1, 1, 1, 1, 0, 20, 0, 0, 0,162, 0,161, 0],
[ 1, 0,123, 1, 0, 20,124, 0,121, 0,122, 0,126],
[ 1, 0, 0, 1, 88, 20, 86, 0, 0, 0, 0, 0, 0]
],
"firstArrive": [],
"events": {
"4,10": [
"\t[样板提示]本层楼将会对各类事件进行介绍。",
"左边是一个仿50层的陷阱做法上方是商店、快捷商店的使用方法右上是一个典型的杀怪开门的例子右下是各类可能的NPC事件。",
"本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\ntip: 左上角显示提示\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nanimate: 显示动画\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)",
"openShop: 打开一个全局商店\ndisableShop: 禁用一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置;转向\nshowImage: 显示图片\nsetFg: 更改画面色调\nsetWeather: 更改天气\nmove: 移动事件效果\nmoveHero: 移动勇士效果\nplayBgm: 播放某个背景音乐\npauseBgm: 暂停背景音乐\nresumeBgm: 恢复背景音乐的播放\nplaySound: 播放某个音频",
"if: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nwin: 获得胜利(游戏通关)\nlose: 游戏失败\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n\n更多支持的事件还在编写中欢迎您宝贵的意见。",
"有关各事件的样例可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后需要调用{\"type\": \"hide\"}该事件才不会再次出现。",
{
"type": "hide"
}
],
"1,5": {
"enable": false,
"data": []
},
"1,6": {
"enable": false,
"data": []
},
"0,7": {
"enable": false,
"data": []
},
"2,7": {
"enable": false,
"data": []
},
"1,8": {
"enable": false,
"data": []
},
"1,7": [
{
"type": "show",
"loc": [
1,
5
],
"time": 1500
},
{
"type": "sleep",
"time": 500
},
"\t[redKing]欢迎来到魔塔,你是第一百位挑战者。\n若你能打败我所有的手下我就与你一对一的决斗。\n现在你必须接受我的安排。",
{
"type": "show",
"loc": [
[
1,
6
],
[
0,
7
],
[
1,
8
],
[
2,
7
]
],
"time": 500
},
"\t[hero]什么?",
{
"type": "playSound",
"name": "attack.ogg"
},
{
"type": "setValue",
"name": "status:atk",
"value": "status:atk/10"
},
{
"type": "setValue",
"name": "status:def",
"value": "status:def/10"
},
{
"type": "hide",
"loc": [
[
1,
6
],
[
0,
7
],
[
2,
7
],
[
1,
8
]
]
},
{
"type": "hide",
"loc": [
1,
5
],
"time": 500
},
{
"type": "hide"
},
{
"type": "setCurtain", "keep": true,
"color": [
0,
0,
0
],
"time": 1250
},
{
"type": "sleep",
"time": 700
},
{
"type": "changeFloor",
"floorId": "sample1",
"loc": [
1,
11
],
"direction": "right",
"time": 1000
},
{
"type": "trigger",
"loc": [
2,
11
]
}
],
"2,11": [
"\t[杰克,thief]喂!醒醒!快醒醒!",
{
"type": "setCurtain", "keep": true,
"time": 1500
},
"\t[hero]额,我这是在什么地方?",
"\t[杰克,thief]你被魔王抓了起来扔进了监狱,和我关在了一起,但是幸运的是我在昨天刚刚挖好一条越狱的暗道!",
{
"type": "openDoor",
"loc": [
3,
11
]
},
{
"type": "sleep",
"time": 300
},
"\t[杰克,thief]我先走了,祝你好运!",
{
"type": "move",
"time": 750,
"steps": [
{
"direction": "right",
"value": 2
},
"down"
]
},
"上面是个move事件可以对NPC等进行移动。\n详见样板中小偷事件的写法。",
"\t[hero]怎么跑的这么快..."
],
"4,2": [
"\t[老人,man]本塔的商店有两类,全局商店和非全局商店。\n\n所谓非全局商店就类似于右下角那个卖钥匙的老人一样一定要碰到才能触发事件。\n\n而全局商店则能在快捷商店中直接使用。",
"\t[老人,man]要注册一个全局商店,你需要在 data.js 中,找到 shops并在内添加你的商店信息。",
"\t[老人,man]商店信息添加后,可以在需要的事件处调用{\"type\": \"openShop\"}来打开你添加的全局商店。",
"\t[老人,man]在上面的例子里左边是一个仿50层的金币商店右边是一个仿24层的经验商店。\n\n商店被访问后即可在快捷商店中进行使用。",
"\t[老人,man]如果你需要在某层暂时禁用快捷商店可以在data.js中设置cannotUseQuickShop。\n如果需要永久禁用商店请使用{\"type\":\"disableShop\"}",
{
"type": "hide",
"time": 500
}
],
"1,0": [
{
"type": "openShop",
"id": "moneyShop1"
}
],
"5,0": [
{
"type": "openShop",
"id": "expShop1"
}
],
"7,7": [
"\t[老人,man]这是一个典型的杀怪开门、强制战斗事件。",
{
"type": "hide"
}
],
"8,7": {
"enable": false,
"data": []
},
"9,7": [
{
"type": "show",
"loc": [
8,
7
]
},
{
"type": "hide"
}
],
"10,4": [
"\t[blackKing]你终于还是来了。",
"\t[hero]放开我们的公主!",
"\t[blackKing]如果我不愿意呢?",
"\t[hero]无需多说,拔剑吧!",
{
"type": "battle",
"id": "blackKing"
},
{
"type": "hide",
"loc": [
10,
2
]
},
{
"type": "openDoor",
"loc": [
8,
7
]
},
"\t[blackKing]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了请好好对她。",
{
"type": "hide"
}
],
"10,0": [
"\t[hero]公主,我来救你了~",
"\t[公主,princess]快救我出去!我受够这里了!",
"\t[hero]公主别怕,我们走吧~",
{
"type": "win",
"reason": "救出公主"
}
],
"6,12": {
"enable": false,
"data": []
},
"6,11": [
"\t[仙子,fairy]通过调用 {\"type\": \"show\"} 可以使隐藏的事件显示出来。\n比如我下面这个机关门。",
{
"type": "show",
"loc": [
6,
12
]
},
"\t[仙子,fairy]通过调用 {\"type\": \"openDoor\"} 可以无需钥匙打开一扇门或暗墙。",
{
"type": "openDoor",
"loc": [
6,
12
]
},
"\t[仙子,fairy]同时,也可以对其它层进行操作,比如楼下的机关门,现在已经为你打开了。",
{
"type": "openDoor",
"loc": [
11,
10
],
"floorId": "sample0"
},
"\t[仙子,fairy]如果 show 或 hide 指定了 time 参数,则以动画效果显示,指定的参数作为消失时间(毫秒)来计算。",
"\t[仙子,fairy]现在到楼下来找我吧~",
{
"type": "show",
"loc": [
12,
10
],
"floorId": "sample0"
},
{
"type": "hide",
"time": 500
}
],
"8,11": [
{
"type": "setValue",
"name": "flag:man_times",
"value": "flag:man_times+1"
},
"\t[老人,man]在文字中使用${' ${ '}和 } 可以计算并显示一个表达式的结果。\n",
"\t[老人,man]例如:\n你的当前攻击力是${status:atk},防御力是${status:def}。\n攻防和的十倍是${10*(status:atk+status:def)},攻防之积是${status:atk*status:def}。\n你有${item:yellowKey}把黄钥匙,${item:blueKey}把蓝钥匙,${item:redKey}把红钥匙。\n你有${item:pickaxe}个破,${item:bomb}个炸,${item:centerFly}个飞。\n这是你第${flag:man_times}次和我对话。",
"\t[老人,man]同时,你也可以通过{\"type\": \"setValue\"}来设置一个勇士的属性、道具或某个Flag。",
"\t[老人,man]例如:\n现在我将让你的攻防提升50%,再将攻防和的十倍加到生命值上。",
{
"type": "setValue",
"name": "status:atk",
"value": "status:atk*1.5"
},
{
"type": "setValue",
"name": "status:def",
"value": "status:def*1.5"
},
{
"type": "setValue",
"name": "status:hp",
"value": "status:hp+10*(status:atk+status:def)"
},
"\t[老人,man]再送你500金币1000经验1破2炸3飞",
{
"type": "setValue",
"name": "status:money",
"value": "status:money+500"
},
{
"type": "setValue",
"name": "status:exp",
"value": "status:exp+1000"
},
{
"type": "setValue",
"name": "item:pickaxe",
"value": "item:pickaxe+1"
},
{
"type": "setValue",
"name": "item:bomb",
"value": "item:bomb+2"
},
{
"type": "setValue",
"name": "item:centerFly",
"value": "item:centerFly+3"
},
"\t[老人,man]status:xxx 代表勇士的某个属性。\n其中xxx可取hp, atk, def, mdef, money,exp这几项。\n\nitem:xxx 代表勇士的某个道具的个数。\nxxx为道具ID具体可参见items.js中的定义。\n\nflag:xxx 代表某个自定义Flag或变量。\nxxx为Flag/变量名,可以自行定义,由字母、数字和下划线组成。\n未定义过而直接取用的Flag默认值为false。",
"\t[老人,man]你现在可以重新和我进行对话,进一步看到属性值的改变。"
],
"10,11": [
{
"type": "if",
"condition": "flag:woman_times==0",
"true": [
"\t[老人,woman]这是个很复杂的例子它将教会你如何使用if 语句进行条件判断,以及 choices 提供选项来供用户进行选择。",
"\t[老人,woman]第一次访问我将显示这段文字;从第二次开始将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后将送你一把大黄门钥匙并消失不再出现。",
"\t[老人,woman]这部分的逻辑比较长,请细心看样板的写法,是很容易看懂并理解的。"
],
"false": [
{
"type": "if",
"condition": "flag:woman_times==8",
"true": [
"\t[老人,woman]你购买的钥匙已经够多了,再继续卖给你的话我会有危险的。",
"\t[老人,woman]看在你贡献给我这么多钱的份上,送你一把大黄门钥匙吧,希望你能好好用它。",
{
"type": "setValue",
"name": "item:bigKey",
"value": "item:bigKey+1"
},
"\t[老人,woman]我先走了,拜拜~",
{
"type": "hide",
"time": 500
},
{
"type": "exit"
}
],
"false": [
{
"type": "choices",
"text": "\t[老人,woman]少年,你需要钥匙吗?\n我这里有大把的",
"choices": [
{
"text": "黄钥匙(${9+flag:woman_times}金币)",
"action": [
{
"type": "if",
"condition": "status:money>=9+flag:woman_times",
"true": [
{
"type": "setValue",
"name": "status:money",
"value": "status:money-(9+flag:woman_times)"
},
{
"type": "setValue",
"name": "item:yellowKey",
"value": "item:yellowKey+1"
}
],
"false": [
"\t[老人,woman]你的金钱不足!",
{
"type": "revisit"
}
]
}
]
},
{
"text": "蓝钥匙(${18+2*flag:woman_times}金币)",
"action": [
{
"type": "if",
"condition": "status:money>=18+2*flag:woman_times",
"true": [
{
"type": "setValue",
"name": "status:money",
"value": "status:money-(18+2*flag:woman_times)"
},
{
"type": "setValue",
"name": "item:blueKey",
"value": "item:blueKey+1"
}
],
"false": [
"\t[老人,woman]你的金钱不足!",
{
"type": "revisit"
}
]
}
]
},
{
"text": "红钥匙(${36+4*flag:woman_times}金币)",
"action": [
{
"type": "if",
"condition": "status:money>=36+4*flag:woman_times",
"true": [
{
"type": "setValue",
"name": "status:money",
"value": "status:money-(36+4*flag:woman_times)"
},
{
"type": "setValue",
"name": "item:redKey",
"value": "item:redKey+1"
}
],
"false": [
"\t[老人,woman]你的金钱不足!",
{
"type": "revisit"
}
]
}
]
},
{
"text": "离开",
"action": [
{
"type": "exit"
}
]
}
]
}
]
}
]
},
{
"type": "setValue",
"name": "flag:woman_times",
"value": "flag:woman_times+1"
},
{
"type": "revisit"
}
],
"12,11": [
"\t[老人,womanMagician]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
{
"type": "input",
"text": "请输入你要加攻击力的数值:"
},
{
"type": "if",
"condition": "flag:input>0",
"true": [
{
"type": "setValue",
"name": "status:atk",
"value": "status:atk+flag:input"
},
{
"type": "tip",
"text": "操作成功,攻击+${flag:input}"
},
"操作成功,攻击+${flag:input}"
],
"false": []
},
"\t[老人,womanMagician]具体可参见样板中本事件的写法。"
]
},
"changeFloor": {
"4,12": {
"floorId": "sample0",
"loc": [
6,
0
]
},
"5,5": {
"floorId": "sample2",
"stair": "downFloor",
"direction": "up"
}
},
"afterBattle": {
"9,6": [
{
"type": "setValue",
"name": "flag:door",
"value": "flag:door+1"
},
{
"type": "if",
"condition": "flag:door==2",
"true": [
{
"type": "openDoor",
"loc": [
10,
5
]
}
],
"false": []
}
],
"11,6": [
{
"type": "setValue",
"name": "flag:door",
"value": "flag:door+1"
},
{
"type": "if",
"condition": "flag:door==2",
"true": [
{
"type": "openDoor",
"loc": [
10,
5
]
}
],
"false": []
}
]
},
"afterGetItem": {},
"afterOpenDoor": {},
"cannotMove": {},"ratio": 1,"ratio": 1,
"cannotViewMap": true,
"bgmap": [
],
"fgmap": [
],
}