Merge remote-tracking branch 'refs/remotes/ckcz123/master'

This commit is contained in:
YouWei Zhao 2018-01-08 16:19:29 +08:00
commit cc6acf0515
4 changed files with 37 additions and 21 deletions

View File

@ -1,6 +1,6 @@
# 附录:API列表
?> 上次更新时间:* {docsify-updated} * 如不是最新版请Ctrl+F5强制刷新缓存。
?> 上次更新时间:* {docsify-updated} *
所有系统支持的API都列在了这里。所有可能被用到的API都在前面用\*标记。

View File

@ -264,24 +264,15 @@ core.prototype.loader = function (callback) {
// 加载pngs
core.material.images.pngs = {};
if (core.pngs.length==0) {
core.loadAutotile(callback);
return;
}
for (var x=0;x<core.pngs.length;x++) {
core.loadImage(core.pngs[x], function (pngId, image) {
core.material.images.pngs[pngId] = image;
if (Object.keys(core.material.images.pngs).length==core.pngs.length) {
// 加载Autotile
core.material.images.autotile={};
var autotileIds = Object.keys(core.material.icons.autotile);
for (var x=0;x<autotileIds.length;x++) {
core.loadImage(autotileIds[x], function (autotileId, image) {
core.material.images.autotile[autotileId]=image;
if (Object.keys(core.material.images.autotile).length==autotileIds.length) {
// 最后加载音频
core.loadMusic(callback);
}
})
}
core.loadAutotile(callback);
}
});
}
@ -290,6 +281,26 @@ core.prototype.loader = function (callback) {
}
}
////// 加载Autotile //////
core.prototype.loadAutotile = function (callback) {
core.material.images.autotile={};
var autotileIds = Object.keys(core.material.icons.autotile);
if (autotileIds.length==0) {
core.loadMusic(callback);
return;
}
for (var x=0;x<autotileIds.length;x++) {
core.loadImage(autotileIds[x], function (autotileId, image) {
core.material.images.autotile[autotileId]=image;
if (Object.keys(core.material.images.autotile).length==autotileIds.length) {
// 最后加载音频
core.loadMusic(callback);
}
})
}
}
////// 加载图片 //////
core.prototype.loadImage = function (imgName, callback) {
try {
@ -2907,6 +2918,9 @@ core.prototype.setItem = function (itemId, itemNum) {
core.status.hero.items[itemCls] = {};
}
core.status.hero.items[itemCls][itemId] = itemNum;
if (itemCls!='keys' && itemNum==0) {
delete core.status.hero.items[itemCls][itemId];
}
}
////// 删除某个物品 //////
@ -2914,10 +2928,10 @@ core.prototype.removeItem = function (itemId) {
if (!core.hasItem(itemId)) return false;
var itemCls = core.material.items[itemId].cls;
core.status.hero.items[itemCls][itemId]--;
core.updateStatusBar();
if (itemCls=='tools' && core.status.hero.items[itemCls][itemId]==0) {
if (itemCls!='keys' && core.status.hero.items[itemCls][itemId]==0) {
delete core.status.hero.items[itemCls][itemId];
}
core.updateStatusBar();
return true;
}

View File

@ -127,7 +127,7 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
switch (special) {
case 1: return "先攻:怪物首先攻击";
case 2: return "魔攻:怪物无视勇士的防";
case 2: return "魔攻:怪物无视勇士的";
case 3: return "坚固勇士每回合最多只能对怪物造成1点伤害";
case 4: return "2连击怪物每回合攻击2次";
case 5: return "3连击怪物每回合攻击3次";

View File

@ -185,9 +185,11 @@ items.prototype.useItem = function (itemId) {
if (itemId == 'curseWine') core.setFlag('curse', false);
if (itemId == 'superWine') {
core.setFlag('poison', false);
core.setFlag('weak', false);
core.status.hero.atk += core.values.weakValue;
core.status.hero.def += core.values.weakValue;
if (core.hasFlag('weak')) {
core.setFlag('weak', false);
core.status.hero.atk += core.values.weakValue;
core.status.hero.def += core.values.weakValue;
}
core.setFlag('curse', false);
}
core.updateStatusBar();