Merge pull request #137 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-06-03 10:23:12 +08:00 committed by GitHub
commit 2bbc898dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 56 additions and 315 deletions

View File

@ -67,6 +67,7 @@ HTML5 canvas制作的魔塔样板支持全平台游戏
* [x] 地图数据统计
* [x] 衰弱可以减少攻防的比例
* [x] 便捷PS工具可以批量导入素材
* [x] 楼层转换可以直接指定“上一楼”和“下一楼”
* [x] 除Autotile外均可自动注册
* [x] 支持status:x获得当前坐标
* [x] core.debug()改成调试模式可以Ctrl穿墙

View File

@ -158,19 +158,21 @@ return code;
//changeFloor 事件编辑器入口之一
changeFloor_m
: '楼梯, 传送门' BGNL? Newline '目标楼层' IdString Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? '允许穿透' Bool BEND
: '楼梯, 传送门' BGNL? Newline Floor_List IdString? Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? '允许穿透' Bool BEND
/* changeFloor_m
tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置
helpUrl : https://ckcz123.github.io/mota-js/#/element?id=%e8%b7%af%e9%9a%9c%ef%bc%8c%e6%a5%bc%e6%a2%af%ef%bc%8c%e4%bc%a0%e9%80%81%e9%97%a8
default : ["MT1",null,0,0,null,500,null]
default : [null,"MT1",null,0,0,null,500,null]
var toFloorId = IdString_0;
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
Int_0 = Int_0 ?(', "time": '+Int_0):'';
Bool_0 = Bool_0 ?'':(', "portalWithoutTrigger": false');
var code = '{"floorId": "'+IdString_0+'"'+loc+DirectionEx_List_0+Int_0+Bool_0+' }\n';
var code = '{"floorId": "'+toFloorId+'"'+loc+DirectionEx_List_0+Int_0+Bool_0+' }\n';
return code;
*/;
@ -531,7 +533,7 @@ return code;
*/;
changeFloor_s
: '楼层切换' IdString 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List '动画时间' Int? Newline
: '楼层切换' IdString? 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List '动画时间' Int? Newline
/* changeFloor_s
@ -1135,6 +1137,10 @@ PosString
: 'sdeirughvuiyasbde'+ //为了被识别为复杂词法规则
;
Floor_List
: '楼层ID'|'前一楼'|'后一楼'
/*Floor_List ['floorId',':before',':next']*/;
Stair_List
: '坐标'|'上楼'|'下楼'
/*Stair_List ['loc','upFloor','downFloor']*/;
@ -1278,8 +1284,12 @@ ActionParser.prototype.parse = function (obj,type) {
case 'changeFloor':
if(!obj)obj={};
if(!this.isset(obj.loc))obj.loc=[0,0];
if (obj.floorId==':before'||obj.floorId==':next') {
obj.floorType=obj.floorId;
delete obj.floorId;
}
return MotaActionBlocks['changeFloor_m'].xmlText([
obj.floorId,obj.stair||'loc',obj.loc[0],obj.loc[1],obj.direction,obj.time||0,!this.isset(obj.portalWithoutTrigger)
obj.floorType||'floorId',obj.floorId,obj.stair||'loc',obj.loc[0],obj.loc[1],obj.direction,obj.time||0,!this.isset(obj.portalWithoutTrigger)
]);
case 'point':

View File

@ -445,6 +445,12 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_bool": "bool",
"_data": "使用炸弹是否四个方向都会炸如果false则只炸面前的怪物即和圣锤等价"
},
"snowFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用冰冻徽章是否四个方向都会消除熔岩如果false则只消除面前的熔岩"
},
"bigKeyIsBox": {
"_leaf": true,
"_type": "checkbox",

View File

@ -164,6 +164,8 @@ N连击怪物的special是6且我们可以为它定义n代表实际连击数
floorId指定的是目标楼层的唯一标识符ID
也可以写`"floorId": ":before"`和`"floorId": ":next"`表示上一楼和下一楼。
后面可以写stair到upFloor或downFloor表示将前往目标楼层的上楼梯/下楼梯位置。你也可以写loc然后指定目标点的坐标。
请注意的是如果目标楼层有多个楼梯写stair可能会导致到达的楼梯不确定这时候请使用loc方式来指定具体的点位置。

View File

@ -20,6 +20,8 @@ enemys.prototype.getEnemys = function (enemyId) {
////// 判断是否含有某特殊属性 //////
enemys.prototype.hasSpecial = function (special, test) {
if (!core.isset(special)) return false;
if (special instanceof Array) {
return special.indexOf(test)>=0;
}
@ -28,6 +30,14 @@ enemys.prototype.hasSpecial = function (special, test) {
return special!=0 && (special%100==test||this.hasSpecial(parseInt(special/100), test));
}
if (typeof special == 'string') {
return this.hasSpecial(core.material.enemys[special], test);
}
if (core.isset(special.special)) {
return this.hasSpecial(special.special, test);
}
return false;
}
@ -300,7 +310,7 @@ enemys.prototype.getDamageInfo = function(monster, hero_hp, hero_atk, hero_def,
enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, hero_mdef) {
if (typeof monster == 'string') {
monster = core.material.enemys[monsterId];
monster = core.material.enemys[monster];
}
var info = this.getDamageInfo(monster, hero_hp, hero_atk, hero_def, hero_mdef);

View File

@ -986,6 +986,19 @@ events.prototype.trigger = function (x, y) {
////// 楼层切换 //////
events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback, fromLoad) {
if (!core.isset(floorId)) floorId = core.status.floorId;
if (floorId == ':before') {
var index=core.floorIds.indexOf(core.status.floorId);
if (index>0) floorId = core.floorIds[index-1];
else floorId=core.status.floorId;
}
else if (floorId == ':next') {
var index=core.floorIds.indexOf(core.status.floorId);
if (index<core.floorIds.length-1) floorId = core.floorIds[index+1];
else floorId=core.status.floorId;
}
var displayAnimate=!(time==0) && !core.status.replay.replaying;
time = time || 800;

View File

@ -145,6 +145,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"flyNearStair": true,
"pickaxeFourDirections": false,
"bombFourDirections": false,
"snowFourDirections": false,
"bigKeyIsBox": false,
"equipment": false,
"enableDeleteItem": true,

View File

@ -223,11 +223,11 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"name": "圣锤",
"text": "可以炸掉勇士面前的怪物"
},
"lifeWand": {
"cls": "tools",
"name": "生命魔杖",
"text": "可以恢复100点生命值"
}
"lifeWand": {
"cls": "tools",
"name": "生命魔杖",
"text": "可以恢复100点生命值"
}
},
"itemEffect": {
"redJewel": "core.status.hero.atk += core.values.redJewel * ratio",
@ -317,7 +317,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"centerFly": "var able=false;\nvar toX = 12 - core.getHeroLoc('x'), toY = 12-core.getHeroLoc('y');\nvar block = core.getBlock(toX, toY);\nif (block==null) {\n core.status.event.data = {'x': toX, 'y': toY};\n able = true;\n}\nable",
"upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index<core.floorIds.length-1) {\n\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
"downFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index>0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
"snow": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
"snow": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'lava') {\n\t\tif (core.flags.snowFourDirections) {\n if (Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n ids.push(i);\n }\n }\n else {\n if (block.x == core.nextX() && block.y == core.nextY()) {\n ids.push(i);\n }\n }\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
"bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
"poisonWine": "core.hasFlag('poison')",
"weakWine": "core.hasFlag('weak')",

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>17E202</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>MTBuilder</string>
<key>CFBundleIdentifier</key>
<string>com.xiongdianpku.MTBuilder</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MTBuilder</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>9E501</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>17E189</string>
<key>DTSDKName</key>
<string>macosx10.13</string>
<key>DTXcode</key>
<string>0931</string>
<key>DTXcodeBuild</key>
<string>9E501</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018年 熊典. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -1 +0,0 @@
APPL????

View File

@ -1,252 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Assets.car</key>
<data>
Y8vFWeV9aMFK2k/Fmvn1VKDb4G4=
</data>
<key>Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib</key>
<data>
EN/jmkBY5XqitaaV2kWybEgMtTE=
</data>
<key>Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib</key>
<data>
vZO5vWZuRi0vaSFqKPCW1qksfDE=
</data>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<data>
71E/nyD1JC6i4rw6+kjjVgE/fZA=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<data>
lC9mNWqzXYAYynusmnCrDuM3hvI=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib</key>
<data>
jBRfznhMbiKUnUxlCD1QLUegGsc=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<data>
S9xl+rRRrH6aWKPTrX11XmKhYtA=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib</key>
<data>
a5hup3BYBUycbe+iJd/nx+VQ/rA=
</data>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<data>
7osH7f7CY2aFRWbCLAy1odTex/M=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Assets.car</key>
<dict>
<key>hash</key>
<data>
Y8vFWeV9aMFK2k/Fmvn1VKDb4G4=
</data>
<key>hash2</key>
<data>
R6hkb6fWvTpPEJXUWnyv4rhwHuVVIqsihlgRCdNNoz4=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib</key>
<dict>
<key>hash</key>
<data>
EN/jmkBY5XqitaaV2kWybEgMtTE=
</data>
<key>hash2</key>
<data>
8KgZX7l1DB4wlq8OlL6h9gk2PUditNbKqqR7qnoHCoc=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib</key>
<dict>
<key>hash</key>
<data>
vZO5vWZuRi0vaSFqKPCW1qksfDE=
</data>
<key>hash2</key>
<data>
aK2kvZcgmqywotLHVkXGbEh1LkOnXWQEX6RKwgp3f7s=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<dict>
<key>hash</key>
<data>
71E/nyD1JC6i4rw6+kjjVgE/fZA=
</data>
<key>hash2</key>
<data>
d1R62G7VThDKTjMMGGoUR6TC9bR0hjwLNqAggKJwsS0=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<dict>
<key>hash</key>
<data>
lC9mNWqzXYAYynusmnCrDuM3hvI=
</data>
<key>hash2</key>
<data>
ZBTMovff3XB5dFKWqxpFhQsHN7/F4Zfp45tuh4OSDB0=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib</key>
<dict>
<key>hash</key>
<data>
jBRfznhMbiKUnUxlCD1QLUegGsc=
</data>
<key>hash2</key>
<data>
niqIc11tpbnFJIeMHBNiCcjwUkpkJvJJoAKTguRNp/s=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<dict>
<key>hash</key>
<data>
S9xl+rRRrH6aWKPTrX11XmKhYtA=
</data>
<key>hash2</key>
<data>
unrn3sgw+6nM2WDwyTjK8g/wIOAogLhFXRotyPK6xIw=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib</key>
<dict>
<key>hash</key>
<data>
a5hup3BYBUycbe+iJd/nx+VQ/rA=
</data>
<key>hash2</key>
<data>
P/jSqX6j8bzFQoaQzsZl49a9zRuMnaO4/Gq+iECoDu4=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<dict>
<key>hash</key>
<data>
7osH7f7CY2aFRWbCLAy1odTex/M=
</data>
<key>hash2</key>
<data>
aNkXpHLXtb/zTBJ/LsXFPlcRqVfZh4L5qRk4kUZx2NE=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@ -7,6 +7,7 @@
地图数据统计
衰弱可以减少攻防的比例
便捷PS工具可以批量导入素材
楼层转换可以直接指定“上一楼”和“下一楼”
除Autotile外均可自动注册
支持status:x获得当前坐标
core.debug()改成调试模式可以Ctrl穿墙