remove battleAnimate
This commit is contained in:
parent
4b32b0c571
commit
ca250fa60a
@ -351,7 +351,6 @@ core.ui.drawConfirmBox // 绘制一个确认/取消的警告页面
|
||||
core.ui.drawSwitchs // 绘制系统设置界面
|
||||
core.ui.drawSettings // 绘制系统菜单栏
|
||||
core.ui.drawQuickShop // 绘制快捷商店选择栏
|
||||
core.ui.drawBattleAnimate // 绘制战斗动画
|
||||
core.ui.drawWaiting // 绘制等待界面
|
||||
core.ui.drawSyncSave // 绘制存档同步界面
|
||||
core.ui.drawPagination // 绘制分页
|
||||
|
||||
@ -187,13 +187,6 @@ function() {
|
||||
|
||||
多属性可采用数组的写法,比如`'special': [1,3]`视为同时拥有先攻和坚固属性;`'special': [5,10,14,18]`视为拥有3连击、魔防、诅咒、阻击四个属性。
|
||||
|
||||
本塔支持战斗动画,在`data.js`中存在三个全局选项:`canOpenBattleAnimate`, `showBattleAnimateConfirm`, `battleAnimate`。
|
||||
|
||||
- `canOpenBattleAnimate`代表是否允许用户开启战斗动画。如果你添加了一些自定义属性,且不想修改战斗界面的UI,则可以将其关闭。
|
||||
- `showBattleAnimateConfirm`代表是否在游戏开始时给用户提供开启动画的选项。对于一些偏向于萌新的塔,可以开启此项。
|
||||
- `battleAnimate`代表是否默认开启战斗动画。此项会被用户存储的设置给覆盖。
|
||||
- 如果`canOpenBattleAnimate`为false,则后面两个也强制为false。
|
||||
|
||||
怪物可以负伤,在`data.js`的全局变量`enableNegativeDamage`中指定。
|
||||
|
||||
下面的`getSpecialHint`函数则给定了每个特殊属性的详细描述。这个描述将在怪物手册中看到。
|
||||
|
||||
@ -606,24 +606,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_range": "thiseval==null || (thiseval>0 && thiseval<=4)",
|
||||
"_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效"
|
||||
},
|
||||
"canOpenBattleAnimate": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false"
|
||||
},
|
||||
"showBattleAnimateConfirm": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "是否在游戏开始时提供“是否开启战斗动画”的选项"
|
||||
},
|
||||
"battleAnimate": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "是否默认显示战斗动画;用户可以手动在菜单栏中开关"
|
||||
},
|
||||
"displayEnemyDamage": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
|
||||
@ -1845,34 +1845,24 @@ actions.prototype.clickSwitchs = function (x,y) {
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 2:
|
||||
if (!core.flags.canOpenBattleAnimate) {
|
||||
core.drawTip("本塔不能开启战斗动画!");
|
||||
}
|
||||
else {
|
||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;
|
||||
core.updateDamage();
|
||||
core.setLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
core.flags.displayCritical=!core.flags.displayCritical;
|
||||
core.updateDamage();
|
||||
core.setLocalStorage('critical', core.flags.displayCritical);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
|
||||
core.updateDamage();
|
||||
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
core.platform.useLocalForage=!core.platform.useLocalForage;
|
||||
core.setLocalStorage('useLocalForage', core.platform.useLocalForage);
|
||||
core.control.getSaveIndexes(function (indexes) {
|
||||
@ -1880,17 +1870,17 @@ actions.prototype.clickSwitchs = function (x,y) {
|
||||
});
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
core.setFlag('clickMove', !core.getFlag('clickMove', true));
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 8:
|
||||
case 7:
|
||||
core.platform.extendKeyboard = !core.platform.extendKeyboard;
|
||||
core.setLocalStorage('extendKeyboard', core.platform.extendKeyboard);
|
||||
core.updateStatusBar();
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 9:
|
||||
case 8:
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawSettings();
|
||||
break;
|
||||
|
||||
@ -223,11 +223,6 @@ core.prototype.init = function (coreData, callback) {
|
||||
core.flags.enableLevelUp = false;
|
||||
if (!core.flags.enableLevelUp)
|
||||
core.flags.levelUpLeftMode = false;
|
||||
if (!core.flags.canOpenBattleAnimate) {
|
||||
core.flags.showBattleAnimateConfirm = false;
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
}
|
||||
|
||||
if (core.isset(core.firstData.shops)) {
|
||||
core.firstData.shops.forEach(function (t) {
|
||||
@ -323,7 +318,6 @@ core.prototype.init = function (coreData, callback) {
|
||||
core.musicStatus.soundStatus = core.getLocalStorage('soundStatus', true);
|
||||
|
||||
// switchs
|
||||
core.flags.battleAnimate = core.getLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
|
||||
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
|
||||
@ -135,21 +135,7 @@ events.prototype.startGame = function (hard, seed, route, callback) {
|
||||
|
||||
var real_start = function () {
|
||||
core.insertAction(core.clone(core.firstData.startText), null, null, function() {
|
||||
if (!core.flags.startUsingCanvas && !core.isReplaying() && core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
|
||||
core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
|
||||
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () {
|
||||
core.flags.battleAnimate = true;
|
||||
core.setLocalStorage('battleAnimate', true);
|
||||
post_start();
|
||||
}, function () {
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
post_start();
|
||||
});
|
||||
}
|
||||
else {
|
||||
post_start();
|
||||
}
|
||||
post_start();
|
||||
});
|
||||
}
|
||||
|
||||
@ -1525,16 +1511,7 @@ events.prototype.battle = function (id, x, y, force, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
if (core.flags.battleAnimate&&!core.isReplaying()) {
|
||||
core.waitHeroToStop(function() {
|
||||
core.ui.drawBattleAnimate(id, function() {
|
||||
core.events.afterBattle(id, x, y, callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
core.events.afterBattle(id, x, y, callback);
|
||||
}
|
||||
core.events.afterBattle(id, x, y, callback);
|
||||
}
|
||||
|
||||
////// 触发(x,y)点的事件 //////
|
||||
|
||||
306
libs/ui.js
306
libs/ui.js
@ -1120,7 +1120,6 @@ ui.prototype.drawSwitchs = function() {
|
||||
var choices = [
|
||||
"背景音乐: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]"),
|
||||
"背景音效: "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
|
||||
"战斗动画: "+(core.flags.battleAnimate ? "[ON]" : "[OFF]"),
|
||||
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
|
||||
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
|
||||
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||
@ -1155,311 +1154,6 @@ ui.prototype.drawQuickShop = function () {
|
||||
this.drawChoices(null, choices);
|
||||
}
|
||||
|
||||
////// 绘制战斗动画 //////
|
||||
ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
|
||||
// UI层
|
||||
core.lockControl();
|
||||
if (!core.isset(core.status.event.id)) {
|
||||
core.status.event = {'id': 'battle'};
|
||||
}
|
||||
|
||||
var hero_hp = core.getStatus('hp'), hero_atk = core.getStatus('atk'), hero_def = core.getStatus('def'),
|
||||
hero_mdef = core.getStatus('mdef');
|
||||
|
||||
hero_hp=Math.max(0, hero_hp);
|
||||
hero_atk=Math.max(0, hero_atk);
|
||||
hero_def=Math.max(0, hero_def);
|
||||
hero_mdef=Math.max(0, hero_mdef);
|
||||
|
||||
hero_atk = Math.floor(core.getFlag('equip_atk_buff',1)*hero_atk);
|
||||
hero_def = Math.floor(core.getFlag('equip_def_buff',1)*hero_def);
|
||||
hero_mdef = Math.floor(core.getFlag('equip_mdef_buff',1)*hero_mdef);
|
||||
|
||||
var enemy = core.material.enemys[monsterId];
|
||||
var enemyInfo = core.enemys.getEnemyInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef);
|
||||
var mon_hp = enemyInfo.hp, mon_atk = enemyInfo.atk, mon_def = enemyInfo.def, mon_money=enemyInfo.money,
|
||||
mon_exp = enemyInfo.experience, mon_special=enemyInfo.special;
|
||||
|
||||
var initDamage = 0; // 战前伤害
|
||||
|
||||
// 吸血
|
||||
if (core.enemys.hasSpecial(mon_special, 11)) {
|
||||
var vampireDamage = hero_hp * enemy.value;
|
||||
|
||||
// 如果有神圣盾免疫吸血等可以在这里写
|
||||
|
||||
vampireDamage = Math.floor(vampireDamage) || 0;
|
||||
// 加到自身
|
||||
if (enemy.add) // 如果加到自身
|
||||
mon_hp += vampireDamage;
|
||||
|
||||
initDamage += vampireDamage;
|
||||
}
|
||||
|
||||
hero_hp -= core.enemys.getExtraDamage(enemy);
|
||||
|
||||
if (core.enemys.hasSpecial(mon_special, 2)) hero_def=0; // 魔攻
|
||||
|
||||
// 实际操作
|
||||
var turn = 0; // 0为勇士攻击
|
||||
if (core.enemys.hasSpecial(mon_special, 1)) turn=1;
|
||||
|
||||
// 回合
|
||||
var turns = 2;
|
||||
if (core.enemys.hasSpecial(mon_special, 4)) turns=3;
|
||||
if (core.enemys.hasSpecial(mon_special, 5)) turns=4;
|
||||
if (core.enemys.hasSpecial(mon_special, 6)) turns=1+(enemy.n||4);
|
||||
|
||||
// 初始伤害
|
||||
if (core.enemys.hasSpecial(mon_special, 7)) initDamage+=Math.floor(core.values.breakArmor * hero_def);
|
||||
if (core.enemys.hasSpecial(mon_special, 9)) initDamage+=Math.floor(core.values.purify * hero_mdef);
|
||||
hero_mdef-=initDamage;
|
||||
if (hero_mdef<0) {
|
||||
hero_hp+=hero_mdef;
|
||||
hero_mdef=0;
|
||||
}
|
||||
|
||||
var specialTexts = core.enemys.getSpecialText(monsterId);
|
||||
|
||||
core.clearMap('ui');
|
||||
var left=10, right=416-2*left;
|
||||
|
||||
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 height = lineHeight * lines + 50;
|
||||
|
||||
var top = (416-height)/2, bottom = height;
|
||||
|
||||
core.fillRect('ui', left, top, right, bottom, 'rgba(0,0,0,0.85)');
|
||||
core.setAlpha('ui', 1);
|
||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||
core.clearMap('data');
|
||||
|
||||
clearInterval(core.interval.tipAnimate);
|
||||
core.setAlpha('data', 1);
|
||||
core.status.boxAnimateObjs = [];
|
||||
var globalFont = core.status.globalAttribute.font;
|
||||
|
||||
var margin = 35;
|
||||
var boxWidth = 40;
|
||||
var monsterHeight = 32, animate=2;
|
||||
|
||||
var image = core.material.images.enemys, icon = core.material.icons.enemys;
|
||||
if (core.isset(core.material.icons.enemy48[monsterId])) {
|
||||
image = core.material.images.enemy48;
|
||||
icon = core.material.icons.enemy48;
|
||||
monsterHeight = 48;
|
||||
animate=4;
|
||||
}
|
||||
|
||||
// 方块
|
||||
var heroHeight = core.material.icons.hero.height;
|
||||
core.strokeRect('ui', left + margin - 1, top + margin - 1, boxWidth+2, heroHeight+boxWidth-32+2, '#FFD700', 2);
|
||||
core.strokeRect('ui', left + right - margin - boxWidth - 1 , top+margin-1, boxWidth+2, monsterHeight+boxWidth-32+2);
|
||||
|
||||
// 名称
|
||||
core.setTextAlign('ui', 'center');
|
||||
core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px '+globalFont);
|
||||
core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+monsterHeight+40);
|
||||
for (var i=0, j=0; i<specialTexts.length;i++) {
|
||||
if (specialTexts[i]!='') {
|
||||
core.fillText('ui', specialTexts[i], left+right-margin-boxWidth/2, top+margin+monsterHeight+44+20*(++j), '#FF6A6A', '15px '+globalFont);
|
||||
}
|
||||
}
|
||||
|
||||
// 图标
|
||||
core.clearMap('ui', left + margin, top + margin, boxWidth, heroHeight+boxWidth-32);
|
||||
core.fillRect('ui', left + margin, top + margin, boxWidth, heroHeight+boxWidth-32, core.material.groundPattern);
|
||||
var heroIcon = core.material.icons.hero['down'];
|
||||
core.drawImage('ui', core.material.images.hero, heroIcon.stop * 32, heroIcon.loc *heroHeight, 32, heroHeight, left+margin+(boxWidth-32)/2, top+margin+(boxWidth-32)/2, 32, heroHeight);
|
||||
// 怪物的
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.status.boxAnimateObjs.push({
|
||||
'bgx': left+right-margin-40, 'bgy': top+margin, 'bgWidth': boxWidth, 'bgHeight': monsterHeight+boxWidth-32,
|
||||
'x': left + right - margin - 40 + (boxWidth-32)/2, 'y': top + margin + (boxWidth-32)/2, 'height': monsterHeight,
|
||||
'image': image, 'pos': monsterHeight*icon[monsterId], 'animate': animate
|
||||
})
|
||||
core.drawBoxAnimate();
|
||||
var lineWidth = 80;
|
||||
|
||||
var left_start = left + margin + boxWidth + 10;
|
||||
var left_end = left_start+lineWidth;
|
||||
|
||||
var right_end = left+right-margin-boxWidth-10;
|
||||
var right_start = right_end-lineWidth;
|
||||
|
||||
// 勇士的线
|
||||
core.setTextAlign('ui', 'left');
|
||||
var textTop = top+margin+10;
|
||||
core.fillText('ui', "生命值", left_start, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', left_start, textTop+8, left_end, textTop+8, '#FFFFFF', 2);
|
||||
core.setTextAlign('data', 'right');
|
||||
core.fillText('data', hero_hp, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
textTop+=lineHeight;
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', "攻击", left_start, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', left_start, textTop+8, left_end, textTop+8, '#FFFFFF', 2);
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText('ui', hero_atk, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
textTop+=lineHeight;
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', "防御", left_start, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', left_start, textTop+8, left_end, textTop+8, '#FFFFFF', 2);
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText('ui', hero_def, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
if (core.flags.enableMDef) {
|
||||
textTop += lineHeight;
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', "护盾", left_start, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', left_start, textTop + 8, left_end, textTop + 8, '#FFFFFF', 2);
|
||||
core.setTextAlign('data', 'right');
|
||||
core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
}
|
||||
|
||||
// 怪物的线
|
||||
core.setTextAlign('ui', 'right');
|
||||
var textTop = top+margin+10;
|
||||
core.fillText('ui', "生命值", right_end, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', right_start, textTop+8, right_end, textTop+8, '#FFFFFF', 2);
|
||||
core.setTextAlign('data', 'left');
|
||||
core.fillText('data', mon_hp, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
textTop+=lineHeight;
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText('ui', "攻击", right_end, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', right_start, textTop+8, right_end, textTop+8, '#FFFFFF', 2);
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', mon_atk, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
textTop+=lineHeight;
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText('ui', "防御", right_end, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', right_start, textTop+8, right_end, textTop+8, '#FFFFFF', 2);
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
if (core.flags.enableMoney) {
|
||||
textTop += lineHeight;
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', mon_money, right_start, textTop + 26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
}
|
||||
|
||||
if (core.flags.enableExperience) {
|
||||
textTop += lineHeight;
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText('ui', "经验", right_end, textTop, '#DDDDDD', '16px '+globalFont);
|
||||
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText('ui', mon_exp, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
}
|
||||
|
||||
core.setTextAlign('ui', 'left');
|
||||
core.fillText("ui", "V", left_end+8, 208-15, "#FFFFFF", "italic bold 40px "+globalFont);
|
||||
|
||||
core.setTextAlign('ui', 'right');
|
||||
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px "+globalFont);
|
||||
|
||||
var battleInterval = setInterval(function() {
|
||||
core.playSound("attack.mp3");
|
||||
|
||||
if (turn==0) {
|
||||
// 勇士攻击
|
||||
core.drawLine('data', left + right - margin - boxWidth + 6, top+margin+monsterHeight+boxWidth-32-6,
|
||||
left+right-margin-6, top+margin+6, '#FF0000', 4);
|
||||
setTimeout(function() {
|
||||
core.clearMap('data', left + right - margin - boxWidth, top+margin,
|
||||
boxWidth, boxWidth+monsterHeight-32);
|
||||
}, 250);
|
||||
|
||||
if (hero_atk-mon_def>0)
|
||||
mon_hp-=hero_atk-mon_def;
|
||||
if (mon_hp<0) mon_hp=0;
|
||||
|
||||
// 更新怪物伤害
|
||||
core.clearMap('data', right_start, top+margin+10, lineWidth, 40);
|
||||
core.setTextAlign('data', 'left');
|
||||
core.fillText('data', mon_hp, right_start, top+margin+10+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
// 反击
|
||||
if (core.enemys.hasSpecial(mon_special, 8)) {
|
||||
hero_mdef -= Math.floor(core.values.counterAttack * hero_atk);
|
||||
|
||||
if (hero_mdef<0) {
|
||||
hero_hp+=hero_mdef;
|
||||
hero_mdef=0;
|
||||
}
|
||||
// 更新勇士数据
|
||||
core.clearMap('data', left_start, top+margin+10, lineWidth, 40);
|
||||
core.setTextAlign('data', 'right');
|
||||
core.fillText('data', hero_hp, left_end, top+margin+10+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
if (core.flags.enableMDef) {
|
||||
core.clearMap('data', left_start, top+margin+10+3*lineHeight, lineWidth, 40);
|
||||
core.fillText('data', hero_mdef, left_end, top+margin+10+26+3*lineHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// 怪物攻击
|
||||
core.drawLine('data', left + margin + 6, top+margin+heroHeight+(boxWidth-32)-6,
|
||||
left+margin+boxWidth-6, top+margin+6, '#FF0000', 4);
|
||||
setTimeout(function() {
|
||||
core.clearMap('data', left + margin, top+margin, boxWidth, heroHeight+boxWidth-32);
|
||||
}, 250);
|
||||
|
||||
var per_damage = mon_atk-hero_def;
|
||||
if (per_damage < 0) per_damage = 0;
|
||||
|
||||
hero_mdef-=per_damage;
|
||||
if (hero_mdef<0) {
|
||||
hero_hp+=hero_mdef;
|
||||
hero_mdef=0;
|
||||
}
|
||||
// 更新勇士数据
|
||||
core.clearMap('data', left_start, top+margin+10, lineWidth, 40);
|
||||
core.setTextAlign('data', 'right');
|
||||
core.fillText('data', hero_hp, left_end, top+margin+10+26, '#DDDDDD', 'bold 16px '+globalFont);
|
||||
|
||||
if (core.flags.enableMDef) {
|
||||
core.clearMap('data', left_start, top+margin+10+3*lineHeight, lineWidth, 40);
|
||||
core.fillText('data', hero_mdef, left_end, top+margin+10+26+3*lineHeight);
|
||||
}
|
||||
|
||||
}
|
||||
turn++;
|
||||
if (turn>=turns) turn=0;
|
||||
|
||||
if (hero_hp<=0 || mon_hp<=0) {
|
||||
// 战斗结束
|
||||
clearInterval(battleInterval);
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.clearMap('ui');
|
||||
core.setAlpha('ui', 1.0);
|
||||
core.clearMap('data');
|
||||
if (core.status.event.id=='battle') {
|
||||
core.unLockControl();
|
||||
core.status.event.id=null;
|
||||
}
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
}, 400);
|
||||
}
|
||||
|
||||
////// 绘制等待界面 //////
|
||||
ui.prototype.drawWaiting = function(text) {
|
||||
|
||||
|
||||
@ -388,9 +388,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"startDirectly": false,
|
||||
"statusCanvas": false,
|
||||
"statusCanvasRowsOnMobile": 3,
|
||||
"canOpenBattleAnimate": true,
|
||||
"showBattleAnimateConfirm": false,
|
||||
"battleAnimate": false,
|
||||
"displayEnemyDamage": true,
|
||||
"displayCritical": true,
|
||||
"displayExtraDamage": true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user