Jump shoes

This commit is contained in:
oc 2018-06-25 01:33:50 +08:00
parent e318c26e65
commit db364b26d1
9 changed files with 26 additions and 16 deletions

View File

@ -138,12 +138,12 @@ localStorage
core.js实际上是所有API的入口路由核心API的实现在其他几个文件中core.js主要进行转发操作。 core.js实际上是所有API的入口路由核心API的实现在其他几个文件中core.js主要进行转发操作。
core.nextX() core.nextX(n)
获得勇士面向的下一个位置的x坐标 获得勇士面向的第n个位置的x坐标n可以省略默认为1即正前方
core.nextY() core.nextY(n)
获得勇士面向的下一个位置的y坐标 获得勇士面向的第n个位置的y坐标n可以省略默认为1即正前方
core.openDoor(id, x, y, needKey, callback) [异步] core.openDoor(id, x, y, needKey, callback) [异步]

View File

@ -990,25 +990,25 @@ control.prototype.getHeroLoc = function (itemName) {
} }
////// 获得勇士面对位置的x坐标 ////// ////// 获得勇士面对位置的x坐标 //////
control.prototype.nextX = function() { control.prototype.nextX = function(n) {
var scan = { var scan = {
'up': {'x': 0, 'y': -1}, 'up': {'x': 0, 'y': -1},
'left': {'x': -1, 'y': 0}, 'left': {'x': -1, 'y': 0},
'down': {'x': 0, 'y': 1}, 'down': {'x': 0, 'y': 1},
'right': {'x': 1, 'y': 0} 'right': {'x': 1, 'y': 0}
}; };
return core.getHeroLoc('x')+scan[core.getHeroLoc('direction')].x; return core.getHeroLoc('x')+scan[core.getHeroLoc('direction')].x*(n||1);
} }
////// 获得勇士面对位置的y坐标 ////// ////// 获得勇士面对位置的y坐标 //////
control.prototype.nextY = function () { control.prototype.nextY = function (n) {
var scan = { var scan = {
'up': {'x': 0, 'y': -1}, 'up': {'x': 0, 'y': -1},
'left': {'x': -1, 'y': 0}, 'left': {'x': -1, 'y': 0},
'down': {'x': 0, 'y': 1}, 'down': {'x': 0, 'y': 1},
'right': {'x': 1, 'y': 0} 'right': {'x': 1, 'y': 0}
}; };
return core.getHeroLoc('y')+scan[core.getHeroLoc('direction')].y; return core.getHeroLoc('y')+scan[core.getHeroLoc('direction')].y*(n||1);
} }
////// 更新领域、夹击、阻击的伤害地图 ////// ////// 更新领域、夹击、阻击的伤害地图 //////

View File

@ -499,13 +499,13 @@ core.prototype.getHeroLoc = function (itemName) {
} }
////// 获得勇士面对位置的x坐标 ////// ////// 获得勇士面对位置的x坐标 //////
core.prototype.nextX = function() { core.prototype.nextX = function(n) {
return core.control.nextX(); return core.control.nextX(n);
} }
////// 获得勇士面对位置的y坐标 ////// ////// 获得勇士面对位置的y坐标 //////
core.prototype.nextY = function () { core.prototype.nextY = function (n) {
return core.control.nextY(); return core.control.nextY(n);
} }
/////////// 自动行走 & 行走控制 END /////////// /////////// 自动行走 & 行走控制 END ///////////

View File

@ -850,7 +850,7 @@ events.prototype.getNextItem = function() {
////// 获得某个物品 ////// ////// 获得某个物品 //////
events.prototype.getItem = function (itemId, itemNum, itemX, itemY, callback) { events.prototype.getItem = function (itemId, itemNum, itemX, itemY, callback) {
// core.getItemAnimate(itemId, itemNum, itemX, itemY); itemNum=itemNum||1;
core.playSound('item.mp3'); core.playSound('item.mp3');
var itemCls = core.material.items[itemId].cls; var itemCls = core.material.items[itemId].cls;
core.items.getItemEffect(itemId, itemNum); core.items.getItemEffect(itemId, itemNum);

View File

@ -123,6 +123,7 @@ items.prototype.removeItem = function (itemId) {
////// 增加某个物品的个数 ////// ////// 增加某个物品的个数 //////
items.prototype.addItem = function (itemId, itemNum) { items.prototype.addItem = function (itemId, itemNum) {
itemNum=itemNum||1;
var itemData = core.material.items[itemId]; var itemData = core.material.items[itemId];
var itemCls = itemData.cls; var itemCls = itemData.cls;
if (itemCls == 'items') return; if (itemCls == 'items') return;

View File

@ -235,7 +235,8 @@ icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
'knife': 42, 'knife': 42,
'moneyPocket': 46, 'moneyPocket': 46,
'shoes': 47, 'shoes': 47,
'hammer': 48 'hammer': 48,
'jumpShoes': 49
}, },
'autotile': { // 所有的Autotile列表后面的index简单取0即可 'autotile': { // 所有的Autotile列表后面的index简单取0即可
'autotile': 0, 'autotile': 0,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -227,6 +227,11 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"cls": "tools", "cls": "tools",
"name": "生命魔杖", "name": "生命魔杖",
"text": "可以恢复100点生命值" "text": "可以恢复100点生命值"
},
"jumpShoes": {
"cls": "tools",
"name": "跳跃靴",
"text": "能跳跃到前方两格处"
} }
}, },
"itemEffect": { "itemEffect": {
@ -304,7 +309,8 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield3": "core.plugin.useEquipment(itemId)", "shield3": "core.plugin.useEquipment(itemId)",
"shield4": "core.plugin.useEquipment(itemId)", "shield4": "core.plugin.useEquipment(itemId)",
"shield5": "core.plugin.useEquipment(itemId)", "shield5": "core.plugin.useEquipment(itemId)",
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.setItem('lifeWand', core.itemCount('lifeWand')+1);" "lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.setItem('lifeWand', core.itemCount('lifeWand')+1);",
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});"
}, },
"canUseItemEffect": { "canUseItemEffect": {
"book": "true", "book": "true",
@ -336,6 +342,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield4": "true", "shield4": "true",
"shiled5": "true", "shiled5": "true",
"shield5": "true", "shield5": "true",
"lifeWand": "true" "lifeWand": "true",
"jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx<=12&&ny>=0&&ny<=12&&core.getBlock(core.nextX(2), core.nextY(2))==null"
} }
} }

View File

@ -80,6 +80,7 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
'66':{'cls': 'items', 'id': 'sword0'}, // 空剑 '66':{'cls': 'items', 'id': 'sword0'}, // 空剑
'67':{'cls': 'items', 'id': 'shield0'}, // 空盾 '67':{'cls': 'items', 'id': 'shield0'}, // 空盾
'68':{'cls': 'items', 'id': 'lifeWand'}, // 生命魔杖 '68':{'cls': 'items', 'id': 'lifeWand'}, // 生命魔杖
'69':{'cls': 'items', 'id': 'jumpShoes'}, // 生命魔杖
////////////////////////// 门、楼梯、传送点部分 ////////////////////////// ////////////////////////// 门、楼梯、传送点部分 //////////////////////////