diff --git a/_docs/_api.md b/_docs/_api.md index db441be3..546db51e 100644 --- a/_docs/_api.md +++ b/_docs/_api.md @@ -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 // 绘制分页 diff --git a/_docs/element.md b/_docs/element.md index c5fcc4be..8d352fef 100644 --- a/_docs/element.md +++ b/_docs/element.md @@ -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`函数则给定了每个特殊属性的详细描述。这个描述将在怪物手册中看到。 diff --git a/_server/data.comment.js b/_server/data.comment.js index 76c87a1f..4b6d6156 100644 --- a/_server/data.comment.js +++ b/_server/data.comment.js @@ -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", diff --git a/libs/actions.js b/libs/actions.js index a899d99e..d94daf11 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -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; diff --git a/libs/core.js b/libs/core.js index 0092ac83..e1a03f86 100644 --- a/libs/core.js +++ b/libs/core.js @@ -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); diff --git a/libs/events.js b/libs/events.js index 02c68ae5..6b162aca 100644 --- a/libs/events.js +++ b/libs/events.js @@ -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)点的事件 ////// diff --git a/libs/ui.js b/libs/ui.js index 41290945..7f1a24b9 100644 --- a/libs/ui.js +++ b/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; i0) - 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) { diff --git a/project/data.js b/project/data.js index 9b502c42..5802ae43 100644 --- a/project/data.js +++ b/project/data.js @@ -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,