Update Status Bar

This commit is contained in:
oc 2017-12-28 01:51:13 +08:00
parent 38672bd677
commit cf02a59dee
13 changed files with 171 additions and 76 deletions

BIN
images/lv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

View File

@ -47,10 +47,14 @@
<p id='floorNameLabel'></p> <p id='floorNameLabel'></p>
</div> </div>
<div id='statusBar' class="clearfix"> <div id='statusBar' class="clearfix">
<div class="status"> <div class="status" id="floorCol">
<img src='images/floor.png' id="img-floor"> <img src='images/floor.png' id="img-floor">
<p class='statusLabel' id='floor'></p> <p class='statusLabel' id='floor'></p>
</div> </div>
<div class="status" id="lvCol">
<img src='images/lv.png' id="img-lv">
<p class='statusLabel' id='lv'></p>
</div>
<div class="status"> <div class="status">
<img src='images/hp.png' id="img-hp"> <img src='images/hp.png' id="img-hp">
<p class='statusLabel' id='hp'></p> <p class='statusLabel' id='hp'></p>
@ -67,7 +71,7 @@
<img src='images/mdef.png' id="img-mdef"> <img src='images/mdef.png' id="img-mdef">
<p class='statusLabel' id='mdef'></p> <p class='statusLabel' id='mdef'></p>
</div> </div>
<div class="status"> <div class="status" id="moneyCol">
<img src='images/money.png' id="img-money"> <img src='images/money.png' id="img-money">
<p class='statusLabel' id='money'></p> <p class='statusLabel' id='money'></p>
</div> </div>
@ -75,12 +79,16 @@
<img src='images/experience.png' id="img-experience"> <img src='images/experience.png' id="img-experience">
<p class='statusLabel' id='experience'></p> <p class='statusLabel' id='experience'></p>
</div> </div>
<div class="status" id="upCol">
<img src='images/up.png' id="img-up">
<p class='statusLabel' id='up'></p>
</div>
<div class="status"> <div class="status">
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span> <span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span> <span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span> <span class='statusLabel' id='redKey' style="color:#FF8888"></span>
</div> </div>
<div class="status"> <div class="status" id="debuffCol">
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span> <span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span> <span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span> <span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>

View File

