diff --git a/.gitignore b/.gitignore index d742b1fc..359a1962 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode +*ce5eec52_2fa1_447b_8dad_764e267a7fab* # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 diff --git a/_server/editor_file.demo.js b/_server/editor_file.demo.js new file mode 100644 index 00000000..943dc71d --- /dev/null +++ b/_server/editor_file.demo.js @@ -0,0 +1,89 @@ +(function(){ + + editor_file = {}; + + editor_file.getFloorFileList = function(editor,callback){ + if (isset(callback)) callback(['simple0.js','simple1.js','simple2.js'],null); + } + //callback(Array,err:String) + editor_file.loadFloorFile = function(editor,filename,callback){ + if (isset(callback)) callback('',null); + } + //callback(String,err:String) + editor_file.saveFloorFile = function(editor,callback){ + if (isset(callback)) callback(null); + } + //callback(err:String) + editor_file.saveFloorFileAs = function(editor,saveAsFilename,callback){ + if (isset(callback)) callback(null); + } + //callback(err:String) + + //////////////////////////////////////////////////////////////////// + + editor_file.changeIdAndIdnum = function(editor,id,idnum,callback){ + if (isset(callback)) callback(null); + } + //callback(err:String) + editor_file.editItem = function(editor,id,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (isset(callback)) callback( + {'items':{'cls': 'items', 'name': '红宝石'},'itemEffect':'core.status.hero.atk += core.values.redJewel','itemEffectTip':"',攻击+'+core.values.redJewel"}, + {'items':'','itemEffect':'','itemEffectTip':''}, + null); + //只有items.cls是items的才有itemEffect和itemEffectTip,keys和constants和tools只有items + } + //callback(obj,commentObj,err:String) + editor_file.editEnemy = function(editor,id,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (isset(callback)) callback( + {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100, "bomb": false}, + {'name': '名称', 'hp': '生命值', 'atk': '攻击力', 'def': '防御力', 'money': '金币', 'experience': '经验', 'special': '特殊属性\n1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:4连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨\n多个属性例如用010411表示先攻2连击吸血\n模仿怪的攻防设为0就好\n', 'value': '特殊属性的数值\n领域怪需要加value表示领域伤害的数值\n吸血怪需要在后面添加value代表吸血比例', 'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉'}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + editor_file.editLoc = function(editor,x,y,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (isset(callback)) callback( + {"events":['\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。', '\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义的需求则需在items.js中修改代码。', '\t[老人,man]constants 和 tools 各最多只允许12种,多了会导致图标溢出。', '\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。', {'type': 'hide', 'time': 500}],"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""}, + {"events":['', '', '', '', {'type': '', 'time': ' // 消失 \n // 守着门的老人 '}],"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + editor_file.editFloor = function(editor,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (isset(callback)) callback( + {'floorId': 'sample0', 'title': '样板 0 层', 'name': '0', 'canFlyTo': True, 'canUseQuickShop': True, 'defaultGround': 'ground', 'firstArrive': ['\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:', '\t[hero]我是谁?我从哪来?我又要到哪去?', '\t[仙子,fairy]你问我...?我也不知道啊...', '本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。']}, + {'floorId': '// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致 // 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 // 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 \n // 楼层唯一标识符,需要和名字完全一致 ', 'title': ' // 楼层中文名 ', 'name': ' // 显示在状态栏中的层数 ', 'canFlyTo': ' // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) ', 'canUseQuickShop': ' // 该层是否允许使用快捷商店 ', 'defaultGround': ' // 默认地面的图块ID(terrains中) \n // 地图数据,需要是13x13,建议使用地图生成器来生成 ', 'firstArrive': ['', '', '', ' // 该楼的所有可能事件列表 \n // 守着道具的老人 ']}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + + + editor_file.editTower = function(editor,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (isset(callback)) callback( + {'main': {'useCompress': False, 'floorIds': ['sample0', 'sample1', 'sample2', 'test']}, 'firstData': {'title': '魔塔样板', 'name': 'template', 'version': 'Ver 1.0.0 (Beta)', 'floorId': 'sample0', 'hero': {'name': '阳光', 'lv': 1, 'hp': 2000, 'atk': 100, 'def': 100, 'mdef': 100, 'money': 100, 'experience': 0, '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': '1F金币商店', 'use': 'money', 'need': '20+10*times*(times+1)', 'text': '勇敢的武士啊,给我${need}金币就可以:', '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': '1F经验商店', 'use': 'experience', 'need': '-1', 'text': '勇敢的武士啊,给我若干经验就可以:', 'choices': [{'text': '等级+1', 'need': '100', 'effect': 'status:lv+=1;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'}]}}, 'levelUp': [{}, {'need': 20, 'name': '第二级', 'effect': 'status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10'}, {'need': 40, 'effect': 'function () {\n core.drawText("恭喜升级!");\n core.status.hero.hp *= 2;\n core.status.hero.atk += 100;\n core.status.hero.def += 100;\n }'}]}, 'values': {'HPMAX': 999999, 'lavaDamage': 100, 'poisonDamage': 10, 'weakValue': 20, '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, 'breakArmor': 0.9, 'counterAttack': 0.1, 'purify': 3, 'hatred': 2, 'animateSpeed': 500}, 'flags': {'enableNegativeDamage': True, 'enableFloor': False, 'enableLv': True, 'enableMDef': True, 'enableMoney': True, 'enableExperience': True, 'enableLevelUp': False, 'enableDebuff': True, 'flyNearStair': True, 'pickaxeFourDirections': True, 'bombFourDirections': True, 'bigKeyIsBox': False, 'startDirectly': False, 'canOpenBattleAnimate': True, 'showBattleAnimateConfirm': True, 'battleAnimate': True, 'displayEnemyDamage': True, 'displayExtraDamage': False, 'enableGentleClick': True, 'portalWithoutTrigger': True, 'potionWhileRouting': False}}, + {'main': {'useCompress': ' // 是否使用压缩文件 // 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 // 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 // 如果要进行剧本的修改请务必将其改成false。 \n // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序 ', 'floorIds': ['', '', '', '']}, 'firstData': {'title': ' // 游戏名,将显示在标题页面以及切换楼层的界面中 ', 'name': ' // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。 ', 'version': ' // 当前游戏版本;版本不一致的存档不能通用。 ', 'floorId': ' // 初始楼层ID \n // 勇士初始数据 ', 'hero': {'name': ' // 勇士名;可以改成喜欢的 ', 'lv': ' // 初始等级,该项必须为正整数 ', 'hp': ' // 初始生命值 ', 'atk': ' // 初始攻击 ', 'def': ' // 初始防御 ', 'mdef': ' // 初始魔防 ', 'money': ' // 初始金币 ', 'experience': ' // 初始经验 \n // 初始道具个数 ', 'items': {'keys': {'yellowKey': '', 'blueKey': '', 'redKey': ''}, 'constants': '', 'tools': ''}, 'flyRange': ' // 初始可飞的楼层;一般留空数组即可 ', 'loc': {'direction': '', 'x': '', 'y': ' // 勇士初始位置 \n // 游戏过程中的变量或flags '}, 'flags': {'poison': ' // 毒 ', 'weak': ' // 衰 ', 'curse': ' // 咒 \n // 游戏开始前剧情。如果无剧情直接留一个空数组即可。 '}}, 'startText': ['', '', ' // 定义全局商店(即快捷商店) \n // 商店唯一ID '], 'shops': {'moneyShop1': {'name': ' // 商店名称(标题) ', 'icon': ' // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店 ', 'textInList': ' // 在快捷商店栏中显示的名称 ', 'use': ' // 商店所要使用的。只能是"money"或"experience"。 ', 'need': ' // 商店需要的金币/经验数值;可以是一个表达式,以times作为参数计算。 // 这里用到的times为该商店的已经的访问次数。首次访问该商店时times的值为0。 // 上面的例子是50层商店的计算公式。你也可以写任意其他的计算公式,只要以times作为参数即可。 // 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。 // 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。 ', 'text': ' // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。 \n // 商店的选项 ', 'choices': [{'text': '', 'effect': ' // 如果有多个effect以分号分开,参见下面的经验商店 '}, {'text': '', 'effect': ''}, {'text': '', 'effect': ''}, {'text': '', 'effect': ' // effect只能对status和item进行操作,不能修改flag值。 // 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数 // 其他effect样例: // "item:yellowKey+=1" 黄钥匙+1 // "item:pickaxe+=3" 破墙镐+3 // "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍 \n // 商店唯一ID '}]}, 'expShop1': {'name': '', 'icon': '', 'textInList': '', 'use': ' // 该商店使用的是经验进行计算 ', 'need': ' // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值 ', 'text': ' // 在choices中写need,可以针对每个选项都有不同的需求。 // 这里的need同样可以以times作为参数,比如 "need": "100+20*times" ', 'choices': [{'text': '', 'need': '', 'effect': ' // 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。 '}, {'text': '', 'need': '', 'effect': ''}, {'text': '', 'need': '', 'effect': ' // 经验升级所需要的数值,是一个数组 '}]}}, 'levelUp': [' // 第一项为初始等级,可以简单留空,也可以写name // 每一个里面可以含有三个参数 name, need, effect // need为所需要的经验数值,是一个正整数。请确保need所需的依次递增 // name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中 // effect为本次升级所执行的操作,可由若干项组成,由分号分开 // 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数 ', {'need': '', 'name': '', 'effect': ' // 先将生命提升攻防和的2倍;再将攻击+10,防御+10 // effect也允许写一个function,代表本次升级将会执行的操作 '}, {'need': '', 'effect': ' // 依次往下写需要的数值即可 \n // 各种数值;一些数值可以在这里设置 \n /****** 角色相关 ******/ '}]}, 'values': {'HPMAX': ' // HP上限;-1则无上限 ', 'lavaDamage': ' // 经过血网受到的伤害 ', 'poisonDamage': ' // 中毒后每步受到的伤害 ', 'weakValue': ' // 衰弱状态下攻防减少的数值 /****** 道具相关 ******/ ', 'redJewel': ' // 红宝石加攻击的数值 ', 'blueJewel': ' // 蓝宝石加防御的数值 ', 'greenJewel': ' // 绿宝石加魔防的数值 ', 'redPotion': ' // 红血瓶加血数值 ', 'bluePotion': ' // 蓝血瓶加血数值 ', 'yellowPotion': ' // 黄血瓶加血数值 ', 'greenPotion': ' // 绿血瓶加血数值 ', 'sword1': ' // 铁剑加攻数值 ', 'shield1': ' // 铁盾加防数值 ', 'sword2': ' // 银剑加攻数值 ', 'shield2': ' // 银盾加防数值 ', 'sword3': ' // 骑士剑加攻数值 ', 'shield3': ' // 骑士盾加防数值 ', 'sword4': ' // 圣剑加攻数值 ', 'shield4': ' // 圣盾加防数值 ', 'sword5': ' // 神圣剑加攻数值 ', 'shield5': ' // 神圣盾加防数值 ', 'moneyPocket': ' // 金钱袋加金币的数值 /****** 怪物相关 ******/ ', 'breakArmor': ' // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) ', 'counterAttack': ' // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) ', 'purify': ' // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害) ', 'hatred': ' // 仇恨属性中,每杀死一个怪物获得的仇恨值 /****** 系统相关 ******/ ', 'animateSpeed': ' // 动画时间 \n // 系统FLAG,在游戏运行中中请不要修改它。 \n /****** 角色状态相关 ******/ '}, 'flags': {'enableNegativeDamage': ' // 是否支持负伤害(回血) ', 'enableFloor': ' // 是否在状态栏显示当前楼层 ', 'enableLv': ' // 是否在状态栏显示当前等级 ', 'enableMDef': ' // 是否在状态栏及战斗界面显示魔防(护盾) ', 'enableMoney': ' // 是否在状态栏、怪物手册及战斗界面显示金币 ', 'enableExperience': ' // 是否在状态栏、怪物手册及战斗界面显示经验 ', 'enableLevelUp': ' // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false ', 'enableDebuff': ' // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff ////// 上述的几个开关将直接影响状态栏的显示效果 ////// /****** 道具相关 ******/ ', 'flyNearStair': ' // 是否需要在楼梯边使用传送器 ', 'pickaxeFourDirections': ' // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁 ', 'bombFourDirections': ' // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价) ', 'bigKeyIsBox': ' // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙 /****** 系统相关 ******/ ', 'startDirectly': ' // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面 ', 'canOpenBattleAnimate': ' // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false ', 'showBattleAnimateConfirm': ' // 是否在游戏开始时提供“是否开启战斗动画”的选项 ', 'battleAnimate': ' // 是否默认显示战斗动画;用户可以手动在菜单栏中开关 ', 'displayEnemyDamage': ' // 是否地图怪物显伤;用户可以手动在菜单栏中开关 ', 'displayExtraDamage': ' // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关 ', 'enableGentleClick': ' // 是否允许轻触(获得面前物品) ', 'portalWithoutTrigger': ' // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件 ', 'potionWhileRouting': ' // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶 '}}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + var isset = function (val) { + if (val == undefined || val == null) { + return false; + } + return true + } +})(); \ No newline at end of file diff --git a/_server/editor_file.js b/_server/editor_file.js index b076565a..8ce40c89 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -1,63 +1,213 @@ -(function(){ - - editor_file = {}; - editor_file.getFloorFileList = function(editor,callback){ - if (isset(callback)) callback(['simple0.js','simple1.js','simple2.js'],null); - } - //callback(Array,err:String) - editor_file.loadFloorFile = function(editor,filename,callback){ - if (isset(callback)) callback('',null); - } - //callback(String,err:String) - editor_file.saveFloorFile = function(editor,callback){ - if (isset(callback)) callback(null); - } - //callback(err:String) - editor_file.saveFloorFile = function(editor,saveAsFilename,callback){ - if (isset(callback)) callback(null); - } - //callback(err:String) - editor_file.changeIdAndIdnum = function(editor,id,idnum,callback){ - if (isset(callback)) callback(null); - } - //callback(err:String) - editor_file.editItem = function(editor,id,callback){ - if (isset(callback)) callback('',null); - } - //callback(String,err:String) - editor_file.editEnemy = function(editor,id,callback){ - if (isset(callback)) callback({'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100},null); - } - //callback(obj,err:String) - editor_file.editLoc = function(editor,x,y,input_value,callback){ - if (isset(callback)) callback({"events":` [ // 守着道具的老人 - "\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。", - "\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义的需求则需在items.js中修改代码。", - "\t[老人,man]constants 和 tools 各最多只允许12种,多了会导致图标溢出。", - "\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。", - {"type": "hide", "time": 500} // 消失 - ],`,"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""},null); - } - //callback(obj,err:String) - editor_file.editFloor = function(editor,input_value,callback){ - if (isset(callback)) callback({"floorId": "sample0", - "title": "样板 0 层", - "name": "0", - "canFlyTo": true, - "canUseQuickShop": true, - "defaultGround": "ground", - "firstArrive":` [ // 第一次到该楼层触发的事件 - "\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:", - "\t[hero]我是谁?我从哪来?我又要到哪去?", - "\t[仙子,fairy]你问我...?我也不知道啊...", - "本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。", - ],`},null); - } - //callback(obj,err:String) - var isset = function (val) { - if (val == undefined || val == null) { - return false; - } - return true - } +(function(){ + + editor_file = {}; + + editor_file.getFloorFileList = function(editor,callback){ + if (!isset(callback)) throw('未设置callback'); + var fs = editor.fs; + fs.readdir('libs/project/floors',function(err, data){ + callback([data,err]); + }); + } + //callback([Array,err:String]) + editor_file.loadFloorFile = function(editor,filename,callback){ + //filename不含'/'不含'.js' + if (!isset(callback)) throw('未设置callback'); + var fs = editor.fs; + fs.readFile('libs/project/floors/'+filename+'.js','utf-8',function(err, data){ + if (err!=null){callback(err);return;} + data=data.split('='); + data=[data[0],data.slice(1).join('=')]; + var varnameId = data[0].split('.').slice(-1)[0].trim(); + var filenameId = filename.split('/').slice(-1)[0].split('\\').slice(-1)[0]; + eval('b3917d1d_71c2_41f2_a8aa_481b215ffb99='+data[1]); + var floorData = b3917d1d_71c2_41f2_a8aa_481b215ffb99; + delete(b3917d1d_71c2_41f2_a8aa_481b215ffb99); + var floorId = floorData.floorId; + if (varnameId!=filenameId || filenameId!=floorId){ + callback('文件名,第一行的变量名以及floorId不一致'); + return; + } + editor.currentFloorId = floorId; + editor.currentfloorData = floorData; + callback(null) + }); + } + //callback(err:String) + editor_file.saveFloorFile = function(editor,callback){ + if (!isset(callback)) throw('未设置callback'); + if (!isset(editor.currentFloorId) || !isset(editor.currentfloorData)) { + callback('未选中文件或无数据'); + } + var filename = 'libs/project/floors/' + editor.currentFloorId + '.js'; + var datastr = ['main.floors.' , editor.currentFloorId , '=\n{']; + for(var ii in editor.currentfloorData) + if (editor.currentfloorData.hasOwnProperty(ii)) { + if (ii=='map') + datastr=datastr.concat(['\n"',ii,'": [\n',formatMap(editor.currentfloorData[ii]),'\n],']); + else + datastr=datastr.concat(['\n"',ii,'": ',JSON.stringify(editor.currentfloorData[ii],null,4),',']); + } + datastr=datastr.concat(['\n}']); + datastr=datastr.join(''); + fs.writeFile(filename,datastr,'utf-8',function(err, data){ + callback(err); + }); + } + //callback(err:String) + editor_file.saveFloorFileAs = function(editor,saveAsFilename,callback){ + //saveAsFilename不含'/'不含'.js' + if (!isset(callback)) throw('未设置callback'); + if (!isset(editor.currentfloorData)) { + callback('无数据'); + } + editor.currentfloorData.floorId=saveAsFilename; + editor.currentFloorId=saveAsFilename; + editor_file.saveFloorFile(editor,callback); + } + //callback(err:String) + + //////////////////////////////////////////////////////////////////// + + editor_file.changeIdAndIdnum = function(editor,id,idnum,info,callback){ + if (!isset(callback)) throw('未设置callback'); + //检查maps中是否有重复的idnum或id + var change = -1; + for(var ii in core.maps.blocksInfo){ + if (ii==idnum) { + if (info.idnum==idnum){change=ii;break;}//修改id + callback('idnum重复了'); + return; + } + if (core.maps.blocksInfo[ii].id==id) { + if (info.id==id){change=ii;break;}//修改idnum + callback('id重复了'); + return; + } + } + if (change!=-1 && change!=idnum){//修改idnum + core.maps.blocksInfo[idnum] = core.maps.blocksInfo[change]; + delete(core.maps.blocksInfo[change]); + } else if (change==idnum) {//修改id + var oldid = core.maps.blocksInfo[idnum].id; + core.maps.blocksInfo[idnum].id = id; + for(var ii in core.icons.icons){ + if (ii.hasOwnProperty(oldid)){ + ii[id]=ii[oldid]; + delete(ii[oldid]); + } + } + } else {//创建新的 + core.maps.blocksInfo[idnum]={'cls': info.images, 'id':id}; + core.icons.icons[info.images][id]=info.y; + } + + throw('尚未实现:save(core.maps.blocksInfo,map.js);save(core.icons.icons,icons.js);') + callback(null); + } + //callback(err:String) + editor_file.editItem = function(editor,id,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (!isset(callback)) throw('未设置callback'); + callback( + {'items':{'cls': 'items', 'name': '红宝石'},'itemEffect':'core.status.hero.atk += core.values.redJewel','itemEffectTip':"',攻击+'+core.values.redJewel"}, + {'items':'','itemEffect':'','itemEffectTip':''}, + null); + //只有items.cls是items的才有itemEffect和itemEffectTip,keys和constants和tools只有items + } + /* + << + {'items':{'cls': 'items', 'name': '红宝石'},'itemEffect':'core.status.hero.atk += core.values.redJewel','itemEffectTip':"',攻击+'+core.values.redJewel"} + == + [ + ["change","['items']['name']","红宝石的新名字"], + ["add","['items']['新的和name同级的属性']",123], + ["change","['itemEffectTip']","',攻击力+'+core.values.redJewel"], + ] + >> + 'yellowKey': {'cls': 'keys' \*只能取keys items constants tools\n$range(thiseval in ['keys','items','constants','tools'])\n*\ , 'name': '黄钥匙'} + + $range((function(){typeof(thiseval)==typeof(0)||})()) + if( 注释.indexof('$range(')!= -1){ + thiseval = 新值; + evalstr = 注释.split('$range')[1].split('\n')[0]; + if(eval(evalstr) !== true)alert('不在取值范围内') + } + */ + + //callback(obj,commentObj,err:String) + editor_file.editEnemy = function(editor,id,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (!isset(callback)) throw('未设置callback'); + callback( + {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100, "bomb": false}, + {'name': '名称', 'hp': '生命值', 'atk': '攻击力', 'def': '防御力', 'money': '金币', 'experience': '经验', 'special': '特殊属性\n1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:4连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨\n多个属性例如用010411表示先攻2连击吸血\n模仿怪的攻防设为0就好\n', 'value': '特殊属性的数值\n领域怪需要加value表示领域伤害的数值\n吸血怪需要在后面添加value代表吸血比例', 'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉'}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + editor_file.editLoc = function(editor,x,y,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (!isset(callback)) throw('未设置callback'); + callback( + {"events":['\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。', '\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义的需求则需在items.js中修改代码。', '\t[老人,man]constants 和 tools 各最多只允许12种,多了会导致图标溢出。', '\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。', {'type': 'hide', 'time': 500}],"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""}, + {"events":['', '', '', '', {'type': '', 'time': ' // 消失 \n // 守着门的老人 '}],"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + editor_file.editFloor = function(editor,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (!isset(callback)) throw('未设置callback'); + callback( + {'floorId': 'sample0', 'title': '样板 0 层', 'name': '0', 'canFlyTo': True, 'canUseQuickShop': True, 'defaultGround': 'ground', 'firstArrive': ['\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:', '\t[hero]我是谁?我从哪来?我又要到哪去?', '\t[仙子,fairy]你问我...?我也不知道啊...', '本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。']}, + {'floorId': '// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致 // 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 // 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 \n // 楼层唯一标识符,需要和名字完全一致 ', 'title': ' // 楼层中文名 ', 'name': ' // 显示在状态栏中的层数 ', 'canFlyTo': ' // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) ', 'canUseQuickShop': ' // 该层是否允许使用快捷商店 ', 'defaultGround': ' // 默认地面的图块ID(terrains中) \n // 地图数据,需要是13x13,建议使用地图生成器来生成 ', 'firstArrive': ['', '', '', ' // 该楼的所有可能事件列表 \n // 守着道具的老人 ']}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + + + editor_file.editTower = function(editor,obj,callback){ + //obj形式同callback的obj,为null或undefined时只查询不修改 + if (!isset(callback)) throw('未设置callback'); + callback( + {'main': {'useCompress': False, 'floorIds': ['sample0', 'sample1', 'sample2', 'test']}, 'firstData': {'title': '魔塔样板', 'name': 'template', 'version': 'Ver 1.0.0 (Beta)', 'floorId': 'sample0', 'hero': {'name': '阳光', 'lv': 1, 'hp': 2000, 'atk': 100, 'def': 100, 'mdef': 100, 'money': 100, 'experience': 0, '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': '1F金币商店', 'use': 'money', 'need': '20+10*times*(times+1)', 'text': '勇敢的武士啊,给我${need}金币就可以:', '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': '1F经验商店', 'use': 'experience', 'need': '-1', 'text': '勇敢的武士啊,给我若干经验就可以:', 'choices': [{'text': '等级+1', 'need': '100', 'effect': 'status:lv+=1;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'}]}}, 'levelUp': [{}, {'need': 20, 'name': '第二级', 'effect': 'status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10'}, {'need': 40, 'effect': 'function () {\n core.drawText("恭喜升级!");\n core.status.hero.hp *= 2;\n core.status.hero.atk += 100;\n core.status.hero.def += 100;\n }'}]}, 'values': {'HPMAX': 999999, 'lavaDamage': 100, 'poisonDamage': 10, 'weakValue': 20, '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, 'breakArmor': 0.9, 'counterAttack': 0.1, 'purify': 3, 'hatred': 2, 'animateSpeed': 500}, 'flags': {'enableNegativeDamage': True, 'enableFloor': False, 'enableLv': True, 'enableMDef': True, 'enableMoney': True, 'enableExperience': True, 'enableLevelUp': False, 'enableDebuff': True, 'flyNearStair': True, 'pickaxeFourDirections': True, 'bombFourDirections': True, 'bigKeyIsBox': False, 'startDirectly': False, 'canOpenBattleAnimate': True, 'showBattleAnimateConfirm': True, 'battleAnimate': True, 'displayEnemyDamage': True, 'displayExtraDamage': False, 'enableGentleClick': True, 'portalWithoutTrigger': True, 'potionWhileRouting': False}}, + {'main': {'useCompress': ' // 是否使用压缩文件 // 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 // 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 // 如果要进行剧本的修改请务必将其改成false。 \n // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序 ', 'floorIds': ['', '', '', '']}, 'firstData': {'title': ' // 游戏名,将显示在标题页面以及切换楼层的界面中 ', 'name': ' // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。 ', 'version': ' // 当前游戏版本;版本不一致的存档不能通用。 ', 'floorId': ' // 初始楼层ID \n // 勇士初始数据 ', 'hero': {'name': ' // 勇士名;可以改成喜欢的 ', 'lv': ' // 初始等级,该项必须为正整数 ', 'hp': ' // 初始生命值 ', 'atk': ' // 初始攻击 ', 'def': ' // 初始防御 ', 'mdef': ' // 初始魔防 ', 'money': ' // 初始金币 ', 'experience': ' // 初始经验 \n // 初始道具个数 ', 'items': {'keys': {'yellowKey': '', 'blueKey': '', 'redKey': ''}, 'constants': '', 'tools': ''}, 'flyRange': ' // 初始可飞的楼层;一般留空数组即可 ', 'loc': {'direction': '', 'x': '', 'y': ' // 勇士初始位置 \n // 游戏过程中的变量或flags '}, 'flags': {'poison': ' // 毒 ', 'weak': ' // 衰 ', 'curse': ' // 咒 \n // 游戏开始前剧情。如果无剧情直接留一个空数组即可。 '}}, 'startText': ['', '', ' // 定义全局商店(即快捷商店) \n // 商店唯一ID '], 'shops': {'moneyShop1': {'name': ' // 商店名称(标题) ', 'icon': ' // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店 ', 'textInList': ' // 在快捷商店栏中显示的名称 ', 'use': ' // 商店所要使用的。只能是"money"或"experience"。 ', 'need': ' // 商店需要的金币/经验数值;可以是一个表达式,以times作为参数计算。 // 这里用到的times为该商店的已经的访问次数。首次访问该商店时times的值为0。 // 上面的例子是50层商店的计算公式。你也可以写任意其他的计算公式,只要以times作为参数即可。 // 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。 // 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。 ', 'text': ' // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。 \n // 商店的选项 ', 'choices': [{'text': '', 'effect': ' // 如果有多个effect以分号分开,参见下面的经验商店 '}, {'text': '', 'effect': ''}, {'text': '', 'effect': ''}, {'text': '', 'effect': ' // effect只能对status和item进行操作,不能修改flag值。 // 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数 // 其他effect样例: // "item:yellowKey+=1" 黄钥匙+1 // "item:pickaxe+=3" 破墙镐+3 // "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍 \n // 商店唯一ID '}]}, 'expShop1': {'name': '', 'icon': '', 'textInList': '', 'use': ' // 该商店使用的是经验进行计算 ', 'need': ' // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值 ', 'text': ' // 在choices中写need,可以针对每个选项都有不同的需求。 // 这里的need同样可以以times作为参数,比如 "need": "100+20*times" ', 'choices': [{'text': '', 'need': '', 'effect': ' // 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。 '}, {'text': '', 'need': '', 'effect': ''}, {'text': '', 'need': '', 'effect': ' // 经验升级所需要的数值,是一个数组 '}]}}, 'levelUp': [' // 第一项为初始等级,可以简单留空,也可以写name // 每一个里面可以含有三个参数 name, need, effect // need为所需要的经验数值,是一个正整数。请确保need所需的依次递增 // name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中 // effect为本次升级所执行的操作,可由若干项组成,由分号分开 // 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数 ', {'need': '', 'name': '', 'effect': ' // 先将生命提升攻防和的2倍;再将攻击+10,防御+10 // effect也允许写一个function,代表本次升级将会执行的操作 '}, {'need': '', 'effect': ' // 依次往下写需要的数值即可 \n // 各种数值;一些数值可以在这里设置 \n /****** 角色相关 ******/ '}]}, 'values': {'HPMAX': ' // HP上限;-1则无上限 ', 'lavaDamage': ' // 经过血网受到的伤害 ', 'poisonDamage': ' // 中毒后每步受到的伤害 ', 'weakValue': ' // 衰弱状态下攻防减少的数值 /****** 道具相关 ******/ ', 'redJewel': ' // 红宝石加攻击的数值 ', 'blueJewel': ' // 蓝宝石加防御的数值 ', 'greenJewel': ' // 绿宝石加魔防的数值 ', 'redPotion': ' // 红血瓶加血数值 ', 'bluePotion': ' // 蓝血瓶加血数值 ', 'yellowPotion': ' // 黄血瓶加血数值 ', 'greenPotion': ' // 绿血瓶加血数值 ', 'sword1': ' // 铁剑加攻数值 ', 'shield1': ' // 铁盾加防数值 ', 'sword2': ' // 银剑加攻数值 ', 'shield2': ' // 银盾加防数值 ', 'sword3': ' // 骑士剑加攻数值 ', 'shield3': ' // 骑士盾加防数值 ', 'sword4': ' // 圣剑加攻数值 ', 'shield4': ' // 圣盾加防数值 ', 'sword5': ' // 神圣剑加攻数值 ', 'shield5': ' // 神圣盾加防数值 ', 'moneyPocket': ' // 金钱袋加金币的数值 /****** 怪物相关 ******/ ', 'breakArmor': ' // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) ', 'counterAttack': ' // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) ', 'purify': ' // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害) ', 'hatred': ' // 仇恨属性中,每杀死一个怪物获得的仇恨值 /****** 系统相关 ******/ ', 'animateSpeed': ' // 动画时间 \n // 系统FLAG,在游戏运行中中请不要修改它。 \n /****** 角色状态相关 ******/ '}, 'flags': {'enableNegativeDamage': ' // 是否支持负伤害(回血) ', 'enableFloor': ' // 是否在状态栏显示当前楼层 ', 'enableLv': ' // 是否在状态栏显示当前等级 ', 'enableMDef': ' // 是否在状态栏及战斗界面显示魔防(护盾) ', 'enableMoney': ' // 是否在状态栏、怪物手册及战斗界面显示金币 ', 'enableExperience': ' // 是否在状态栏、怪物手册及战斗界面显示经验 ', 'enableLevelUp': ' // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false ', 'enableDebuff': ' // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff ////// 上述的几个开关将直接影响状态栏的显示效果 ////// /****** 道具相关 ******/ ', 'flyNearStair': ' // 是否需要在楼梯边使用传送器 ', 'pickaxeFourDirections': ' // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁 ', 'bombFourDirections': ' // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价) ', 'bigKeyIsBox': ' // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙 /****** 系统相关 ******/ ', 'startDirectly': ' // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面 ', 'canOpenBattleAnimate': ' // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false ', 'showBattleAnimateConfirm': ' // 是否在游戏开始时提供“是否开启战斗动画”的选项 ', 'battleAnimate': ' // 是否默认显示战斗动画;用户可以手动在菜单栏中开关 ', 'displayEnemyDamage': ' // 是否地图怪物显伤;用户可以手动在菜单栏中开关 ', 'displayExtraDamage': ' // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关 ', 'enableGentleClick': ' // 是否允许轻触(获得面前物品) ', 'portalWithoutTrigger': ' // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件 ', 'potionWhileRouting': ' // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶 '}}, + null); + } + //callback(obj,commentObj,err:String) + + //////////////////////////////////////////////////////////////////// + + var isset = function (val) { + if (val == undefined || val == null) { + return false; + } + return true + } + + var formatMap = function(mapArr){ + //把13*13或者1*169数组格式化 + var formatArrStr = ''; + var arr = JSON.stringify(mapArr).replace(/\s+/g, '').split('],['); + for(var i =0; i<13; i++){ + var a = []; + formatArrStr +=' ['; + if(i==0||i==12) a = arr[i].split(/\D+/).join(' ').trim().split(' '); + else a = arr[i].split(/\D+/); + for(var k=0; k<13; k++){ + var num = parseInt(a[k]); + formatArrStr += Array(Math.max(4-String(num).length,0)).join(' ')+num+(k==12?'':','); + } + formatArrStr += ']'+(i==12?'':',\n'); + } + return formatArrStr; + } })(); \ No newline at end of file diff --git a/_server/editor_file_test.html b/_server/editor_file_test.html new file mode 100644 index 00000000..fa7ac2c3 --- /dev/null +++ b/_server/editor_file_test.html @@ -0,0 +1,23 @@ + + + + +
+
+    
+ + + + + \ No newline at end of file diff --git a/drawMapGUI.html b/drawMapGUI.html index bddabf11..e6051f11 100644 --- a/drawMapGUI.html +++ b/drawMapGUI.html @@ -31,8 +31,8 @@
- - + +
@@ -70,13 +70,111 @@
+ + + + + - + diff --git a/index.html b/index.html index ae063d97..d59b0e43 100644 --- a/index.html +++ b/index.html @@ -113,6 +113,7 @@ 此浏览器不支持HTML5 + \ No newline at end of file diff --git a/libs/core.js b/libs/core.js index 26977f69..c659d2d6 100644 --- a/libs/core.js +++ b/libs/core.js @@ -2001,47 +2001,70 @@ core.prototype.setFillStyle = function (map, style) { ////// 绘制某张地图 ////// core.prototype.drawMap = function (mapName, callback) { - var mapData = core.status.maps[mapName]; - var mapBlocks = mapData.blocks; - core.status.floorId = mapName; - core.status.thisMap = mapData; core.clearMap('all'); core.removeGlobalAnimate(null, null, true); - var groundId = core.floors[mapName].defaultGround || "ground"; - var blockIcon = core.material.icons.terrains[groundId]; - var blockImage = core.material.images.terrains; - for (var x = 0; x < 13; x++) { - for (var y = 0; y < 13; y++) { - core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32); - } - } - - // 如果存在png - if (core.isset(core.floors[mapName].png)) { - var png = core.floors[mapName].png; - if (core.isset(core.material.images.pngs[png])) { - core.canvas.bg.drawImage(core.material.images.pngs[png], 0, 0, 416, 416); - } - } - - var mapArray = core.maps.getMapArray(core.status.maps, mapName); - for (var b = 0; b < mapBlocks.length; b++) { - // 事件启用 - var block = mapBlocks[b]; - if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) { - if (block.event.cls == 'autotile') { - core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0); + var drawBg = function(){ + var groundId = core.floors[mapName].defaultGround || "ground"; + var blockIcon = core.material.icons.terrains[groundId]; + var blockImage = core.material.images.terrains; + for (var x = 0; x < 13; x++) { + for (var y = 0; y < 13; y++) { + core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32); } - else { - if (block.event.id!='none') { - blockIcon = core.material.icons[block.event.cls][block.event.id]; - blockImage = core.material.images[block.event.cls]; - core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); - core.addGlobalAnimate(block.event.animate, block.x * 32, block.y * 32, blockIcon, blockImage); + } + // 如果存在png + if (core.isset(core.floors[mapName].png)) { + var png = core.floors[mapName].png; + if (core.isset(core.material.images.pngs[png])) { + core.canvas.bg.drawImage(core.material.images.pngs[png], 0, 0, 416, 416); + } + } + } + if (main.mode=='editor'){ + main.editor.drawMapBg = function(){ + core.clearMap('bg', 0, 0, 416, 416); + drawBg(); + } + } else { + drawBg(); + } + + core.status.floorId = mapName; + core.status.thisMap = core.status.maps[mapName]; + var drawEvent = function(){ + var mapData = core.status.maps[core.status.floorId]; + var mapBlocks = mapData.blocks; + + var mapArray = core.maps.getMapArray(core.status.maps, core.status.floorId); + for (var b = 0; b < mapBlocks.length; b++) { + // 事件启用 + var block = mapBlocks[b]; + if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) { + if (block.event.cls == 'autotile') { + core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0); + } + else { + if (block.event.id!='none') { + var blockIcon = core.material.icons[block.event.cls][block.event.id]; + var blockImage = core.material.images[block.event.cls]; + core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); + core.addGlobalAnimate(block.event.animate, block.x * 32, block.y * 32, blockIcon, blockImage); + } } } } } + + if (main.mode=='editor'){ + main.editor.updateMap = function(){ + core.removeGlobalAnimate(null, null, true); + core.clearMap('event', 0, 0, 416, 416); + drawEvent(); + core.setGlobalAnimate(core.values.animateSpeed); + } + } else { + drawEvent(); + } core.setGlobalAnimate(core.values.animateSpeed); if (core.isset(callback)) callback(); @@ -2210,8 +2233,8 @@ core.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) { core.setAlpha('ui', 1.0); block=block.block; - blockIcon = core.material.icons[block.event.cls][block.event.id]; - blockImage = core.material.images[block.event.cls]; + var blockIcon = core.material.icons[block.event.cls][block.event.id]; + var blockImage = core.material.images[block.event.cls]; // 绘制data层 var opacityVal = 1; @@ -2400,6 +2423,7 @@ core.prototype.removeBlockByIds = function (floorId, ids) { ////// 添加一个全局动画 ////// core.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) { + if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; if (animateMore == 2) { core.status.twoAnimateObjs.push({ 'x': x, @@ -2426,6 +2450,9 @@ core.prototype.removeGlobalAnimate = function (x, y, all) { core.status.twoAnimateObjs = []; core.status.fourAnimateObjs = []; } + + if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; + for (var t = 0; t < core.status.twoAnimateObjs.length; t++) { if (core.status.twoAnimateObjs[t].x == x * 32 && core.status.twoAnimateObjs[t].y == y * 32) { core.status.twoAnimateObjs.splice(t, 1); @@ -2442,6 +2469,7 @@ core.prototype.removeGlobalAnimate = function (x, y, all) { ////// 设置全局动画的显示效果 ////// core.prototype.setGlobalAnimate = function (speed) { + if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; clearInterval(core.interval.twoAnimate); clearInterval(core.interval.fourAnimate); var animateClose = false; @@ -3803,7 +3831,8 @@ core.prototype.updateStatusBar = function () { ////// 屏幕分辨率改变后重新自适应 ////// core.prototype.resize = function(clientWidth, clientHeight) { - + if (main.mode=='editor')return; + // 默认画布大小 var DEFAULT_CANVAS_WIDTH = 422; // 默认边栏宽度 diff --git a/libs/data.js b/libs/data.js index e82b3603..1e68480b 100644 --- a/libs/data.js +++ b/libs/data.js @@ -3,170 +3,10 @@ function data() { } data.prototype.init = function() { - this.firstData = { - "title": "魔塔样板", // 游戏名,将显示在标题页面以及切换楼层的界面中 - "name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。 - "version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。 - "floorId": "sample0", // 初始楼层ID - "hero": { // 勇士初始数据 - "name": "阳光", // 勇士名;可以改成喜欢的 - 'lv': 1, // 初始等级,该项必须为正整数 - "hp": 1000, // 初始生命值 - "atk": 100, // 初始攻击 - "def": 100, // 初始防御 - "mdef": 100, // 初始魔防 - "money": 100, // 初始金币 - "experience": 0, // 初始经验 - "items": { // 初始道具个数 - "keys": { - "yellowKey": 0, - "blueKey": 0, - "redKey": 0 - }, - "constants": {}, - "tools": {} - }, - "flyRange": [], // 初始可飞的楼层;一般留空数组即可 - "loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置 - "flags": { // 游戏过程中的变量或flags - "poison": false, // 毒 - "weak": false, // 衰 - "curse": false, // 咒 - } - }, - "startText": [ // 游戏开始前剧情。如果无剧情直接留一个空数组即可。 - "Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!", - "这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。", - "赶快来试一试吧!" - ], - "shops": { // 定义全局商店(即快捷商店) - "moneyShop1": { // 商店唯一ID - "name": "贪婪之神", // 商店名称(标题) - "icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店 - "textInList": "1F金币商店", // 在快捷商店栏中显示的名称 - "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" 即可。可参见下面的经验商店。 - "text": "勇敢的武士啊,给我${need}金币就可以:", // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。 - "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和item进行操作,不能修改flag值。 - // 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数 - // 其他effect样例: - // "item:yellowKey+=1" 黄钥匙+1 - // "item:pickaxe+=3" 破墙镐+3 - // "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍 - ] - }, - "expShop1": { // 商店唯一ID - "name": "经验之神", - "icon": "pinkShop", - "textInList": "1F经验商店", - "use": "experience", // 该商店使用的是经验进行计算 - "need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值 - "text": "勇敢的武士啊,给我若干经验就可以:", - "choices": [ - // 在choices中写need,可以针对每个选项都有不同的需求。 - // 这里的need同样可以以times作为参数,比如 "need": "100+20*times" - {"text": "等级+1", "need": "100", "effect": "status:lv+=1;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"}, - ] - }, - }, - "levelUp": [ // 经验升级所需要的数值,是一个数组 - {}, // 第一项为初始等级,可以简单留空,也可以写name - - // 每一个里面可以含有三个参数 need, name, effect - // need为所需要的经验数值,是一个正整数。请确保need所需的依次递增 - // name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中 - // effect为本次升级所执行的操作,可由若干项组成,由分号分开 - // 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数 - {"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10 - - // effect也允许写一个function,代表本次升级将会执行的操作 - {"need": 40, "effect": function () { - core.drawText("恭喜升级!"); - core.status.hero.hp *= 2; - core.status.hero.atk += 100; - core.status.hero.def += 100; - }}, - - // 依次往下写需要的数值即可 - ] - } - // 各种数值;一些数值可以在这里设置 - this.values = { - /****** 角色相关 ******/ - "HPMAX": 999999, // HP上限;-1则无上限 - "lavaDamage": 100, // 经过血网受到的伤害 - "poisonDamage": 10, // 中毒后每步受到的伤害 - "weakValue": 20, // 衰弱状态下攻防减少的数值 - /****** 道具相关 ******/ - "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, // 金钱袋加金币的数值 - /****** 怪物相关 ******/ - 'breakArmor': 0.9, // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) - 'counterAttack': 0.1, // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) - 'purify': 3, // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害) - 'hatred': 2, // 仇恨属性中,每杀死一个怪物获得的仇恨值 - /****** 系统相关 ******/ - 'animateSpeed': 500, // 动画时间 - } - // 系统FLAG,在游戏运行中中请不要修改它。 - this.flags = { - /****** 状态栏相关 ******/ - "enableFloor": true, // 是否在状态栏显示当前楼层 - "enableLv": true, // 是否在状态栏显示当前等级 - "enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾) - "enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币 - "enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验 - "enableLevelUp": true, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false - "enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff - ////// 上述的几个开关将直接影响状态栏的显示效果 ////// - /****** 道具相关 ******/ - "flyNearStair": true, // 是否需要在楼梯边使用传送器 - "pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁 - "bombFourDirections": true, // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价) - "bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙 - /****** 怪物相关 ******/ - "enableNegativeDamage": true, // 是否支持负伤害(回血) - "zoneSquare": false, // 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害 - /****** 系统相关 ******/ - "startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面 - "canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false - "showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项 - "battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关 - "displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关 - "displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关 - "enableGentleClick": true, // 是否允许轻触(获得面前物品) - "portalWithoutTrigger": true, // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件 - "potionWhileRouting": false, // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶 - } + this.firstData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData; + this.values = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values; + this.flags = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags; + delete(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d); } data.prototype.getFirstData = function() { diff --git a/libs/enemys.js b/libs/enemys.js index 8b492099..f98e73c7 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -5,68 +5,8 @@ function enemys() { ////// 初始化 ////// enemys.prototype.init = function () { // 怪物属性初始化定义: - this.enemys = { - 'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]}, - 'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': [1,9]}, - 'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'special': 1}, - 'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'special': 4}, - 'vampire': {'name': '冥灵魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'skeleton': {'name': '骷髅人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'skeletonSoilder': {'name': '骷髅士兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'skeletonCaptain': {'name': '骷髅队长', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'ghostSkeleton': {'name': '冥队长', 'hp': 100, 'atk': 120, 'def': 0, 'money': 8, 'experience': 0, 'special': 7}, - 'zombie': {'name': '兽人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'zombieKnight': {'name': '兽人武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'rock': {'name': '石头人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 4, 'experience': 0, 'special': 3}, - '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, 'point': 1}, // 'point'可以在打败怪物后进行加点,详见文档说明。 - '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, 'zoneSquare': true}, // 领域怪需要加value表示领域伤害的数值;zoneSquare代表是否九宫格伤害 - 'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'special': 15, 'value': 200, 'range': 2}, // range可选,代表领域伤害的范围;不加默认为1 - '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}, - 'soldier': {'name': '冥战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - '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': 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}, - 'goldSlime': {'name': '黄头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'poisonSkeleton': {'name': '紫骷髅', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'poisonBat': {'name': '紫蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 14, 'experience': 0, 'special': 13}, - 'steelRock': {'name': '铁面人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'skeletonPriest': {'name': '骷髅法师', 'hp': 100, 'atk': 100, 'def': 0, 'money': 0, 'experience': 0, 'special': 18, 'value': 20}, - 'skeletonKing': {'name': '骷髅王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'skeletonWizard': {'name': '骷髅巫师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'redSkeletonCaption': {'name': '骷髅武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'special': 0}, - 'badHero': {'name': '迷失勇者', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'demon': {'name': '魔神武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - '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, 'bomb': false}, // 吸血怪需要在后面添加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}, - 'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6, 'n': 8}, // 多连击需要在后面指定n代表是几连击 - 'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'special': 12}, - 'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'octopus': {'name': '血影', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'darkFairy': {'name': '仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'greenKnight': {'name': '强盾骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - } + this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80; + delete(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80); } ////// 获得一个或所有怪物数据 ////// diff --git a/libs/icons.js b/libs/icons.js index 4aced479..a614cded 100644 --- a/libs/icons.js +++ b/libs/icons.js @@ -3,220 +3,8 @@ function icons() { } icons.prototype.init = function () { - this.icons = { - 'hero': { - 'down': {'loc': 0, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3}, - 'left': {'loc': 1, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3}, - 'right': {'loc': 2, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3}, - 'up': {'loc': 3, 'stop': 0, 'leftFoot': 1, 'rightFoot': 3} - }, - 'terrains': { - 'ground': 0, - 'grass': 1, - 'grass2': 2, - 'snowGround': 3, - 'ground2': 4, - 'ground3': 5, - 'ground4': 6, - 'sand': 7, - 'ground5': 8, - 'yellowWall2': 9, - 'whiteWall2': 10, - 'blueWall2': 11, - 'blockWall': 12, - 'grayWall': 13, - 'white': 14, - 'ground6': 15, - 'soil': 16, - 'yellowWall': 17, - 'whiteWall': 18, - 'blueWall': 19, - 'star': 20, - 'lava': 21, - 'ice': 22, - 'downFloor': 23, - 'upFloor': 24, - 'yellowDoor': 25, - 'blueDoor': 26, - 'redDoor': 27, - 'greenDoor': 28, - 'specialDoor': 29, - 'steelDoor': 30, - 'blueShop-left': 31, - 'blueShop-right': 32, - 'pinkShop-left': 33, - 'pinkShop-right': 34, - 'arrowUp': 35, - 'arrowDown': 36, - 'arrowLeft': 37, - 'arrowRight': 38, - 'light': 39, - 'darkLight': 40 - }, - 'animates': { - 'star': 0, - 'lava': 1, - 'waterWall': 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, - 'water': 31, - }, - '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, - 'darkFairy': 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 - }, - 'autotile': { // 所有的Autotile列表;后面的index简单取0即可 - 'autotile': 0, - 'autotile1': 0, - 'autotile2': 0, - 'autotile3': 0, - } - } + this.icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1; + delete(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1); } icons.prototype.getIcons = function () { diff --git a/libs/items.js b/libs/items.js index e603d3a4..a210a68b 100644 --- a/libs/items.js +++ b/libs/items.js @@ -4,60 +4,10 @@ function items() { ////// 初始化 ////// items.prototype.init = function () { - this.items = { - // 钥匙 - 'yellowKey': {'cls': 'keys', 'name': '黄钥匙'}, - 'blueKey': {'cls': 'keys', 'name': '蓝钥匙'}, - 'redKey': {'cls': 'keys', 'name': '红钥匙'}, - - // 宝石、血瓶 - 'redJewel': {'cls': 'items', 'name': '红宝石'}, - 'blueJewel': {'cls': 'items', 'name': '蓝宝石'}, - 'greenJewel': {'cls': 'items', 'name': '绿宝石'}, - 'yellowJewel': {'cls': 'items', 'name': '黄宝石'}, - 'redPotion': {'cls': 'items', 'name': '红血瓶'}, - 'bluePotion': {'cls': 'items', 'name': '蓝血瓶'}, - 'yellowPotion': {'cls': 'items', 'name': '黄血瓶'}, - 'greenPotion': {'cls': 'items', 'name': '绿血瓶'}, - 'sword1': {'cls': 'items', 'name': '铁剑'}, - 'sword2': {'cls': 'items', 'name': '银剑'}, - 'sword3': {'cls': 'items', 'name': '骑士剑'}, - 'sword4': {'cls': 'items', 'name': '圣剑'}, - 'sword5': {'cls': 'items', 'name': '神圣剑'}, - 'shield1': {'cls': 'items', 'name': '铁盾'}, - 'shield2': {'cls': 'items', 'name': '银盾'}, - 'shield3': {'cls': 'items', 'name': '骑士盾'}, - 'shield4': {'cls': 'items', 'name': '圣盾'}, - 'shield5': {'cls': 'items', 'name': '神圣盾'}, - 'superPotion': {'cls': 'items', 'name': '圣水'}, - 'moneyPocket': {'cls': 'items', 'name': '金钱袋'}, - - // 物品 - 'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性'}, - 'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层'}, - 'coin': {'cls': 'constants', 'name': '幸运金币', 'text': '持有时打败怪物可得双倍金币'}, - 'snow': {'cls': 'constants', 'name': '冰冻徽章', 'text': '可以将四周的熔岩变成平地'}, - 'cross': {'cls': 'constants', 'name': '十字架', 'text': '持有后无视怪物的无敌属性'}, - 'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'}, - 'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'}, - - // 道具 - 'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'}, - 'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'}, - 'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'}, - 'pickaxe': {'cls': 'tools', 'name': '破墙镐', 'text': '可以破坏勇士面前的墙'}, - 'icePickaxe': {'cls': 'tools', 'name': '破冰镐', 'text': '可以破坏勇士面前的一堵冰墙'}, - 'bomb': {'cls': 'tools', 'name': '炸弹', 'text': '可以炸掉勇士面前的怪物'}, - 'centerFly': {'cls': 'tools', 'name': '中心对称飞行器', 'text': '可以飞向当前楼层中心对称的位置'}, - 'upFly': {'cls': 'tools', 'name': '上楼器', 'text': '可以飞往楼上的相同位置'}, - 'downFly': {'cls': 'tools', 'name': '下楼器', 'text': '可以飞往楼下的相同位置'}, - 'earthquake': {'cls': 'tools', 'name': '地震卷轴', 'text': '可以破坏当前层的所有墙'}, - 'poisonWine': {'cls': 'tools', 'name': '解毒药水', 'text': '可以解除中毒状态'}, - 'weakWine': {'cls': 'tools', 'name': '解衰药水', 'text': '可以解除衰弱状态'}, - 'curseWine': {'cls': 'tools', 'name': '解咒药水', 'text': '可以解除诅咒状态'}, - 'superWine': {'cls': 'tools', 'name': '万能药水', 'text': '可以解除所有不良状态'}, - 'hammer': {'cls': 'tools', 'name': '圣锤', 'text': '可以炸掉勇士面前的怪物'} - } + this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items; + this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect; + this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip; + delete(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a); } ////// 获得所有道具 ////// @@ -80,36 +30,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) { var itemCls = core.material.items[itemId].cls; // 消耗品 if (itemCls === 'items') { - 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.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.values.moneyPocket; + if (itemId in this.itemEffect)eval(this.itemEffect[itemId]); } else { core.addItem(itemId, itemNum); @@ -118,27 +39,7 @@ items.prototype.getItemEffect = function(itemId, itemNum) { ////// “即捡即用类”道具的文字提示 ////// items.prototype.getItemEffectTip = function(itemId) { - 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.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.values.moneyPocket; + if (itemId in this.itemEffectTip)return eval(this.itemEffectTip[itemId]); return ""; } diff --git a/libs/maps.js b/libs/maps.js index 1e9c72dc..d5118e63 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -1,5 +1,8 @@ function maps() {} -maps.prototype.init = function() {} +maps.prototype.init = function() { + this.blocksInfo = maps_90f36752_8815_4be8_b32b_d7fad1d0542e; + delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e); +} ////// 加载某个楼层(从剧本或存档中) ////// maps.prototype.loadFloor = function (floorId, map) { @@ -10,38 +13,46 @@ maps.prototype.loadFloor = function (floorId, map) { content['title'] = floor.title; content['canFlyTo'] = floor.canFlyTo; if (!core.isset(map)) map=floor.map; - var blocks = []; - for (var i = 0; i < 13; i++) { - for (var j = 0; j < 13; j++) { - var block = this.getBlock(j, i, map[i][j]); - if (core.isset(block.event)) { - if (block.event.cls == 'enemys' && block.event.trigger==undefined) { - block.event.trigger = 'battle'; - } - if (block.event.cls == 'items' && block.event.trigger==undefined) { - block.event.trigger = 'getItem'; - } - if (block.event.noPass == undefined) { - if (block.event.cls=='enemys' || block.event.cls=='terrains' || block.event.cls=='npcs') { - block.event.noPass = true; - } - } - if (block.event.animate == undefined) { - if (block.event.cls=='enemys' || block.event.cls=='npcs') { - block.event.animate = 2; - } - if (block.event.cls == 'animates') { - block.event.animate = 4; + var mapIntoBlocks = function(map,maps,floor){ + var blocks = []; + for (var i = 0; i < 13; i++) { + for (var j = 0; j < 13; j++) { + var block = maps.getBlock(j, i, map[i][j]); + if (core.isset(block.event)) { + if (block.event.cls == 'enemys' && block.event.trigger==undefined) { + block.event.trigger = 'battle'; + } + if (block.event.cls == 'items' && block.event.trigger==undefined) { + block.event.trigger = 'getItem'; + } + if (block.event.noPass == undefined) { + if (block.event.cls=='enemys' || block.event.cls=='terrains' || block.event.cls=='npcs') { + block.event.noPass = true; + } + } + if (block.event.animate == undefined) { + if (block.event.cls=='enemys' || block.event.cls=='npcs') { + block.event.animate = 2; + } + if (block.event.cls == 'animates') { + block.event.animate = 4; + } } } + maps.addEvent(block,j,i,floor.events[j+","+i]); + maps.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]); + if (core.isset(block.event)) blocks.push(block); } - this.addEvent(block,j,i,floor.events[j+","+i]) - this.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]); - if (core.isset(block.event)) blocks.push(block); + } + return blocks; + } + if (main.mode=='editor'){ + main.editor.mapIntoBlocks = function(map,floor){ + return mapIntoBlocks(map,core.maps,floor); } } // 事件处理 - content['blocks'] = blocks; + content['blocks'] = mapIntoBlocks(map,this,floor); return content; } @@ -63,196 +74,7 @@ maps.prototype.getBlock = function (x, y, id) { var tmp = {'x': x, 'y': y, 'id': id}; if (enable!=null) tmp.enable = enable; - ////////////////////////// 地形部分 ////////////////////////// - - // 0-20 地形 - if (id == 1) tmp.event = {'cls': 'terrains', 'id': 'yellowWall'}; // 黄墙 - if (id == 2) tmp.event = {'cls': 'terrains', 'id': 'whiteWall'}; // 白墙 - if (id == 3) tmp.event = {'cls': 'terrains', 'id': 'blueWall'}; // 白墙 - if (id == 4) tmp.event = {'cls': 'animates', 'id': 'star', 'noPass': true}; // 星空 - if (id == 5) tmp.event = {'cls': 'animates', 'id': 'lava', 'noPass': true}; // 岩浆 - if (id == 6) tmp.event = {'cls': 'terrains', 'id': 'ice'}; // 岩浆 - if (id == 7) tmp.event = {'cls': 'terrains', 'id': 'blueShop-left'}; // 蓝色商店左 - if (id == 8) tmp.event = {'cls': 'terrains', 'id': 'blueShop-right'}; // 蓝色商店右 - if (id == 9) tmp.event = {'cls': 'terrains', 'id': 'pinkShop-left'}; // 粉色商店左 - if (id == 10) tmp.event = {'cls': 'terrains', 'id': 'pinkShop-right'}; // 粉色商店左 - if (id == 11) tmp.event = {'cls': 'animates', 'id': 'lavaNet', 'noPass': false, 'trigger': 'passNet'}; // 血网 - if (id == 12) tmp.event = {'cls': 'animates', 'id': 'poisonNet', 'noPass': false, 'trigger': 'passNet'}; // 毒网 - if (id == 13) tmp.event = {'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}; // 衰网 - if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网 - if (id == 15) tmp.event = {'cls': 'animates', 'id': 'water', 'noPass': true}; // 水 - // 在这里添加更多地形 - // 如果空位不足,可以从180以后开始继续放,只要不和现有的数字冲突即可 - - // Autotile - if (id == 20) tmp.event = {'cls': 'autotile', 'id': 'autotile', 'noPass': true}; // autotile - // 更多的autotile从151到160等,只要不和现有的数字冲突即可 - if (id == 151) tmp.event = {'cls': 'autotile', 'id': 'autotile1', 'noPass': true}; - if (id == 152) tmp.event = {'cls': 'autotile', 'id': 'autotile2', 'noPass': true}; - if (id == 153) tmp.event = {'cls': 'autotile', 'id': 'autotile3', 'noPass': true}; - - ////////////////////////// 物品部分 ////////////////////////// - - // 21-80 物品 - if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙 - if (id == 22) tmp.event = {'cls': 'items', 'id': 'blueKey'}; // 蓝钥匙 - if (id == 23) tmp.event = {'cls': 'items', 'id': 'redKey'}; // 红钥匙 - if (id == 24) tmp.event = {'cls': 'items', 'id': 'greenKey'}; // 绿钥匙 - if (id == 25) tmp.event = {'cls': 'items', 'id': 'steelKey'}; // 铁门钥匙 - if (id == 26) tmp.event = {'cls': 'items', 'id': 'bigKey'}; // 大黄门钥匙(钥匙盒) - if (id == 27) tmp.event = {'cls': 'items', 'id': 'redJewel'}; // 红宝石 - if (id == 28) tmp.event = {'cls': 'items', 'id': 'blueJewel'}; // 蓝宝石 - if (id == 29) tmp.event = {'cls': 'items', 'id': 'greenJewel'}; // 绿宝石 - if (id == 30) tmp.event = {'cls': 'items', 'id': 'yellowJewel'}; // 黄宝石 - if (id == 31) tmp.event = {'cls': 'items', 'id': 'redPotion'}; // 红血瓶 - if (id == 32) tmp.event = {'cls': 'items', 'id': 'bluePotion'}; // 蓝血瓶 - if (id == 33) tmp.event = {'cls': 'items', 'id': 'greenPotion'}; // 绿血瓶 - if (id == 34) tmp.event = {'cls': 'items', 'id': 'yellowPotion'}; // 黄血瓶 - if (id == 35) tmp.event = {'cls': 'items', 'id': 'sword1'}; // 铁剑 - if (id == 36) tmp.event = {'cls': 'items', 'id': 'shield1'}; // 铁盾 - if (id == 37) tmp.event = {'cls': 'items', 'id': 'sword2'}; // 银剑 - if (id == 38) tmp.event = {'cls': 'items', 'id': 'shield2'}; // 银盾 - if (id == 39) tmp.event = {'cls': 'items', 'id': 'sword3'}; // 骑士剑 - if (id == 40) tmp.event = {'cls': 'items', 'id': 'shield3'}; // 骑士盾 - if (id == 41) tmp.event = {'cls': 'items', 'id': 'sword4'}; // 圣剑 - if (id == 42) tmp.event = {'cls': 'items', 'id': 'shield4'}; // 圣盾 - if (id == 43) tmp.event = {'cls': 'items', 'id': 'sword5'}; // 神圣剑 - if (id == 44) tmp.event = {'cls': 'items', 'id': 'shield5'}; // 神圣盾 - if (id == 45) tmp.event = {'cls': 'items', 'id': 'book'}; // 怪物手册 - if (id == 46) tmp.event = {'cls': 'items', 'id': 'fly'}; // 楼层传送器 - if (id == 47) tmp.event = {'cls': 'items', 'id': 'pickaxe'}; // 破墙镐 - if (id == 48) tmp.event = {'cls': 'items', 'id': 'icePickaxe'}; // 破冰镐 - if (id == 49) tmp.event = {'cls': 'items', 'id': 'bomb'}; // 炸弹 - if (id == 50) tmp.event = {'cls': 'items', 'id': 'centerFly'}; // 中心对称 - if (id == 51) tmp.event = {'cls': 'items', 'id': 'upFly'}; // 上楼器 - if (id == 52) tmp.event = {'cls': 'items', 'id': 'downFly'}; // 下楼器 - if (id == 53) tmp.event = {'cls': 'items', 'id': 'coin'}; // 幸运金币 - if (id == 54) tmp.event = {'cls': 'items', 'id': 'snow'}; // 冰冻徽章 - if (id == 55) tmp.event = {'cls': 'items', 'id': 'cross'}; // 十字架 - if (id == 56) tmp.event = {'cls': 'items', 'id': 'superPotion'}; // 圣水 - if (id == 57) tmp.event = {'cls': 'items', 'id': 'earthquake'} // 地震卷轴 - if (id == 58) tmp.event = {'cls': 'items', 'id': 'poisonWine'} // 解毒药水 - if (id == 59) tmp.event = {'cls': 'items', 'id': 'weakWine'} // 解衰药水 - if (id == 60) tmp.event = {'cls': 'items', 'id': 'curseWine'} // 解咒药水 - if (id == 61) tmp.event = {'cls': 'items', 'id': 'superWine'} // 万能药水 - if (id == 62) tmp.event = {'cls': 'items', 'id': 'knife'} // 屠龙匕首 - if (id == 63) tmp.event = {'cls': 'items', 'id': 'moneyPocket'} // 金钱袋 - if (id == 64) tmp.event = {'cls': 'items', 'id': 'shoes'} // 绿鞋 - if (id == 65) tmp.event = {'cls': 'items', 'id': 'hammer'} // 圣锤 - - - ////////////////////////// 门、楼梯、传送点部分 ////////////////////////// - - // 81-100 门 - if (id == 81) tmp.event = {'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'}; // 黄门 - if (id == 82) tmp.event = {'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'}; // 蓝门 - if (id == 83) tmp.event = {'cls': 'terrains', 'id': 'redDoor', 'trigger': 'openDoor'}; // 红门 - if (id == 84) tmp.event = {'cls': 'terrains', 'id': 'greenDoor', 'trigger': 'openDoor'}; // 绿门 - if (id == 85) tmp.event = {'cls': 'terrains', 'id': 'specialDoor', 'trigger': 'openDoor'}; // 机关门左 - if (id == 86) tmp.event = {'cls': 'terrains', 'id': 'steelDoor', 'trigger': 'openDoor'}; // 铁门 - if (id == 87) tmp.event = {'cls': 'terrains', 'id': 'upFloor', 'noPass': false}; // 上楼梯 - if (id == 88) tmp.event = {'cls': 'terrains', 'id': 'downFloor', 'noPass': false}; // 下楼梯 - if (id == 89) tmp.event = {'cls': 'animates', 'id': 'portal', 'noPass': false}; // 传送门 - if (id == 90) tmp.event = {'cls': 'animates', 'id': 'starPortal', 'noPass': false}; // 星空传送门 - if (id == 91) tmp.event = {'cls': 'animates', 'id': 'upPortal', 'noPass': false}; // 上箭头 - if (id == 92) tmp.event = {'cls': 'animates', 'id': 'leftPortal', 'noPass': false}; // 左箭头 - if (id == 93) tmp.event = {'cls': 'animates', 'id': 'downPortal', 'noPass': false}; // 下箭头 - if (id == 94) tmp.event = {'cls': 'animates', 'id': 'rightPortal', 'noPass': false}; // 右箭头 - - - ////////////////////////// NPC部分 ////////////////////////// - - // 121-150 NPC - if (id == 121) tmp.event = {'cls': 'npcs', 'id': 'man'}; - if (id == 122) tmp.event = {'cls': 'npcs', 'id': 'woman'}; - if (id == 123) tmp.event = {'cls': 'npcs', 'id': 'thief'}; - if (id == 124) tmp.event = {'cls': 'npcs', 'id': 'fairy'}; - if (id == 125) tmp.event = {'cls': 'npcs', 'id': 'magician'}; - if (id == 126) tmp.event = {'cls': 'npcs', 'id': 'womanMagician'}; - if (id == 127) tmp.event = {'cls': 'npcs', 'id': 'oldMan'}; - if (id == 128) tmp.event = {'cls': 'npcs', 'id': 'child'}; - if (id == 129) tmp.event = {'cls': 'npcs', 'id': 'wood'}; - if (id == 130) tmp.event = {'cls': 'npcs', 'id': 'pinkShop'}; - if (id == 131) tmp.event = {'cls': 'npcs', 'id': 'blueShop'}; - if (id == 132) tmp.event = {'cls': 'npcs', 'id': 'princess'}; - - ////////////////////////// 其他部分 ////////////////////////// - - // 161-200 其他(单向箭头、灯、箱子等等) - if (id == 161) tmp.event = {'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}; // 单向上箭头 - if (id == 162) tmp.event = {'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}; // 单向下箭头 - if (id == 163) tmp.event = {'cls': 'terrains', 'id': 'arrowLeft', 'noPass': false}; // 单向左箭头 - if (id == 164) tmp.event = {'cls': 'terrains', 'id': 'arrowRight', 'noPass': false}; // 单向右箭头 - if (id == 165) tmp.event = {'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}; // 灯 - if (id == 166) tmp.event = {'cls': 'terrains', 'id': 'darkLight', 'noPass': true}; // 暗灯 - - - ////////////////////////// 怪物部分 ////////////////////////// - - // 201-300 怪物 - if (id == 201) tmp.event = {'cls': 'enemys', 'id': 'greenSlime'}; - if (id == 202) tmp.event = {'cls': 'enemys', 'id': 'redSlime'}; - if (id == 203) tmp.event = {'cls': 'enemys', 'id': 'blackSlime'}; - if (id == 204) tmp.event = {'cls': 'enemys', 'id': 'slimelord'}; - if (id == 205) tmp.event = {'cls': 'enemys', 'id': 'bat'}; - if (id == 206) tmp.event = {'cls': 'enemys', 'id': 'bigBat'}; - if (id == 207) tmp.event = {'cls': 'enemys', 'id': 'redBat'}; - if (id == 208) tmp.event = {'cls': 'enemys', 'id': 'vampire'}; - if (id == 209) tmp.event = {'cls': 'enemys', 'id': 'skeleton'}; - if (id == 210) tmp.event = {'cls': 'enemys', 'id': 'skeletonSoilder'}; - if (id == 211) tmp.event = {'cls': 'enemys', 'id': 'skeletonCaptain'}; - if (id == 212) tmp.event = {'cls': 'enemys', 'id': 'ghostSkeleton'}; - if (id == 213) tmp.event = {'cls': 'enemys', 'id': 'zombie'}; - if (id == 214) tmp.event = {'cls': 'enemys', 'id': 'zombieKnight'}; - if (id == 215) tmp.event = {'cls': 'enemys', 'id': 'rock'}; - if (id == 216) tmp.event = {'cls': 'enemys', 'id': 'slimeMan'}; - if (id == 217) tmp.event = {'cls': 'enemys', 'id': 'bluePriest'}; - if (id == 218) tmp.event = {'cls': 'enemys', 'id': 'redPriest'}; - if (id == 219) tmp.event = {'cls': 'enemys', 'id': 'brownWizard'}; - if (id == 220) tmp.event = {'cls': 'enemys', 'id': 'redWizard'}; - if (id == 221) tmp.event = {'cls': 'enemys', 'id': 'yellowGuard'}; - if (id == 222) tmp.event = {'cls': 'enemys', 'id': 'blueGuard'}; - if (id == 223) tmp.event = {'cls': 'enemys', 'id': 'redGuard'}; - if (id == 224) tmp.event = {'cls': 'enemys', 'id': 'swordsman'}; - if (id == 225) tmp.event = {'cls': 'enemys', 'id': 'soldier'}; - if (id == 226) tmp.event = {'cls': 'enemys', 'id': 'yellowKnight'}; - if (id == 227) tmp.event = {'cls': 'enemys', 'id': 'redKnight'}; - if (id == 228) tmp.event = {'cls': 'enemys', 'id': 'darkKnight'}; - if (id == 229) tmp.event = {'cls': 'enemys', 'id': 'blackKing'}; - if (id == 230) tmp.event = {'cls': 'enemys', 'id': 'yellowKing'}; - if (id == 231) tmp.event = {'cls': 'enemys', 'id': 'greenKing'}; - if (id == 232) tmp.event = {'cls': 'enemys', 'id': 'blueKnight'}; - if (id == 233) tmp.event = {'cls': 'enemys', 'id': 'goldSlime'}; - if (id == 234) tmp.event = {'cls': 'enemys', 'id': 'poisonSkeleton'}; - if (id == 235) tmp.event = {'cls': 'enemys', 'id': 'poisonBat'}; - if (id == 236) tmp.event = {'cls': 'enemys', 'id': 'steelRock'}; - if (id == 237) tmp.event = {'cls': 'enemys', 'id': 'skeletonPriest'}; - if (id == 238) tmp.event = {'cls': 'enemys', 'id': 'skeletonKing'}; - if (id == 239) tmp.event = {'cls': 'enemys', 'id': 'skeletonWizard'}; - if (id == 240) tmp.event = {'cls': 'enemys', 'id': 'redSkeletonCaption'}; - if (id == 241) tmp.event = {'cls': 'enemys', 'id': 'badHero'}; - if (id == 242) tmp.event = {'cls': 'enemys', 'id': 'demon'}; - if (id == 243) tmp.event = {'cls': 'enemys', 'id': 'demonPriest'}; - if (id == 244) tmp.event = {'cls': 'enemys', 'id': 'goldHornSlime'}; - if (id == 245) tmp.event = {'cls': 'enemys', 'id': 'redKing'}; - if (id == 246) tmp.event = {'cls': 'enemys', 'id': 'whiteKing'}; - if (id == 247) tmp.event = {'cls': 'enemys', 'id': 'blackMagician'}; - if (id == 248) tmp.event = {'cls': 'enemys', 'id': 'silverSlime'}; - if (id == 249) tmp.event = {'cls': 'enemys', 'id': 'swordEmperor'}; - if (id == 250) tmp.event = {'cls': 'enemys', 'id': 'whiteHornSlime'}; - if (id == 251) tmp.event = {'cls': 'enemys', 'id': 'badPrincess'}; - if (id == 252) tmp.event = {'cls': 'enemys', 'id': 'badFairy'}; - if (id == 253) tmp.event = {'cls': 'enemys', 'id': 'grayPriest'}; - if (id == 254) tmp.event = {'cls': 'enemys', 'id': 'redSwordsman'}; - if (id == 255) tmp.event = {'cls': 'enemys', 'id': 'whiteGhost'}; - if (id == 256) tmp.event = {'cls': 'enemys', 'id': 'poisonZombie'}; - if (id == 257) tmp.event = {'cls': 'enemys', 'id': 'magicDragon'}; - if (id == 258) tmp.event = {'cls': 'enemys', 'id': 'octopus'}; - if (id == 259) tmp.event = {'cls': 'enemys', 'id': 'darkFairy'}; - if (id == 260) tmp.event = {'cls': 'enemys', 'id': 'greenKnight'}; - - ////////////////////////// 待定... ////////////////////////// - // 目前ID暂时不要超过400 + if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id])); return tmp; } diff --git a/libs/project/data.js b/libs/project/data.js new file mode 100644 index 00000000..978f5547 --- /dev/null +++ b/libs/project/data.js @@ -0,0 +1,190 @@ +data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = +{ + "main" : { + "useCompress" : false, // 是否使用压缩文件 + // 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 + // 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 + // 如果要进行剧本的修改请务必将其改成false。 + + "floorIds" : [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序 + "sample0", "sample1", "sample2" + ], + "pngs" : [ // 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416 + // 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量 + // 有关使用自定义背景图,请参见文档的“自定义素材”说明 + "bg.png", "yewai.png", // 依次向后添加 + ], + "bgms" : [ // 在此存放所有的bgm,和文件名一致。第一项为默认播放项 + // 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 + '058-Slow01.mid', 'bgm.mp3', 'qianjin.mid', 'star.mid', + ], + "sounds" : [ // 在此存放所有的SE,和文件名一致 + // 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 + 'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg', + ], + }, + "firstData" : { + "title": "魔塔样板", // 游戏名,将显示在标题页面以及切换楼层的界面中 + "name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。 + "version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。 + "floorId": "sample0", // 初始楼层ID + "hero": { // 勇士初始数据 + "name": "阳光", // 勇士名;可以改成喜欢的 + 'lv': 1, // 初始等级,该项必须为正整数 + "hp": 1000, // 初始生命值 + "atk": 100, // 初始攻击 + "def": 100, // 初始防御 + "mdef": 100, // 初始魔防 + "money": 100, // 初始金币 + "experience": 0, // 初始经验 + "items": { // 初始道具个数 + "keys": { + "yellowKey": 0, + "blueKey": 0, + "redKey": 0 + }, + "constants": {}, + "tools": {} + }, + "flyRange": [], // 初始可飞的楼层;一般留空数组即可 + "loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置 + "flags": { // 游戏过程中的变量或flags + "poison": false, // 毒 + "weak": false, // 衰 + "curse": false, // 咒 + } + }, + "startText": [ // 游戏开始前剧情。如果无剧情直接留一个空数组即可。 + "Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!", + "这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。", + "赶快来试一试吧!" + ], + "shops": { // 定义全局商店(即快捷商店) + "moneyShop1": { // 商店唯一ID + "name": "贪婪之神", // 商店名称(标题) + "icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店 + "textInList": "1F金币商店", // 在快捷商店栏中显示的名称 + "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" 即可。可参见下面的经验商店。 + "text": "勇敢的武士啊,给我${need}金币就可以:", // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。 + "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和item进行操作,不能修改flag值。 + // 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数 + // 其他effect样例: + // "item:yellowKey+=1" 黄钥匙+1 + // "item:pickaxe+=3" 破墙镐+3 + // "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍 + ] + }, + "expShop1": { // 商店唯一ID + "name": "经验之神", + "icon": "pinkShop", + "textInList": "1F经验商店", + "use": "experience", // 该商店使用的是经验进行计算 + "need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值 + "text": "勇敢的武士啊,给我若干经验就可以:", + "choices": [ + // 在choices中写need,可以针对每个选项都有不同的需求。 + // 这里的need同样可以以times作为参数,比如 "need": "100+20*times" + {"text": "等级+1", "need": "100", "effect": "status:lv+=1;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"}, + ] + }, + }, + "levelUp": [ // 经验升级所需要的数值,是一个数组 + {}, // 第一项为初始等级,可以简单留空,也可以写name + + // 每一个里面可以含有三个参数 need, name, effect + // need为所需要的经验数值,是一个正整数。请确保need所需的依次递增 + // name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中 + // effect为本次升级所执行的操作,可由若干项组成,由分号分开 + // 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数 + {"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10 + + // effect也允许写一个function,代表本次升级将会执行的操作 + {"need": 40, "effect": function () { + core.drawText("恭喜升级!"); + core.status.hero.hp *= 2; + core.status.hero.atk += 100; + core.status.hero.def += 100; + }}, + + // 依次往下写需要的数值即可 + ] + }, + // 各种数值;一些数值可以在这里设置 + "values" : { + /****** 角色相关 ******/ + "HPMAX": 999999, // HP上限;-1则无上限 + "lavaDamage": 100, // 经过血网受到的伤害 + "poisonDamage": 10, // 中毒后每步受到的伤害 + "weakValue": 20, // 衰弱状态下攻防减少的数值 + /****** 道具相关 ******/ + "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, // 金钱袋加金币的数值 + /****** 怪物相关 ******/ + 'breakArmor': 0.9, // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) + 'counterAttack': 0.1, // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) + 'purify': 3, // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害) + 'hatred': 2, // 仇恨属性中,每杀死一个怪物获得的仇恨值 + /****** 系统相关 ******/ + 'animateSpeed': 500, // 动画时间 + }, + // 系统FLAG,在游戏运行中中请不要修改它。 + "flags" : { + /****** 状态栏相关 ******/ + "enableFloor": true, // 是否在状态栏显示当前楼层 + "enableLv": true, // 是否在状态栏显示当前等级 + "enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾) + "enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币 + "enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验 + "enableLevelUp": true, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false + "enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff + ////// 上述的几个开关将直接影响状态栏的显示效果 ////// + /****** 道具相关 ******/ + "flyNearStair": true, // 是否需要在楼梯边使用传送器 + "pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁 + "bombFourDirections": true, // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价) + "bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙 + /****** 怪物相关 ******/ + "enableNegativeDamage": true, // 是否支持负伤害(回血) + "zoneSquare": false, // 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害 + /****** 系统相关 ******/ + "startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面 + "canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false + "showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项 + "battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关 + "displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关 + "displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关 + "enableGentleClick": true, // 是否允许轻触(获得面前物品) + "portalWithoutTrigger": true, // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件 + "potionWhileRouting": false, // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶 + } +} \ No newline at end of file diff --git a/libs/project/enemys.js b/libs/project/enemys.js new file mode 100644 index 00000000..b947b0e0 --- /dev/null +++ b/libs/project/enemys.js @@ -0,0 +1,63 @@ +enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = //1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:4连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨 +{ + 'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]}, + 'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': [1,9]}, + 'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'special': 1}, + 'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'special': 4}, + 'vampire': {'name': '冥灵魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'skeleton': {'name': '骷髅人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'skeletonSoilder': {'name': '骷髅士兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'skeletonCaptain': {'name': '骷髅队长', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'ghostSkeleton': {'name': '冥队长', 'hp': 100, 'atk': 120, 'def': 0, 'money': 8, 'experience': 0, 'special': 7}, + 'zombie': {'name': '兽人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'zombieKnight': {'name': '兽人武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'rock': {'name': '石头人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 4, 'experience': 0, 'special': 3}, + '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, 'point': 1}, // 'point'可以在打败怪物后进行加点,详见文档说明。 + '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, 'zoneSquare': true}, // 领域怪需要加value表示领域伤害的数值;zoneSquare代表是否九宫格伤害 + 'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'special': 15, 'value': 200, 'range': 2}, // range可选,代表领域伤害的范围;不加默认为1 + '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}, + 'soldier': {'name': '冥战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + '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': 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}, + 'goldSlime': {'name': '黄头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'poisonSkeleton': {'name': '紫骷髅', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'poisonBat': {'name': '紫蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 14, 'experience': 0, 'special': 13}, + 'steelRock': {'name': '铁面人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'skeletonPriest': {'name': '骷髅法师', 'hp': 100, 'atk': 100, 'def': 0, 'money': 0, 'experience': 0, 'special': 18, 'value': 20}, + 'skeletonKing': {'name': '骷髅王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'skeletonWizard': {'name': '骷髅巫师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'redSkeletonCaption': {'name': '骷髅武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'special': 0}, + 'badHero': {'name': '迷失勇者', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'demon': {'name': '魔神武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + '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, 'bomb': false}, // 吸血怪需要在后面添加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}, + 'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6, 'n': 8}, // 多连击需要在后面指定n代表是几连击 + 'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'special': 12}, + 'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'octopus': {'name': '血影', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'darkFairy': {'name': '仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + 'greenKnight': {'name': '强盾骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, +} \ No newline at end of file diff --git a/libs/floors/MT0.js b/libs/project/floors/MT0.js similarity index 100% rename from libs/floors/MT0.js rename to libs/project/floors/MT0.js diff --git a/libs/floors/sample0.js b/libs/project/floors/sample0.js similarity index 99% rename from libs/floors/sample0.js rename to libs/project/floors/sample0.js index bbc54cd8..aee78417 100644 --- a/libs/floors/sample0.js +++ b/libs/project/floors/sample0.js @@ -44,7 +44,7 @@ main.floors.sample0 = { "10,11": [ // 守着门的老人 "\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。", "\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。", - {'type': 'hide', "time": 500} + {"type": "hide", "time": 500} ], "2,10": [ // 守着楼梯、传送门、路障的老人 "\t[老人,womanMagician]这些是路障、楼梯、传送门。", diff --git a/libs/floors/sample1.js b/libs/project/floors/sample1.js similarity index 99% rename from libs/floors/sample1.js rename to libs/project/floors/sample1.js index ee2d9b4e..1be0fcf3 100644 --- a/libs/floors/sample1.js +++ b/libs/project/floors/sample1.js @@ -65,9 +65,9 @@ main.floors.sample1 = { {"type": "hide", "loc": [1,8]}, {"type": "hide", "loc": [1,5], "time": 500}, // 隐藏红衣魔王,动画500ms {"type": "hide"}, // 隐藏本事件 - {"type": "setFg", "color": [0,0,0], 'time': 1250}, // 渐变为白色 + {"type": "setFg", "color": [0,0,0], "time": 1250}, // 渐变为白色 {"type": "sleep", "time": 700}, - {"type": "changeFloor", "floorId": "sample1", "loc": [1,11], 'direction': 'right', 'time': 1000}, // 楼层切换。changeFloor必须指定floorId和loc。 + {"type": "changeFloor", "floorId": "sample1", "loc": [1,11], "direction": "right", "time": 1000}, // 楼层切换。changeFloor必须指定floorId和loc。 // 备注:这里也可以下面的这种写法: // {"type": "changePos", "loc": [1,11]} // 使用这种写法将不会有“楼层切换动画”,而是直接让勇士到达本层的loc位置。 diff --git a/libs/floors/sample2.js b/libs/project/floors/sample2.js similarity index 100% rename from libs/floors/sample2.js rename to libs/project/floors/sample2.js diff --git a/libs/project/floors/test.js b/libs/project/floors/test.js new file mode 100644 index 00000000..c125ab71 --- /dev/null +++ b/libs/project/floors/test.js @@ -0,0 +1,45 @@ +// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致 +// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 +// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 +main.floors.test = { + "floorId": "test", // 楼层唯一标识符,需要和名字完全一致 + "title": "test", // 楼层中文名 + "name": "", // 显示在状态栏中的层数 + "canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) + "canUseQuickShop": true, // 该层是否允许使用快捷商店 + "defaultGround": "ground", // 默认地面的图块ID(terrains中) + "map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成 + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201,201,201,201,201,201,201,201], + [201,201,201,201,201,201, 45,201,201,201,201,201,201], + [201,201,201,201,201,201, 0,201,201,201,201,201,201] + ], + "firstArrive": [ // 第一次到该楼层触发的事件 + + ], + "events": { // 该楼的所有可能事件列表 + + }, + "changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖 + + }, + "afterBattle": { // 战斗后可能触发的事件列表 + + }, + "afterGetItem": { // 获得道具后可能触发的事件列表 + + }, + "afterOpenDoor": { // 开完门后可能触发的事件列表 + + } +} + diff --git a/libs/project/icons.js b/libs/project/icons.js new file mode 100644 index 00000000..f9a0e1b1 --- /dev/null +++ b/libs/project/icons.js @@ -0,0 +1,215 @@ +icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = +{ + "hero": { + "down": {"loc": 0, "stop": 0, "leftFoot": 1, "rightFoot": 3}, + "left": {"loc": 1, "stop": 0, "leftFoot": 1, "rightFoot": 3}, + "right": {"loc": 2, "stop": 0, "leftFoot": 1, "rightFoot": 3}, + "up": {"loc": 3, "stop": 0, "leftFoot": 1, "rightFoot": 3} + }, + "terrains": { + "ground": 0, + "grass": 1, + "grass2": 2, + "snowGround": 3, + "ground2": 4, + "ground3": 5, + "ground4": 6, + "sand": 7, + "ground5": 8, + "yellowWall2": 9, + "whiteWall2": 10, + "blueWall2": 11, + "blockWall": 12, + "grayWall": 13, + "white": 14, + "ground6": 15, + "soil": 16, + "yellowWall": 17, + "whiteWall": 18, + "blueWall": 19, + "star": 20, + "lava": 21, + "ice": 22, + "downFloor": 23, + "upFloor": 24, + "yellowDoor": 25, + "blueDoor": 26, + "redDoor": 27, + "greenDoor": 28, + "specialDoor": 29, + "steelDoor": 30, + "blueShop-left": 31, + "blueShop-right": 32, + "pinkShop-left": 33, + "pinkShop-right": 34, + "arrowUp": 35, + "arrowDown": 36, + "arrowLeft": 37, + "arrowRight": 38, + "light": 39, + "darkLight": 40 + }, + "animates": { + "star": 0, + "lava": 1, + "waterWall": 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, + "water": 31, + }, + "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, + "darkFairy": 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 + }, + "autotile": { // 所有的Autotile列表;后面的index简单取0即可 + "autotile": 0, + "autotile1": 0, + "autotile2": 0, + "autotile3": 0, + } +} \ No newline at end of file diff --git a/libs/project/items.js b/libs/project/items.js new file mode 100644 index 00000000..c42662bd --- /dev/null +++ b/libs/project/items.js @@ -0,0 +1,113 @@ +items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = +{ + +"items" : { + // 钥匙 + 'yellowKey': {'cls': 'keys', 'name': '黄钥匙'}, + 'blueKey': {'cls': 'keys', 'name': '蓝钥匙'}, + 'redKey': {'cls': 'keys', 'name': '红钥匙'}, + + // 宝石、血瓶 + 'redJewel': {'cls': 'items', 'name': '红宝石'}, + 'blueJewel': {'cls': 'items', 'name': '蓝宝石'}, + 'greenJewel': {'cls': 'items', 'name': '绿宝石'}, + 'yellowJewel': {'cls': 'items', 'name': '黄宝石'}, + 'redPotion': {'cls': 'items', 'name': '红血瓶'}, + 'bluePotion': {'cls': 'items', 'name': '蓝血瓶'}, + 'yellowPotion': {'cls': 'items', 'name': '黄血瓶'}, + 'greenPotion': {'cls': 'items', 'name': '绿血瓶'}, + 'sword1': {'cls': 'items', 'name': '铁剑'}, + 'sword2': {'cls': 'items', 'name': '银剑'}, + 'sword3': {'cls': 'items', 'name': '骑士剑'}, + 'sword4': {'cls': 'items', 'name': '圣剑'}, + 'sword5': {'cls': 'items', 'name': '神圣剑'}, + 'shield1': {'cls': 'items', 'name': '铁盾'}, + 'shield2': {'cls': 'items', 'name': '银盾'}, + 'shield3': {'cls': 'items', 'name': '骑士盾'}, + 'shield4': {'cls': 'items', 'name': '圣盾'}, + 'shield5': {'cls': 'items', 'name': '神圣盾'}, + 'superPotion': {'cls': 'items', 'name': '圣水'}, + 'moneyPocket': {'cls': 'items', 'name': '金钱袋'}, + + // 物品 + 'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性'}, + 'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层'}, + 'coin': {'cls': 'constants', 'name': '幸运金币', 'text': '持有时打败怪物可得双倍金币'}, + 'snow': {'cls': 'constants', 'name': '冰冻徽章', 'text': '可以将四周的熔岩变成平地'}, + 'cross': {'cls': 'constants', 'name': '十字架', 'text': '持有后无视怪物的无敌属性'}, + 'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'}, + 'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'}, + + // 道具 + 'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'}, + 'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'}, + 'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'}, + 'pickaxe': {'cls': 'tools', 'name': '破墙镐', 'text': '可以破坏勇士面前的墙'}, + 'icePickaxe': {'cls': 'tools', 'name': '破冰镐', 'text': '可以破坏勇士面前的一堵冰墙'}, + 'bomb': {'cls': 'tools', 'name': '炸弹', 'text': '可以炸掉勇士面前的怪物'}, + 'centerFly': {'cls': 'tools', 'name': '中心对称飞行器', 'text': '可以飞向当前楼层中心对称的位置'}, + 'upFly': {'cls': 'tools', 'name': '上楼器', 'text': '可以飞往楼上的相同位置'}, + 'downFly': {'cls': 'tools', 'name': '下楼器', 'text': '可以飞往楼下的相同位置'}, + 'earthquake': {'cls': 'tools', 'name': '地震卷轴', 'text': '可以破坏当前层的所有墙'}, + 'poisonWine': {'cls': 'tools', 'name': '解毒药水', 'text': '可以解除中毒状态'}, + 'weakWine': {'cls': 'tools', 'name': '解衰药水', 'text': '可以解除衰弱状态'}, + 'curseWine': {'cls': 'tools', 'name': '解咒药水', 'text': '可以解除诅咒状态'}, + 'superWine': {'cls': 'tools', 'name': '万能药水', 'text': '可以解除所有不良状态'}, + 'hammer': {'cls': 'tools', 'name': '圣锤', 'text': '可以炸掉勇士面前的怪物'} +}, + + + + +"itemEffect" : { + "redJewel":"core.status.hero.atk += core.values.redJewel", + "blueJewel":"core.status.hero.def += core.values.blueJewel", + "greenJewel":"core.status.hero.mdef += core.values.greenJewel", + // 黄宝石属性:需自己定义 + "yellowJewel":"core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;", + "redPotion":"core.status.hero.hp += core.values.redPotion", + "bluePotion":"core.status.hero.hp += core.values.bluePotion", + "yellowPotion":"core.status.hero.hp += core.values.yellowPotion", + "greenPotion":"core.status.hero.hp += core.values.greenPotion", + "sword1":"core.status.hero.atk += core.values.sword1", + "sword2":"core.status.hero.atk += core.values.sword2", + "sword3":"core.status.hero.atk += core.values.sword3", + "sword4":"core.status.hero.atk += core.values.sword4", + "sword5":"core.status.hero.atk += core.values.sword5", + "shield1":"core.status.hero.def += core.values.shield1", + "shield2":"core.status.hero.def += core.values.shield2", + "shield3":"core.status.hero.def += core.values.shield3", + "shield4":"core.status.hero.def += core.values.shield4", + "shield5":"core.status.hero.def += core.values.shield5", + // 只有是钥匙盒才会执行这一步 + "bigKey":"core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;", + "superPotion":"core.status.hero.hp *= 2", + "moneyPocket":"core.status.hero.money += core.values.moneyPocket", +}, + + +"itemEffectTip" : { + "redJewel":"',攻击+'+core.values.redJewel", + "blueJewel":"',防御+'+core.values.blueJewel", + "greenJewel":"',魔防+'+core.values.greenJewel", + "yellowJewel":"',全属性提升'", + "redPotion":"',生命+'+core.values.redPotion", + "bluePotion":"',生命+'+core.values.bluePotion", + "yellowPotion":"',生命+'+core.values.yellowPotion", + "greenPotion":"',生命+'+core.values.greenPotion", + "sword1":"',攻击+'+core.values.sword1", + "sword2":"',攻击+'+core.values.sword2", + "sword3":"',攻击+'+core.values.sword3", + "sword4":"',攻击+'+core.values.sword4", + "sword5":"',攻击+'+core.values.sword5", + "shield1":"',防御+'+core.values.shield1", + "shield2":"',防御+'+core.values.shield2", + "shield3":"',防御+'+core.values.shield3", + "shield4":"',防御+'+core.values.shield4", + "shield5":"',防御+'+core.values.shield5", + "bigKey":"',全钥匙+1'", + "superPotion":"',生命值翻倍'", + "moneyPocket":"',金币+'+core.values.moneyPocket", +} + +} \ No newline at end of file diff --git a/libs/project/maps.js b/libs/project/maps.js new file mode 100644 index 00000000..0865925e --- /dev/null +++ b/libs/project/maps.js @@ -0,0 +1,193 @@ +maps_90f36752_8815_4be8_b32b_d7fad1d0542e = +{ + ////////////////////////// 地形部分 ////////////////////////// + + // 0-20 地形 + '1':{'cls': 'terrains', 'id': 'yellowWall'}, // 黄墙 + '2':{'cls': 'terrains', 'id': 'whiteWall'}, // 白墙 + '3':{'cls': 'terrains', 'id': 'blueWall'}, // 白墙 + '4':{'cls': 'animates', 'id': 'star', 'noPass': true}, // 星空 + '5':{'cls': 'animates', 'id': 'lava', 'noPass': true}, // 岩浆 + '6':{'cls': 'terrains', 'id': 'ice'}, // 岩浆 + '7':{'cls': 'terrains', 'id': 'blueShop-left'}, // 蓝色商店左 + '8':{'cls': 'terrains', 'id': 'blueShop-right'}, // 蓝色商店右 + '9':{'cls': 'terrains', 'id': 'pinkShop-left'}, // 粉色商店左 + '10':{'cls': 'terrains', 'id': 'pinkShop-right'}, // 粉色商店左 + '11':{'cls': 'animates', 'id': 'lavaNet', 'noPass': false, 'trigger': 'passNet'}, // 血网 + '12':{'cls': 'animates', 'id': 'poisonNet', 'noPass': false, 'trigger': 'passNet'}, // 毒网 + '13':{'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}, // 衰网 + '14':{'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}, // 咒网 + '15':{'cls': 'animates', 'id': 'water', 'noPass': true}, // 水 + // 在这里添加更多地形 + // 如果空位不足,可以从180以后开始继续放,只要不和现有的数字冲突即可 + + // Autotile + '20':{'cls': 'autotile', 'id': 'autotile', 'noPass': true}, // autotile + // 更多的autotile从151到160等,只要不和现有的数字冲突即可 + '151':{'cls': 'autotile', 'id': 'autotile1', 'noPass': true}, + '152':{'cls': 'autotile', 'id': 'autotile2', 'noPass': true}, + '153':{'cls': 'autotile', 'id': 'autotile3', 'noPass': true}, + + ////////////////////////// 物品部分 ////////////////////////// + + // 21-80 物品 + '21':{'cls': 'items', 'id': 'yellowKey'}, // 黄钥匙 + '22':{'cls': 'items', 'id': 'blueKey'}, // 蓝钥匙 + '23':{'cls': 'items', 'id': 'redKey'}, // 红钥匙 + '24':{'cls': 'items', 'id': 'greenKey'}, // 绿钥匙 + '25':{'cls': 'items', 'id': 'steelKey'}, // 铁门钥匙 + '26':{'cls': 'items', 'id': 'bigKey'}, // 大黄门钥匙(钥匙盒) + '27':{'cls': 'items', 'id': 'redJewel'}, // 红宝石 + '28':{'cls': 'items', 'id': 'blueJewel'}, // 蓝宝石 + '29':{'cls': 'items', 'id': 'greenJewel'}, // 绿宝石 + '30':{'cls': 'items', 'id': 'yellowJewel'}, // 黄宝石 + '31':{'cls': 'items', 'id': 'redPotion'}, // 红血瓶 + '32':{'cls': 'items', 'id': 'bluePotion'}, // 蓝血瓶 + '33':{'cls': 'items', 'id': 'greenPotion'}, // 绿血瓶 + '34':{'cls': 'items', 'id': 'yellowPotion'}, // 黄血瓶 + '35':{'cls': 'items', 'id': 'sword1'}, // 铁剑 + '36':{'cls': 'items', 'id': 'shield1'}, // 铁盾 + '37':{'cls': 'items', 'id': 'sword2'}, // 银剑 + '38':{'cls': 'items', 'id': 'shield2'}, // 银盾 + '39':{'cls': 'items', 'id': 'sword3'}, // 骑士剑 + '40':{'cls': 'items', 'id': 'shield3'}, // 骑士盾 + '41':{'cls': 'items', 'id': 'sword4'}, // 圣剑 + '42':{'cls': 'items', 'id': 'shield4'}, // 圣盾 + '43':{'cls': 'items', 'id': 'sword5'}, // 神圣剑 + '44':{'cls': 'items', 'id': 'shield5'}, // 神圣盾 + '45':{'cls': 'items', 'id': 'book'}, // 怪物手册 + '46':{'cls': 'items', 'id': 'fly'}, // 楼层传送器 + '47':{'cls': 'items', 'id': 'pickaxe'}, // 破墙镐 + '48':{'cls': 'items', 'id': 'icePickaxe'}, // 破冰镐 + '49':{'cls': 'items', 'id': 'bomb'}, // 炸弹 + '50':{'cls': 'items', 'id': 'centerFly'}, // 中心对称 + '51':{'cls': 'items', 'id': 'upFly'}, // 上楼器 + '52':{'cls': 'items', 'id': 'downFly'}, // 下楼器 + '53':{'cls': 'items', 'id': 'coin'}, // 幸运金币 + '54':{'cls': 'items', 'id': 'snow'}, // 冰冻徽章 + '55':{'cls': 'items', 'id': 'cross'}, // 十字架 + '56':{'cls': 'items', 'id': 'superPotion'}, // 圣水 + '57':{'cls': 'items', 'id': 'earthquake'}, // 地震卷轴 + '58':{'cls': 'items', 'id': 'poisonWine'}, // 解毒药水 + '59':{'cls': 'items', 'id': 'weakWine'}, // 解衰药水 + '60':{'cls': 'items', 'id': 'curseWine'}, // 解咒药水 + '61':{'cls': 'items', 'id': 'superWine'}, // 万能药水 + '62':{'cls': 'items', 'id': 'knife'}, // 屠龙匕首 + '63':{'cls': 'items', 'id': 'moneyPocket'}, // 金钱袋 + '64':{'cls': 'items', 'id': 'shoes'}, // 绿鞋 + '65':{'cls': 'items', 'id': 'hammer'}, // 圣锤 + + + ////////////////////////// 门、楼梯、传送点部分 ////////////////////////// + + // 81-100 门 + '81':{'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'}, // 黄门 + '82':{'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'}, // 蓝门 + '83':{'cls': 'terrains', 'id': 'redDoor', 'trigger': 'openDoor'}, // 红门 + '84':{'cls': 'terrains', 'id': 'greenDoor', 'trigger': 'openDoor'}, // 绿门 + '85':{'cls': 'terrains', 'id': 'specialDoor', 'trigger': 'openDoor'}, // 机关门左 + '86':{'cls': 'terrains', 'id': 'steelDoor', 'trigger': 'openDoor'}, // 铁门 + '87':{'cls': 'terrains', 'id': 'upFloor', 'noPass': false}, // 上楼梯 + '88':{'cls': 'terrains', 'id': 'downFloor', 'noPass': false}, // 下楼梯 + '89':{'cls': 'animates', 'id': 'portal', 'noPass': false}, // 传送门 + '90':{'cls': 'animates', 'id': 'starPortal', 'noPass': false}, // 星空传送门 + '91':{'cls': 'animates', 'id': 'upPortal', 'noPass': false}, // 上箭头 + '92':{'cls': 'animates', 'id': 'leftPortal', 'noPass': false}, // 左箭头 + '93':{'cls': 'animates', 'id': 'downPortal', 'noPass': false}, // 下箭头 + '94':{'cls': 'animates', 'id': 'rightPortal', 'noPass': false}, // 右箭头 + + + ////////////////////////// NPC部分 ////////////////////////// + + // 121-150 NPC + '121':{'cls': 'npcs', 'id': 'man'}, + '122':{'cls': 'npcs', 'id': 'woman'}, + '123':{'cls': 'npcs', 'id': 'thief'}, + '124':{'cls': 'npcs', 'id': 'fairy'}, + '125':{'cls': 'npcs', 'id': 'magician'}, + '126':{'cls': 'npcs', 'id': 'womanMagician'}, + '127':{'cls': 'npcs', 'id': 'oldMan'}, + '128':{'cls': 'npcs', 'id': 'child'}, + '129':{'cls': 'npcs', 'id': 'wood'}, + '130':{'cls': 'npcs', 'id': 'pinkShop'}, + '131':{'cls': 'npcs', 'id': 'blueShop'}, + '132':{'cls': 'npcs', 'id': 'princess'}, + + ////////////////////////// 其他部分 ////////////////////////// + + // 161-200 其他(单向箭头、灯、箱子等等) + '161':{'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}, // 单向上箭头 + '162':{'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}, // 单向下箭头 + '163':{'cls': 'terrains', 'id': 'arrowLeft', 'noPass': false}, // 单向左箭头 + '164':{'cls': 'terrains', 'id': 'arrowRight', 'noPass': false}, // 单向右箭头 + '165':{'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}, // 灯 + '166':{'cls': 'terrains', 'id': 'darkLight', 'noPass': true}, // 暗灯 + + + ////////////////////////// 怪物部分 ////////////////////////// + + // 201-300 怪物 + '201':{'cls': 'enemys', 'id': 'greenSlime'}, + '202':{'cls': 'enemys', 'id': 'redSlime'}, + '203':{'cls': 'enemys', 'id': 'blackSlime'}, + '204':{'cls': 'enemys', 'id': 'slimelord'}, + '205':{'cls': 'enemys', 'id': 'bat'}, + '206':{'cls': 'enemys', 'id': 'bigBat'}, + '207':{'cls': 'enemys', 'id': 'redBat'}, + '208':{'cls': 'enemys', 'id': 'vampire'}, + '209':{'cls': 'enemys', 'id': 'skeleton'}, + '210':{'cls': 'enemys', 'id': 'skeletonSoilder'}, + '211':{'cls': 'enemys', 'id': 'skeletonCaptain'}, + '212':{'cls': 'enemys', 'id': 'ghostSkeleton'}, + '213':{'cls': 'enemys', 'id': 'zombie'}, + '214':{'cls': 'enemys', 'id': 'zombieKnight'}, + '215':{'cls': 'enemys', 'id': 'rock'}, + '216':{'cls': 'enemys', 'id': 'slimeMan'}, + '217':{'cls': 'enemys', 'id': 'bluePriest'}, + '218':{'cls': 'enemys', 'id': 'redPriest'}, + '219':{'cls': 'enemys', 'id': 'brownWizard'}, + '220':{'cls': 'enemys', 'id': 'redWizard'}, + '221':{'cls': 'enemys', 'id': 'yellowGuard'}, + '222':{'cls': 'enemys', 'id': 'blueGuard'}, + '223':{'cls': 'enemys', 'id': 'redGuard'}, + '224':{'cls': 'enemys', 'id': 'swordsman'}, + '225':{'cls': 'enemys', 'id': 'soldier'}, + '226':{'cls': 'enemys', 'id': 'yellowKnight'}, + '227':{'cls': 'enemys', 'id': 'redKnight'}, + '228':{'cls': 'enemys', 'id': 'darkKnight'}, + '229':{'cls': 'enemys', 'id': 'blackKing'}, + '230':{'cls': 'enemys', 'id': 'yellowKing'}, + '231':{'cls': 'enemys', 'id': 'greenKing'}, + '232':{'cls': 'enemys', 'id': 'blueKnight'}, + '233':{'cls': 'enemys', 'id': 'goldSlime'}, + '234':{'cls': 'enemys', 'id': 'poisonSkeleton'}, + '235':{'cls': 'enemys', 'id': 'poisonBat'}, + '236':{'cls': 'enemys', 'id': 'steelRock'}, + '237':{'cls': 'enemys', 'id': 'skeletonPriest'}, + '238':{'cls': 'enemys', 'id': 'skeletonKing'}, + '239':{'cls': 'enemys', 'id': 'skeletonWizard'}, + '240':{'cls': 'enemys', 'id': 'redSkeletonCaption'}, + '241':{'cls': 'enemys', 'id': 'badHero'}, + '242':{'cls': 'enemys', 'id': 'demon'}, + '243':{'cls': 'enemys', 'id': 'demonPriest'}, + '244':{'cls': 'enemys', 'id': 'goldHornSlime'}, + '245':{'cls': 'enemys', 'id': 'redKing'}, + '246':{'cls': 'enemys', 'id': 'whiteKing'}, + '247':{'cls': 'enemys', 'id': 'blackMagician'}, + '248':{'cls': 'enemys', 'id': 'silverSlime'}, + '249':{'cls': 'enemys', 'id': 'swordEmperor'}, + '250':{'cls': 'enemys', 'id': 'whiteHornSlime'}, + '251':{'cls': 'enemys', 'id': 'badPrincess'}, + '252':{'cls': 'enemys', 'id': 'badFairy'}, + '253':{'cls': 'enemys', 'id': 'grayPriest'}, + '254':{'cls': 'enemys', 'id': 'redSwordsman'}, + '255':{'cls': 'enemys', 'id': 'whiteGhost'}, + '256':{'cls': 'enemys', 'id': 'poisonZombie'}, + '257':{'cls': 'enemys', 'id': 'magicDragon'}, + '258':{'cls': 'enemys', 'id': 'octopus'}, + '259':{'cls': 'enemys', 'id': 'darkFairy'}, + '260':{'cls': 'enemys', 'id': 'greenKnight'}, + + ////////////////////////// 待定... ////////////////////////// + // 目前ID暂时不要超过400 +} \ No newline at end of file diff --git a/main.js b/main.js index fd19a8a0..8efdf81d 100644 --- a/main.js +++ b/main.js @@ -4,28 +4,6 @@ function main() { this.version = "0.1"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。 - this.useCompress = false; // 是否使用压缩文件 - // 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 - // 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 - // 如果要进行剧本的修改请务必将其改成false。 - - this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序 - "sample0", "sample1", "sample2" - ]; - this.pngs = [ // 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416 - // 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量 - // 有关使用自定义背景图,请参见文档的“自定义素材”说明 - "bg.png", "yewai.png", // 依次向后添加 - ]; - this.bgms = [ // 在此存放所有的bgm,和文件名一致。第一项为默认播放项 - // 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 - '058-Slow01.mid', 'bgm.mp3', 'qianjin.mid', 'star.mid', - ]; - this.sounds = [ // 在此存放所有的SE,和文件名一致 - // 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 - 'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg', - ]; - //------------------------ 用户修改内容 END ------------------------// this.dom = { @@ -69,9 +47,13 @@ function main() { 'debuffCol': document.getElementById('debuffCol'), 'hard': document.getElementById('hard'), }; + this.mode = 'play'; this.loadList = [ 'items', 'icons', 'maps', 'enemys', 'events', 'data', 'ui', 'core' ]; + this.pureData = [ + "data","enemys","icons","maps","items" + ]; this.images = [ 'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains' ]; @@ -117,23 +99,30 @@ function main() { this.canvas = {}; } -////// 初始化 ////// -main.prototype.init = function () { +main.prototype.init = function (mode) { for (var i = 0; i < main.dom.gameCanvas.length; i++) { main.canvas[main.dom.gameCanvas[i].id] = main.dom.gameCanvas[i].getContext('2d'); } - main.loaderJs(function () { - var coreData = {}; - for (i = 0; i < main.loadList.length; i++) { - var name = main.loadList[i]; - if (name === 'core') continue; - main[name].init(main.dom); - coreData[name] = main[name]; - } - main.loaderFloors(function() { - main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.pngs, main.bgms, main.sounds, main.floorIds, main.floors, coreData); - main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight); - }) + if (({"editor":0,"replay":0}).hasOwnProperty(mode)) { + main.mode = mode; + if (mode === 'editor')main.editor = {'disableGlobalAnimate':true}; + } + main.loadPureData(function(){ + var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main; + for(var ii in mainData)main[ii]=mainData[ii]; + main.loaderJs(function () { + var coreData = {}; + for (i = 0; i < main.loadList.length; i++) { + var name = main.loadList[i]; + if (name === 'core') continue; + main[name].init(main.dom); + coreData[name] = main[name]; + } + main.loaderFloors(function() { + main.core.init(main.dom, main.statusBar, main.canvas, main.images, main.pngs, main.bgms, main.sounds, main.floorIds, main.floors, coreData); + main.core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight); + }); + }); }); } @@ -165,7 +154,7 @@ main.prototype.loaderFloors = function (callback) { main.setMainTipsText('正在加载楼层文件...') if (this.useCompress) { // 读取压缩文件 var script = document.createElement('script'); - script.src = 'libs/floors.min.js?v=' + this.version; + script.src = 'libs/project/floors.min.js?v=' + this.version; main.dom.body.appendChild(script); script.onload = function () { main.dom.mainTips.style.display = 'none'; @@ -200,20 +189,35 @@ main.prototype.loadMod = function (modName, callback) { ////// 加载某一个楼层 ////// main.prototype.loadFloor = function(floorId, callback) { var script = document.createElement('script'); - script.src = 'libs/floors/' + floorId +'.js?v=' + this.version; + script.src = 'libs/project/floors/' + floorId +'.js?v=' + this.version; main.dom.body.appendChild(script); script.onload = function () { callback(floorId); } } +main.prototype.loadPureData = function(callback) { + var loadedNum = 0; + main.pureData.forEach(function(name){ + var script = document.createElement('script'); + script.src = 'libs/project/' + name +'.js?v=' + this.version; + main.dom.body.appendChild(script); + script.onload = function () { + loadedNum++; + if (loadedNum == main.pureData.length)callback(); + } + }); + +} + ////// 加载过程提示 ////// main.prototype.setMainTipsText = function (text) { main.dom.mainTips.innerHTML = text; } -var main = new main(); -main.init(); + + +main.prototype.listen = function () { ////// 窗口大小变化时 ////// window.onresize = function () { @@ -395,3 +399,7 @@ main.dom.normalLevel.onclick = function () { main.dom.hardLevel.onclick = function () { core.events.startGame('Hard'); } + +}//listen end + +var main = new main(); \ No newline at end of file diff --git a/test_main_init_mode.html b/test_main_init_mode.html new file mode 100644 index 00000000..61a2b11a --- /dev/null +++ b/test_main_init_mode.html @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + +
+

请稍后...

+
+
+
+
+
+

资源即将开始加载

+
+ + + +
+
+ 开始游戏 + 载入游戏 + 关于本塔 +
+
+ 简单 + 普通 + 困难 +
+
+
+
+

+

+

+
+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ + + +
+
+ + + +
+
+
+ + + + + + + +

+
+
+ + + + + + 此浏览器不支持HTML5 +
+ + + + \ No newline at end of file