commit
5e12d3c70a
BIN
EcmaScript.NET.dll
Normal file
BIN
EcmaScript.NET.dll
Normal file
Binary file not shown.
BIN
H5样板使用指南.docx
Normal file
BIN
H5样板使用指南.docx
Normal file
Binary file not shown.
BIN
H5样板使用指南.pdf
Normal file
BIN
H5样板使用指南.pdf
Normal file
Binary file not shown.
BIN
JS代码压缩工具.exe
Normal file
BIN
JS代码压缩工具.exe
Normal file
Binary file not shown.
BIN
Yahoo.Yui.Compressor.dll
Normal file
BIN
Yahoo.Yui.Compressor.dll
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 298 KiB |
@ -13,7 +13,7 @@
|
||||
3,terrains,3 # 蓝色墙
|
||||
4,terrains,4 # 星空
|
||||
5,terrains,5 # 岩浆
|
||||
6,terrains,5 # 冰面
|
||||
6,terrains,6 # 冰面
|
||||
7,terrains,15 # 蓝色商店左
|
||||
8,terrains,16 # 蓝色商店右
|
||||
9,terrains,17 # 红色商店左
|
||||
@ -81,8 +81,8 @@
|
||||
84,terrains,12 # 绿门
|
||||
85,terrains,13 # 机关门
|
||||
86,terrains,14 # 铁门
|
||||
87,terrains,7 # 上楼梯
|
||||
88,terrains,6 # 下楼梯
|
||||
87,terrains,8 # 上楼梯
|
||||
88,terrains,7 # 下楼梯
|
||||
89,animates,21 # 传送门
|
||||
90,animates,19 # 星空传送
|
||||
91,animates,30 # 上箭头传送
|
||||
|
||||
1243
libs/core.js
1243
libs/core.js
File diff suppressed because it is too large
Load Diff
1
libs/core.min.js
vendored
Normal file
1
libs/core.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
163
libs/data.js
163
libs/data.js
@ -4,101 +4,89 @@ function data() {
|
||||
|
||||
data.prototype.init = function() {
|
||||
this.firstData = {
|
||||
'title': '魔塔样板',
|
||||
'name': 'template',
|
||||
'version': 'Ver 1.0.0 (Beta)',
|
||||
'floorId': 'sample0',
|
||||
'hero': {
|
||||
'id': 'hero1',
|
||||
'name': '勇士',
|
||||
'hp': 1000,
|
||||
'atk': 100,
|
||||
'def': 100,
|
||||
'mdef': 0,
|
||||
'money': 0,
|
||||
'experience': 0,
|
||||
'items': {
|
||||
'keys': {
|
||||
'yellowKey': 0,
|
||||
'blueKey': 0,
|
||||
'redKey': 0
|
||||
"title": "魔塔样板", // 游戏名,将显示在标题页面以及切换楼层的界面中
|
||||
"name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。
|
||||
"version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。
|
||||
"floorId": "sample0", // 初始楼层ID
|
||||
"hero": { // 勇士初始数据
|
||||
"id": "hero1", // 此项关系到icons中的heroID,一般不要改
|
||||
"name": "勇士", // 勇士名;可以改成喜欢的
|
||||
"hp": 1000, // 初始生命值
|
||||
"atk": 100, // 初始攻击
|
||||
"def": 100, // 初始防御
|
||||
"mdef": 100, // 初始魔防
|
||||
"money": 100, // 初始金币
|
||||
"experience": 1000, // 初始经验
|
||||
"items": { // 初始道具个数
|
||||
"keys": {
|
||||
"yellowKey": 0,
|
||||
"blueKey": 0,
|
||||
"redKey": 0
|
||||
},
|
||||
'constants': {},
|
||||
'tools': {}
|
||||
"constants": {},
|
||||
"tools": {}
|
||||
},
|
||||
'flyRange': [],
|
||||
'loc': {'direction': 'up', 'x': 6, 'y': 10},
|
||||
'flags': {
|
||||
"flyRange": [], // 初始可飞的楼层;一般留空数组即可
|
||||
"loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置
|
||||
"flags": { // 游戏过程中的变量或flags
|
||||
"poison": false, // 毒
|
||||
"weak": false, // 衰
|
||||
"curse": false, // 咒
|
||||
}
|
||||
},
|
||||
'startText': [
|
||||
"startText": [ // 游戏开始前剧情。如果无剧情直接留一个空数组即可。
|
||||
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
||||
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
||||
"赶快来试一试吧!"
|
||||
],
|
||||
'shops': {
|
||||
'shop1': {
|
||||
'id': 'shop1', 'title': '贪婪之神', 'name': '3楼金币商店', 'icon': 'blueShop',
|
||||
'times': 0, 'need': "25", 'visited': false, 'use': 'money',
|
||||
'choices': [
|
||||
{'text': '生命+800', 'effect': 'status,hp,800'},
|
||||
{'text': '攻击+4', 'effect': 'status,atk,4'},
|
||||
{'text': '防御+4', 'effect': 'status,def,4'}
|
||||
"shops": { // 定义全局商店(即快捷商店)
|
||||
"moneyShop1": { // 商店唯一ID
|
||||
"name": "贪婪之神", // 商店名称(标题)
|
||||
"icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店
|
||||
"textInList": "3楼金币商店", // 在快捷商店栏中显示的名称
|
||||
"use": "money", // 商店所要使用的。只能是"money"或"experience"。
|
||||
"need": "20+10*times*(times+1)", // 商店需要的金币/经验数值;可以是一个表达式,以times作为参数计算。
|
||||
// 这里用到的times为该商店的已经的访问次数。首次访问该商店时times的值为0。
|
||||
// 上面的例子是50层商店的计算公式。你也可以写任意其他的计算公式,只要以times作为参数即可。
|
||||
// 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。
|
||||
// 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。
|
||||
"choices": [ // 商店的选项
|
||||
{"text": "生命+800", "effect": "status:hp+=800"},
|
||||
// 如果有多个effect以分号分开,参见下面的经验商店
|
||||
{"text": "攻击+4", "effect": "status:atk+=4"},
|
||||
{"text": "防御+4", "effect": "status:def+=4"},
|
||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||
// effect只能对status和items进行操作,不能修改flag值。
|
||||
// 中间只能用+=符号(也就是只能增加某个属性或道具)
|
||||
// 其他effect样例:
|
||||
// "items:yellowKey+=1" 黄钥匙+1
|
||||
// "items:pickaxe+=3" 破墙镐+3
|
||||
]
|
||||
},
|
||||
'shop2': {
|
||||
'id': 'shop2', 'title': '经验之神', 'name': '5楼经验商店', 'icon': 'redShop',
|
||||
'times': 0, 'need': -1, 'visited': false, 'use': 'experience',
|
||||
'choices': [
|
||||
{'text': '攻击+5', 'effect': 'status,atk,5', 'need': '30'},
|
||||
{'text': '防御+5', 'effect': 'status,def,5' ,'need': '30'},
|
||||
{'text': '等级+1', 'effect': 'status,hp,1000;status,atk,7;status,def,7', 'need': '100'}
|
||||
"expShop1": { // 商店唯一ID
|
||||
"name": "经验之神",
|
||||
"icon": "pinkShop",
|
||||
"textInList": "5楼经验商店",
|
||||
"use": "experience", // 该商店使用的是经验进行计算
|
||||
"need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值
|
||||
"choices": [
|
||||
// 在choices中写need,可以针对每个选项都有不同的需求。
|
||||
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
||||
{"text": "等级+1", "need": "100", "effect": "status:hp+=1000;status:atk+=7;status:def+=7"},
|
||||
// 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。
|
||||
{"text": "攻击+5", "need": "30", "effect": "status:atk+=5"},
|
||||
{"text": "防御+5", "need": "30", "effect": "status:def+=5"},
|
||||
]
|
||||
},
|
||||
'shop3': {
|
||||
'id': 'shop3', 'title': '钥匙商人', 'name': '6楼钥匙商人', 'icon': 'womanMagician',
|
||||
'times': 0, 'need': -1, 'visited': false, 'use': 'money',
|
||||
'choices': [
|
||||
{'text': '黄钥匙+1', 'effect': 'item,yellowKey,1', 'need': '10'},
|
||||
{'text': '蓝钥匙+1', 'effect': 'item,blueKey,1', 'need': '50'},
|
||||
{'text': '红钥匙+1', 'effect': 'item,redKey,1', 'need': '100'}
|
||||
]
|
||||
},
|
||||
'shop4': {
|
||||
'id': 'shop4', 'title': '贪婪之神', 'name': '10楼金币商店', 'icon': 'blueShop',
|
||||
'times': 0, 'need': "100", 'visited': false, 'use': 'money',
|
||||
'choices': [
|
||||
{'text': '生命+4000', 'effect': 'status,hp,4000'},
|
||||
{'text': '攻击+20', 'effect': 'status,atk,20'},
|
||||
{'text': '防御+20', 'effect': 'status,def,20'}
|
||||
]
|
||||
},
|
||||
'shop5': {
|
||||
'id': 'shop5', 'title': '经验之神', 'name': '15楼经验商店', 'icon': 'redShop',
|
||||
'times': 0, 'need': -1, 'visited': false, 'use': 'experience',
|
||||
'choices': [
|
||||
{'text': '攻击+17', 'effect': 'status,atk,17', 'need': '95'},
|
||||
{'text': '防御+17', 'effect': 'status,def,17' ,'need': '95'},
|
||||
{'text': '等级+3', 'effect': 'status,hp,3000;status,atk,21;status,def,21', 'need': '270'}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
'npcs': {},
|
||||
'animateSpeed': 500,
|
||||
}
|
||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||
this.flags = {
|
||||
|
||||
/****** 角色状态相关 ******/
|
||||
// 各种数值;一些数值可以在这里设置
|
||||
this.values = {
|
||||
/****** 角色相关 ******/
|
||||
"HPMAX": 999999, // HP上限;-1则无上限
|
||||
"enableMDef": true, // 是否涉及勇士的魔防值;如果此项为false,则状态栏不会显示勇士的魔防值
|
||||
"enableExperience": false, // 是否涉及经验值;如果此项为false,则状态栏和怪物手册均将不会显示经验值
|
||||
// 重要说明:如果enableMDef和enableExperience均为true,则在状态栏不会显示当前楼层!!!! //
|
||||
"lavaDamage": 100, // 经过血网受到的伤害
|
||||
"poisonDamage": 10, // 经过毒网受到的伤害
|
||||
"poisonDamage": 10, // 中毒后每步受到的伤害
|
||||
"weakValue": 20, // 衰弱状态下攻防减少的数值
|
||||
|
||||
|
||||
/****** 道具相关 ******/
|
||||
"redJewel": 3, // 红宝石加攻击的数值
|
||||
"blueJewel": 3, // 蓝宝石加防御的数值
|
||||
@ -119,7 +107,22 @@ data.prototype.init = function() {
|
||||
"shield5": 160, // 神圣盾加防数值
|
||||
"moneyPocket": 500, // 金钱袋加金币的数值
|
||||
|
||||
"flyNearStair": false, // 是否需要在楼梯边使用传送器
|
||||
/****** 系统相关 ******/
|
||||
"cannotUseQuickShop": ["MT0"], // 不能使用快捷商店的楼层列表
|
||||
'animateSpeed': 500,
|
||||
}
|
||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||
this.flags = {
|
||||
|
||||
/****** 角色状态相关 ******/
|
||||
"enableMDef": false, // 是否涉及勇士的魔防值;如果此项为false,则状态栏不会显示勇士的魔防值
|
||||
"enableExperience": true, // 是否涉及经验值;如果此项为false,则状态栏和怪物手册均将不会显示经验值
|
||||
// 重要说明:如果enableMDef和enableExperience均为true,则在状态栏不会显示当前楼层!!!! //
|
||||
|
||||
|
||||
|
||||
/****** 道具相关 ******/
|
||||
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
||||
"bombTrigger": true, // 使用炸弹后是否触发怪物事件(如开门)
|
||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
|
||||
1
libs/data.min.js
vendored
Normal file
1
libs/data.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
function data(){}data.prototype.init=function(){this.firstData={title:"魔塔样板",name:"template",version:"Ver 1.0.0 (Beta)",floorId:"sample0",hero:{id:"hero1",name:"勇士",hp:1000,atk:100,def:100,mdef:100,money:100,experience:1000,items:{keys:{yellowKey:0,blueKey:0,redKey:0},constants:{},tools:{}},flyRange:[],loc:{direction:"up",x:6,y:10},flags:{poison:false,weak:false,curse:false,}},startText:["Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!","这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。","赶快来试一试吧!"],shops:{moneyShop1:{name:"贪婪之神",icon:"blueShop",textInList:"3楼金币商店",use:"money",need:"20+10*times*(times+1)",choices:[{text:"生命+800",effect:"status:hp+=800"},{text:"攻击+4",effect:"status:atk+=4"},{text:"防御+4",effect:"status:def+=4"},{text:"魔防+10",effect:"status:mdef+=10"}]},expShop1:{name:"经验之神",icon:"pinkShop",textInList:"5楼经验商店",use:"experience",need:"-1",choices:[{text:"等级+1",need:"100",effect:"status:hp+=1000;status:atk+=7;status:def+=7"},{text:"攻击+5",need:"30",effect:"status:atk+=5"},{text:"防御+5",need:"30",effect:"status:def+=5"},]}},};this.values={HPMAX:999999,lavaDamage:100,poisonDamage:10,weakValue:20,cannotUseQuickShop:["MT0"],redJewel:3,blueJewel:3,greenJewel:5,redPotion:100,bluePotion:250,yellowPotion:500,greenPotion:800,sword1:10,shield1:10,sword2:20,shield2:20,sword3:40,shield3:40,sword4:80,shield4:80,sword5:160,shield5:160,moneyPocket:500,animateSpeed:500,};this.flags={enableMDef:false,enableExperience:true,flyNearStair:true,bombTrigger:true,pickaxeFourDirections:true,bigKeyIsBox:false,portalWithoutTrigger:true,potionWhileRouting:false,}};data.prototype.getFirstData=function(){return core.clone(this.firstData)};main.instance.data=new data();
|
||||
@ -23,9 +23,9 @@ enemys.prototype.init = function () {
|
||||
'slimeMan': {'name': '影子战士', 'hp': 100, 'atk': 0, 'def': 0, 'money': 11, 'experience': 0, 'special': 10}, // 模仿怪的攻防设为0就好
|
||||
'bluePriest': {'name': '初级法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 3, 'experience': 0, 'special': 2},
|
||||
'redPriest': {'name': '高级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'brownWizard': {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100},
|
||||
'brownWizard': {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100}, // 领域怪需要加value表示领域伤害的数值
|
||||
'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'special': 15, 'value': 200},
|
||||
'yellowGuard': {'name': '初级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'yellowGuard': {'name': '初级卫兵', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': 0},
|
||||
'blueGuard': {'name': '中级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redGuard': {'name': '高级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'swordsman': {'name': '双手剑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 6, 'experience': 0, 'special': 5},
|
||||
@ -33,7 +33,7 @@ enemys.prototype.init = function () {
|
||||
'yellowKnight': {'name': '金骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redKnight': {'name': '红骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'darkKnight': {'name': '黑骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'blackKing': {'name': '黑衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0, 'bomb': false}, // 加入 'bomb': false 代表该怪物不可被炸弹或圣锤炸掉
|
||||
'blackKing': {'name': '黑衣魔王', 'hp': 1000, 'atk': 500, 'def': 0, 'money': 1000, 'experience': 1000, 'special': 0, 'bomb': false}, // 加入 'bomb': false 代表该怪物不可被炸弹或圣锤炸掉
|
||||
'yellowKing': {'name': '黄衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'greenKing': {'name': '青衣武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'blueKnight': {'name': '蓝骑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 9, 'experience': 0, 'special': 8},
|
||||
@ -51,7 +51,7 @@ enemys.prototype.init = function () {
|
||||
'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 16},
|
||||
'blackMagician': {'name': '黑魔法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3}, // 吸血怪需要在后面添加value代表吸血比例
|
||||
'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3}, // 吸血怪需要在后面添加value代表吸血比例
|
||||
'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'special': 14},
|
||||
'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
'whiteHornSlime': {'name': '尖角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||
@ -102,14 +102,12 @@ enemys.prototype.getDamage = function (monsterId) {
|
||||
var hero_atk = core.status.hero.atk, hero_def = core.status.hero.def, hero_mdef = core.status.hero.mdef;
|
||||
var mon_hp = monster.hp, mon_atk = monster.atk, mon_def = monster.def, mon_special = monster.special;
|
||||
var damage = this.calDamage(hero_atk, hero_def, hero_mdef, mon_hp, mon_atk, mon_def, mon_special);
|
||||
if (damage == 999999999) return damage;
|
||||
|
||||
var extra_damage = 0;
|
||||
if (monster.special == 11) { // 吸血
|
||||
// 吸血的比例
|
||||
extra_damage = core.status.hero.hp * monster.value;
|
||||
|
||||
if (core.status.hero.flags.hasShield5) // 存在神圣盾
|
||||
extra_damage /= 2;
|
||||
|
||||
extra_damage = parseInt(extra_damage);
|
||||
}
|
||||
return damage + extra_damage;
|
||||
@ -167,7 +165,7 @@ enemys.prototype.calDamage = function (hero_atk, hero_def, hero_mdef, mon_hp, mo
|
||||
mon_atk = hero_atk;
|
||||
mon_def = hero_def;
|
||||
}
|
||||
if (hero_atk <= mon_def) return 999999999;
|
||||
if (hero_atk <= mon_def) return 999999999; // 不可战斗时请直接返回999999999
|
||||
|
||||
var per_damage = mon_atk - hero_def;
|
||||
if (per_damage < 0) per_damage = 0;
|
||||
@ -203,7 +201,7 @@ enemys.prototype.getCurrentEnemys = function () {
|
||||
var used = {};
|
||||
var mapBlocks = core.status.thisMap.blocks;
|
||||
for (var b = 0; b < mapBlocks.length; b++) {
|
||||
if (core.isset(mapBlocks[b].event) && mapBlocks[b].event.cls == 'enemys') {
|
||||
if (core.isset(mapBlocks[b].event) && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable) && mapBlocks[b].event.cls == 'enemys') {
|
||||
var monsterId = mapBlocks[b].event.id;
|
||||
if (core.isset(used[monsterId])) continue;
|
||||
|
||||
|
||||
1
libs/enemys.min.js
vendored
Normal file
1
libs/enemys.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
514
libs/events.js
514
libs/events.js
@ -9,15 +9,6 @@ events.prototype.init = function () {
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
},
|
||||
'changeFloor': function (data, core, callback) {
|
||||
// core.changeFloor(data.event.data.floorId, data.event.data.heroLoc);
|
||||
var heroLoc = null;
|
||||
if (core.isset(data.event.data.loc)) {
|
||||
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
|
||||
}
|
||||
core.changeFloor(data.event.data.floorId, data.event.data.stair,
|
||||
heroLoc, callback);
|
||||
},
|
||||
'getItem': function (data, core, callback) {
|
||||
core.getItem(data.event.id, 1, data.x, data.y);
|
||||
if (core.isset(callback))
|
||||
@ -28,15 +19,15 @@ events.prototype.init = function () {
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
},
|
||||
'visitNpc': function (data, core, callback) {
|
||||
core.visitNpc(data.event.npcid, data.x, data.y);
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
},
|
||||
'openShop': function (data, core, callback) {
|
||||
core.ui.drawShop(data.event.shopid);
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
'changeFloor': function (data, core, callback) {
|
||||
var heroLoc = null;
|
||||
if (core.isset(data.event.data.loc)) {
|
||||
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
|
||||
if (core.isset(data.event.data.direction))
|
||||
heroLoc.direction = data.event.data.direction;
|
||||
}
|
||||
core.changeFloor(data.event.data.floorId, data.event.data.stair,
|
||||
heroLoc, data.event.data.time, callback);
|
||||
},
|
||||
'passNet': function (data, core, callback) {
|
||||
core.events.passNet(data);
|
||||
@ -45,6 +36,8 @@ events.prototype.init = function () {
|
||||
},
|
||||
"checkBlock": function (data, core, callback) {
|
||||
core.events.checkBlock(data.x, data.y);
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
},
|
||||
'action': function (data, core, callback) {
|
||||
core.events.doEvents(data.event.data, data.x, data.y);
|
||||
@ -68,17 +61,53 @@ main.instance.events = new events();
|
||||
////// 游戏开始事件 //////
|
||||
events.prototype.startGame = function (hard) {
|
||||
|
||||
if (core.status.isStarting) return;
|
||||
core.status.isStarting = true;
|
||||
|
||||
core.hideStartAnimate(function() {
|
||||
core.drawText(core.firstData.startText, function() {
|
||||
core.drawText(core.clone(core.firstData.startText), function() {
|
||||
core.startGame(hard);
|
||||
if (hard=='Easy') { // 简单难度
|
||||
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
||||
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
||||
// core.setStatus("hp", 10000);
|
||||
}
|
||||
if (hard=='Normal') { // 普通难度
|
||||
core.setFlag('hard', 2); // 可以用flag:hard来获得当前难度
|
||||
}
|
||||
if (hard=='Hard') { // 困难难度
|
||||
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
////// 走到某位置时触发事件 //////
|
||||
events.prototype.blockEvent = function (data) {
|
||||
////// 游戏结束事件 //////
|
||||
events.prototype.win = function(reason) {
|
||||
// 获胜
|
||||
core.waitHeroToStop(function() {
|
||||
core.removeGlobalAnimate(0,0,true);
|
||||
core.clearMap('all'); // 清空全地图
|
||||
core.drawText([
|
||||
"\t[结局2]恭喜通关!你的分数是${status:hp}。"
|
||||
], function () {
|
||||
core.restart();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
events.prototype.lose = function(reason) {
|
||||
// 失败
|
||||
core.waitHeroToStop(function() {
|
||||
core.drawText([
|
||||
"\t[结局1]你死了。\n如题。"
|
||||
], function () {
|
||||
core.restart();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
////// 检查领域、夹击事件 //////
|
||||
events.prototype.checkBlock = function (x,y) {
|
||||
var damage = 0;
|
||||
@ -125,7 +154,7 @@ events.prototype.checkBlock = function (x,y) {
|
||||
////// 转换楼层结束的事件 //////
|
||||
events.prototype.afterChangeFloor = function (floorId) {
|
||||
if (!core.hasFlag("visited_"+floorId)) {
|
||||
this.doEvents(core.status.thisMap.firstArrive);
|
||||
this.doEvents(core.floors[floorId].firstArrive);
|
||||
core.setFlag("visited_"+floorId, true);
|
||||
}
|
||||
}
|
||||
@ -140,13 +169,18 @@ events.prototype.doEvents = function (list, x, y, callback) {
|
||||
}
|
||||
core.lockControl();
|
||||
core.status.event = {'id': 'action', 'data': {
|
||||
'list': list, 'x': x, 'y': y, 'callback': callback
|
||||
'list': core.clone(list), 'x': x, 'y': y, 'callback': callback
|
||||
}}
|
||||
core.events.doAction();
|
||||
});
|
||||
}
|
||||
|
||||
events.prototype.doAction = function() {
|
||||
// 清空boxAnimate和UI层
|
||||
clearInterval(core.interval.boxAnimate);
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
core.setAlpha('ui', 1.0);
|
||||
|
||||
// 事件处理完毕
|
||||
if (core.status.event.data.list.length==0) {
|
||||
if (core.isset(core.status.event.data.callback))
|
||||
@ -154,6 +188,7 @@ events.prototype.doAction = function() {
|
||||
core.ui.closePanel(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = core.status.event.data.list.shift();
|
||||
core.status.event.data.current = data;
|
||||
|
||||
@ -172,14 +207,161 @@ events.prototype.doAction = function() {
|
||||
case "text": // 文字/对话
|
||||
core.ui.drawTextBox(data.data);
|
||||
break;
|
||||
case "disappear": // 消失
|
||||
core.removeBlock('event', x, y);
|
||||
case "show": // 显示
|
||||
if (core.isset(data.time) && data.time>0 && (!core.isset(data.floorId) || data.floorId==core.status.floorId)) {
|
||||
core.animateBlock(data.loc[0],data.loc[1],'show', data.time, function () {
|
||||
core.addBlock(data.loc[0],data.loc[1],data.floorId);
|
||||
core.events.doAction();
|
||||
});
|
||||
}
|
||||
else {
|
||||
core.addBlock(data.loc[0],data.loc[1],data.floorId)
|
||||
this.doAction();
|
||||
}
|
||||
break;
|
||||
case "hide": // 消失
|
||||
var toX=x, toY=y, toId=core.status.floorId;
|
||||
if (core.isset(data.loc)) {
|
||||
toX=data.loc[0]; toY=data.loc[1];
|
||||
}
|
||||
if (core.isset(data.floorId)) toId=data.floorId;
|
||||
core.removeBlock(toX,toY,toId)
|
||||
if (core.isset(data.time) && data.time>0 && toId==core.status.floorId) {
|
||||
core.animateBlock(toX,toY,'hide',data.time, function () {
|
||||
core.events.doAction();
|
||||
});
|
||||
}
|
||||
else this.doAction();
|
||||
break;
|
||||
case "move": // 移动事件
|
||||
core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function() {
|
||||
core.events.doAction();
|
||||
})
|
||||
break;
|
||||
case "changeFloor": // 楼层转换
|
||||
var heroLoc = {"x": data.loc[0], "y": data.loc[1]};
|
||||
if (core.isset(data.direction)) heroLoc.direction=data.direction;
|
||||
core.changeFloor(data.floorId||core.status.floorId, null, heroLoc, data.time, function() {
|
||||
core.lockControl();
|
||||
core.events.doAction();
|
||||
});
|
||||
break;
|
||||
case "changePos": // 直接更换勇士位置,不切换楼层
|
||||
core.clearMap('hero', 0, 0, 416, 416);
|
||||
core.setHeroLoc('x', data.loc[0]);
|
||||
core.setHeroLoc('y', data.loc[1]);
|
||||
if (core.isset(data.direction)) core.setHeroLoc('direction', data.direction);
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
this.doAction();
|
||||
break;
|
||||
case "openDoor": // 开一个门,包括暗墙
|
||||
var floorId=data.floorId || core.status.floorId;
|
||||
var block=core.getBlock(data.loc[0], data.loc[1], floorId);
|
||||
if (block!=null) {
|
||||
if (floorId==core.status.floorId)
|
||||
core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() {
|
||||
core.events.doAction();
|
||||
})
|
||||
else {
|
||||
core.removeBlock(block.block.x,block.block.y,floorId);
|
||||
this.doAction();
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.doAction();
|
||||
break;
|
||||
case "openShop": // 打开一个全局商店
|
||||
core.events.openShop(data.id);
|
||||
break;
|
||||
case "battle": // 强制战斗
|
||||
core.battle(data.id,null,null,true,function() {
|
||||
core.events.doAction();
|
||||
})
|
||||
break;
|
||||
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
|
||||
var toX=data.loc[0], toY=data.loc[1];
|
||||
var block=core.getBlock(toX, toY);
|
||||
if (block!=null) {
|
||||
block = block.block;
|
||||
if (core.isset(block.event) && block.event.trigger=='action') {
|
||||
// 触发
|
||||
core.status.event = {'id': 'action', 'data': {
|
||||
'list': core.clone(block.event.data), 'x': block.x, 'y': block.y, 'callback': core.status.event.data.callback
|
||||
}}
|
||||
}
|
||||
}
|
||||
this.doAction();
|
||||
break;
|
||||
case "playSound":
|
||||
var name=data.name.split(".");
|
||||
if (name.length==2)
|
||||
core.playSound(name[0],name[1]);
|
||||
this.doAction();
|
||||
break;
|
||||
case "setValue":
|
||||
try {
|
||||
var value=core.calValue(data.value);
|
||||
// 属性
|
||||
if (data.name.indexOf("status:")==0) {
|
||||
value=parseInt(value);
|
||||
core.setStatus(data.name.substring(7), value);
|
||||
}
|
||||
// 道具
|
||||
if (data.name.indexOf("item:")==0) {
|
||||
value=parseInt(value);
|
||||
var itemId=data.name.substring(5);
|
||||
if (value>core.itemCount(itemId)) // 效果
|
||||
core.getItem(itemId,value-core.itemCount(itemId));
|
||||
else core.setItem(itemId, value);
|
||||
}
|
||||
// flag
|
||||
if (data.name.indexOf("flag:")==0) {
|
||||
core.setFlag(data.name.substring(5), value);
|
||||
}
|
||||
}
|
||||
catch (e) {console.log(e)}
|
||||
core.updateStatusBar();
|
||||
this.doAction();
|
||||
break;
|
||||
case "if": // 条件判断
|
||||
if (core.calValue(data.condition))
|
||||
core.events.insertAction(data["true"])
|
||||
else
|
||||
core.events.insertAction(data["false"])
|
||||
this.doAction();
|
||||
break;
|
||||
case "choices": // 提供选项
|
||||
core.ui.drawChoices(data.text, data.choices);
|
||||
break;
|
||||
case "win":
|
||||
core.events.win(data.reason);
|
||||
break;
|
||||
case "lose":
|
||||
core.events.lose(data.reason);
|
||||
break;
|
||||
case "function":
|
||||
if (core.isset(data["function"]))
|
||||
data["function"]();
|
||||
this.doAction();
|
||||
break;
|
||||
case "update":
|
||||
core.updateStatusBar();
|
||||
this.doAction();
|
||||
break;
|
||||
case "sleep": // 等待多少毫秒
|
||||
setTimeout(function () {
|
||||
core.events.doAction();
|
||||
}, data.data);
|
||||
}, data.time);
|
||||
break;
|
||||
case "revisit": // 立刻重新执行该事件
|
||||
var block=core.getBlock(x,y); // 重新获得事件
|
||||
if (block!=null) {
|
||||
block = block.block;
|
||||
if (core.isset(block.event) && block.event.trigger=='action') {
|
||||
core.status.event.data.list = core.clone(block.event.data);
|
||||
}
|
||||
}
|
||||
this.doAction();
|
||||
break;
|
||||
case "exit": // 立刻结束事件
|
||||
core.status.event.data.list = [];
|
||||
@ -192,7 +374,51 @@ events.prototype.doAction = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
////// 往当前事件列表之前添加一个或多个事件 //////
|
||||
events.prototype.insertAction = function (action) {
|
||||
core.unshift(core.status.event.data.list, action)
|
||||
}
|
||||
|
||||
////// 打开商店 //////
|
||||
events.prototype.openShop = function(shopId, needVisited) {
|
||||
var shop = core.status.shops[shopId];
|
||||
shop.times = shop.times || 0;
|
||||
shop.visited = shop.visited || false;
|
||||
if (needVisited && !shop.visited) {
|
||||
if (shop.times==0) core.drawTip("该商店尚未开启");
|
||||
else core.drawTip("该商店已失效");
|
||||
return;
|
||||
}
|
||||
shop.visited = true;
|
||||
|
||||
core.ui.closePanel();
|
||||
core.lockControl();
|
||||
core.status.event = {'id': 'shop', 'data': {'id': shopId, 'shop': shop}};
|
||||
// 拼词
|
||||
var content = "\t["+shop.name+","+shop.icon+"]";
|
||||
var times = shop.times, need=eval(shop.need);
|
||||
if (need<0) need="若干";
|
||||
var use=shop.use=="experience"?"经验":"金币";
|
||||
content = content+"勇敢的武士啊,给我"+need+"\n"+use+",你就可以:"
|
||||
var choices = [];
|
||||
for (var i=0;i<shop.choices.length;i++) {
|
||||
var choice = shop.choices[i];
|
||||
var text = choice.text;
|
||||
if (core.isset(choice.need))
|
||||
text += "("+eval(choice.need)+use+")"
|
||||
choices.push({"text": text});
|
||||
}
|
||||
choices.push({"text": "离开"});
|
||||
core.ui.drawChoices(content, choices);
|
||||
}
|
||||
|
||||
events.prototype.disableQuickShop = function (shopId) {
|
||||
core.status.shops[shopId].visited = false;
|
||||
|
||||
}
|
||||
|
||||
////// 降低难度 //////
|
||||
/*
|
||||
events.prototype.decreaseHard = function() {
|
||||
if (core.status.hard == 0) {
|
||||
core.drawTip("当前已是难度0,不能再降低难度了");
|
||||
@ -212,10 +438,12 @@ events.prototype.decreaseHard = function() {
|
||||
core.ui.drawSettings(false);
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
////// 能否使用快捷商店 //////
|
||||
events.prototype.canUseQuickShop = function(index) {
|
||||
if (core.status.floorId == 'MT20') return '当前不能使用快捷商店。';
|
||||
events.prototype.canUseQuickShop = function(shopIndex) {
|
||||
if (core.isset(core.values.cannotUseQuickShop) && core.values.cannotUseQuickShop.indexOf(core.status.floorId)>=0)
|
||||
return '当前不能使用快捷商店。';
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -249,8 +477,8 @@ events.prototype.afterBattle = function(enemyId,x,y,callback) {
|
||||
// 衰弱
|
||||
if (special==13 && !core.hasFlag('weak')) {
|
||||
core.setFlag('weak', true);
|
||||
core.status.hero.atk-=core.flags.weakValue;
|
||||
core.status.hero.def-=core.flags.weakValue;
|
||||
core.status.hero.atk-=core.values.weakValue;
|
||||
core.status.hero.def-=core.values.weakValue;
|
||||
core.updateStatusBar();
|
||||
}
|
||||
// 诅咒
|
||||
@ -259,6 +487,12 @@ events.prototype.afterBattle = function(enemyId,x,y,callback) {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
// 如果已有事件正在处理中
|
||||
if (core.status.lockControl) {
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查处理后的事件。
|
||||
var event = core.floors[core.status.floorId].afterBattle[x+","+y];
|
||||
if (core.isset(event)) {
|
||||
@ -273,6 +507,13 @@ events.prototype.afterBattle = function(enemyId,x,y,callback) {
|
||||
|
||||
/****** 开完门 ******/
|
||||
events.prototype.afterOpenDoor = function(doorId,x,y,callback) {
|
||||
|
||||
// 如果已有事件正在处理中
|
||||
if (core.status.lockControl) {
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查处理后的事件。
|
||||
var event = core.floors[core.status.floorId].afterOpenDoor[x+","+y];
|
||||
if (core.isset(event)) {
|
||||
@ -289,49 +530,31 @@ events.prototype.afterOpenDoor = function(doorId,x,y,callback) {
|
||||
events.prototype.passNet = function (data) {
|
||||
// 有鞋子
|
||||
if (core.hasItem('shoes')) return;
|
||||
if (data.event.id=='lavaNet') {
|
||||
core.status.hero.hp -= core.flags.lavaDamage;
|
||||
if (data.event.id=='lavaNet') { // 血网
|
||||
core.status.hero.hp -= core.values.lavaDamage;
|
||||
if (core.status.hero.hp<=0) {
|
||||
core.status.hero.hp=0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose('lava');
|
||||
return;
|
||||
}
|
||||
core.updateStatusBar();
|
||||
core.drawTip('经过血网,生命-'+core.flags.lavaDamage);
|
||||
core.drawTip('经过血网,生命-'+core.values.lavaDamage);
|
||||
}
|
||||
if (data.event.id=='poisonNet') {
|
||||
if (data.event.id=='poisonNet') { // 毒网
|
||||
if (core.hasFlag('poison')) return;
|
||||
core.setFlag('poison', true);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
if (data.event.id=='weakNet') {
|
||||
if (data.event.id=='weakNet') { // 衰网
|
||||
if (core.hasFlag('weak')) return;
|
||||
core.setFlag('weak', true);
|
||||
core.status.hero.atk-=core.flags.weakValue;
|
||||
core.status.hero.def-=core.flags.weakValue;
|
||||
core.updateStatusBar();
|
||||
core.status.hero.atk-=core.values.weakValue;
|
||||
core.status.hero.def-=core.values.weakValue;
|
||||
}
|
||||
if (data.event.id=='curseNet') {
|
||||
if (data.event.id=='curseNet') { // 咒网
|
||||
if (core.hasFlag('curse')) return;
|
||||
core.setFlag('curse', true);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
// NPC自定义操作
|
||||
events.prototype.npcCustomAction = function (npcData) {
|
||||
|
||||
}
|
||||
|
||||
// 当点击(x,y)位置后自定义操作
|
||||
events.prototype.npcCustomActionOnClick = function (npcData, x, y) {
|
||||
|
||||
}
|
||||
|
||||
// NPC自定义事件处理
|
||||
events.prototype.npcCustomEffect = function (effect, npc) {
|
||||
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
// 存档事件前一刻的处理
|
||||
@ -344,31 +567,6 @@ events.prototype.afterLoadData = function(data) {
|
||||
|
||||
}
|
||||
|
||||
events.prototype.win = function(reason) {
|
||||
// 获胜
|
||||
core.waitHeroToStop(function() {
|
||||
core.clearMap('all');
|
||||
core.rmGlobalAnimate(0,0,true);
|
||||
core.drawText([
|
||||
"\t[结局3]恭喜通关!"
|
||||
], function () {
|
||||
core.restart();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
events.prototype.lose = function(reason) {
|
||||
// 失败
|
||||
core.waitHeroToStop(function() {
|
||||
core.drawText('\t[结局1]你死了。', function () {
|
||||
core.restart();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************/
|
||||
/*********** 界面上的点击事件 ***************/
|
||||
@ -382,7 +580,19 @@ events.prototype.clickAction = function (x,y) {
|
||||
this.doAction();
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.status.event.data.type=='choices') {
|
||||
// 选项
|
||||
var data = core.status.event.data.current;
|
||||
var choices = data.choices;
|
||||
if (choices.length==0) return;
|
||||
if (x >= 5 && x <= 7) {
|
||||
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||
if (y>=topIndex && y<topIndex+choices.length) {
|
||||
this.insertAction(choices[y-topIndex].action);
|
||||
this.doAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 怪物手册
|
||||
@ -419,22 +629,19 @@ events.prototype.clickFly = function(x,y) {
|
||||
|
||||
// 商店
|
||||
events.prototype.clickShop = function(x,y) {
|
||||
if (core.status.event.data == null) {
|
||||
console.log("发生错误,商店不存在?");
|
||||
return;
|
||||
}
|
||||
var shop = core.status.event.data.shop;
|
||||
var choices = shop.choices;
|
||||
if (x >= 5 && x <= 7) {
|
||||
if (y >= 5 && y <= 8) {
|
||||
if (y >= 5 + core.status.event.data.choices.length) return;
|
||||
|
||||
var topIndex = 6 - parseInt(choices.length / 2);
|
||||
if (y>=topIndex && y<topIndex+choices.length) {
|
||||
//this.insertAction(choices[y-topIndex].action);
|
||||
//this.doAction();
|
||||
var money = core.getStatus('money'), experience = core.getStatus('experience');
|
||||
|
||||
var shop = core.status.event.data;
|
||||
var times = shop.times, need = eval(shop.need);
|
||||
var use = shop.use;
|
||||
var use_text = use=='money'?"金币":"经验";
|
||||
|
||||
var choice = shop.choices[y-5];
|
||||
var choice = choices[y-topIndex];
|
||||
if (core.isset(choice.need))
|
||||
need = eval(choice.need);
|
||||
|
||||
@ -444,28 +651,36 @@ events.prototype.clickShop = function(x,y) {
|
||||
}
|
||||
|
||||
eval(use+'-='+need);
|
||||
|
||||
core.setStatus('money', money);
|
||||
core.setStatus('experience', experience);
|
||||
|
||||
// 更新属性
|
||||
choice.effect.split(";").forEach(function (t) {
|
||||
if (t.indexOf("status:")==0) {
|
||||
eval(t.replace("status:", "core.status.hero."));
|
||||
}
|
||||
else if (t.indexOf("item:")==0) {
|
||||
eval(t.replace("item:", "core.getItem('").replace("+=", "', ")+")");
|
||||
}
|
||||
});
|
||||
core.updateStatusBar();
|
||||
|
||||
core.npcEffect(choice.effect);
|
||||
|
||||
core.status.event.data.times++;
|
||||
core.ui.openShop(core.status.event.data.id);
|
||||
return;
|
||||
shop.times++;
|
||||
this.openShop(core.status.event.data.id);
|
||||
}
|
||||
|
||||
// 退出商店
|
||||
if (y == 9) {
|
||||
core.status.event.data = null;
|
||||
core.ui.closePanel();
|
||||
return;
|
||||
// 离开
|
||||
else if (y==topIndex+choices.length) {
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.setBoxAnimate();
|
||||
if (core.status.event.data.fromList)
|
||||
core.ui.drawQuickShop();
|
||||
else core.ui.closePanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 快捷商店
|
||||
events.prototype.clickSelectShop = function(x,y) {
|
||||
events.prototype.clickQuickShop = function(x, y) {
|
||||
if (x >= 5 && x <= 7) {
|
||||
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||
var topIndex = 6 - parseInt((keys.length + 1) / 2);
|
||||
@ -477,13 +692,9 @@ events.prototype.clickSelectShop = function(x,y) {
|
||||
core.drawText(reason);
|
||||
return;
|
||||
}
|
||||
var shop=shopList[keys[y - topIndex]];
|
||||
if (!shop.visited) {
|
||||
if (shop.times==0) core.drawTip('该商店尚未开启');
|
||||
else core.drawTip('该商店已失效');
|
||||
return;
|
||||
}
|
||||
core.ui.drawShop(keys[y - topIndex]);
|
||||
this.openShop(keys[y - topIndex], true);
|
||||
if (core.status.event.id=='shop')
|
||||
core.status.event.data.fromList = true;
|
||||
}
|
||||
if (y == exitIndex) {
|
||||
core.ui.closePanel();
|
||||
@ -567,11 +778,19 @@ events.prototype.clickSettings = function (x,y) {
|
||||
core.changeSoundStatus();
|
||||
core.ui.drawSettings(false);
|
||||
}
|
||||
if (y == 4) core.ui.drawSelectShop();
|
||||
if (y == 5) this.decreaseHard();
|
||||
if (y == 6) {
|
||||
if (y == 4) core.ui.drawQuickShop();
|
||||
// if (y == 5) this.decreaseHard();
|
||||
if (y == 5) {
|
||||
core.ui.drawSyncSave();
|
||||
}
|
||||
if (y == 6) {
|
||||
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
||||
localStorage.clear();
|
||||
core.drawText("\t[操作成功]你的本地所有存档已被清空。");
|
||||
}, function() {
|
||||
core.ui.drawSettings(false);
|
||||
})
|
||||
}
|
||||
if (y == 7) {
|
||||
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
||||
core.ui.closePanel();
|
||||
@ -588,67 +807,4 @@ events.prototype.clickSettings = function (x,y) {
|
||||
return;
|
||||
}
|
||||
|
||||
events.prototype.clickNPC = function(x,y) {
|
||||
|
||||
var data = core.status.event.data.current;
|
||||
if (core.isset(data)) {
|
||||
|
||||
// 对话,任意位置继续
|
||||
if (data.action == 'text') {
|
||||
core.npcAction();
|
||||
return;
|
||||
}
|
||||
if (data.action == 'choices') {
|
||||
if (x >= 5 && x <= 7) {
|
||||
if (y >= 5 && y <= 8) {
|
||||
if (y >= 5 + data.choices.length) return;
|
||||
|
||||
var choice = data.choices[y - 5];
|
||||
if (core.isset(choice.need)) {
|
||||
var able = true;
|
||||
choice.need.split(';').forEach(function (e) {
|
||||
var ones = e.split(',');
|
||||
var type = ones[0], key = ones[1], value = ones[2];
|
||||
if (type == 'status') {
|
||||
if (core.getStatus(key)<parseInt(value)) able=false;
|
||||
}
|
||||
else if (type == 'item') {
|
||||
if (core.itemCount(key)<parseInt(value)) able=false;
|
||||
}
|
||||
});
|
||||
if (!able) {
|
||||
core.drawTip("无法选择此项");
|
||||
return;
|
||||
}
|
||||
choice.need.split(';').forEach(function (e) {
|
||||
var ones = e.split(',');
|
||||
var type = ones[0], key = ones[1], value = ones[2];
|
||||
if (type == 'status') {
|
||||
core.setStatus(key, core.getStatus(key)-parseInt(value));
|
||||
}
|
||||
else if (type == 'item') {
|
||||
core.setItem(key, core.itemCount(key)-parseInt(value));
|
||||
}
|
||||
});
|
||||
}
|
||||
core.npcEffect(choice.effect);
|
||||
core.npcAction();
|
||||
return;
|
||||
}
|
||||
|
||||
// 退出商店
|
||||
if (y == 9 && !(core.isset(data.cancel) && !data.cancel)) {
|
||||
core.status.event.data = null;
|
||||
core.ui.closePanel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data.action == 'custom') {
|
||||
core.events.npcCustomActionOnClick(data, x, y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********** 点击事件 END ***************/
|
||||
|
||||
1
libs/events.min.js
vendored
Normal file
1
libs/events.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
libs/floors.min.js
vendored
Normal file
1
libs/floors.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,30 +1,39 @@
|
||||
function MT0() {}
|
||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||
main.floors.MT0 = {
|
||||
"floorId": "MT0", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "主塔 0 层", // 楼层中文名
|
||||
"name": 0, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
|
||||
MT0.prototype.init = function() {
|
||||
this.data = {
|
||||
'floorId': 'MT0', // 楼层唯一标识符
|
||||
'title': "样板层", // 楼层中文名;转换楼层时显示
|
||||
'name': 0, // 显示在状态栏中的楼层名称
|
||||
"canFlyTo": true, // 该楼能否被飞行器飞到(不能的话在该楼也不允许使用)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
],
|
||||
"events": { // 该楼的所有可能事件列表
|
||||
|
||||
],
|
||||
"events": [ // 该楼的所有可能事件列表
|
||||
},
|
||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||
|
||||
],
|
||||
"afterOpenDoor": [ // 开完门后可能触发的事件列表
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
|
||||
],
|
||||
"afterBattle": [ // 战斗后可能触发的事件列表
|
||||
},
|
||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||
|
||||
],
|
||||
"afterGetItem": [ // 获得道具后可能触发的事件列表
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
|
||||
},
|
||||
"checkBlock": [
|
||||
/****** 领域、夹击检查事件 ******/
|
||||
// 所有可能的领域、夹击点均需要在这里给出,否则将不会触发检查事件
|
||||
// 另外,如果该点已经存在events事件或changeFloor事件(即上面有相同点位置定义),则会被覆盖
|
||||
// afterBattle, afterGetItem, afterOpenDoor则不受影响(仍能正常工作)。
|
||||
// 所以 |****** 强烈要求可能的夹击、领域点不要存在自定义事件!! ******|
|
||||
]
|
||||
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
main.floors.MT0 = new MT0();
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||
main.floors.sample0 = {
|
||||
'floorId': 'sample0', // 楼层唯一标识符,需要和名字完全一致
|
||||
'title': "样板 0 层", // 楼层中文名
|
||||
'name': 0, // 显示在状态栏中的名称
|
||||
"floorId": "sample0", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "样板 0 层", // 楼层中文名
|
||||
"name": 0, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[0, 0, 220, 0, 0, 6, 87, 3, 65, 64, 44, 43, 42],
|
||||
@ -14,106 +16,107 @@ main.floors.sample0 = {
|
||||
[224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36],
|
||||
[201, 205, 217, 215, 207, 5, 0, 1, 27, 28, 29, 30, 35],
|
||||
[5, 5, 125, 5, 5, 5, 0, 1, 21, 22, 23, 24, 25],
|
||||
[45, 0, 0, 0, 0, 0, 0, 1, 1, 1, 121, 1, 1],
|
||||
[0, 0, 0, 0, 0, 0, 45, 1, 1, 1, 121, 1, 1],
|
||||
[4, 4, 126, 4, 4, 4, 0, 0, 0, 0, 0, 85, 124],
|
||||
[87, 11, 12, 13, 14, 4, 4, 2, 2, 2, 122, 2, 2],
|
||||
[88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86],
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
"\t[样板提示]首次到达某层可以触发 firstArrive 事件,\n该事件可类似于RMXP中的“自动执行脚本”。",
|
||||
"本事件支持一切的事件类型,常常用来触发对话,\n例如:",
|
||||
"\t[样板提示]首次到达某层可以触发 firstArrive 事件,\n该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,\n例如:",
|
||||
"\t[hero]我是谁?\n我从哪来?\n我又要到哪去?",
|
||||
"\t[仙子,fairy]你问我...?我也不知道啊...",
|
||||
"本层主要对道具、门、怪物等进行介绍,\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
],
|
||||
"events": { // 该楼的所有可能事件列表;NPC事件和楼层转换事件也需要包括在内
|
||||
"events": { // 该楼的所有可能事件列表
|
||||
|
||||
/****** NPC事件 ******/
|
||||
"10,9": [ // 守着道具的老人
|
||||
"\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、\n剑盾等。\nconstants 为永久道具,例如怪物手册、楼层\n传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中\n心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。",
|
||||
"\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义\n的需求则需在items.js中修改代码。",
|
||||
"\t[老人,man]constants 和 tools 各最多只允许12种,\n多了会导致图标溢出。",
|
||||
"\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
|
||||
{"type": "disappear"} // 消失
|
||||
{"type": "hide", "time": 500} // 消失
|
||||
],
|
||||
"10,11": [ // 守着门的老人
|
||||
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
|
||||
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
|
||||
{'type': 'disappear'}
|
||||
{'type': 'hide', "time": 500}
|
||||
],
|
||||
"2,10": [ // 守着楼梯、传送门、路障的老人
|
||||
"\t[老人,womanMagician]这些是路障、楼梯、传送门。",
|
||||
"\t[老人,womanMagician]血网的伤害数值、中毒后每步伤害数值、衰弱\n时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。",
|
||||
"\t[老人,womanMagician]楼梯和传送门需要在events中定义目标楼层\n和位置,可参见样板里已有的的写法。",
|
||||
"\t[老人,womanMagician]楼梯和传送门需要在changeFloor中定义目标\n楼层和位置,可参见样板里已有的的写法。",
|
||||
"\t[老人,womanMagician]楼梯和传送门是否可“穿透”,由data.js中的\n全局变量所决定,你也可以单独设置。\n穿透的意思是,自动寻路得到的路径中间经\n过了楼梯,行走时是否触发楼层转换事件。\n例如,下面的“下箭头”就是不能穿透的。",
|
||||
{"type": "disappear"}
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
"2,8": [ // 守着第一批怪物的老人
|
||||
"\t[老人,magician]这些都是各种各样的怪物。\n所有怪物的数据都在enemys.js中设置。\n\n每个怪物最多只能有一个特殊属性。",
|
||||
"\t[老人,magician]这些都是各种各样的怪物,\n所有怪物的数据都在enemys.js中设置。\n\n每个怪物最多只能有一个特殊属性。",
|
||||
"\t[老人,magician]这批怪物分别为:普通、先攻、魔攻、坚固、\n2连击、3连击、4连击、破甲、反击、净化。",
|
||||
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",
|
||||
{"type": "disappear"}
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
"2,5": [
|
||||
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值,\n可参见样板中黑魔法师的写法。",
|
||||
{"type": "disappear"}
|
||||
"2,5": [ // 守着第二批怪物的老人
|
||||
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值,\n可参见样板中黑暗大法师的写法。",
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
"2,3": [
|
||||
"2,3": [ // 守着第三批怪物额老人
|
||||
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,\n可参见样板中初级巫师的写法。",
|
||||
"\t[老人,magician]出于游戏性能的考虑,我们不可能每走一步都\n对领域和夹击进行检查。\n因此我们需要在本楼层的 events 中指明哪些\n点可能会触发领域和夹击事件,在这些点才会\n对领域和夹击进行检查和处理。\n\n具体可参见本层样板中events的做法。",
|
||||
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n\n另:本塔不支持阻击怪。",
|
||||
"\t[老人,magician]自动寻路会尽量绕过你设置的这些点。",
|
||||
{"type": "disappear"}
|
||||
"\t[老人,magician]出于游戏性能的考虑,我们不可能每走一步都\n对领域和夹击进行检查。\n因此我们需要在本楼层的 checkBlock 中指明\n哪些点可能会触发领域和夹击事件,在这些点\n才会对领域和夹击进行检查和处理。\n具体可参见本层 checkBlock 的写法。",
|
||||
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。\n\n另:本塔不支持阻击怪。",
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
|
||||
/****** 楼层转换事件 ******/
|
||||
"6,0": {"trigger": "changeFloor", "data": {"floorId": "sample0", "stair": "downFloor"}},
|
||||
"0,11": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [0,12]}},
|
||||
"0,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "stair": "upFloor"}}, // 注意,目标层有多个楼梯的话,写stair可能会导致到达位置不确定。这时候推荐写loc指明目标点位置。
|
||||
"1,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [1,12]}},
|
||||
"2,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [2,12]}},
|
||||
"3,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [6,1]}},
|
||||
"4,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [0,9]}},
|
||||
"5,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [6,10]}, "portalWithoutTrigger": false}, // 不能穿透
|
||||
"6,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [10,10]}},
|
||||
|
||||
|
||||
/****** 领域、夹击检查事件 ******/
|
||||
"1,0": {"trigger": "checkBlock"},
|
||||
"0,1": {"trigger": "checkBlock"},
|
||||
"1,1": {"trigger": "checkBlock"},
|
||||
"1,2": {"trigger": "checkBlock"},
|
||||
"2,1": {"trigger": "checkBlock"},
|
||||
"3,0": {"trigger": "checkBlock"},
|
||||
"3,2": {"trigger": "checkBlock"},
|
||||
"4,1": {"trigger": "checkBlock"},
|
||||
"12,10": { // 隐藏的仙子
|
||||
"enable": false, // enable: false代表初始时禁用事件
|
||||
"data": [
|
||||
"\t[仙子,fairy]只有楼上启用事件后,才能看到我并可以和我\n对话来触发事件。",
|
||||
{"type": "hide", "time": 500}
|
||||
]
|
||||
},
|
||||
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
"11,12": "你开了一个绿门,触发了一个afterOpenDoor事件"
|
||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||
"6,0": {"floorId": "sample1", "stair": "downFloor"}, // 目标点:sample1层的下楼梯位置
|
||||
"0,11": {"floorId": "sample0", "loc": [0,12]}, // 目标点:sample0层的x=0,y=12位置
|
||||
"0,12": {"floorId": "sample0", "stair": "upFloor"}, // 注意,目标层有多个楼梯的话,写stair可能会导致到达位置不确定。这时候推荐写loc指明目标点位置。
|
||||
"1,12": {"floorId": "sample0", "loc": [1,12]},
|
||||
"2,12": {"floorId": "sample0", "loc": [2,12]},
|
||||
"3,12": {"floorId": "sample0", "loc": [6,1], "direction": "up"}, // 切换楼层后勇士面对上方
|
||||
"4,12": {"floorId": "sample0", "loc": [0,9], "direction": "left", "time": 1000}, // 切换楼层后勇士面对左边,切换动画1000ms
|
||||
"5,12": {"floorId": "sample0", "loc": [6,10], "portalWithoutTrigger": false}, // 不能穿透
|
||||
"6,12": {"floorId": "sample0", "loc": [10,10], "direction": "left", "time": 1000, "portalWithoutTrigger": false},
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
"2,6": "\t[ghostSkeleton]不可能,你怎么可能打败我!\n(一个打败怪物触发的事件)"
|
||||
"2,6": ["\t[ghostSkeleton]不可能,你怎么可能打败我!\n(一个打败怪物触发的事件)"]
|
||||
},
|
||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||
"11,8": "由于状态栏放不下,绿钥匙和铁门钥匙均视为tools,\n放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。",
|
||||
"8,6": "由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。",
|
||||
"8,7": "如需修改消耗品的效果,请前往items.js,修改\ngetItemEffect 和 getItemEffectTip 两个函数\n的具体数值即可。",
|
||||
"11,8": ["由于状态栏放不下,绿钥匙和铁门钥匙均视为tools,\n放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。"],
|
||||
"8,6": ["由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。"],
|
||||
"8,7": ["如需修改消耗品的效果,请前往 data.js ,找到\n并修改values内对应的具体数值即可。\n\n如果有更高级的需求(如每个区域宝石数值变化)\n,详见doc文档内的做法说明。"],
|
||||
"10,7": ["在 data.js 的系统Flag中设置是否启用魔防。\n如果不启用魔防则不会在状态栏显示。"],
|
||||
"9,5": [
|
||||
"每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。",
|
||||
"飞行的楼层顺序由 main.js 中 floorIds 加载顺序\n所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统\nFlag所决定。"
|
||||
],
|
||||
"10,5": "破墙镐是破面前的墙壁还是四个方向的墙壁,\n由data.js中的系统Flag所决定。",
|
||||
"10,5": ["破墙镐是破面前的墙壁还是四个方向的墙壁,\n由data.js中的系统Flag所决定。"],
|
||||
"8,4": [
|
||||
"炸弹可以炸四个方向的怪物。\n如只需要炸前方怪物请使用上面的圣锤。",
|
||||
"不能被炸的怪物在enemys中可以定义。\n可参见样板里黑衣魔王的写法。\n\n炸死怪物是否触发事件由 data.js 中的系统Flag\n所决定。"
|
||||
],
|
||||
"9,4": "中心对称飞行器飞向的目标不能在楼层的events\n列表里存在,即使事件已经结束(如刚刚的老人)。",
|
||||
"10,4": "上楼器和下楼器的目标点要求同中心对称飞行器。\n\n“上楼”和“下楼”的目标层由 main.js 的 floorIds\n顺序所决定。",
|
||||
"10,3": "十字架目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。",
|
||||
"9,2": "该道具默认是大黄门钥匙,如需改为钥匙盒直接\n修改 data.js 中的系统Flag即可。",
|
||||
"10,2": "屠龙匕首目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。",
|
||||
}
|
||||
"10,4": ["“上楼”和“下楼”的目标层由 main.js 的 floorIds\n顺序所决定。"],
|
||||
"10,3": ["十字架目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。"],
|
||||
"9,2": ["该道具默认是大黄门钥匙,如需改为钥匙盒直接\n修改 data.js 中的系统Flag即可。"],
|
||||
"10,2": ["屠龙匕首目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。"],
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
"11,12": ["你开了一个绿门,触发了一个afterOpenDoor事件"]
|
||||
},
|
||||
"checkBlock": [
|
||||
/****** 领域、夹击检查事件 ******/
|
||||
// 所有可能的领域、夹击点均需要在这里给出,否则将不会触发检查事件
|
||||
// 另外,如果该点已经存在events事件或changeFloor事件(即上面有相同点位置定义),则会被覆盖
|
||||
// afterBattle, afterGetItem, afterOpenDoor则不受影响(仍能正常工作)。
|
||||
// 所以 |****** 强烈要求可能的夹击、领域点不要存在自定义事件!! ******|
|
||||
"1,0", "3,0", "0,1", "2,1", "4,1", "1,2", "3,2"
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,30 +1,311 @@
|
||||
function sample1() {}
|
||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||
main.floors.sample1 = {
|
||||
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "样板 1 层", // 楼层中文名
|
||||
"name": 1, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[7, 131, 8, 2, 9, 130, 10, 2, 0, 0, 132, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0],
|
||||
[2, 2, 2, 2, 121, 2, 2, 2, 0, 0, 229, 0, 0],
|
||||
[43, 33, 44, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0],
|
||||
[21, 22, 21, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0],
|
||||
[1, 245, 1, 1, 0, 87, 0, 2, 2, 2, 85, 2, 2],
|
||||
[0, 246, 0, 1, 0, 0, 0, 2, 2, 221, 0, 221, 2],
|
||||
[246, 0, 246, 1, 0, 0, 0, 121, 85, 0, 0, 0, 2],
|
||||
[1, 246, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[1, 1, 1, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0],
|
||||
[1, 0, 123, 1, 0, 3, 124, 0, 121, 0, 122, 0, 126],
|
||||
[1, 0, 0, 1, 88, 3, 86, 0, 0, 0, 0, 0, 0],
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
|
||||
sample1.prototype.init = function() {
|
||||
this.data = {
|
||||
'floorId': 'template', // 楼层唯一标识符,需要和名字完全一致
|
||||
'title': "样板层", // 楼层中文名
|
||||
'name': 0, // 显示在status bar中的名称
|
||||
"canFlyTo": true, // 该楼能否被飞行器飞到(不能的话在该楼也不允许使用)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
],
|
||||
"events": { // 该楼的所有可能事件列表
|
||||
|
||||
"4,10": [ // 走到中间时的提示
|
||||
"\t[样板提示]本层楼将会对各类事件进行介绍。",
|
||||
"左边是一个仿50层的陷阱做法,上方是商店、快捷\n商店的使用方法,右上是一个典型的杀怪开门的例\n子,右下是各类可能的NPC事件。",
|
||||
"本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)\nopenShop: 打开一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置\nwin: 获得胜利(游戏通关)\nlose: 游戏失败",
|
||||
"move: 移动事件效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性、道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n\n更多支持的事件还在编写中,欢迎您宝贵的意见。",
|
||||
"有关各类事件的样例,可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后,需要调用\n{\"type\": \"hide\"}\n该事件才不会再次出现。",
|
||||
{"type": "hide"}
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
|
||||
|
||||
|
||||
/****** 左边仿50F陷阱事件 ******/
|
||||
"1,5": {"enable": false}, // 这几个是白衣武士等怪物,起始时需要隐藏起来
|
||||
"1,6": {"enable": false},
|
||||
"0,7": {"enable": false},
|
||||
"2,7": {"enable": false},
|
||||
"1,8": {"enable": false},
|
||||
"1,7": [ // 走到白衣武士中间,触发陷阱事件
|
||||
{"type": "show", "loc": [1,5], "time": 1500}, // 显示红衣魔王,动画效果1500ms
|
||||
{"type": "sleep", "time": 500}, // 等待500ms
|
||||
"\t[redKing]欢迎来到魔塔,你是第一百位挑战者。\n若你能打败我所有的手下,我就与你一对一\n的决斗。\n现在你必须接受我的安排。",
|
||||
{"type": "show", "loc": [1,6], "time": 500}, // 显示四个白衣武士,每个动画效果500ms
|
||||
{"type": "show", "loc": [0,7], "time": 500},
|
||||
{"type": "show", "loc": [1,8], "time": 500},
|
||||
{"type": "show", "loc": [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]}, // 直接隐藏四个白衣武士,没有动画效果
|
||||
{"type": "hide", "loc": [0,7]},
|
||||
{"type": "hide", "loc": [2,7]},
|
||||
{"type": "hide", "loc": [1,8]},
|
||||
{"type": "hide", "loc": [1,5], "time": 500}, // 隐藏红衣魔王,动画500ms
|
||||
{"type": "hide"}, // 隐藏本事件
|
||||
{"type": "changeFloor", "floorId": "sample1", "loc": [1,11]}, // 楼层切换。changeFloor必须指定floorId和loc。
|
||||
// 备注:这里也可以下面的这种写法:
|
||||
// {"type": "changePos", "loc": [1,11]}
|
||||
// 使用这种写法将不会有“楼层切换动画”,而是直接让勇士到达本层的loc位置。
|
||||
{"type": "trigger", "loc": [2,11]} // 立刻直接触发另一个事件(也就是下面的小偷事件);当前事件会被立刻结束
|
||||
],
|
||||
"events": [ // 该楼的所有可能事件列表
|
||||
|
||||
"2,11": [ // 小偷事件
|
||||
"\t[杰克,thief]喂!醒醒!快醒醒!",
|
||||
"\t[hero]额,我这是在什么地方?",
|
||||
"\t[杰克,thief]你被魔王抓了起来扔进了监狱,和我关在了一\n起,但是幸运的是我在昨天刚刚挖好一条越狱\n的暗道!",
|
||||
{"type": "openDoor", "loc": [3,11]}, // 开门或墙必须指定门/墙的名称,否则不会执行
|
||||
{"type": "sleep", "time": 300}, // 等待300ms
|
||||
"\t[杰克,thief]我先走了,祝你好运!",
|
||||
{"type": "move", "time": 750, "steps": [ // 动画移动效果,time为每步事件(毫秒),steps是个数组指定了移动的方位
|
||||
{"direction": "right", "value": 2}, // 向右移动两步,再向下移动一步,并消失
|
||||
"down" // 如果该方向只移动一步,可以直接这样简写。 这种写法等价于: {"direction":"down","value":1}
|
||||
]},
|
||||
// 调用move事件后,hide事件也会被自动调用,因此无需再手动调用 {"type":"hide"} 来隐藏本事件了
|
||||
"上面是个move事件,可以对NPC等进行移动。\n详见样板中小偷事件的写法。",
|
||||
"\t[hero]怎么跑的这么快..."
|
||||
],
|
||||
"afterOpenDoor": [ // 开完门后可能触发的事件列表
|
||||
|
||||
|
||||
|
||||
/****** 上方商店事件相关 ******/
|
||||
"4,2": [ // 商店门前的老人
|
||||
"\t[老人,man]本塔的商店有两类,全局商店和非全局商店。\n\n所谓非全局商店,就类似于右下角那个卖钥匙\n的老人一样,一定要碰到才能触发事件。\n\n而全局商店,则能在快捷商店中直接使用。",
|
||||
"\t[老人,man]要注册一个全局商店,你需要在 data.js 中,\n找到 shops,并在内添加你的商店信息。",
|
||||
"\t[老人,man]商店信息添加后,可以在需要的事件处调用\n{\"type\": \"openShop\"}\n来打开你添加的全局商店。",
|
||||
"\t[老人,man]在上面的例子里,左边是一个仿50层的金币\n商店,右边是一个仿24层的经验商店。\n\n商店被访问后即可在快捷商店中进行使用。",
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
"afterBattle": [ // 战斗后可能触发的事件列表
|
||||
|
||||
"1,0": [ // 金币商店
|
||||
// 打开商店前,你也可以添加自己的剧情
|
||||
// 例如,通过if来事件来判断是不是第一次访问商店,是的则显示一段文字(类似宿命的华音那样)
|
||||
{"type": "openShop", "id": "moneyShop1"} // 这里的id要和data.js中你定义的商店ID完全一致
|
||||
// 调用openShop事件后,所有当前事件都会被结束(同exit事件),然后打开一个全局商店
|
||||
],
|
||||
"5,0": [ // 经验商店
|
||||
{"type": "openShop", "id": "expShop1"}
|
||||
],
|
||||
"afterGetItem": [ // 获得道具后可能触发的事件列表
|
||||
|
||||
|
||||
|
||||
/****** 右边陷阱、战斗相关 ******/
|
||||
"7,7": [ // 门口老人的提示
|
||||
"\t[老人,man]这是一个典型的杀怪开门、强制战斗事件。",
|
||||
{"type": "hide"} // 不显示动画,直接消失
|
||||
],
|
||||
"8,7": {"enable": false}, // 门口的机关门,初始时是禁用状态
|
||||
"9,7": [ // 当你刚进去后,触发机关门
|
||||
{"type": "show", "loc": [8,7]}, // 显示机关门
|
||||
{"type": "hide"} // 该事件消失
|
||||
],
|
||||
// 注意:初级卫兵打死后的开门事件是在 afterBattle 中调用
|
||||
"10,4": [ // 开门后走进去的事件:强制战斗
|
||||
"\t[blackKing]你终于还是来了。",
|
||||
"\t[hero]放开我们的公主!",
|
||||
"\t[blackKing]如果我不愿意呢?",
|
||||
"\t[hero]无需多说,拔剑吧!",
|
||||
{"type": "battle", "id": "blackKing"}, // 强制战斗
|
||||
// 如果战斗失败直接死亡,不会继续触发接下来的剧情。
|
||||
{"type": "hide", "loc": [10,2]}, // 战斗后需要手动使怪物消失;战斗后不会引发afterBattle事件。
|
||||
{"type": "openDoor", "loc": [8,7]}, // 开门口的机关门
|
||||
"\t[blackKing]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了,请好好对她。",
|
||||
{"type": "hide"} // 隐藏本事件
|
||||
],
|
||||
"10,0": [ // 公主事件
|
||||
"\t[hero]公主,我来救你了~",
|
||||
"\t[公主,princess]快救我出去!我受够这里了!",
|
||||
"\t[hero]公主别怕,我们走吧~",
|
||||
{"type": "win", "reason": "救出公主"} // 获得胜利。此事件将显示获胜界面,并结束游戏。
|
||||
// 该事件将直接调用events.js中的win()函数;如需修改获胜界面内容可前往修改。
|
||||
// 下面这个是失败事件,同样会直接调用events.js中的lose()函数;如需修改失败界面内容可以前往修改。
|
||||
// {"type": "lose", "reason": "救了假公主"}
|
||||
],
|
||||
|
||||
|
||||
|
||||
/****** 右下各种NPC事件相关 ******/
|
||||
"6,12": {"enable":false}, // 仙子下面的铁门,初始时是禁用的
|
||||
"6,11": [ // 仙子事件
|
||||
"\t[仙子,fairy]通过调用 {\"type\": \"show\"} 可以使隐藏的\n事件显示出来。\n比如我下面这个机关门。",
|
||||
{"type": "show", "loc": [6,12]}, // 使隐藏的铁门显示出来
|
||||
"\t[仙子,fairy]通过调用 {\"type\": \"openDoor\"} 可以无需\n钥匙打开一扇门或暗墙。",
|
||||
{"type": "openDoor", "loc": [6,12]}, // 开门
|
||||
"\t[仙子,fairy]同时,也可以对其它层进行操作,比如楼下\n的机关门,现在已经为你打开了。",
|
||||
{"type": "openDoor", "loc": [11,10], "floorId": "sample0"}, // 打开其它层的门,需要指定floorId
|
||||
"\t[仙子,fairy]如果 show 或 hide 指定了 time 参数,则\n以动画效果显示,指定的参数作为消失时间\n(毫秒)来计算。",
|
||||
"\t[仙子,fairy]现在到楼下来找我吧~",
|
||||
{"type": "show", "loc": [12,10], "floorId": "sample0"}, // 显示其它层的事件,需要指定其floorId
|
||||
{"type": "hide", "time": 500}
|
||||
],
|
||||
"8,11": [ // 老人事件,勇士状态的显示与变化
|
||||
{"type": "setValue", "name": "flag:man_times", "value": "flag:man_times+1"}, // 设置这个老人的访问次数
|
||||
"\t[老人,man]在文字中使用${' ${ '}和 } 可以计算并显示一个\n表达式的结果。\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]同时,你也可以通过\n{\"type\": \"setValue\"}\n来设置一个勇士的属性、道具,或某个Flag。",
|
||||
"\t[老人,man]例如:\n现在我将让你的攻防提升50%,再将攻防和\n的十倍加到生命值上。",
|
||||
{"type": "setValue", "name": "status:atk", "value": "status:atk*1.5"}, // 攻击提升50%;注意不要加${}
|
||||
{"type": "setValue", "name": "status:def", "value": "status:def*1.5"}, // 防御提升50%;注意不要加${}
|
||||
{"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:experience", "value": "status:experience+1000"},
|
||||
{"type": "setValue", "name": "item:pickaxe", "value": "item:pickaxe+1"}, // 1破
|
||||
{"type": "setValue", "name": "item:bomb", "value": "item:bomb+2"}, // 2炸
|
||||
{"type": "setValue", "name": "item:centerFly", "value": "item:centerFly+3"}, // 3飞
|
||||
"\t[老人,man]status:xxx 代表勇士的某个属性。\n其中xxx可取hp, atk, def, mdef, money,\nexperience这几项。\n\nitem:xxx 代表勇士的某个道具的个数。\nxxx为道具ID,具体可参见items.js中的定义。\n\nflag:xxx 代表某个自定义Flag或变量。\nxxx为Flag/变量名,可以自行定义,由字母、\n数字和下划线组成。\n未定义过而直接取用的Flag默认值为false。",
|
||||
// 如果老人不消失,则不要调用 {"type": "hide"}
|
||||
"\t[老人,man]你现在可以重新和我进行对话,进一步看到\n属性值的改变。"
|
||||
],
|
||||
"10,11": [ // 商人事件,if语句和choices语句的写法
|
||||
// 这部分逻辑相对比较长,细心看,很容易看懂的。
|
||||
{"type": "if", "condition": "flag:woman_times==0", // 条件判断:是否从未访问过此商人。
|
||||
"true": [ // 如果从未访问过该商人,显示一段文字
|
||||
"\t[老人,woman]这是个很复杂的例子,它将教会你如何使用\nif 语句进行条件判断,以及 choices 提供\n选项来供用户进行选择。",
|
||||
"\t[老人,woman]第一次访问我将显示这段文字;从第二次开始\n将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后,将送你一把大黄门\n钥匙,并消失不再出现。",
|
||||
"\t[老人,woman]这部分的逻辑比较长,请细心看样板的写法,\n是很容易看懂并理解的。"
|
||||
// 第一次访问结束
|
||||
],
|
||||
"false": [ // 如果已经访问过该商人
|
||||
{"type": "if", "condition": "flag:woman_times==8", // 条件判断:是否已经出售七把钥匙
|
||||
"true": [ // 如果已经出售过七把钥匙,则直接结束
|
||||
"\t[老人,woman]你购买的钥匙已经够多了,再继续卖给你的话\n我会有危险的。",
|
||||
"\t[老人,woman]看在你贡献给我这么多钱的份上,送你一把大\n黄门钥匙吧,希望你能好好用它。",
|
||||
{"type": "setValue", "name": "item:bigKey", "value": "item:bigKey+1"}, // 获得一把大黄门钥匙
|
||||
"\t[老人,woman]我先走了,拜拜~",
|
||||
{"type":"hide", "time": 500}, // 消失
|
||||
{"type":"exit"} // 立刻结束当前事件。下面的 setValue 和 revisit 都不会再执行。
|
||||
],
|
||||
"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"}, // 增加黄钥匙
|
||||
// 然后会继续执行下面的setValue来增加商人访问次数
|
||||
],
|
||||
"false": [
|
||||
"\t[老人,woman]你的金钱不足!",
|
||||
{"type": "revisit"} // 直接重新访问;不执行下面的setValue来增加访问次数
|
||||
]
|
||||
}
|
||||
]},
|
||||
{"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\"} 可以写自定义的\nJS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
|
||||
"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后\n会将你的输入结果直接加到你的攻击力上。",
|
||||
{"type": "function", "function": function() { // 自己写JS脚本并执行
|
||||
var value = prompt("请输入你要加攻击力的数值:"); // 弹出一个输入框让用户输入数据
|
||||
if (value!=null) {
|
||||
value=parseInt(value);
|
||||
if (value>0) { // 检查
|
||||
core.setStatus("atk", core.getStatus("atk")+value);
|
||||
// core.updateStatusBar(); // 和下面的 {"type": "update"} 等价,立即更新状态栏和地图显伤
|
||||
core.drawTip("操作成功,攻击+"+value); // 左上角气泡提示
|
||||
core.events.insertAction([ // 往当前事件列表前插入两条事件
|
||||
{"type": "update"}, // 更新状态栏和地图显伤
|
||||
"操作成功,攻击+"+value // 对话框提示
|
||||
]);
|
||||
}
|
||||
}
|
||||
}},
|
||||
"\t[老人,womanMagician]具体可参见样板中本事件的写法。"
|
||||
]
|
||||
};
|
||||
},
|
||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||
"4,12": {"floorId": "sample0", "loc": [6,0]}, // 由于楼下有多个上楼梯,所以需指定位置而不是简单地写"stair": "upFloor"
|
||||
"5,5": {"floorId": "sample2", "stair": "downFloor"}
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
"9,6": [ // 初级卫兵1
|
||||
{"type": "setValue", "name": "flag:door", "value": "flag:door+1"}, // 将"door"这个自定义flag加一
|
||||
{"type": "if", "condition": "flag:door==2", // 一个条件判断事件,条件是"door"这个flag值等于2
|
||||
"true": [ // 如果条件成立:打开机关门
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
"false": [] // 如果条件不成立则无事件触发
|
||||
},
|
||||
],
|
||||
"11,6": [ // 初级卫兵2;注意由于打怪顺序问题,可能都得写一遍。
|
||||
{"type": "setValue", "name": "flag:door", "value": "flag:door+1"}, // 将"door"这个自定义flag加一
|
||||
{"type": "if", "condition": "flag:door==2", // 一个条件判断事件,条件是"door"这个flag值等于2
|
||||
"true": [ // 如果条件成立:打开机关门
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
"false": [] // 如果条件不成立则无事件触发
|
||||
},
|
||||
],
|
||||
},
|
||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
|
||||
},
|
||||
"checkBlock": [
|
||||
/****** 领域、夹击检查事件 ******/
|
||||
// 所有可能的领域、夹击点均需要在这里给出,否则将不会触发检查事件
|
||||
// 另外,如果该点已经存在events事件或changeFloor事件(即上面有相同点位置定义),则会被覆盖
|
||||
// afterBattle, afterGetItem, afterOpenDoor则不受影响(仍能正常工作)。
|
||||
// 所以 |****** 强烈要求可能的夹击、领域点不要存在自定义事件!! ******|
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
main.floors.sample1 = new sample1();
|
||||
|
||||
376
libs/floors/sample2.js
Normal file
376
libs/floors/sample2.js
Normal file
@ -0,0 +1,376 @@
|
||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||
main.floors.sample2 = {
|
||||
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "主塔 40 层", // 楼层中文名
|
||||
"name": 40, // 显示在状态栏中的层数
|
||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
||||
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 4, 1, 85, 1, 4, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 247, 1, 247, 1, 247, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 1, 247, 247, 247, 1, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 1, 247, 30, 247, 1, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 247, 1, 124, 1, 247, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 4, 1, 123, 1, 4, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 5],
|
||||
[5, 4, 4, 4, 4, 4, 85, 4, 4, 4, 4, 4, 5],
|
||||
[5, 5, 5, 5, 5, 5, 88, 5, 5, 5, 5, 5, 5],
|
||||
],
|
||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||
"\t[实战!]本楼将尝试复刻《宿命的旋律》40F剧情。",
|
||||
"由于暂不支持一些动画效果,例如雷电、振动、天\n气渲染等等,因此做出来的效果远远比不上原版。\n\n不过作为抛砖引玉,还是可以展示一下H5的能力。\n(开音效食用更加)"
|
||||
],
|
||||
"events": { // 该楼的所有可能事件列表
|
||||
|
||||
"6,11": {"enable": false}, // 下楼梯口的机关门,初始处于关闭状态
|
||||
"6,10": [ // 进入陷阱后关门
|
||||
{"type": "playSound", "name": "door.ogg"},
|
||||
{"type": "show", "loc": [6,11]}, // 显示机关门
|
||||
{"type": "hide"}, // 隐藏该事件
|
||||
{"type": "trigger", "loc": [6,7]}, // 直接引发"6,7"处的事件,即下面的杰克
|
||||
// 请再次注意"trigger"会立刻结束当前事件,因此"type":"hide"需要在trigger前调用
|
||||
],
|
||||
"6,7": [ // 杰克事件
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]杰克,你究竟是什么人?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[杰克,thief]……",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]我们……是朋友对吧?\n是朋友就应该相互信任对吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[杰克,thief]……事到如今也没有什么好隐瞒的了。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[杰克,thief]没错,我就是这一切的背后主谋。",
|
||||
{"type": "move", "steps": [ // 移动到黑暗大法师的位置;使用move会自动调用hide进行隐藏,无需再手动调用
|
||||
{"direction": "up", "value": 3}
|
||||
], "time": 1000},
|
||||
{"type": "show", "loc": [6,4], "time": 1000}, // 显示黑暗大法师
|
||||
{"type": "sleep", "time": 500}, // 等待500毫秒
|
||||
// 下面是黑暗大法师的事件
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]我的真名为——黑暗大法师,第四区域的头目。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]呵呵,不知道为什么,我竟然对事情走到\n现在这一步毫不感觉意外。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]以杰克的名义利用了你这么久,真是抱歉啊。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]真正的杰克现在在哪里?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]盗贼杰克这个人类从未存在过,他只是我用来\n接近你的一副皮囊而已。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……这样啊,呵呵。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]为什么你看上去丝毫不生气?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]多亏了鬼帝,我现在的脾气好得连我自己\n都害怕。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]说起来我还得好好感谢你呢,如果没有杰\n克……你的帮助,我早就死在第一区域了。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]不论你的目的如何,你的所作所为都是对\n我有利的。不是吗?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]能够如此淡定的面对背叛,看来跟五年前相比,\n你确实成长了很多啊。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]五年前?……黑暗大法师,在这之前,我们\n好像素未谋面吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]五年前那场屠城你应该这一生都不会忘记吧。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]很不巧,那场屠城的主谋,也是我。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]这么说,击中我双亲的那道紫色闪电,也\n就是你释放的吧……",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下\n他们的样子吗?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]老 子 要 你 的 命",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]你应该对我心怀感激才对,如果不是那时的\n我看出了你隐藏的稀有勇者体质,你绝对不\n可能活到今天。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]在暗中动手脚让你通过勇者选拔的人也是我,\n我一直一直在暗中引导你走到今天这一步。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]是我救赎了一无是处的你。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]为什么只有我一个人活了下来!!!!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]为什么偏偏是我!!!!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]我刚才不是说过了吗?因为我看出了你有\n稀有勇者体质啊。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]你刚刚跟鬼帝交过手,应该已经很清楚这\n稀有勇者体质意味着什么了吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……就因为我有这种体质,就不得不背负如此\n残酷的宿命吗?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]愚蠢!这意味着只要我对你加以引导跟培养,\n你就能成为这世间实力最强的存在!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……所以,你究竟想利用我干什么?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]我利用你干的事情,你不是已经完成了吗?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……你说什么?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]不知不觉间,你已经在我的指引下跟鬼帝\n正面交手并且杀掉了他啊。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]就连我跟鬼帝的对决……也是被你安排好了的?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]你们两个一个是人类勇者,一个是魔物勇者,\n迟早会有交手的一天。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]我只不过是操纵了一系列的连锁事件让这一天\n提早了数十年到来而已。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……你这样做对谁有好处?他可是你们魔物\n世界的救世主啊。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]一个惧怕征战,爱好和平的懦夫,也配叫\n救世主?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]获得了力量,却只会被动挨打而不主动向\n人类世界出击,龟缩在第二区域惶惶度日,\n他根本就不配拥有稀有勇者体质。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]为了不让这种人霸占着积累多年的庞大灵魂\n能量无作为,我设计让你杀掉了他。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]你没有辜负我的期待,成功战胜了那个废物,\n现在你体内累积的灵魂能量……也就是魔力,\n已经达到了能跟魔王匹敌的地步。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……是吗?现在的我能与魔王匹敌?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]不止如此,你现在的力量之强就算是统治\n世界也是绰绰有余!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]怎么样?要不要加入我的麾下,跟随我去\n征战人类世界?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]能与魔王匹敌的话,也就是说。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]我 现 在 对 付 你 这 种 杂 碎 也 绰 绰 有 余\n吧 ?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]……什么?!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]等一下!别冲动!你先等我把这利害关系\n理一理——",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]你给老子闭嘴。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]老子什么都不想听。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]老子现在想做的事情只有一件——",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]剁掉你的头,把它放回我双亲的墓前。",
|
||||
{"type": "update"} // 本事件剧情结束,更新地图显伤
|
||||
],
|
||||
"6,4": { // 黑暗大法师战斗事件
|
||||
"enable": false, // 初始时是禁用状态
|
||||
// 打败后将触发afterBattle事件
|
||||
},
|
||||
"5,4": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||
"7,4": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||
"5,5": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||
"7,5": {"enable":false}, // 大法师的分身们,初始时禁用状态
|
||||
"6,3": { // 大法师本尊
|
||||
"trigger": "action", // 注意:这里要写 trigger:action ,来覆盖掉系统默认的battle事件。
|
||||
"enable":false,
|
||||
"data": [
|
||||
"\t[blackMagician]听不进去人话的蠢货,就要用疼痛来管教!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]出来吧!禁忌——紫电凶杀阵!",
|
||||
{"type": "show", "loc": [4,3], "time": 500}, // 依次显示四个角的法师
|
||||
{"type": "show", "loc": [4,6], "time": 500}, // 依次显示四个角的法师
|
||||
{"type": "show", "loc": [8,6], "time": 500}, // 依次显示四个角的法师
|
||||
{"type": "show", "loc": [8,3], "time": 500}, // 依次显示四个角的法师
|
||||
{"type": "sleep", "time": 500},
|
||||
"\t[blackMagician]感受绝望吧!冥顽不化的蠢货!",
|
||||
{"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [4,3], "time": 150},
|
||||
{"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [4,6], "time": 150},
|
||||
{"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [8,6], "time": 150},
|
||||
{"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [8,3], "time": 150},
|
||||
{"type": "sleep", "time": 200},
|
||||
{"type": "playSound", "name": "attack.ogg"}, // 播放攻击音效
|
||||
{"type": "sleep", "time": 200},
|
||||
"\t[hero]唔……!!(吐血)",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]我的魔力可是充足的很啊!我会一直折磨\n到你屈服于我为止!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]人类!好好感受吧!当初你们施加于我的\n痛苦!如今我要百倍奉还!",
|
||||
{"type": "show", "loc": [6,6], "time": 1000}, // 显示妖精
|
||||
{"type": "sleep", "time": 700},
|
||||
{"type": "trigger", "loc": [6,6]} // 立刻触发妖精事件
|
||||
]
|
||||
},
|
||||
"4,3": {"trigger":"action","enable":false}, // 四个角的大法师,添加trigger:action可避免该点出现显伤
|
||||
"8,3": {"trigger":"action","enable":false}, // 四个角的大法师
|
||||
"4,6": {"trigger":"action","enable":false}, // 四个角的大法师
|
||||
"8,6": {"trigger":"action","enable":false}, // 四个角的大法师
|
||||
|
||||
"6,6": { // 妖精
|
||||
"enable":false, // 初始时禁用状态
|
||||
"data": [ // 妖精事件
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]…妖精…小姐……是你吗?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]不要绝望,也不要悲伤。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]你从来都不是独自一人在前进。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]咱一直,一直都在注视着你。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]耍小聪明的你、笨笨的你呆呆的你、胆小的\n你、勇敢的你帅气的你……全部全部都是你。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]所以放心吧,无论发生什么,咱都会陪伴\n在你身边的。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]因为你要是离开我的话,立刻就会死掉吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]…妖精…小姐……其实一直以来,我都非常\n感激你……",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]笨蛋!都这种时候了就不要作出像是临终\n遗言的发言了啊!!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]喂!那边穿衣品味差到极点的黑暗大法师,\n别左顾右盼说的就是你!你应该知道咱的\n身份吧?\n还不速速退下!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]可恶…多管闲事的妖精族…明明只要再让他\n承受一点疼痛来瓦解他的意志力,我的计\n划就成功了!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]哼哼哼~抱歉哦,这个笨蛋的意志力可不像\n你想象的那么薄弱哦!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]终于露出狐狸尾巴了,其实咱早就看出你有\n谋反的念头。你的计划就是拉拢这家伙入\n伙然后推翻魔王对魔塔的统治对吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]呵呵呵……那个昏庸的魔王,掌握着那么庞大\n的魔物军队却只知道固守魔塔,而不主动侵略\n人类世界扩张领土!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]我实在是看不过眼,所以我才决定把这个具\n备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]你觉得一个满脑子想着回家种田的废柴勇者\n会成为改变世界的魔王?你晃晃脑袋试试,\n是不是能听到大海的声音?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]恼人至极的妖精族!呵呵呵……我干脆一不做\n二不休,连你也一块收拾了吧!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]别小瞧咱!咱好歹也是妖精族里实力数一\n数二的存在!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]只会耍嘴皮子的恼人苍蝇!我倒要看看一块\n焦炭会不会说话!\n——招雷弹!!",
|
||||
{"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [4,3], "time": 150},
|
||||
{"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [4,6], "time": 150},
|
||||
{"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [8,6], "time": 150},
|
||||
{"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示
|
||||
{"type": "show", "loc": [8,3], "time": 150},
|
||||
{"type": "playSound", "name": "attack.ogg"}, // 播放攻击音效
|
||||
{"type": "hide", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害
|
||||
{"type": "show", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害
|
||||
{"type": "sleep", "time": 500}, // 等待500毫秒
|
||||
"\t[小妖精,fairy]切,这点伤痛跟他刚才经历的身心地狱相比\n根本就不算什么。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]哼!翅膀都被烧焦了还要嘴硬?你难不成\n真以为我不会对你动真格?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……你这混蛋!给我离她远点!!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]!…你现在受了很严重的致命伤,乱动什么?\n乖。别怕,这里有咱顶着!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]对了,咱再问你一遍,你是很珍惜自己性命\n的对吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]!…等等…妖精小姐,你不会是……?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]喂,黑暗大法师,你作为魔塔里最博学多识\n的蠢货,应该对咱妖精族的特殊能力再清楚\n不过吧?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]哼哼哼!你害怕的表情可真美味!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]不过比起这个,咱更期待你吃到“妖精自灭\n冲击”之后的死状哦!~",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[blackMagician]不!!不应该是这样的!我完美的计划竟然\n会被一只小小的妖精破坏!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]不要!……千万不要!……为了我这种人……唔!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]笨蛋,动都动不了了就不要强撑着站起来\n了啊。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]真是的,都到最后一刻了,你这家伙好歹\n也让咱省点心吧。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[小妖精,fairy]那么,再见了……我的勇者大人。",
|
||||
{"type": "move", "time": 700, "steps": [ // 向上移动三个,撞上黑暗大大法师;本事件的hide会自动被调用
|
||||
{"direction": "up", "value": 3}
|
||||
]},
|
||||
{"type": "playSound", "name": "attack.ogg"}, // 播放攻击音效
|
||||
{"type": "sleep", "time": 200},
|
||||
"\t[blackMagician]不可能!!!!!",
|
||||
{"type": "hide", "loc": [6,3]}, // 法师消失
|
||||
{"type": "hide", "loc": [4,3]}, // 四个分身消失
|
||||
{"type": "hide", "loc": [4,6]},
|
||||
{"type": "hide", "loc": [8,6]},
|
||||
{"type": "hide", "loc": [8,3]},
|
||||
{"type": "changeFloor", "floorId": "sample2", "loc": [6,6], "direction": "up", "time": 1000}, // 更换勇士地点,合计1秒
|
||||
{"type": "show", "loc": [6,5]}, // 显示黄宝石
|
||||
{"type": "sleep", "time": 200}, // 等待200毫秒
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
{"type": "sleep", "time": 200}, // 等待200毫秒
|
||||
"\t[hero]…妖精…小姐……",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……妖精小姐!",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]是梦吗?……不对,为什么我在流泪?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]这颗漂亮的宝石是……?",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]我全都想起来了……妖精小姐为了我……\n牺牲了自己的性命。",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]在这颗宝石上,我能感受到你的温度……\n熟悉而又令人安心,这就是你最后留给我\n的东西吗……",
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]好温暖……",
|
||||
{"type": "setValue", "name": "item:yellowJewel", "value": "1"}, // 获得1个黄宝石
|
||||
{"type": "hide", "loc": [6,5]}, // 隐藏黄宝石
|
||||
{"type": "playSound", "name": "item.ogg"},
|
||||
"\t[hero]……",
|
||||
{"type": "openDoor", "loc": [6,2]}, // 开门
|
||||
{"type": "openDoor", "loc": [6,11]}
|
||||
]
|
||||
},
|
||||
"6,5": { // 黄宝石
|
||||
"enable": false
|
||||
}
|
||||
|
||||
},
|
||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||
"6,0": {"floorId": "sample2", "stair": "upFloor"},
|
||||
"6,12": {"floorId": "sample1", "stair": "upFloor"}
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
"6,4": [ // 和黑暗大法师战斗结束
|
||||
"\t[blackMagician]天真!你以为这样就能战胜我吗?",
|
||||
{"type": "show", "loc": [7,5], "time": 500},
|
||||
{"type": "update"}, // 更新地图显伤
|
||||
],
|
||||
"7,5": [ // 和分身1的战斗
|
||||
"\t[blackMagician]你打败的不过是我众多分身中的其中一个\n而已。",
|
||||
{"type": "show", "loc": [5,4], "time": 500},
|
||||
{"type": "update"}, // 更新地图显伤
|
||||
],
|
||||
"5,4": [ // 和分身2的战斗
|
||||
"\t[blackMagician]你的身体已经伤痕累累了,可我还留有着\n九成多的魔力。",
|
||||
{"type": "show", "loc": [5,5], "time": 500},
|
||||
{"type": "update"}, // 更新地图显伤
|
||||
],
|
||||
"5,5": [ // 和分身3的战斗
|
||||
"\t[blackMagician]顽固的家伙!放弃抵抗吧!",
|
||||
{"type": "show", "loc": [7,4], "time": 500},
|
||||
{"type": "update"}, // 更新地图显伤
|
||||
],
|
||||
"7,4": [ // 和分身4的战斗
|
||||
"\t[blackMagician]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!",
|
||||
{"type": "show", "loc": [6,3], "time": 500},
|
||||
{"type": "trigger", "loc": [6,3]} // 显示大法师本尊
|
||||
],
|
||||
},
|
||||
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||
|
||||
},
|
||||
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||
|
||||
},
|
||||
"checkBlock": [
|
||||
/****** 领域、夹击检查事件 ******/
|
||||
// 所有可能的领域、夹击点均需要在这里给出,否则将不会触发检查事件
|
||||
// 另外,如果该点已经存在events事件或changeFloor事件(即上面有相同点位置定义),则会被覆盖
|
||||
// afterBattle, afterGetItem, afterOpenDoor则不受影响(仍能正常工作)。
|
||||
// 所以 |****** 强烈要求可能的夹击、领域点不要存在自定义事件!! ******|
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
1
libs/icons.min.js
vendored
Normal file
1
libs/icons.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
function icons(){}icons.prototype.init=function(){this.icons={heros:{hero1:{down:{loc:0,stop:0,leftFoot:1,rightFoot:2},left:{loc:1,stop:0,leftFoot:1,rightFoot:2},right:{loc:2,stop:0,leftFoot:1,rightFoot:2},up:{loc:3,stop:0,leftFoot:1,rightFoot:2}}},terrains:{ground:0,yellowWall:1,whiteWall:2,blueWall:3,star:4,lava:5,ice:6,downFloor:7,upFloor:8,yellowDoor:9,blueDoor:10,redDoor:11,greenDoor:12,specialDoor:13,steelDoor:14,"blueShop-left":15,"blueShop-right":16,"pinkShop-left":17,"pinkShop-right":18},animates:{star:0,lava:1,water:2,yellowDoor:3,blueDoor:4,redDoor:5,greenDoor:6,specialDoor:7,blueWallDoor:8,yellowWallDoor:9,whiteWallDoor:10,steelDoor:11,lavaDoor:12,grayLavaDoor:13,starDoor:14,mockBlueWallDoor:15,mockYellowWallDoor:16,mockWhiteWallDoor:17,iceYellowWallDoor:18,starPortal:19,exclamation:20,portal:21,"switch":22,lavaNet:23,poisonNet:24,weakNet:25,curseNet:26,downPortal:27,leftPortal:28,rightPortal:29,upPortal:30},npcs:{man:0,woman:1,thief:2,fairy:3,magician:4,womanMagician:5,oldMan:6,child:7,wood:8,pinkShop:9,blueShop:10,princess:11},enemys:{greenSlime:0,redSlime:1,blackSlime:2,slimelord:3,bat:4,bigBat:5,redBat:6,vampire:7,skeleton:8,skeletonSoilder:9,skeletonCaptain:10,ghostSkeleton:11,zombie:12,zombieKnight:13,rock:14,slimeMan:15,bluePriest:16,redPriest:17,brownWizard:18,redWizard:19,yellowGuard:20,blueGuard:21,redGuard:22,swordsman:23,soldier:24,yellowKnight:25,redKnight:26,darkKnight:27,blackKing:28,yellowKing:29,greenKing:30,blueKnight:31,goldSlime:32,poisonSkeleton:33,poisonBat:34,steelRock:35,skeletonPriest:36,skeletonKing:37,skeletonWizard:38,redSkeletonCaption:39,badHero:40,demon:41,demonPriest:42,goldHornSlime:43,redKing:44,whiteKing:45,blackMagician:46,silverSlime:47,swordEmperor:48,whiteHornSlime:49,badPrincess:50,badFairy:51,grayPriest:52,redSwordsman:53,whiteGhost:54,poisonZombie:55,magicDragon:56,octopus:57,fairy:58,greenKnight:59,},items:{yellowKey:0,blueKey:1,redKey:2,greenKey:3,steelKey:4,bigKey:6,redJewel:16,blueJewel:17,greenJewel:18,yellowJewel:19,redPotion:20,bluePotion:21,greenPotion:22,yellowPotion:23,sword1:50,sword2:51,sword3:52,sword4:53,sword5:54,shield1:55,shield2:56,shield3:57,shield4:58,shield5:59,book:9,fly:12,pickaxe:45,icePickaxe:44,bomb:43,centerFly:13,upFly:15,downFly:14,coin:11,snow:41,cross:40,superPotion:29,earthquake:8,poisonWine:24,weakWine:25,curseWine:27,superWine:28,knife:42,moneyPocket:46,shoes:47,hammer:48}}};icons.prototype.getIcons=function(a){if(a==undefined){return this.icons}return this.icons[a]};main.instance.icons=new icons();
|
||||
142
libs/items.js
142
libs/items.js
@ -77,36 +77,36 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
// 消耗品
|
||||
if (itemCls === 'items') {
|
||||
if (itemId === 'redJewel') core.status.hero.atk += core.flags.redJewel;
|
||||
if (itemId === 'blueJewel') core.status.hero.def += core.flags.blueJewel;
|
||||
if (itemId === 'greenJewel') core.status.hero.mdef += core.flags.greenJewel;
|
||||
if (itemId === 'redJewel') core.status.hero.atk += core.values.redJewel;
|
||||
if (itemId === 'blueJewel') core.status.hero.def += core.values.blueJewel;
|
||||
if (itemId === 'greenJewel') core.status.hero.mdef += core.values.greenJewel;
|
||||
if (itemId == 'yellowJewel') { // 黄宝石属性:需自己定义
|
||||
core.status.hero.hp+=1000;
|
||||
core.status.hero.atk+=6;
|
||||
core.status.hero.def+=6;
|
||||
core.status.hero.mdef+=10;
|
||||
}
|
||||
if (itemId === 'redPotion') core.status.hero.hp += core.flags.redPotion;
|
||||
if (itemId === 'bluePotion') core.status.hero.hp += core.flags.bluePotion;
|
||||
if (itemId === 'yellowPotion') core.status.hero.hp += core.flags.yellowPotion;
|
||||
if (itemId === 'greenPotion') core.status.hero.hp += core.flags.greenPotion;
|
||||
if (itemId === 'sword1') core.status.hero.atk += core.flags.sword1;
|
||||
if (itemId === 'sword2') core.status.hero.atk += core.flags.sword2;
|
||||
if (itemId == 'sword3') core.status.hero.atk += core.flags.sword3;
|
||||
if (itemId == 'sword4') core.status.hero.atk += core.flags.sword4;
|
||||
if (itemId === 'sword5') core.status.hero.atk += core.flags.sword5;
|
||||
if (itemId === 'shield1') core.status.hero.def += core.flags.shield1;
|
||||
if (itemId === 'shield2') core.status.hero.def += core.flags.shield2;
|
||||
if (itemId === 'shield3') core.status.hero.def += core.flags.shield3;
|
||||
if (itemId === 'shield4') core.status.hero.def += core.flags.shield4;
|
||||
if (itemId === 'shield5') core.status.hero.def += core.flags.shield5;
|
||||
if (itemId === 'redPotion') core.status.hero.hp += core.values.redPotion;
|
||||
if (itemId === 'bluePotion') core.status.hero.hp += core.values.bluePotion;
|
||||
if (itemId === 'yellowPotion') core.status.hero.hp += core.values.yellowPotion;
|
||||
if (itemId === 'greenPotion') core.status.hero.hp += core.values.greenPotion;
|
||||
if (itemId === 'sword1') core.status.hero.atk += core.values.sword1;
|
||||
if (itemId === 'sword2') core.status.hero.atk += core.values.sword2;
|
||||
if (itemId == 'sword3') core.status.hero.atk += core.values.sword3;
|
||||
if (itemId == 'sword4') core.status.hero.atk += core.values.sword4;
|
||||
if (itemId === 'sword5') core.status.hero.atk += core.values.sword5;
|
||||
if (itemId === 'shield1') core.status.hero.def += core.values.shield1;
|
||||
if (itemId === 'shield2') core.status.hero.def += core.values.shield2;
|
||||
if (itemId === 'shield3') core.status.hero.def += core.values.shield3;
|
||||
if (itemId === 'shield4') core.status.hero.def += core.values.shield4;
|
||||
if (itemId === 'shield5') core.status.hero.def += core.values.shield5;
|
||||
if (itemId === 'bigKey') { // 只有是钥匙盒才会执行这一步
|
||||
core.status.hero.items.keys.yellowKey++;
|
||||
core.status.hero.items.keys.blueKey++;
|
||||
core.status.hero.items.keys.redKey++;
|
||||
}
|
||||
if (itemId == 'superPotion') core.status.hero.hp *= 2;
|
||||
if (itemId == 'moneyPocket') core.status.hero.money += core.flags.moneyPocket;
|
||||
if (itemId == 'moneyPocket') core.status.hero.money += core.values.moneyPocket;
|
||||
}
|
||||
else {
|
||||
core.addItem(itemId, itemNum);
|
||||
@ -114,27 +114,27 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
|
||||
}
|
||||
|
||||
items.prototype.getItemEffectTip = function(itemId) {
|
||||
if (itemId === 'redJewel') return ",攻击+"+core.flags.redJewel;
|
||||
if (itemId === 'blueJewel') return ",防御+"+core.flags.blueJewel;
|
||||
if (itemId === 'greenJewel') return ",魔防+"+core.flags.greenJewel;
|
||||
if (itemId === 'redJewel') return ",攻击+"+core.values.redJewel;
|
||||
if (itemId === 'blueJewel') return ",防御+"+core.values.blueJewel;
|
||||
if (itemId === 'greenJewel') return ",魔防+"+core.values.greenJewel;
|
||||
if (itemId == 'yellowJewel') return ",全属性提升";
|
||||
if (itemId === 'redPotion') return ",生命+"+core.flags.redPotion;
|
||||
if (itemId === 'bluePotion') return ",生命+"+core.flags.bluePotion;
|
||||
if (itemId === 'yellowPotion') return ",生命+"+core.flags.yellowPotion;
|
||||
if (itemId === 'greenPotion') return ",生命+"+core.flags.greenPotion;
|
||||
if (itemId === 'sword1') return ",攻击+"+core.flags.sword1;
|
||||
if (itemId === 'sword2') return ",攻击+"+core.flags.sword2;
|
||||
if (itemId === 'sword3') return ",攻击+"+core.flags.sword3;
|
||||
if (itemId === 'sword4') return ",攻击+"+core.flags.sword4;
|
||||
if (itemId === 'sword5') return ",攻击+"+core.flags.sword5;
|
||||
if (itemId === 'shield1') return ",防御+"+core.flags.shield1;
|
||||
if (itemId === 'shield2') return ",防御+"+core.flags.shield2;
|
||||
if (itemId === 'shield3') return ",防御+"+core.flags.shield3;
|
||||
if (itemId === 'shield4') return ",防御+"+core.flags.shield4;
|
||||
if (itemId === 'shield5') return ",防御+"+core.flags.shield5;
|
||||
if (itemId === 'redPotion') return ",生命+"+core.values.redPotion;
|
||||
if (itemId === 'bluePotion') return ",生命+"+core.values.bluePotion;
|
||||
if (itemId === 'yellowPotion') return ",生命+"+core.values.yellowPotion;
|
||||
if (itemId === 'greenPotion') return ",生命+"+core.values.greenPotion;
|
||||
if (itemId === 'sword1') return ",攻击+"+core.values.sword1;
|
||||
if (itemId === 'sword2') return ",攻击+"+core.values.sword2;
|
||||
if (itemId === 'sword3') return ",攻击+"+core.values.sword3;
|
||||
if (itemId === 'sword4') return ",攻击+"+core.values.sword4;
|
||||
if (itemId === 'sword5') return ",攻击+"+core.values.sword5;
|
||||
if (itemId === 'shield1') return ",防御+"+core.values.shield1;
|
||||
if (itemId === 'shield2') return ",防御+"+core.values.shield2;
|
||||
if (itemId === 'shield3') return ",防御+"+core.values.shield3;
|
||||
if (itemId === 'shield4') return ",防御+"+core.values.shield4;
|
||||
if (itemId === 'shield5') return ",防御+"+core.values.shield5;
|
||||
if (itemId === 'bigKey') return ",全钥匙+1";
|
||||
if (itemId === 'superPotion') return ",生命值翻倍";
|
||||
if (itemId == 'moneyPocket') return ",金币+"+core.flags.moneyPocket;
|
||||
if (itemId == 'moneyPocket') return ",金币+"+core.values.moneyPocket;
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -173,22 +173,22 @@ items.prototype.useItem = function (itemId) {
|
||||
}
|
||||
if (itemId == 'upFly' || itemId == 'downFly') {
|
||||
// 上楼器/下楼器
|
||||
core.changeFloor(core.status.event.data.id, null, {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y}, function (){
|
||||
core.changeFloor(core.status.event.data.id, null, {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y}, null, function (){
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
});
|
||||
}
|
||||
if (itemId == 'poisonWine') core.setFlag('poison', false);
|
||||
if (itemId == 'weakWine') {
|
||||
core.setFlag('weak', false);
|
||||
core.status.hero.atk += core.flags.weakValue;
|
||||
core.status.hero.def += core.flags.weakValue;
|
||||
core.status.hero.atk += core.values.weakValue;
|
||||
core.status.hero.def += core.values.weakValue;
|
||||
}
|
||||
if (itemId == 'curseWine') core.setFlag('curse', false);
|
||||
if (itemId == 'superWine') {
|
||||
core.setFlag('poison', false);
|
||||
core.setFlag('weak', false);
|
||||
core.status.hero.atk += core.flags.weakValue;
|
||||
core.status.hero.def += core.flags.weakValue;
|
||||
core.status.hero.atk += core.values.weakValue;
|
||||
core.status.hero.def += core.values.weakValue;
|
||||
core.setFlag('curse', false);
|
||||
}
|
||||
core.updateStatusBar();
|
||||
@ -212,7 +212,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) &&
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&
|
||||
(block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙
|
||||
{
|
||||
// 四个方向
|
||||
@ -238,7 +238,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
// 破冰镐
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {
|
||||
core.status.event.data = [i];
|
||||
return true;
|
||||
}
|
||||
@ -250,7 +250,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.cls == 'enemys' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls == 'enemys' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
var enemy = core.material.enemys[block.event.id];
|
||||
if (core.isset(enemy.bomb) && !enemy.bomb) continue;
|
||||
ids.push(i);
|
||||
@ -266,7 +266,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
// 圣锤
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.cls == 'enemys' && block.x==core.nextX() && block.y==core.nextY()) {
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls == 'enemys' && block.x==core.nextX() && block.y==core.nextY()) {
|
||||
var enemy = core.material.enemys[block.event.id];
|
||||
if (core.isset(enemy.bomb) && !enemy.bomb) continue;
|
||||
core.status.event.data = [i];
|
||||
@ -279,7 +279,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var ids = []
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall'))
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall'))
|
||||
ids.push(i);
|
||||
}
|
||||
if (ids.length>0) {
|
||||
@ -291,14 +291,12 @@ items.prototype.canUseItem = function (itemId) {
|
||||
if (itemId == 'centerFly') {
|
||||
// 中心对称
|
||||
var toX = 12 - core.getHeroLoc('x'), toY = 12-core.getHeroLoc('y');
|
||||
var blocks = core.status.thisMap.blocks;
|
||||
for (var s = 0; s < blocks.length; s++) {
|
||||
if (blocks[s].x == toX && blocks[s].y == toY) {
|
||||
return false;
|
||||
}
|
||||
var block = core.getBlock(toX, toY);
|
||||
if (block==null) {
|
||||
core.status.event.data = {'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
core.status.event.data = {'x': toX, 'y': toY};
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'upFly') {
|
||||
// 上楼器
|
||||
@ -306,19 +304,14 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var index = core.floorIds.indexOf(floorId);
|
||||
if (index==core.floorIds.length-1) return false;
|
||||
var toId = core.floorIds[index+1];
|
||||
|
||||
// 检查是否存在block(不是空地)
|
||||
var toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');
|
||||
var blocks = core.status.maps[toId].blocks;
|
||||
for (var s = 0; s < blocks.length; s++) {
|
||||
if (blocks[s].x == toX && blocks[s].y == toY) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 可以上楼,记录下位置信息,返回true
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
var block = core.getBlock(toX, toY, toId);
|
||||
if (block==null) {
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'downFly') {
|
||||
// 下楼器
|
||||
@ -326,26 +319,21 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var index = core.floorIds.indexOf(floorId);
|
||||
if (index==0) return false;
|
||||
var toId = core.floorIds[index-1];
|
||||
|
||||
// 检查是否存在block(不是空地)
|
||||
var toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');
|
||||
var blocks = core.status.maps[toId].blocks;
|
||||
for (var s = 0; s < blocks.length; s++) {
|
||||
if (blocks[s].x == toX && blocks[s].y == toY) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 可以上楼,记录下位置信息,返回true
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
var block = core.getBlock(toX, toY, toId);
|
||||
if (block==null) {
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId=='snow') {
|
||||
// 冰冻徽章
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
@ -360,7 +348,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && block.event.id == 'yellowDoor') {
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'yellowDoor') {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
1
libs/items.min.js
vendored
Normal file
1
libs/items.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
71
libs/maps.js
71
libs/maps.js
@ -1,14 +1,13 @@
|
||||
function maps() {}
|
||||
maps.prototype.init = function() {}
|
||||
|
||||
maps.prototype.loadFloor = function (floorId, map, enables) {
|
||||
maps.prototype.loadFloor = function (floorId, map) {
|
||||
var floor = core.floors[floorId];
|
||||
var content = {};
|
||||
content['floorId'] = floor.floorId;
|
||||
content['name'] = floor.name;
|
||||
content['title'] = floor.title;
|
||||
content['canFlyTo'] = floor.canFlyTo;
|
||||
content['firstArrive'] = floor.firstArrive;
|
||||
if (!core.isset(map)) map=floor.map;
|
||||
var blocks = [];
|
||||
for (var i = 0; i < 13; i++) {
|
||||
@ -36,6 +35,9 @@ maps.prototype.loadFloor = function (floorId, map, enables) {
|
||||
}
|
||||
}
|
||||
this.addEvent(block,j,i,floor.events[j+","+i])
|
||||
this.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||
if (floor.checkBlock.indexOf(j+","+i)>=0)
|
||||
this.addEvent(block,j,i,{"trigger":"checkBlock"});
|
||||
if (core.isset(block.event)) blocks.push(block);
|
||||
}
|
||||
}
|
||||
@ -57,6 +59,7 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
enable = true;
|
||||
}
|
||||
}
|
||||
id=parseInt(id);
|
||||
var tmp = {'x': x, 'y': y, 'id': id};
|
||||
if (enable!=null) tmp.enable = enable;
|
||||
|
||||
@ -232,9 +235,11 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
||||
else if (event instanceof Array) {
|
||||
event = {"data": event};
|
||||
}
|
||||
if (!core.isset(event.data))
|
||||
event.data = [];
|
||||
|
||||
// 覆盖enable
|
||||
if (!core.isset(block.event.enable) && core.isset(event.enable)) {
|
||||
if (!core.isset(block.enable) && core.isset(event.enable)) {
|
||||
block.enable=event.enable;
|
||||
}
|
||||
// 覆盖trigger
|
||||
@ -242,6 +247,9 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
||||
if (core.isset(event.trigger)) block.event.trigger=event.trigger;
|
||||
else block.event.trigger='action';
|
||||
}
|
||||
else if (core.isset(event.trigger) && event.trigger!='checkBlock') {
|
||||
block.event.trigger=event.trigger;
|
||||
}
|
||||
// 覆盖其他属性
|
||||
for (var key in event) {
|
||||
if (key!="enable" && key!="trigger") {
|
||||
@ -250,6 +258,11 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype.addChangeFloor = function (block, x, y, event) {
|
||||
if (!core.isset(event)) return;
|
||||
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event});
|
||||
}
|
||||
|
||||
maps.prototype.initMaps = function (floorIds) {
|
||||
var maps = {};
|
||||
for (var i=0;i<floorIds.length;i++) {
|
||||
@ -260,20 +273,16 @@ maps.prototype.initMaps = function (floorIds) {
|
||||
}
|
||||
|
||||
maps.prototype.save = function(maps, floorId) {
|
||||
if (floorId==undefined || floorId==null) {
|
||||
var map = [];
|
||||
if (!core.isset(floorId)) {
|
||||
var map = {};
|
||||
for (var id in maps) {
|
||||
// map[id] = this.save(maps, id);
|
||||
map.push(this.save(maps, id));
|
||||
map[id] = this.save(maps, id);
|
||||
// map.push(this.save(maps, id));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
var thisFloor = maps[floorId];
|
||||
var floor = {};
|
||||
floor.floorId = thisFloor.floorId;
|
||||
floor.name = thisFloor.name;
|
||||
floor.title = thisFloor.title;
|
||||
floor.canFlyTo = thisFloor.canFlyTo;
|
||||
|
||||
var blocks = [];
|
||||
for (var x=0;x<13;x++) {
|
||||
@ -283,44 +292,24 @@ maps.prototype.save = function(maps, floorId) {
|
||||
}
|
||||
}
|
||||
thisFloor.blocks.forEach(function (block) {
|
||||
blocks[block.x][block.y] = block.id;
|
||||
if (core.isset(block.enable)) {
|
||||
if (block.enable) blocks[block.y][block.x] = block.id+":t";
|
||||
else blocks[block.y][block.x] = block.id+":f";
|
||||
}
|
||||
else blocks[block.y][block.x] = block.id;
|
||||
});
|
||||
floor.blocks = blocks;
|
||||
return floor;
|
||||
return blocks;
|
||||
}
|
||||
|
||||
maps.prototype.load = function (data, floorId) {
|
||||
if (floorId == undefined) {
|
||||
var map = [];
|
||||
var map = {};
|
||||
for (var id in data) {
|
||||
map[data[id].floorId] = this.load(data, data[id].floorId);
|
||||
map[id] = this.load(data, id);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
var x = null;
|
||||
for (var id in data) {
|
||||
if (data[id].floorId == floorId) {
|
||||
x = data[id];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x==null) return {};
|
||||
|
||||
var content = {};
|
||||
content['floorId'] = x.floorId;
|
||||
content['name'] = x.name;
|
||||
content['title'] = x.title;
|
||||
content['canFlyTo'] = x.canFlyTo;
|
||||
var blocks = [];
|
||||
for (var i = 0; i < 13; i++) {
|
||||
for (var j = 0; j < 13; j++) {
|
||||
var id = x.blocks[i][j];
|
||||
var block = this.getBlock(x.floorId, x.name, i, j, id);
|
||||
if (block!=null) blocks.push(block);
|
||||
}
|
||||
}
|
||||
content['blocks'] = blocks;
|
||||
return this.updateNoPass(content);
|
||||
return this.loadFloor(floorId, data[floorId]);
|
||||
}
|
||||
|
||||
main.instance.maps = new maps();
|
||||
1
libs/maps.min.js
vendored
Normal file
1
libs/maps.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
71
libs/npcs.js
71
libs/npcs.js
@ -1,71 +0,0 @@
|
||||
function npcs() {
|
||||
|
||||
}
|
||||
|
||||
npcs.prototype.init = function () {
|
||||
this.npcs = {
|
||||
'npc1': {'id': 'npc1', 'name': '神秘老人', 'icon': 'magician'},
|
||||
'npc2': {'id': 'npc2', 'name': '神秘老人', 'icon': 'magician'},
|
||||
'npc3': {'id': 'npc3', 'name': '神秘老人', 'icon': 'womanMagician'},
|
||||
'npc4': {'id': 'npc4', 'name': '神秘老人', 'icon': 'womanMagician'},
|
||||
}
|
||||
}
|
||||
|
||||
npcs.prototype.getNpcs = function (npcId) {
|
||||
if (npcId == undefined) return this.npcs;
|
||||
return this.npcs[npcId];
|
||||
}
|
||||
|
||||
npcs.prototype.getEffect = function (npcid, times) {
|
||||
switch (npcid) {
|
||||
case 'npc1':
|
||||
return [
|
||||
{
|
||||
'action': 'text', 'id': 'npc1',
|
||||
'content': '提示:灰色的水泥墙比棕色的更为坚固。\n用破墙镐无法破坏水泥墙。\n例如本层墙内的宝物,可以使用地震卷轴获取。'
|
||||
},
|
||||
];
|
||||
break;
|
||||
case 'npc2':
|
||||
return [
|
||||
{
|
||||
'action': 'text', 'id': 'npc2',
|
||||
'content': '提示:14F位于神秘空间之中,无法直接到达。\n只能使用特殊道具到达。\n类似14F的还有一层,在0F。'
|
||||
}
|
||||
];
|
||||
break;
|
||||
case 'npc3':
|
||||
return [
|
||||
{
|
||||
'action': 'choices', 'id': 'npc3', 'cancel': true, 'hint': '送你一件道具,你自己\n选吧:',
|
||||
'choices': [
|
||||
{"text": '破墙镐', 'effect': 'item,pickaxe,1'},
|
||||
{"text": '炸弹', 'effect': 'item,bomb,1'},
|
||||
{"text": '中心对称飞行器', 'effect': 'item,centerFly,1'}
|
||||
]
|
||||
},
|
||||
{
|
||||
'action': 'text', 'id': 'npc3',
|
||||
'content': '祝你好运,我先溜了~'
|
||||
},
|
||||
{'action': 'disappear'}
|
||||
];
|
||||
break;
|
||||
case 'npc4':
|
||||
return [
|
||||
{
|
||||
'action': 'choices', 'id': 'npc4', 'cancel': true, 'hint': '低价回收各种钥匙:',
|
||||
'choices': [
|
||||
{"text": '黄钥匙(7金币)', 'effect': 'status,money,7', 'need': 'item,yellowKey,1'},
|
||||
{"text": '蓝钥匙(35金币)', 'effect': 'status,money,35', 'need': 'item,blueKey,1'},
|
||||
{"text": '红钥匙(70金币)', 'effect': 'status,money,70', 'need': 'item,redKey,1'}
|
||||
]
|
||||
},
|
||||
{'action': 'revisit'}
|
||||
];
|
||||
break;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
main.instance.npcs = new npcs();
|
||||
221
libs/ui.js
221
libs/ui.js
@ -72,6 +72,8 @@ ui.prototype.drawTextBox = function(content) {
|
||||
}
|
||||
}
|
||||
|
||||
content = core.replaceText(content);
|
||||
|
||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||
var contents = content.split('\n');
|
||||
|
||||
@ -130,6 +132,127 @@ ui.prototype.drawTextBox = function(content) {
|
||||
core.fillText('ui', '<点击任意位置继续>', 270, top+height-13, '#CCCCCC', '13px Verdana');
|
||||
}
|
||||
|
||||
// 绘制选项事件
|
||||
ui.prototype.drawChoices = function(content, choices) {
|
||||
|
||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
core.setAlpha('ui', 1);
|
||||
core.setFillStyle('ui', background);
|
||||
|
||||
// Step 1: 计算长宽高
|
||||
var length = choices.length;
|
||||
var left=85, width = 416-2*left; // 宽度
|
||||
// 高度
|
||||
var height = 32*(length+2), bottom = 208+height/2;
|
||||
if (length%2==0) bottom+=16;
|
||||
var choice_top = bottom-height+56;
|
||||
|
||||
var id=null, name=null, image=null, icon=null;
|
||||
if (core.isset(content)) {
|
||||
// 获得name, image, icon
|
||||
if (content.indexOf("\t[")==0) {
|
||||
var index = content.indexOf("]");
|
||||
if (index>=0) {
|
||||
var str=content.substring(2, index);
|
||||
content=content.substring(index+1);
|
||||
var ss=str.split(",");
|
||||
if (ss.length==1) {
|
||||
// id
|
||||
id=ss[0];
|
||||
// monster
|
||||
if (id!='hero') {
|
||||
var enemys = core.material.enemys[id];
|
||||
if (core.isset(enemys)) {
|
||||
name = core.material.enemys[id].name;
|
||||
image = core.material.images.enemys;
|
||||
icon = core.material.icons.enemys[id];
|
||||
}
|
||||
else {
|
||||
name=id;
|
||||
id='npc';
|
||||
image=null;
|
||||
icon=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
id='npc';
|
||||
name=ss[0];
|
||||
image=core.material.images.npcs;
|
||||
icon=core.material.icons.npcs[ss[1]];
|
||||
}
|
||||
}
|
||||
}
|
||||
content = core.replaceText(content);
|
||||
|
||||
// content部分高度
|
||||
var cheight=0;
|
||||
// 如果含有标题,标题高度
|
||||
if (name!=null) cheight+=25;
|
||||
cheight += content.split('\n').length*20;
|
||||
height+=cheight;
|
||||
}
|
||||
var top = bottom-height;
|
||||
|
||||
core.fillRect('ui', left, top, width, height, background);
|
||||
core.strokeRect('ui', left - 1, top - 1, width + 1, height + 1, '#FFFFFF', 2);
|
||||
|
||||
// 如果有内容
|
||||
if (core.isset(content)) {
|
||||
|
||||
var content_left = left + 15, content_top = top + 35;
|
||||
|
||||
if (core.isset(id)) {
|
||||
core.canvas.ui.textAlign = "center";
|
||||
|
||||
content_top = top+55;
|
||||
var title_offset = left+width/2;
|
||||
// 动画
|
||||
if (id=='hero' || core.isset(icon)) {
|
||||
core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, 34, '#DDDDDD', 2);
|
||||
content_left = left+60;
|
||||
title_offset += 22;
|
||||
}
|
||||
|
||||
if (id == 'hero') {
|
||||
core.fillText('ui', core.status.hero.name, title_offset, top + 27, '#FFD700', 'bold 19px Verdana');
|
||||
core.clearMap('ui', left + 15, top + 30, 32, 32);
|
||||
core.fillRect('ui', left + 15, top + 30, 32, 32, background);
|
||||
var heroIcon = core.material.icons.heros[core.status.hero.id]['down'];
|
||||
core.canvas.ui.drawImage(core.material.images.heros, heroIcon.stop * 32, heroIcon.loc *32, 32, 32, left+15, top+30, 32, 32);
|
||||
}
|
||||
else {
|
||||
core.fillText('ui', name, title_offset, top + 27, '#FFD700', 'bold 19px Verdana');
|
||||
if (core.isset(icon)) {
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.status.boxAnimateObjs.push({
|
||||
'bgx': left + 15, 'bgy': top + 30, 'bgsize': 32,
|
||||
'image': image, 'x': left + 15, 'y': top + 30, 'icon': icon
|
||||
});
|
||||
core.setBoxAnimate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.canvas.ui.textAlign = "left";
|
||||
var contents=content.split("\n");
|
||||
for (var i=0;i<contents.length;i++) {
|
||||
core.fillText('ui', contents[i], content_left, content_top, '#FFFFFF', 'bold 15px Verdana');
|
||||
content_top+=20;
|
||||
}
|
||||
}
|
||||
|
||||
// 选项
|
||||
core.canvas.ui.textAlign = "center";
|
||||
for (var i = 0; i < choices.length; i++) {
|
||||
core.fillText('ui', core.replaceText(choices[i].text), 208, choice_top + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制确认/取消警告
|
||||
* @param text
|
||||
@ -187,8 +310,9 @@ ui.prototype.drawSettings = function (need) {
|
||||
core.canvas.ui.textAlign = "center";
|
||||
core.fillText('ui', "音乐: " + (core.musicStatus.soundStatus ? "[ON]" : "[OFF]"), 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "快捷商店", 208, top + 88, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "降低难度", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "同步存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
||||
//core.fillText('ui', "降低难度", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "同步存档", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "清空存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "重新开始", 208, top + 184, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "关于本塔", 208, top + 216, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "返回游戏", 208, top + 248, "#FFFFFF", "bold 17px Verdana");
|
||||
@ -199,7 +323,7 @@ ui.prototype.drawSettings = function (need) {
|
||||
* 绘制“选择商店”窗口
|
||||
* @param need
|
||||
*/
|
||||
ui.prototype.drawSelectShop = function (need) {
|
||||
ui.prototype.drawQuickShop = function (need) {
|
||||
|
||||
if (core.isset(need) && !core.checkStatus('selectShop', need))
|
||||
return;
|
||||
@ -220,83 +344,13 @@ ui.prototype.drawSelectShop = function (need) {
|
||||
|
||||
core.canvas.ui.textAlign = "center";
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
core.fillText('ui', shopList[keys[i]].name, 208, top + 56 + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', shopList[keys[i]].textInList, 208, top + 56 + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
||||
}
|
||||
|
||||
core.fillText('ui', "返回游戏", 208, top + bottom - 40);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制商店
|
||||
* @param id
|
||||
*/
|
||||
ui.prototype.drawShop = function (id) {
|
||||
var shop = core.status.shops[id];
|
||||
// 正在移动中...
|
||||
|
||||
if (!core.status.heroStop) {
|
||||
setTimeout(function () {
|
||||
core.ui.drawShop(id);
|
||||
}, 30);
|
||||
return;
|
||||
}
|
||||
|
||||
core.status.event.data = shop;
|
||||
core.status.event.id = 'shop';
|
||||
core.lockControl();
|
||||
shop.visited = true;
|
||||
|
||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||
|
||||
var times = shop.times, need = eval(shop.need);
|
||||
|
||||
clearInterval(core.interval.tipAnimate);
|
||||
core.clearMap('data', 0, 0, 416, 416);
|
||||
core.setOpacity('data', 1);
|
||||
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
core.setAlpha('ui', 1);
|
||||
core.setFillStyle('ui', background);
|
||||
|
||||
var left = 97, top = 64, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
||||
core.fillRect('ui', left, top, right, bottom, background);
|
||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||
|
||||
// 名称
|
||||
core.canvas.ui.textAlign = "center";
|
||||
core.fillText('ui', shop.title, left + 135, top + 34, '#FFFFFF', 'bold 19px Verdana');
|
||||
|
||||
// 动画
|
||||
core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, 34, '#DDDDDD', 2);
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.status.boxAnimateObjs.push({
|
||||
'bgx': left + 15, 'bgy': top + 30, 'bgsize': 32,
|
||||
'image': core.material.images.npcs,
|
||||
'x': left + 15, 'y': top + 30, 'icon': core.material.icons.npcs[shop.icon]
|
||||
});
|
||||
core.setBoxAnimate();
|
||||
|
||||
// 对话
|
||||
core.canvas.ui.textAlign = "left";
|
||||
if (need<0) need="若干";
|
||||
var use = shop.use=='experience'?"经验":"金币";
|
||||
core.fillText('ui', "勇敢的武士啊,给我" + need, left + 60, top + 65, '#FFFFFF', 'bold 14px Verdana');
|
||||
core.fillText('ui', use + "你就可以:", left + 60, top + 83);
|
||||
|
||||
// 选项
|
||||
core.canvas.ui.textAlign = "center";
|
||||
for (var i = 0; i < shop.choices.length; i++) {
|
||||
var choice = shop.choices[i];
|
||||
var text = choice.text;
|
||||
if (core.isset(choice.need))
|
||||
text += "("+eval(choice.need)+use+")"
|
||||
core.fillText('ui', text, 208, top + 120 + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
||||
}
|
||||
core.fillText('ui', "退出商店", 208, top + 248);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绘制“请等候...”
|
||||
@ -660,16 +714,6 @@ ui.prototype.drawSLPanel = function(page) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制缩略图
|
||||
* @param canvas
|
||||
* @param blocks
|
||||
* @param x
|
||||
* @param y
|
||||
* @param size
|
||||
* @param heroLoc
|
||||
* @param heroId
|
||||
*/
|
||||
ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc, heroId) {
|
||||
core.clearMap(canvas, x, y, size, size);
|
||||
var persize = size/13;
|
||||
@ -682,7 +726,7 @@ ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc, heroI
|
||||
}
|
||||
for (var b in blocks) {
|
||||
var block = blocks[b];
|
||||
if (core.isset(block.event)) {
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
||||
var i = block.x, j = block.y;
|
||||
var blockIcon = core.material.icons[block.event.cls][block.event.id];
|
||||
var blockImage = core.material.images[block.event.cls];
|
||||
@ -721,9 +765,11 @@ ui.prototype.drawAbout = function() {
|
||||
|
||||
// 名称
|
||||
core.canvas.ui.textAlign = "left";
|
||||
core.fillText('ui', "异空间", text_start, top+35, "#FFD700", "bold 22px Verdana");
|
||||
core.fillText('ui', "HTML5复刻版", text_start+75, top+37, "#DDDDDD", "bold 15px Verdana");
|
||||
core.fillText('ui', "HTML5 魔塔样板", text_start, top+35, "#FFD700", "bold 22px Verdana");
|
||||
core.fillText('ui', "作者: 艾之葵", text_start, top + 80, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top+112);
|
||||
// TODO: 写自己的“关于”页面
|
||||
/*
|
||||
core.fillText('ui', "原作: ss433_2", text_start, top + 112, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "制作工具: WebStorm", text_start, top + 144, "#FFFFFF", "bold 17px Verdana");
|
||||
core.fillText('ui', "测试平台: Chrome/微信/iOS", text_start, top + 176, "#FFFFFF", "bold 17px Verdana");
|
||||
@ -732,4 +778,5 @@ ui.prototype.drawAbout = function() {
|
||||
core.fillText('ui', 'iEcho', text_start+len, top+240);
|
||||
core.fillText('ui', '打Dota的喵', text_start+len, top+272);
|
||||
core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top+304);
|
||||
*/
|
||||
}
|
||||
1
libs/ui.min.js
vendored
Normal file
1
libs/ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
89
main.js
89
main.js
@ -33,8 +33,7 @@ function main() {
|
||||
// console.log('加载游戏容器和开始界面dom对象完成 如下');
|
||||
// console.log(this.dom);
|
||||
this.loadList = [
|
||||
'items', 'icons', 'maps', 'enemys', 'events',
|
||||
'npcs', 'data', 'ui', 'core'
|
||||
'items', 'icons', 'maps', 'enemys', 'events', 'data', 'ui', 'core'
|
||||
];
|
||||
// console.log('加载js文件列表加载完成' + this.loadList);
|
||||
this.images = [
|
||||
@ -76,8 +75,13 @@ function main() {
|
||||
'curse': document.getElementById('curse'),
|
||||
'hard': document.getElementById("hard")
|
||||
}
|
||||
this.floorIds = [
|
||||
"sample0"
|
||||
this.useCompress = false; // 是否使用压缩文件
|
||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
||||
// 如果要进行剧本的修改请务必将其改成false。
|
||||
|
||||
this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
||||
"sample0", "sample1", "sample2"
|
||||
]
|
||||
this.floors = {}
|
||||
this.instance = {};
|
||||
@ -92,23 +96,11 @@ main.prototype.init = function () {
|
||||
var coreData = {};
|
||||
for (i = 0; i < main.loadList.length; i++) {
|
||||
var name = main.loadList[i];
|
||||
// end with ".min"
|
||||
if (name.indexOf(".min")==name.length-4)
|
||||
name=name.substring(0, name.length-4);
|
||||
if (name === 'core') {
|
||||
continue;
|
||||
}
|
||||
if (name === 'core') continue;
|
||||
main[name].init(main.dom);
|
||||
coreData[name] = main[name];
|
||||
}
|
||||
main.loaderFloors(function() {
|
||||
// 处理.min
|
||||
for (var i=0;i<main.floorIds.length;i++) {
|
||||
if (name.indexOf(".min")==name.length-4) {
|
||||
name = name.substring(0, name.length - 4);
|
||||
main.floorIds[i] = name.substring(0, name.length - 4);
|
||||
}
|
||||
}
|
||||
main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.sounds, main.floorIds, main.floors, coreData);
|
||||
main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
})
|
||||
@ -136,26 +128,35 @@ main.prototype.loaderJs = function (callback) {
|
||||
}
|
||||
|
||||
main.prototype.loaderFloors = function (callback) {
|
||||
|
||||
// 加载js
|
||||
main.setMainTipsText('正在加载楼层文件...')
|
||||
for (var i = 0; i < main.floorIds.length; i++) {
|
||||
main.loadFloor(main.floorIds[i], function (modName) {
|
||||
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
|
||||
if (Object.keys(main.floors).length === main.floorIds.length) {
|
||||
main.dom.mainTips.style.display = 'none';
|
||||
callback();
|
||||
}
|
||||
});
|
||||
if (this.useCompress) { // 读取压缩文件
|
||||
var script = document.createElement('script');
|
||||
script.src = 'libs/floors.min.js?' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
main.dom.mainTips.style.display = 'none';
|
||||
callback();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < main.floorIds.length; i++) {
|
||||
main.loadFloor(main.floorIds[i], function (modName) {
|
||||
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
|
||||
if (Object.keys(main.floors).length === main.floorIds.length) {
|
||||
main.dom.mainTips.style.display = 'none';
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main.prototype.loadMod = function (modName, callback) {
|
||||
var script = document.createElement('script');
|
||||
var name = modName;
|
||||
// end with ".min"
|
||||
if (name.indexOf(".min")==name.length-4)
|
||||
name=name.substring(0, name.length-4);
|
||||
script.src = 'libs/' + modName + '.js?' + this.version;
|
||||
script.src = 'libs/' + modName + (this.useCompress?".min":"") + '.js?' + this.version;
|
||||
main.dom.body.appendChild(script);
|
||||
script.onload = function () {
|
||||
main[name] = main.instance[name];
|
||||
@ -186,15 +187,17 @@ window.onresize = function () {
|
||||
}
|
||||
|
||||
main.dom.body.onkeydown = function(e) {
|
||||
if (main.core.isPlaying())
|
||||
main.core.onkeyDown(e);
|
||||
try {
|
||||
if (main.core.isPlaying())
|
||||
main.core.onkeyDown(e);
|
||||
} catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.body.onkeyup = function(e) {
|
||||
try {
|
||||
if (main.core.isPlaying())
|
||||
main.core.onkeyUp(e);
|
||||
} catch (e) {}
|
||||
} catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.body.onselectstart = function () {
|
||||
@ -220,7 +223,7 @@ main.dom.data.onmousedown = function (e) {
|
||||
if (loc == null) return;
|
||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
||||
main.core.ondown(x, y);
|
||||
} catch (e) {}
|
||||
} catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.data.onmousemove = function (e) {
|
||||
@ -230,7 +233,7 @@ main.dom.data.onmousemove = function (e) {
|
||||
if (loc == null) return;
|
||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
||||
main.core.onmove(x, y);
|
||||
}catch (e) {}
|
||||
}catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.data.onmouseup = function () {
|
||||
@ -256,7 +259,7 @@ main.dom.data.ontouchstart = function (e) {
|
||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
||||
//main.core.onclick(x, y, []);
|
||||
main.core.ondown(x, y);
|
||||
}catch (e) {}
|
||||
}catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.data.ontouchmove = function (e) {
|
||||
@ -266,7 +269,7 @@ main.dom.data.ontouchmove = function (e) {
|
||||
if (loc == null) return;
|
||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
||||
main.core.onmove(x, y);
|
||||
}catch (e) {}
|
||||
}catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.data.ontouchend = function () {
|
||||
@ -281,32 +284,32 @@ main.statusBar.image.book.onclick = function () {
|
||||
main.core.openBook(true);
|
||||
}
|
||||
|
||||
main.statusBar.image.fly.onclick = function (e) {
|
||||
main.statusBar.image.fly.onclick = function () {
|
||||
if (main.core.isPlaying())
|
||||
main.core.useFly(true);
|
||||
}
|
||||
|
||||
main.statusBar.image.toolbox.onclick = function (e) {
|
||||
main.statusBar.image.toolbox.onclick = function () {
|
||||
if (main.core.isPlaying())
|
||||
main.core.openToolbox(true);
|
||||
}
|
||||
|
||||
main.statusBar.image.shop.onclick = function () {
|
||||
if (main.core.isPlaying())
|
||||
main.core.ui.drawSelectShop(true);
|
||||
main.core.ui.drawQuickShop(true);
|
||||
}
|
||||
|
||||
main.statusBar.image.save.onclick = function (e) {
|
||||
main.statusBar.image.save.onclick = function () {
|
||||
if (main.core.isPlaying())
|
||||
main.core.save(true);
|
||||
}
|
||||
|
||||
main.statusBar.image.load.onclick = function (e) {
|
||||
main.statusBar.image.load.onclick = function () {
|
||||
if (main.core.isPlaying())
|
||||
main.core.load(true);
|
||||
}
|
||||
|
||||
main.statusBar.image.settings.onclick = function (e) {
|
||||
main.statusBar.image.settings.onclick = function () {
|
||||
if (main.core.isPlaying())
|
||||
main.core.ui.drawSettings(true);
|
||||
}
|
||||
@ -344,5 +347,5 @@ main.dom.normalLevel.onclick = function () {
|
||||
}
|
||||
|
||||
main.dom.hardLevel.onclick = function () {
|
||||
core.events.startGame('Gard');
|
||||
core.events.startGame('Hard');
|
||||
}
|
||||
|
||||
@ -7,11 +7,6 @@ html, body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: number;
|
||||
src: url("fonts/number.ttf");
|
||||
}
|
||||
|
||||
#gameGroup {
|
||||
position: absolute;
|
||||
outline: 3px #fff solid;
|
||||
|
||||
BIN
~$样板使用指南.docx
Normal file
BIN
~$样板使用指南.docx
Normal file
Binary file not shown.
BIN
伤害和临界值计算器.exe
Normal file
BIN
伤害和临界值计算器.exe
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user