@ -114,6 +114,13 @@ core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds
core[key] = coreData[key]; core[key] = coreData[key];
} }
core.flags = core.clone(core.data.flags); core.flags = core.clone(core.data.flags);
if (!core.flags.enableExperience)
core.flags.enableLevelUp = false;
if (!core.flags.canOpenBattleAnimate) {
core.flags.showBattleAnimateConfirm = false;
core.flags.battleAnimate = false;
core.setLocalStorage('battleAnimate', false);
}
core.values = core.clone(core.data.values); core.values = core.clone(core.data.values);
core.firstData = core.data.getFirstData(); core.firstData = core.data.getFirstData();
core.initStatus.shops = core.firstData.shops; core.initStatus.shops = core.firstData.shops;
@ -1536,7 +1543,9 @@ core.prototype.afterBattle = function(id, x, y, callback) {
core.canvas.event.clearRect(32 * x, 32 * y, 32, 32); core.canvas.event.clearRect(32 * x, 32 * y, 32, 32);
} }
core.updateFg(); core.updateFg();
var hint = "打败 " + core.material.enemys[id].name + ",金币+" + money; var hint = "打败 " + core.material.enemys[id].name;
if (core.flags.enableMoney)
hint += ",金币+" + money;
if (core.flags.enableExperience) if (core.flags.enableExperience)
hint += ",经验+" + core.material.enemys[id].experience; hint += ",经验+" + core.material.enemys[id].experience;
core.drawTip(hint); core.drawTip(hint);
@ -1583,15 +1592,19 @@ core.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback)
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
core.dom.floorNameLabel.innerHTML = core.status.maps[floorId].title; core.dom.floorNameLabel.innerHTML = core.status.maps[floorId].title;
if (core.isset(stair)) { if (core.isset(stair)) {
// find heroLoc if (!core.isset(heroLoc)) heroLoc={};
heroLoc = core.status.hero.loc;
var blocks = core.status.maps[floorId].blocks; var blocks = core.status.maps[floorId].blocks;
for (var i in blocks) { for (var i in blocks) {
if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) { if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) {
heroLoc.x = blocks[i].x; heroLoc.x = blocks[i].x;
heroLoc.y = blocks[i].y; heroLoc.y = blocks[i].y;
break;
} }
} }
if (!core.isset(heroLoc.x)) {
heroLoc.x=core.status.hero.loc.x;
heroLoc.y=core.status.hero.loc.y;
}
} }
if (core.status.maps[floorId].canFlyTo && core.status.hero.flyRange.indexOf(floorId)<0) { if (core.status.maps[floorId].canFlyTo && core.status.hero.flyRange.indexOf(floorId)<0) {
if (core.floorIds.indexOf(floorId)>core.floorIds.indexOf(core.status.floorId)) if (core.floorIds.indexOf(floorId)>core.floorIds.indexOf(core.status.floorId))
@ -1606,6 +1619,7 @@ core.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback)
// 根据文字判断是否斜体 // 根据文字判断是否斜体
var floorName = core.status.maps[floorId].name; var floorName = core.status.maps[floorId].name;
if (!core.isset(floorName) || floorName=="") floorName="&nbsp;"
core.statusBar.floor.innerHTML = floorName; core.statusBar.floor.innerHTML = floorName;
if (/^[+-]?\d+$/.test(floorName)) if (/^[+-]?\d+$/.test(floorName))
core.statusBar.floor.style.fontStyle = 'italic'; core.statusBar.floor.style.fontStyle = 'italic';
@ -3182,6 +3196,11 @@ core.prototype.getStatus = function (statusName) {
return core.status.hero[statusName]; return core.status.hero[statusName];
} }
core.prototype.getLvName = function () {
if (core.status.hero.lv>core.firstData.levelUp.length) return core.status.hero.lv;
return core.firstData.levelUp[core.status.hero.lv-1].name || core.status.hero.lv;
}
core.prototype.setFlag = function(flag, value) { core.prototype.setFlag = function(flag, value) {
if (!core.isset(core.status.hero)) return; if (!core.isset(core.status.hero)) return;
core.status.hero.flags[flag]=value; core.status.hero.flags[flag]=value;
@ -3302,9 +3321,9 @@ core.prototype.hide = function (obj, speed, callback) {
////// 状态栏相关 ////// ////// 状态栏相关 //////
core.prototype.clearStatusBar = function() { core.prototype.clearStatusBar = function() {
var statusList = ['floor', 'hp', 'atk', 'def', 'mdef', 'money', 'experience', 'yellowKey', 'blueKey', 'redKey', 'poison', 'weak', 'curse', 'hard']; var statusList = ['floor', 'lv', 'hp', 'atk', 'def', 'mdef', 'money', 'experience', 'up', 'yellowKey', 'blueKey', 'redKey', 'poison', 'weak', 'curse', 'hard'];
statusList.forEach(function (e) { statusList.forEach(function (e) {
core.statusBar[e].innerHTML = ""; core.statusBar[e].innerHTML = "&nbsp;";
}); });
core.statusBar.image.book.style.opacity = 0.3; core.statusBar.image.book.style.opacity = 0.3;
core.statusBar.image.fly.style.opacity = 0.3; core.statusBar.image.fly.style.opacity = 0.3;
@ -3320,6 +3339,12 @@ core.prototype.updateStatusBar = function () {
core.setStatus('hp', Math.min(core.values.HPMAX, core.getStatus('hp'))); core.setStatus('hp', Math.min(core.values.HPMAX, core.getStatus('hp')));
} }
var lvName = core.getLvName();
core.statusBar.lv.innerHTML = lvName;
if (/^[+-]?\d+$/.test(lvName))
core.statusBar.lv.style.fontStyle = 'italic';
else core.statusBar.lv.style.fontStyle = 'normal';
var statusList = ['hp', 'atk', 'def', 'mdef', 'money', 'experience']; var statusList = ['hp', 'atk', 'def', 'mdef', 'money', 'experience'];
statusList.forEach(function (item) { statusList.forEach(function (item) {
core.statusBar[item].innerHTML = core.getStatus(item); core.statusBar[item].innerHTML = core.getStatus(item);
@ -3376,18 +3401,22 @@ core.prototype.resize = function(clientWidth, clientHeight) {
statusWidth, statusHeight, statusMaxWidth,statusLabelsLH, statusWidth, statusHeight, statusMaxWidth,statusLabelsLH,
toolBarWidth, toolBarHeight, toolBarTop, toolBarBorder, toolBarWidth, toolBarHeight, toolBarTop, toolBarBorder,
toolsWidth, toolsHeight,toolsMargin,toolsPMaxwidth, toolsWidth, toolsHeight,toolsMargin,toolsPMaxwidth,
fontSize, margin; fontSize, toolbarFontSize, margin;
var count = 9; var count = 11;
if (!core.flags.enableFloor) count--;
if (!core.flags.enableLv) count--;
if (!core.flags.enableMDef) count--; if (!core.flags.enableMDef) count--;
if (!core.flags.enableMoney) count--;
if (!core.flags.enableExperience) count--; if (!core.flags.enableExperience) count--;
if (!core.flags.enableLevelUp) count--;
if (!core.flags.enableDebuff) count--; if (!core.flags.enableDebuff) count--;
var statusLineHeight = BASE_LINEHEIGHT * 9/count; var statusLineHeight = BASE_LINEHEIGHT * 9 / count;
var statusLineFontSize = DEFAULT_FONT_SIZE;
if (count>9) statusLineFontSize = statusLineFontSize * 9 / count;
var shopDisplay, mdefDisplay, expDisplay; var shopDisplay;
mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
expDisplay = core.flags.enableExperience ? 'block' : 'none';
statusBarBorder = '3px #fff solid'; statusBarBorder = '3px #fff solid';
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
@ -3407,13 +3436,13 @@ core.prototype.resize = function(clientWidth, clientHeight) {
var scale = core.domStyle.scale var scale = core.domStyle.scale
var tempWidth = DEFAULT_CANVAS_WIDTH * scale; var tempWidth = DEFAULT_CANVAS_WIDTH * scale;
fontSize = DEFAULT_FONT_SIZE * scale;
if(!isHorizontal){ //竖屏 if(!isHorizontal){ //竖屏
core.domStyle.screenMode = 'vertical'; core.domStyle.screenMode = 'vertical';
//显示快捷商店图标 //显示快捷商店图标
shopDisplay = 'block'; shopDisplay = 'block';
//判断应该显示几行 //判断应该显示几行
var col = core.flags.enableMDef || core.flags.enableExperience || core.flags.enableDebuff ? 3 : 2; // var col = core.flags.enableMDef || core.flags.enableExperience || core.flags.enableDebuff ? 3 : 2;
var col = parseInt((count-1)/3)+1;
var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6; var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6;
var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6; var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6;
@ -3440,6 +3469,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
margin = scale * SPACE * 2; margin = scale * SPACE * 2;
toolsMargin = scale * SPACE * 4; toolsMargin = scale * SPACE * 4;
fontSize = DEFAULT_FONT_SIZE * scale;
toolbarFontSize = DEFAULT_FONT_SIZE * scale;
}else { //横屏 }else { //横屏
core.domStyle.screenMode = 'horizontal'; core.domStyle.screenMode = 'horizontal';
shopDisplay = 'none'; shopDisplay = 'none';
@ -3457,6 +3488,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
toolBarTop = scale*statusLineHeight * count + SPACE * 2; toolBarTop = scale*statusLineHeight * count + SPACE * 2;
toolBarBorder = '3px #fff solid'; toolBarBorder = '3px #fff solid';
toolsHeight = scale * BASE_LINEHEIGHT; toolsHeight = scale * BASE_LINEHEIGHT;
fontSize = statusLineFontSize * scale;
toolbarFontSize = DEFAULT_FONT_SIZE * scale;
borderRight = ''; borderRight = '';
statusMaxWidth = scale * DEFAULT_BAR_WIDTH; statusMaxWidth = scale * DEFAULT_BAR_WIDTH;
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH; toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH;
@ -3486,7 +3519,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
toolsHeight = BASE_LINEHEIGHT; toolsHeight = BASE_LINEHEIGHT;
borderRight = ''; borderRight = '';
fontSize = DEFAULT_FONT_SIZE; fontSize = statusLineFontSize;
toolbarFontSize = DEFAULT_FONT_SIZE;
statusMaxWidth = DEFAULT_BAR_WIDTH; statusMaxWidth = DEFAULT_BAR_WIDTH;
toolsPMaxwidth = DEFAULT_BAR_WIDTH * .9; toolsPMaxwidth = DEFAULT_BAR_WIDTH * .9;
margin = SPACE * 2; margin = SPACE * 2;
@ -3511,8 +3545,6 @@ core.prototype.resize = function(clientWidth, clientHeight) {
height: canvasWidth + unit, height: canvasWidth + unit,
top: canvasTop + unit, top: canvasTop + unit,
right: 0, right: 0,
// left: canvasLeft + unit,
border: '3px #fff solid', border: '3px #fff solid',
} }
}, },
@ -3576,7 +3608,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
borderBottom: toolBarBorder, borderBottom: toolBarBorder,
borderLeft: toolBarBorder, borderLeft: toolBarBorder,
borderRight: borderRight, borderRight: borderRight,
fontSize: fontSize + unit fontSize: toolbarFontSize + unit
} }
}, },
{ {
@ -3595,15 +3627,45 @@ core.prototype.resize = function(clientWidth, clientHeight) {
} }
}, },
{ {
id: 'expCol', id: 'floorCol',
rules: { rules: {
display: expDisplay display: core.flags.enableFloor ? 'block': 'none'
}
},
{
id: 'lvCol',
rules: {
display: core.flags.enableLv ? 'block': 'none'
} }
}, },
{ {
id: 'mdefCol', id: 'mdefCol',
rules: { rules: {
display: mdefDisplay display: core.flags.enableMDef ? 'block': 'none'
}
},
{
id: 'moneyCol',
rules: {
display: core.flags.enableMoney ? 'block': 'none'
}
},
{
id: 'expCol',
rules: {
display: core.flags.enableExperience ? 'block': 'none'
}
},
{
id: 'upCol',
rules: {
display: core.flags.enableLevelUp ? 'block': 'none'
}
},
{
'id': 'debuffCol',
rules: {
display: core.flags.enableDebuff ? 'block': 'none'
} }
}, },
{ {

View File

@ -10,12 +10,13 @@ data.prototype.init = function() {
"floorId": "sample0", // 初始楼层ID "floorId": "sample0", // 初始楼层ID
"hero": { // 勇士初始数据 "hero": { // 勇士初始数据
"name": "阳光", // 勇士名;可以改成喜欢的 "name": "阳光", // 勇士名;可以改成喜欢的
'lv': 1, // 初始等级,该项必须为正整数
"hp": 1000, // 初始生命值 "hp": 1000, // 初始生命值
"atk": 100, // 初始攻击 "atk": 100, // 初始攻击
"def": 100, // 初始防御 "def": 100, // 初始防御
"mdef": 100, // 初始魔防 "mdef": 100, // 初始魔防
"money": 100, // 初始金币 "money": 100, // 初始金币
"experience": 1000, // 初始经验 "experience": 0, // 初始经验
"items": { // 初始道具个数 "items": { // 初始道具个数
"keys": { "keys": {
"yellowKey": 0, "yellowKey": 0,
@ -57,10 +58,11 @@ data.prototype.init = function() {
{"text": "防御+4", "effect": "status:def+=4"}, {"text": "防御+4", "effect": "status:def+=4"},
{"text": "魔防+10", "effect": "status:mdef+=10"} {"text": "魔防+10", "effect": "status:mdef+=10"}
// effect只能对status和item进行操作不能修改flag值。 // effect只能对status和item进行操作不能修改flag值。
// 中间只能用+=符号(也就是只能增加某个属性或道具) // 必须是X+=Y的形式其中Y可以是一个表达式以status:xxx或item:xxx为参数
// 其他effect样例 // 其他effect样例
// "item:yellowKey+=1" 黄钥匙+1 // "item:yellowKey+=1" 黄钥匙+1
// "item:pickaxe+=3" 破墙镐+3 // "item:pickaxe+=3" 破墙镐+3
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
] ]
}, },
"expShop1": { // 商店唯一ID "expShop1": { // 商店唯一ID
@ -80,6 +82,17 @@ data.prototype.init = function() {
] ]
}, },
}, },
"levelUp": [ // 经验升级所需要的数值,是一个数组
{}, // 第一项为初始等级可以简单留空也可以写name
{"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍再将攻击+10防御+10
// 每一个里面可以含有三个参数 name, need, effect
// need为所需要的经验数值是一个正整数。请确保need所需的依次递增
// name为该等级的名称也可以省略代表使用系统默认值本项将显示在状态栏中
// effect为本次升级所执行的操作可由若干项组成由分号分开
// 其中每一项写法和上面的商店完全相同同样必须是X+=Y的形式Y是一个表达式同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数
{"need": 40, "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"},
// 依次往下写需要的数值即可
]
} }
// 各种数值;一些数值可以在这里设置 // 各种数值;一些数值可以在这里设置
this.values = { this.values = {
@ -118,9 +131,15 @@ data.prototype.init = function() {
// 系统FLAG在游戏运行中中请不要修改它。 // 系统FLAG在游戏运行中中请不要修改它。
this.flags = { this.flags = {
/****** 角色状态相关 ******/ /****** 角色状态相关 ******/
"enableMDef": true, // 是否涉及勇士的魔防值如果此项为false则状态栏不会显示勇士的魔防值 "enableNegativeDamage": true, // 是否支持负伤害(回血)
"enableExperience": true, // 是否涉及经验值如果此项为false则状态栏和怪物手册均将不会显示经验值 "enableFloor": true, // 是否在状态栏显示当前楼层
"enableLv": false, // 是否在状态栏显示当前等级
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
"enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验
"enableLevelUp": false, // 是否允许等级提升进阶如果上面enableExperience为false则此项恒视为false
"enableDebuff": true, // 是否涉及毒衰咒如果此项为false则不会在状态栏中显示毒衰咒的debuff "enableDebuff": true, // 是否涉及毒衰咒如果此项为false则不会在状态栏中显示毒衰咒的debuff
////// 上述的几个开关将直接影响状态栏的显示效果 //////
/****** 道具相关 ******/ /****** 道具相关 ******/
"flyNearStair": true, // 是否需要在楼梯边使用传送器 "flyNearStair": true, // 是否需要在楼梯边使用传送器
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏如果false则只破坏面前的墙壁 "pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏如果false则只破坏面前的墙壁

View File

@ -131,7 +131,7 @@ enemys.prototype.getCritical = function (monsterId) {
if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???"; if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???";
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef, var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
monster.hp, monster.atk, monster.def, monster.special); monster.hp, monster.atk, monster.def, monster.special);
if (last == 0) return 0; if (last <= 0) return 0;
for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) { for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) {
var damage = this.calDamage(i, core.status.hero.def, core.status.hero.mdef, var damage = this.calDamage(i, core.status.hero.def, core.status.hero.mdef,
@ -147,9 +147,8 @@ enemys.prototype.getCritical = function (monsterId) {
enemys.prototype.getCriticalDamage = function (monsterId) { enemys.prototype.getCriticalDamage = function (monsterId) {
var c = this.getCritical(monsterId); var c = this.getCritical(monsterId);
if (c == '???') return '???'; if (c == '???') return '???';
if (c == 0) return 0; if (c <= 0) return 0;
var monster = core.material.enemys[monsterId]; var monster = core.material.enemys[monsterId];
// if (c<=0) return 0;
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef, var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
monster.hp, monster.atk, monster.def, monster.special); monster.hp, monster.atk, monster.def, monster.special);
if (last == 999999999) return '???'; if (last == 999999999) return '???';
@ -202,11 +201,7 @@ enemys.prototype.calDamage = function (hero_atk, hero_def, hero_mdef, mon_hp, mo
var ans = damage + turn * per_damage + (turn + 1) * counterDamage; var ans = damage + turn * per_damage + (turn + 1) * counterDamage;
ans -= hero_mdef; ans -= hero_mdef;
// 魔防回血 return core.flags.enableNegativeDamage?ans:Math.max(0, ans);
// return ans;
// 魔防不回血
return ans <= 0 ? 0 : ans;
} }
// 获得当前楼层的怪物列表 // 获得当前楼层的怪物列表

View File

@ -20,12 +20,11 @@ events.prototype.init = function () {
callback(); callback();
}, },
'changeFloor': function (data, core, callback) { 'changeFloor': function (data, core, callback) {
var heroLoc = null; var heroLoc = {};
if (core.isset(data.event.data.loc)) { if (core.isset(data.event.data.loc))
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]}; heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
if (core.isset(data.event.data.direction)) if (core.isset(data.event.data.direction))
heroLoc.direction = data.event.data.direction; heroLoc.direction = data.event.data.direction;
}
core.changeFloor(data.event.data.floorId, data.event.data.stair, core.changeFloor(data.event.data.floorId, data.event.data.stair,
heroLoc, data.event.data.time, callback); heroLoc, data.event.data.time, callback);
}, },
@ -66,14 +65,6 @@ events.prototype.startGame = function (hard) {
core.hideStartAnimate(function() { core.hideStartAnimate(function() {
core.drawText(core.clone(core.firstData.startText), function() { core.drawText(core.clone(core.firstData.startText), function() {
// 强制关闭战斗过程?
if (!core.flags.canOpenBattleAnimate) {
core.flags.showBattleAnimateConfirm=false;
core.flags.battleAnimate=false;
core.setLocalStorage('battleAnimate', false);
}
if (core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项 if (core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
core.status.event.selection = core.flags.battleAnimate ? 0 : 1; core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n强烈建议新手开启此项", function () { core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n强烈建议新手开启此项", function () {

View File

@ -4,7 +4,7 @@
main.floors.sample1 = { main.floors.sample1 = {
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致 "floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
"title": "样板 1 层", // 楼层中文名 "title": "样板 1 层", // 楼层中文名
"name": "样板1", // 显示在状态栏中的层数 "name": "1", // 显示在状态栏中的层数
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) "canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"canUseQuickShop": true, // 该层是否允许使用快捷商店 "canUseQuickShop": true, // 该层是否允许使用快捷商店
"defaultGround": "grass", // 默认地面的图块IDterrains中 "defaultGround": "grass", // 默认地面的图块IDterrains中
@ -273,7 +273,7 @@ main.floors.sample1 = {
}, },
"changeFloor": { // 楼层转换事件该事件不能和上面的events有冲突同位置点否则会被覆盖 "changeFloor": { // 楼层转换事件该事件不能和上面的events有冲突同位置点否则会被覆盖
"4,12": {"floorId": "sample0", "loc": [6,0]}, // 由于楼下有多个上楼梯,所以需指定位置而不是简单地写"stair": "upFloor" "4,12": {"floorId": "sample0", "loc": [6,0]}, // 由于楼下有多个上楼梯,所以需指定位置而不是简单地写"stair": "upFloor"
"5,5": {"floorId": "sample2", "stair": "downFloor"} "5,5": {"floorId": "sample2", "stair": "downFloor", "direction": "up"}
}, },
"afterBattle": { // 战斗后可能触发的事件列表 "afterBattle": { // 战斗后可能触发的事件列表
"9,6": [ // 初级卫兵1 "9,6": [ // 初级卫兵1

View File

@ -4,7 +4,7 @@
main.floors.sample2 = { main.floors.sample2 = {
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致 "floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
"title": "主塔 40 层", // 楼层中文名 "title": "主塔 40 层", // 楼层中文名
"name": "-40", // 显示在状态栏中的层数 "name": "40", // 显示在状态栏中的层数
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) "canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"canUseQuickShop": true, // 该层是否允许使用快捷商店 "canUseQuickShop": true, // 该层是否允许使用快捷商店
"defaultGround": "snowGround", // 默认地面的图块IDterrains中 "defaultGround": "snowGround", // 默认地面的图块IDterrains中

View File

@ -430,7 +430,10 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
var left=10, right=416-2*left; var left=10, right=416-2*left;
var lines = core.flags.enableExperience?5:4; // var lines = core.flags.enableExperience?5:4;
var lines = 3;
if (core.flags.enableMDef || core.flags.enableMoney || core.flags.enableExperience) lines=4;
if (core.flags.enableMoney && core.flags.enableExperience) lines=5;
var lineHeight = 60; var lineHeight = 60;
var height = lineHeight * lines + 50; var height = lineHeight * lines + 50;
@ -515,7 +518,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
if (core.flags.enableMDef) { if (core.flags.enableMDef) {
textTop += lineHeight; textTop += lineHeight;
core.canvas.ui.textAlign='left'; core.canvas.ui.textAlign='left';
core.fillText('ui', "魔防", left_start, textTop, '#DDDDDD', '16px Verdana'); core.fillText('ui', "护盾", left_start, textTop, '#DDDDDD', '16px Verdana');
core.drawLine('ui', left_start, textTop + 8, left_end, textTop + 8, '#FFFFFF', 2); core.drawLine('ui', left_start, textTop + 8, left_end, textTop + 8, '#FFFFFF', 2);
core.canvas.data.textAlign='right'; core.canvas.data.textAlign='right';
core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana'); core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
@ -543,12 +546,14 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
core.canvas.ui.textAlign='left'; core.canvas.ui.textAlign='left';
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana'); core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
if (core.flags.enableMoney) {
textTop += lineHeight; textTop += lineHeight;
core.canvas.ui.textAlign='right'; core.canvas.ui.textAlign = 'right';
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana'); core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana');
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2); core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
core.canvas.ui.textAlign='left'; core.canvas.ui.textAlign = 'left';
core.fillText('ui', mon_money, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana'); core.fillText('ui', mon_money, right_start, textTop + 26, '#DDDDDD', 'bold 16px Verdana');
}
if (core.flags.enableExperience) { if (core.flags.enableExperience) {
textTop += lineHeight; textTop += lineHeight;
@ -564,12 +569,6 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
core.canvas.ui.textAlign='right'; core.canvas.ui.textAlign='right';
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px Verdana"); core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px Verdana");
/*
core.drawLine('data', left + right - margin - boxWidth + 6, top+margin+boxWidth-6,
left+right-margin-6, top+margin+6, '#FF0000', 4);
core.drawLine('data', left + margin + 6, top+margin+heroHeight+(boxWidth-32)-6,
left+margin+boxWidth-6, top+margin+6, '#FF0000', 4);
*/
var battleInterval = setInterval(function() { var battleInterval = setInterval(function() {
core.playSound("attack", "ogg"); core.playSound("attack", "ogg");
@ -797,25 +796,34 @@ ui.prototype.drawEnemyBook = function (page) {
core.fillText('ui', enemy.atk, 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', enemy.atk, 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana'); core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.def, 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', enemy.def, 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
var expOffset = 165;
if (core.flags.enableMoney) {
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana'); core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
expOffset = 255;
}
var damage_offset = 326;
if (core.flags.enableExperience) { if (core.flags.enableExperience) {
core.canvas.ui.textAlign = "left"; core.canvas.ui.textAlign = "left";
core.fillText('ui', '经验', 255, 62 * i + 50, '#DDDDDD', '13px Verdana'); core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.experience, 285, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', enemy.experience, expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
damage_offset = 361;
} }
var damageOffet = 281;
if (core.flags.enableMoney && core.flags.enableExperience)
damageOffet = 361;
else if (core.flags.enableMoney || core.flags.enableExperience)
damageOffet = 326;
core.canvas.ui.textAlign = "center"; core.canvas.ui.textAlign = "center";
var damage = enemy.damage; var damage = enemy.damage;
var color = '#FFFF00'; var color = '#FFFF00';
if (damage >= core.status.hero.hp) color = '#FF0000'; if (damage >= core.status.hero.hp) color = '#FF0000';
if (damage == 0) color = '#00FF00'; if (damage <= 0) color = '#00FF00';
if (damage >= 999999999) damage = '无法战斗'; if (damage >= 999999999) damage = '无法战斗';
var length = core.canvas.ui.measureText(damage).width; core.fillText('ui', damage, damageOffet, 62 * i + 50, color, 'bold 13px Verdana');
core.fillText('ui', damage, damage_offset, 62 * i + 50, color, 'bold 13px Verdana');
core.canvas.ui.textAlign = "left"; core.canvas.ui.textAlign = "left";

View File

@ -31,8 +31,13 @@ function main() {
'hardLevel': document.getElementById('hardLevel'), 'hardLevel': document.getElementById('hardLevel'),
'data': document.getElementById('data'), 'data': document.getElementById('data'),
'statusLabels': document.getElementsByClassName('statusLabel'), 'statusLabels': document.getElementsByClassName('statusLabel'),
'floorCol': document.getElementById('floorCol'),
'lvCol': document.getElementById('lvCol'),
'mdefCol': document.getElementById('mdefCol'), 'mdefCol': document.getElementById('mdefCol'),
'moneyCol': document.getElementById('moneyCol'),
'expCol': document.getElementById('expCol'), 'expCol': document.getElementById('expCol'),
'upCol': document.getElementById('upCol'),
'debuffCol': document.getElementById('debuffCol'),
'hard': document.getElementById('hard'), 'hard': document.getElementById('hard'),
}; };
this.loadList = [ this.loadList = [
@ -49,12 +54,14 @@ function main() {
this.statusBar = { this.statusBar = {
'image': { 'image': {
'floor': document.getElementById('img-floor'), 'floor': document.getElementById('img-floor'),
'lv': document.getElementById('img-lv'),
'hp': document.getElementById("img-hp"), 'hp': document.getElementById("img-hp"),
'atk': document.getElementById("img-atk"), 'atk': document.getElementById("img-atk"),
'def': document.getElementById("img-def"), 'def': document.getElementById("img-def"),
'mdef': document.getElementById("img-mdef"), 'mdef': document.getElementById("img-mdef"),
'money': document.getElementById("img-money"), 'money': document.getElementById("img-money"),
'experience': document.getElementById("img-experience"), 'experience': document.getElementById("img-experience"),
'up': document.getElementById("img-up"),
'book': document.getElementById("img-book"), 'book': document.getElementById("img-book"),
'fly': document.getElementById("img-fly"), 'fly': document.getElementById("img-fly"),
'toolbox': document.getElementById("img-toolbox"), 'toolbox': document.getElementById("img-toolbox"),
@ -64,12 +71,14 @@ function main() {
'settings': document.getElementById("img-settings") 'settings': document.getElementById("img-settings")
}, },
'floor': document.getElementById('floor'), 'floor': document.getElementById('floor'),
'lv': document.getElementById('lv'),
'hp': document.getElementById('hp'), 'hp': document.getElementById('hp'),
'atk': document.getElementById('atk'), 'atk': document.getElementById('atk'),
'def': document.getElementById("def"), 'def': document.getElementById("def"),
'mdef': document.getElementById('mdef'), 'mdef': document.getElementById('mdef'),
'money': document.getElementById("money"), 'money': document.getElementById("money"),
'experience': document.getElementById("experience"), 'experience': document.getElementById("experience"),
'up': document.getElementById('up'),
'yellowKey': document.getElementById("yellowKey"), 'yellowKey': document.getElementById("yellowKey"),
'blueKey': document.getElementById("blueKey"), 'blueKey': document.getElementById("blueKey"),
'redKey': document.getElementById("redKey"), 'redKey': document.getElementById("redKey"),

View File

@ -180,8 +180,9 @@
} }
.status img{ .status img{
vertical-align: middle; vertical-align: middle;
width: 1.6em; width: auto;
height: 1.6em; height: 100%;
max-height: 1.6em;
} }
#statusBar span{ #statusBar span{
color: white; color: white;

View File

@ -1,8 +1,10 @@
全键盘操作 √ 全键盘操作 √
Ctrl快速跳过对话 √ Ctrl快速跳过对话 √
增加负伤 √
支持不同层使用不同的地面素材 √ 支持不同层使用不同的地面素材 √
支持多个Autotile同时存在 √ 支持多个Autotile同时存在 √
直接内嵌了诸多默认的terrains素材 √ 直接内嵌了诸多默认的terrains素材 √
自动定位到上次存/读档位置 √ 自动定位到上次存/读档位置 √
设置储存 √ 设置储存 √
修改setFg的实现方法 √ 修改setFg的实现方法 √
大范围领域伤害