Merge branch 'noAnimate' into hasAnimate

This commit is contained in:
bdf1 2023-01-04 06:09:30 +13:00
commit 92548bc2a2
6 changed files with 893 additions and 291 deletions

View File

@ -417,6 +417,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"baofa", "baofa",
"daizhi", "daizhi",
"daji", "daji",
"daji_bai",
"dajian", "dajian",
"daluoleitian", "daluoleitian",
"daluoleitianhong", "daluoleitianhong",

View File

@ -55,15 +55,8 @@ main.floors.MT9=
"function": "function(){\ncore.Confirmskip_On();\n}" "function": "function(){\ncore.Confirmskip_On();\n}"
}, },
{ {
"type": "move", "type": "function",
"loc": [ "function": "function(){\ncore.moveHidingBlock(9,3,[\"right:3\"],500,0);\n}"
9,
3
],
"time": 500,
"steps": [
"right:3"
]
}, },
{ {
"type": "showImage2", "type": "showImage2",
@ -142,7 +135,7 @@ main.floors.MT9=
}, },
{ {
"type": "animate", "type": "animate",
"name": "hanyou", "name": "han",
"loc": [ "loc": [
8, 8,
3 3
@ -185,15 +178,8 @@ main.floors.MT9=
"time": 500 "time": 500
}, },
{ {
"type": "move", "type": "function",
"loc": [ "function": "function(){\ncore.moveHidingBlock(8,3,[\"right:4\"],500,0);\n}"
8,
3
],
"time": 500,
"steps": [
"right:4"
]
}, },
{ {
"type": "function", "type": "function",

View File

@ -75,8 +75,8 @@ main.floors.QISHI=
], ],
"text": [ "text": [
255, 255,
0, 128,
244, 255,
1 1
], ],
"background": "winskin.png", "background": "winskin.png",

View File

@ -257,177 +257,177 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
return true; return true;
}, },
"afterBattle": function (enemyId, x, y) { "afterBattle": function (enemyId, x, y) {
// 战斗结束后触发的事件 // 战斗结束后触发的事件
var enemy = core.material.enemys[enemyId]; var enemy = core.material.enemys[enemyId];
var special = enemy.special; var special = enemy.special;
// 播放战斗音效和动画 // 播放战斗音效和动画
// 默认播放的动画;你也可以使用 // 默认播放的动画;你也可以使用
var animate = 'hand'; // 默认动画 var animate = 'daji_bai'; // 默认动画
// 检查当前装备是否存在攻击动画 // 检查当前装备是否存在攻击动画
var equipId = core.getEquip(0); var equipId = core.getEquip(0);
if (equipId && (core.material.items[equipId].equip || {}).animate) if (equipId && (core.material.items[equipId].equip || {}).animate)
animate = core.material.items[equipId].equip.animate; animate = core.material.items[equipId].equip.animate;
// 你也可以在这里根据自己的需要比如enemyId或special或flag来修改播放的动画效果 // 你也可以在这里根据自己的需要比如enemyId或special或flag来修改播放的动画效果
// if (enemyId == '...') animate = '...'; // if (enemyId == '...') animate = '...';
// 检查该动画是否存在SE如果不存在则使用默认音效 // 检查该动画是否存在SE如果不存在则使用默认音效
if (!(core.material.animates[animate] || {}).se) if (!(core.material.animates[animate] || {}).se)
core.playSound('attack.mp3'); core.playSound('attack.mp3');
// 播放动画;如果不存在坐标(强制战斗)则播放到勇士自身 // 播放动画;如果不存在坐标(强制战斗)则播放到勇士自身
if (x != null && y != null) if (x != null && y != null)
core.drawAnimate(animate, x, y); core.drawAnimate(animate, x, y);
else else
core.drawHeroAnimate(animate); core.drawHeroAnimate(animate);
// 获得战斗伤害信息 // 获得战斗伤害信息
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {}; var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {};
// 战斗伤害 // 战斗伤害
var damage = damageInfo.damage; var damage = damageInfo.damage;
// 当前战斗回合数,可用于战后所需的判定 // 当前战斗回合数,可用于战后所需的判定
var turn = damageInfo.turn; var turn = damageInfo.turn;
// 判定是否致死 // 判定是否致死
if (damage == null || damage >= core.status.hero.hp) { if (damage == null || damage >= core.status.hero.hp) {
core.status.hero.hp = 0; core.status.hero.hp = 0;
core.updateStatusBar(false, true); core.updateStatusBar(false, true);
core.events.lose('战斗失败'); core.events.lose('战斗失败');
return; return;
} }
// 扣减体力值并记录统计数据 // 扣减体力值并记录统计数据
core.status.hero.hp -= damage; core.status.hero.hp -= damage;
core.status.hero.statistics.battleDamage += damage; core.status.hero.statistics.battleDamage += damage;
core.status.hero.statistics.battle++; core.status.hero.statistics.battle++;
// 计算当前怪物的支援怪物 // 计算当前怪物的支援怪物
var guards = []; var guards = [];
if (x != null && y != null) { if (x != null && y != null) {
guards = core.getFlag("__guards__" + x + "_" + y, []); guards = core.getFlag("__guards__" + x + "_" + y, []);
core.removeFlag("__guards__" + x + "_" + y); core.removeFlag("__guards__" + x + "_" + y);
} }
core.status.hero.mdef += [20, 3, 2, 1, 0, 20][core.getFlag('hard', 0)]; core.status.hero.mdef += [20, 3, 2, 1, 0, 20][core.getFlag('hard', 0)];
// 获得金币 // 获得金币
var money = guards.reduce(function (curr, g) { var money = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].money; return curr + core.material.enemys[g[2]].money;
}, core.getEnemyValue(enemy, "money", x, y)); }, core.getEnemyValue(enemy, "money", x, y));
if (core.hasItem('coin')) money *= 2; // 幸运金币:双倍 if (core.hasItem('coin')) money *= 2; // 幸运金币:双倍
if (core.hasFlag('curse')) money = 0; // 诅咒效果 if (core.hasFlag('curse')) money = 0; // 诅咒效果
core.status.hero.money += money; core.status.hero.money += money;
core.status.hero.statistics.money += money; core.status.hero.statistics.money += money;
// 获得经验 // 获得经验
var exp = guards.reduce(function (curr, g) { var exp = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].exp; return curr + core.material.enemys[g[2]].exp;
}, core.getEnemyValue(enemy, "exp", x, y)); }, core.getEnemyValue(enemy, "exp", x, y));
if (core.hasFlag('curse')) exp = 0; if (core.hasFlag('curse')) exp = 0;
core.status.hero.exp += exp; core.status.hero.exp += exp;
core.status.hero.statistics.exp += exp; core.status.hero.statistics.exp += exp;
var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y); var hint = "打败 " + core.getEnemyValue(enemy, "name", x, y);
if (core.flags.statusBarItems.indexOf('enableMoney') >= 0) if (core.flags.statusBarItems.indexOf('enableMoney') >= 0)
hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money; hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money;
if (core.flags.statusBarItems.indexOf('enableExp') >= 0) if (core.flags.statusBarItems.indexOf('enableExp') >= 0)
hint += ',' + core.getStatusLabel('exp') + '+' + exp; // hint += ",经验+" + exp; hint += ',' + core.getStatusLabel('exp') + '+' + exp; // hint += ",经验+" + exp;
core.drawTip(hint, enemy.id); if (!core.getFlag("isNoTip")) core.drawTip(hint, enemy.id);
// 中毒 // 中毒
if (core.enemys.hasSpecial(special, 12)) { if (core.enemys.hasSpecial(special, 12)) {
core.triggerDebuff('get', 'poison'); core.triggerDebuff('get', 'poison');
} }
// 衰弱 // 衰弱
if (core.enemys.hasSpecial(special, 13)) { if (core.enemys.hasSpecial(special, 13)) {
core.triggerDebuff('get', 'weak'); core.triggerDebuff('get', 'weak');
} }
// 诅咒 // 诅咒
if (core.enemys.hasSpecial(special, 14)) { if (core.enemys.hasSpecial(special, 14)) {
core.triggerDebuff('get', 'curse'); core.triggerDebuff('get', 'curse');
} }
// 仇恨怪物将仇恨值减半 // 仇恨怪物将仇恨值减半
if (core.enemys.hasSpecial(special, 17)) { if (core.enemys.hasSpecial(special, 17)) {
core.setFlag('hatred', Math.floor(core.getFlag('hatred', 0) / 2)); core.setFlag('hatred', Math.floor(core.getFlag('hatred', 0) / 2));
} }
// 自爆 // 自爆
if (core.enemys.hasSpecial(special, 19)) { if (core.enemys.hasSpecial(special, 19)) {
core.status.hero.statistics.battleDamage += core.status.hero.hp - 1; core.status.hero.statistics.battleDamage += core.status.hero.hp - 1;
core.status.hero.hp = 1; core.status.hero.hp = 1;
} }
// 退化 // 退化
if (core.enemys.hasSpecial(special, 21)) { if (core.enemys.hasSpecial(special, 21)) {
core.status.hero.atk -= (enemy.atkValue || 0); core.status.hero.atk -= (enemy.atkValue || 0);
core.status.hero.def -= (enemy.defValue || 0); core.status.hero.def -= (enemy.defValue || 0);
if (core.status.hero.atk < 0) core.status.hero.atk = 0; if (core.status.hero.atk < 0) core.status.hero.atk = 0;
if (core.status.hero.def < 0) core.status.hero.def = 0; if (core.status.hero.def < 0) core.status.hero.def = 0;
} }
// 增加仇恨值 // 增加仇恨值
core.setFlag('hatred', core.getFlag('hatred', 0) + core.values.hatred); core.setFlag('hatred', core.getFlag('hatred', 0) + core.values.hatred);
// 战后的技能处理,比如扣除魔力值 // 战后的技能处理,比如扣除魔力值
if (core.flags.statusBarItems.indexOf('enableSkill') >= 0) { if (core.flags.statusBarItems.indexOf('enableSkill') >= 0) {
// 检测当前开启的技能类型 // 检测当前开启的技能类型
var skill = core.getFlag('skill', 0); var skill = core.getFlag('skill', 0);
if (skill == 1) { // 技能1二倍斩 if (skill == 1) { // 技能1二倍斩
core.status.hero.mana -= 5; // 扣除5点魔力值 core.status.hero.mana -= 5; // 扣除5点魔力值
} }
// 关闭技能 // 关闭技能
core.setFlag('skill', 0); core.setFlag('skill', 0);
core.setFlag('skillName', '无'); core.setFlag('skillName', '无');
} }
core.addPop(x * 32, y * 32, core.getBlockId(x, y));
// 事件的处理
var todo = [];
// 事件的处理 // 加点事件
var todo = []; var point = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].point;
}, core.getEnemyValue(enemy, "point", x, y)) || 0;
if (core.flags.enableAddPoint && point > 0) {
core.push(todo, [{ "type": "insert", "name": "加点事件", "args": [point] }]);
}
// 加点事件 // 战后事件
var point = guards.reduce(function (curr, g) { if (core.status.floorId != null) {
return curr + core.material.enemys[g[2]].point; core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
}, core.getEnemyValue(enemy, "point", x, y)) || 0; }
if (core.flags.enableAddPoint && point > 0) { core.push(todo, enemy.afterBattle);
core.push(todo, [{ "type": "insert", "name": "加点事件", "args": [point] }]);
}
// 战后事件 // 在这里增加其他的自定义事件需求
if (core.status.floorId != null) { /*
core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]); if (enemyId=='xxx') {
} core.push(todo, [
core.push(todo, enemy.afterBattle); {"type": "...", ...},
]);
}
*/
// 在这里增加其他的自定义事件需求 // 如果事件不为空,将其插入
/* if (todo.length > 0) core.insertAction(todo, x, y);
if (enemyId=='xxx') {
core.push(todo, [
{"type": "...", ...},
]);
}
*/
// 如果事件不为空,将其插入 // 删除该点设置的怪物信息
if (todo.length > 0) core.insertAction(todo, x, y); delete((flags.enemyOnPoint || {})[core.status.floorId] || {})[x + "," + y];
// 删除该点设置的怪物信息 // 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率
delete ((flags.enemyOnPoint || {})[core.status.floorId] || {})[x + "," + y]; if (core.getBlock(x, y) != null) {
// 检查是否是重生怪物;如果是则仅隐藏不删除
if (core.hasSpecial(enemy.special, 23)) {
core.hideBlock(x, y);
} else {
core.removeBlock(x, y);
}
} else {
core.updateStatusBar();
}
// 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率 // 如果已有事件正在处理中
if (core.getBlock(x, y) != null) { if (core.status.event.id == null)
// 检查是否是重生怪物;如果是则仅隐藏不删除 core.continueAutomaticRoute();
if (core.hasSpecial(enemy.special, 23)) { else
core.hideBlock(x, y); core.clearContinueAutomaticRoute();
} else {
core.removeBlock(x, y);
}
} else {
core.updateStatusBar();
}
// 如果已有事件正在处理中 },
if (core.status.event.id == null)
core.continueAutomaticRoute();
else
core.clearContinueAutomaticRoute();
},
"afterOpenDoor": function (doorId, x, y) { "afterOpenDoor": function (doorId, x, y) {
// 开一个门后触发的事件 // 开一个门后触发的事件
@ -450,27 +450,29 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
}, },
"afterGetItem": function (itemId, x, y, isGentleClick) { "afterGetItem": function (itemId, x, y, isGentleClick) {
// 获得一个道具后触发的事件 // 获得一个道具后触发的事件
// itemId获得的道具IDx和y是该道具所在的坐标 // itemId获得的道具IDx和y是该道具所在的坐标
// isGentleClick是否是轻按触发的 // isGentleClick是否是轻按触发的
if (itemId.endsWith('Potion') && core.material.items[itemId].cls == 'items') if (itemId.endsWith('Potion') && core.material.items[itemId].cls == 'items')
core.playSound('回血'); core.playSound('回血');
else if (itemId.endsWith('Gem') && core.material.items[itemId].cls == 'items') else if (itemId.endsWith('Gem') && core.material.items[itemId].cls == 'items')
core.playSound('宝石') core.playSound('宝石')
else else
core.playSound('获得道具'); core.playSound('获得道具');
var todo = [];
// 检查该点的获得道具后事件。
if (core.status.floorId == null) return;
var event = core.floors[core.status.floorId].afterGetItem[x + "," + y];
if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) {
if (event.data) event = event.data;
core.unshift(todo, event);
}
if (todo.length > 0) core.insertAction(todo, x, y);
}, var todo = [];
// 检查该点的获得道具后事件。
if (core.status.floorId == null) return;
var event = core.floors[core.status.floorId].afterGetItem[x + "," + y];
if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) {
if (event.data) event = event.data;
core.unshift(todo, event);
}
if (todo.length > 0) core.insertAction(todo, x, y);
},
"afterPushBox": function () { "afterPushBox": function () {
// 推箱子后的事件 // 推箱子后的事件
if (core.searchBlock('box').length == 0) { if (core.searchBlock('box').length == 0) {
@ -847,7 +849,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.load(true); core.load(true);
break; break;
case 69: // E上 //打开光标 case 69: // E上 //打开光标
if ((core.flags.flyNearStair && !core.nearStair())) if (!core.hasItem('fly'))
core.drawTip("你没有" + core.material.items['fly'].name, 'fly');
else if ((core.flags.flyNearStair && !core.nearStair()))
core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly');
else if (!core.canUseItem('fly')) else if (!core.canUseItem('fly'))
core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly');
@ -868,7 +872,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.openToolbox(true); core.openToolbox(true);
break; break;
case 81: // Q下 //打开装备栏 case 81: // Q下 //打开装备栏
if ((core.flags.flyNearStair && !core.nearStair())) if (!core.hasItem('fly'))
core.drawTip("你没有" + core.material.items['fly'].name, 'fly');
else if ((core.flags.flyNearStair && !core.nearStair()))
core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly');
else if (!core.canUseItem('fly')) else if (!core.canUseItem('fly'))
core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly');
@ -1000,7 +1006,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.isReplaying() && vertical != null) return vertical; if (core.isReplaying() && vertical != null) return vertical;
return core.domStyle.isVertical; return core.domStyle.isVertical;
} }
if (core.status.floorId == "nandu") {
var h = -1;
if (py >= 46 && py <= 430) h = Math.floor((py - 46) / 77) + 1;
if (h > 0) {
core.actions._clickAction(0, Math.floor(py / 16), 1, py)
}
}
// 如果正在执行事件,则忽略 // 如果正在执行事件,则忽略
if (core.status.lockControl) return; if (core.status.lockControl) return;
// 如果当前正在行走,则忽略;也可以使用 core.waitHeroToStop(callback) 来停止行走再回调执行脚本 // 如果当前正在行走,则忽略;也可以使用 core.waitHeroToStop(callback) 来停止行走再回调执行脚本
@ -1643,7 +1655,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.ui.fillText(ctx, text, x, y, style); core.ui.fillText(ctx, text, x, y, style);
}, },
fill1 = function (text, x, y, style) { fill1 = function (text, x, y, style) {
core.ui.setFont(ctx, '10px fzchyjw'); core.ui.setFont(ctx, '14px fzchyjw');
core.ui.fillText(ctx, text, x, y, style); core.ui.fillText(ctx, text, x, y, style);
}; };
@ -1699,7 +1711,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
fill(core.formatBigNumber(core.status.hero.money), 107, 91 + 35 + 36 + 34 + 32, '#000000'); fill(core.formatBigNumber(core.status.hero.money), 107, 91 + 35 + 36 + 34 + 32, '#000000');
fill(core.getFlag("juqing", 0), 107, 91 + 35 + 36 + 34 + 32 + 32, '#FF0000'); fill(core.getFlag("juqing", 0), 107, 91 + 35 + 36 + 34 + 32 + 32, '#FF0000');
ctx.textAlign = 'left'; ctx.textAlign = 'left';
if (flags.hard - 4) fill1('[' + core.formatBigNumber(core.getRealStatus('mdef')) + ']', 76, 174, '#FF1495'); if (flags.hard - 4) fill1('[' + core.formatBigNumber(core.getRealStatus('mdef')) + ']', 72, 176, '#c800c8');
if (core.status.event.id !== 'book' && core.status.event.id !== 'book-detail' && core.status.event.id !== 'toolbox') { if (core.status.event.id !== 'book' && core.status.event.id !== 'book-detail' && core.status.event.id !== 'toolbox') {
core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112); core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112);
fill('黄钥匙', 50, 320, '#FFFF80'); fill('黄钥匙', 50, 320, '#FFFF80');
@ -1733,8 +1745,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
//else //else
fill(hour + ':' + minutes + ':' + seconds, 140, 360, "#ffffff"); fill(hour + ':' + minutes + ':' + seconds, 140, 360, "#ffffff");
fill(step, 140, 455, '#ffffff'); fill(step, 140, 455, '#ffffff');
setTimeout(function(){core.ui.drawStatusBar();}, 100); setTimeout(function () { core.ui.drawStatusBar(); }, 100);
} }
if (core.status.floorId == "nandu") {
core.dom.statusCanvas.width *= 1;
core.dom.statusCanvas.style.zIndex=80;
}
else core.dom.statusCanvas.style.zIndex=50;
} }
} else if (core.flags.extendToolbar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏 } else if (core.flags.extendToolbar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏
if (!core.dymCanvas['status']) if (!core.dymCanvas['status'])

View File

@ -144,9 +144,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"itemEffectTip": ",攻击+0" "itemEffectTip": ",攻击+0"
}, },
"sword1": { "sword1": {
"cls": "items", "cls": "equips",
"name": "铁剑", "name": "铁剑",
"text": "一把很普通的铁剑", "text": "得到铁剑,攻击力+10",
"equip": { "equip": {
"type": 0, "type": 0,
"animate": "sword", "animate": "sword",

View File

@ -380,94 +380,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 立刻移动 // 立刻移动
core.setAutoHeroMove(); core.setAutoHeroMove();
} }
////// 绘制一个对话框 //////
/*core.ui.drawTextBox = function (content, config) {
config = config || {};
this.clearUI();
content = core.replaceText(content);
let ctx = core.getContextByName(config.ctx || 'ui');
if (ctx && main.mode == 'play') {
core.createCanvas(ctx, 0, 0, core._PX_, core._PY_, 141);
ctx = core.getContextByName(ctx);
}
// Step 1: 获得标题信息和位置信息
var textAttribute = core.status.textAttribute;
var titleInfo = this._getTitleAndIcon(content);
var posInfo = this._getPosition(titleInfo.content);
if (posInfo.position != 'up' && posInfo.position != 'down') posInfo.px = posInfo.py = null;
if (!posInfo.position) posInfo.position = textAttribute.position;
content = this._drawTextBox_drawImages(posInfo.content, config.ctx);
if (config.pos) {
delete posInfo.px;
delete posInfo.py;
posInfo.pos = config.pos;
}
posInfo.ctx = ctx;
// Step 2: 计算对话框的矩形位置
var hPos = this._drawTextBox_getHorizontalPosition(content, titleInfo, posInfo);
var vPos = this._drawTextBox_getVerticalPosition(content, titleInfo, posInfo, hPos.validWidth);
posInfo.xoffset = hPos.xoffset;
posInfo.yoffset = vPos.yoffset - 4;
if (ctx && main.mode == 'play') {
ctx.canvas.setAttribute('_text_left', hPos.left);
ctx.canvas.setAttribute('_text_top', vPos.top);
}
// Step 3: 绘制背景图
var isWindowSkin = this.drawBackground(hPos.left, vPos.top, hPos.right, vPos.bottom, posInfo);
if (titleInfo.title) {
let titlefont = core.status.textAttribute.titlefont,
titleStyle = core.arrayToRGBA(core.status.textAttribute.title);
let tf = this._buildFont(titlefont, false),
width = this.calWidth(ctx, titleInfo.title, tf);
this.drawBackground(hPos.left, vPos.top - titlefont - 12 - 10, hPos.left + width + 30, vPos.top, posInfo);
ctx.save();
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
core.fillText(ctx, titleInfo.title, hPos.left + (width + 30) / 2 - 5, vPos.top - (titlefont + 12) / 2 - 5, titleStyle, tf);
ctx.restore();
}
titleInfo.title = null;
var alpha = isWindowSkin ? this._drawWindowSkin_getOpacity() : textAttribute.background[3];
// Step 4: 绘制标题、头像、动画
var content_top = this._drawTextBox_drawTitleAndIcon(titleInfo, hPos, vPos, alpha, config.ctx);
// Step 5: 绘制正文
var config = this.drawTextContent(config.ctx || 'ui', content, {
left: hPos.content_left,
top: content_top,
maxWidth: hPos.validWidth,
lineHeight: vPos.lineHeight,
time: (config.showAll || config.async || textAttribute.time <= 0 || core.status.event.id != 'action') ? 0 : textAttribute.time
});
// Step 6: 绘制光标
if (main.mode == 'play') {
main.dom.next.style.display = 'block';
main.dom.next.style.borderRightColor = main.dom.next.style.borderBottomColor = core.arrayToRGB(textAttribute.text);
main.dom.next.style.top = (vPos.bottom - 20) * core.domStyle.scale + "px";
var left = (hPos.left + hPos.right) / 2;
if (posInfo.position == 'up' && !posInfo.noPeak && posInfo.px != null && Math.abs(posInfo.px * 32 + 16 - left) < 50)
left = hPos.right - 64;
main.dom.next.style.left = left * core.domStyle.scale + "px";
}
return config;
}
*/
ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, vPos, ctx) { ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, vPos, ctx) {
var hasCtx = ctx != null; var hasCtx = ctx != null;
ctx = ctx || 'ui'; ctx = ctx || 'ui';
// 选项 // 选项
core.setTextAlign(ctx, 'left'); core.setTextAlign(ctx, 'center');
core.setFont(ctx, this._buildFont(17, true)); core.setFont(ctx, this._buildFont(17, true));
for (var i = 0; i < choices.length; i++) { for (var i = 0; i < choices.length; i++) {
var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text); var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text);
@ -484,7 +402,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
offset += 14; offset += 14;
} }
} }
core.fillText(ctx, choices[i].text, offset - 70, vPos.choice_top + 32 * i, color, ui.prototype._buildFont(22, false)); core.fillText(ctx, choices[i].text, core.status.event.id != 'action' ? offset : offset - 55, vPos.choice_top + 32 * i, color, ui.prototype._buildFont(22, false));
} }
if (choices.length > 0 && core.status.event.selection != 'none') { if (choices.length > 0 && core.status.event.selection != 'none') {
@ -498,7 +416,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
len + 10, 28, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20); len + 10, 28, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20);
} else { } else {
this._drawWindowSelector(core.status.textAttribute.background, this._drawWindowSelector(core.status.textAttribute.background,
core._PX_ / 2 - len / 2 - 5 - 60, vPos.choice_top + 32 * core.status.event.selection - 20, len + 10, 28); core.status.event.id != 'action' ? (core._PX_ / 2 - len / 2 - 5 - 20) : (core._PX_ / 2 - len / 2 - 5 - 60), vPos.choice_top + 32 * core.status.event.selection - 20, core.status.event.id != 'action' ? (len + 10 + 30) : (len + 10 + 30), 28);
} }
} else } else
core.strokeRoundRect(ctx, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20, core.strokeRoundRect(ctx, core._PX_ / 2 - len / 2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20,
@ -511,7 +429,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.ui._drawSettings = function () { core.ui._drawSettings = function () {
core.status.event.id = 'settings'; core.status.event.id = 'settings';
this.drawChoices(null, [ this.drawChoices(null, [
"系统设置", "虚拟键盘", "浏览地图", "存档笔记", "同步存档", "游戏信息", "返回标题", "返回游戏", "数值显示: " + (core.getFlag("itemDetail") ? "[ON]" : "[OFF]"), "RM楼传 " + (core.getFlag("isRmFly") ? "[ON]" : "[OFF]") "系统设置", "虚拟键盘", "浏览地图", "存档笔记", "同步存档", "游戏信息", "返回标题", "返回游戏", "爽塔相关", "RM相关"
]); ]);
} }
core.actions._clickSettings = function (x, y) { core.actions._clickSettings = function (x, y) {
@ -558,20 +476,45 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.ui.closePanel(); core.ui.closePanel();
break; break;
case 8: case 8:
core.status.event.selection = 0;
core.playSound('确定'); core.playSound('确定');
core.ui._drawShuangta();
/*core.playSound('');
core.setFlag("itemDetail", !core.getFlag("itemDetail")); core.setFlag("itemDetail", !core.getFlag("itemDetail"));
core.getItemDetail(); core.getItemDetail();
core.ui.closePanel(); core.ui.closePanel();*/
break; break;
case 9: case 9:
core.status.event.selection = 0;
core.playSound('确定'); core.playSound('确定');
core.ui._drawRM();
/*core.playSound('');
core.setFlag("isRmFly", !core.getFlag("isRmFly")); core.setFlag("isRmFly", !core.getFlag("isRmFly"));
core.ui.closePanel(); core.ui.closePanel();*/
break; break;
} }
} }
return; return;
} }
core.ui._drawShuangta = function () {
core.status.event.id = 'shuangta';
this.drawChoices(null, [
"数值显示: " + (core.getFlag("itemDetail") ? "[ON]" : "[OFF]"),
"自动拾取: " + (core.getFlag("__autoGetItem__") ? "[ON]" : "[OFF]"),
"自动清怪: " + (core.getFlag("__autoBattle__") ? "[ON]" : "[OFF]"), "返回主菜单"
]);
}
core.ui._drawRM = function () {
core.status.event.id = 'rm';
this.drawChoices(null, [
"RM楼传 " + (core.getFlag("isRmFly") ? "[ON]" : "[OFF]"),
"显伤靠右: " + (core.getFlag("isDamageRight") ? "[ON]" : "[OFF]"),
"零伤白色: " + (core.getFlag("isZeroWhite") ? "[ON]" : "[OFF]"),
"道具打怪不提示: " + (core.getFlag("isNoTip") ? "[ON]" : "[OFF]"),
"手册显示普通: " + (core.getFlag("isCommon") ? "[ON]" : "[OFF]"),
"返回主菜单"
]);
}
////// 获得某个物品 ////// ////// 获得某个物品 //////
core.events.getItem = function (id, num, x, y, isGentleClick, callback) { core.events.getItem = function (id, num, x, y, isGentleClick, callback) {
if (num == null) num = 1; if (num == null) num = 1;
@ -581,7 +524,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var text = '获得 ' + core.material.items[id].name; var text = '获得 ' + core.material.items[id].name;
if (num > 1) text += "x" + num; if (num > 1) text += "x" + num;
if (itemCls === 'items' && num == 1) text += core.items.getItemEffectTip(id); if (itemCls === 'items' && num == 1) text += core.items.getItemEffectTip(id);
//core.drawTip(text, id); if (!core.getFlag("isNoTip")) core.drawTip(text, id);
// --- 首次获得道具的提示 // --- 首次获得道具的提示
if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []); if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []);
@ -623,7 +566,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933'; else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933';
else if (damage < core.status.hero.hp) color = '#FF9933'; else if (damage < core.status.hero.hp) color = '#FF9933';
else color = '#FF2222'; else color = '#FF2222';
if (!core.getFlag('isZeroWhite')) {
if (damage <= 0) color = '#11FF11';
else if (damage < core.status.hero.hp / 3) color = '#FFFFFF';
else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00';
else if (damage < core.status.hero.hp) color = '#FF9933';
else color = '#FF2222';
}
damage = core.formatBigNumber(damage, true); damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(enemy, 19)) if (core.enemys.hasSpecial(enemy, 19))
damage += "+"; damage += "+";
@ -645,7 +594,475 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.createCanvas('bookBg', 0, 0, 480, 480, 138); ///创建一个动态画布用于绘制手册bg core.createCanvas('bookBg', 0, 0, 480, 480, 138); ///创建一个动态画布用于绘制手册bg
core.drawWindowSkin('winskin.png', 'bookBg', 0, 0, core._PX_, core._PY_); core.drawWindowSkin('winskin.png', 'bookBg', 0, 0, core._PX_, core._PY_);
} }
core.actions._sys_keyDown_lockControl = function (keyCode) {
if (!core.status.lockControl) return false;
// Ctrl跳过对话
if (keyCode == 17) {
this.keyDownCtrl();
return true;
}
switch (core.status.event.id) {
case 'action':
this._keyDownAction(keyCode);
break;
case 'book':
this._keyDownBook(keyCode);
break;
case 'fly':
this._keyDownFly(keyCode);
break;
case 'viewMaps':
this._keyDownViewMaps(keyCode);
break;
case 'equipbox':
this._keyDownEquipbox(keyCode);
break;
case 'toolbox':
this._keyDownToolbox(keyCode);
break;
case 'save':
case 'load':
case 'replayLoad':
case 'replayRemain':
case 'replaySince':
this._keyDownSL(keyCode);
break;
case 'selectShop':
case 'switchs':
case 'switchs-sounds':
case 'switchs-display':
case 'switchs-action':
case 'notes':
case 'settings':
case 'syncSave':
case 'syncSelect':
case 'localSaveSelect':
case 'storageRemove':
case 'replay':
case 'gameInfo':
case 'shuangta':
case 'rm':
this._keyDownChoices(keyCode);
break;
case 'cursor':
this._keyDownCursor(keyCode);
break;
}
return true;
}
core.actions._sys_keyUp_lockControl = function (keyCode, altKey) {
if (!core.status.lockControl) return false;
var ok = function () {
return keyCode == 27 || keyCode == 88 || keyCode == 13 || keyCode == 32 || keyCode == 67;
}
core.status.holdingKeys = [];
switch (core.status.event.id) {
case 'text':
ok() && core.drawText();
break;
case 'confirmBox':
this._keyUpConfirmBox(keyCode);
break;
case 'action':
this._keyUpAction(keyCode);
break;
case 'about':
ok() && core.closePanel();
break;
case 'help':
ok() && core.closePanel();
break;
case 'book':
this._keyUpBook(keyCode);
break;
case 'book-detail':
ok() && this._clickBookDetail();
break;
case 'fly':
this._keyUpFly(keyCode);
break;
case 'viewMaps':
this._keyUpViewMaps(keyCode);
break;
case 'selectShop':
this._keyUpQuickShop(keyCode);
break;
case 'toolbox':
this._keyUpToolbox(keyCode);
break;
case 'equipbox':
this._keyUpEquipbox(keyCode, altKey);
break;
case 'save':
case 'load':
case 'replayLoad':
case 'replayRemain':
case 'replaySince':
this._keyUpSL(keyCode);
break;
case 'keyBoard':
ok() && core.closePanel();
break;
case 'switchs':
this._keyUpSwitchs(keyCode);
break;
case 'switchs-sounds':
this._keyUpSwitchs_sounds(keyCode);
break;
case 'switchs-display':
this._keyUpSwitchs_display(keyCode);
break;
case 'switchs-action':
this._keyUpSwitchs_action(keyCode);
break;
case 'settings':
this._keyUpSettings(keyCode);
break;
case 'notes':
this._keyUpNotes(keyCode);
break;
case 'syncSave':
this._keyUpSyncSave(keyCode);
break;
case 'syncSelect':
this._keyUpSyncSelect(keyCode);
break;
case 'localSaveSelect':
this._keyUpLocalSaveSelect(keyCode);
break;
case 'storageRemove':
this._keyUpStorageRemove(keyCode);
break;
case 'cursor':
this._keyUpCursor(keyCode);
break;
case 'replay':
this._keyUpReplay(keyCode);
break;
case 'gameInfo':
this._keyUpGameInfo(keyCode);
break;
case 'shuangta':
this._keyUpShuangta(keyCode);
break;
case 'rm':
this._keyUpRM(keyCode);
break;
case 'centerFly':
this._keyUpCenterFly(keyCode);
break;
}
return true;
}
core.actions._sys_ondown_lockControl = function (x, y, px, py) {
if (core.status.played && !core.status.lockControl) return false;
switch (core.status.event.id) {
case 'centerFly':
this._clickCenterFly(x, y, px, py);
break;
case 'book':
this._clickBook(x, y, px, py);
break;
case 'book-detail':
this._clickBookDetail(x, y, px, py);
break;
case 'fly':
this._clickFly(x, y, px, py);
break;
case 'viewMaps':
this._clickViewMaps(x, y, px, py);
break;
case 'switchs':
this._clickSwitchs(x, y, px, py);
break;
case 'switchs-sounds':
this._clickSwitchs_sounds(x, y, px, py);
break;
case 'switchs-display':
this._clickSwitchs_display(x, y, px, py);
break;
case 'switchs-action':
this._clickSwitchs_action(x, y, px, py);
break;
case 'settings':
this._clickSettings(x, y, px, py);
break;
case 'selectShop':
this._clickQuickShop(x, y, px, py);
break;
case 'equipbox':
this._clickEquipbox(x, y, px, py);
break;
case 'toolbox':
this._clickToolbox(x, y, px, py);
break;
case 'save':
case 'load':
case 'replayLoad':
case 'replayRemain':
case 'replaySince':
this._clickSL(x, y, px, py);
break;
case 'confirmBox':
this._clickConfirmBox(x, y, px, py);
break;
case 'keyBoard':
this._clickKeyBoard(x, y, px, py);
break;
case 'action':
this._clickAction(x, y, px, py);
break;
case 'text':
core.drawText();
break;
case 'notes':
this._clickNotes(x, y, px, py);
break;
case 'syncSave':
this._clickSyncSave(x, y, px, py);
break;
case 'syncSelect':
this._clickSyncSelect(x, y, px, py);
break;
case 'localSaveSelect':
this._clickLocalSaveSelect(x, y, px, py);
break;
case 'storageRemove':
this._clickStorageRemove(x, y, px, py);
break;
case 'cursor':
this._clickCursor(x, y, px, py);
break;
case 'replay':
this._clickReplay(x, y, px, py);
break;
case 'gameInfo':
this._clickGameInfo(x, y, px, py);
break;
case 'shuangta':
this._clickShuangta(x, y, px, py);
break;
case 'rm':
this._clickRM(x, y, px, py);
break;
case 'about':
case 'help':
core.ui.closePanel();
break;
}
// --- 长按判定
if (core.timeout.onDownTimeout == null) {
core.timeout.onDownTimeout = setTimeout(function () {
if (core.interval.onDownInterval == null) {
core.interval.onDownInterval = setInterval(function () {
if (!core.actions.longClick(x, y, px, py)) {
clearInterval(core.interval.onDownInterval);
core.interval.onDownInterval = null;
}
}, 40)
}
}, 500);
}
return true;
}
core.actions._sys_onmove_choices = function (x, y, px, py) {
if (!core.status.lockControl) return false;
switch (core.status.event.id) {
case 'action':
if (core.status.event.data.type == 'choices') {
this._onMoveChoices(x, y);
return true;
}
if (core.status.event.data.type == 'confirm') {
this._onMoveConfirmBox(x, y, px, py);
return true;
}
break;
case 'selectShop':
case 'switchs':
case 'switchs-sounds':
case 'switchs-display':
case 'switchs-action':
case 'notes':
case 'settings':
case 'syncSave':
case 'syncSelect':
case 'localSaveSelect':
case 'storageRemove':
case 'replay':
case 'gameInfo':
case 'shuangta':
case 'rm':
this._onMoveChoices(x, y);
return true;
case 'confirmBox':
this._onMoveConfirmBox(x, y, px, py);
return true;
default:
break;
}
return false;
}
core.actions._keyUpShuangta = function (keycode) {
if (keycode == 27 || keycode == 88) {
core.status.event.selection = 8;
core.playSound('取消');
return core.ui._drawSettings();
}
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickShuangta);
}
core.actions._clickShuangta = function (x, y) {
if (this._out(x)) return;
var choices = core.status.event.ui.choices;
var topIndex = this._getChoicesTopIndex(choices.length);
if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex;
core.status.event.selection = selection;
switch (selection) {
case 0:
core.setFlag("itemDetail", !core.getFlag("itemDetail"));
core.ui._drawShuangta();
break;
case 1:
core.setFlag("__autoGetItem__", !core.getFlag("__autoGetItem__"));
core.ui._drawShuangta();
break;
case 2:
core.setFlag("__autoBattle__", !core.getFlag("__autoBattle__"));
core.ui._drawShuangta();
break;
case 3:
core.status.event.selection = 8;
core.playSound('取消');
core.ui._drawSettings();
break;
}
}
}
core.actions._keyUpRM = function (keycode) {
if (keycode == 27 || keycode == 88) {
core.status.event.selection = 9;
core.playSound('取消');
return core.ui._drawSettings();
}
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickRM);
}
core.actions._clickRM = function (x, y) {
if (this._out(x)) return;
var choices = core.status.event.ui.choices;
var topIndex = this._getChoicesTopIndex(choices.length);
if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex;
core.status.event.selection = selection;
switch (selection) {
case 0:
core.setFlag("isRmFly", !core.getFlag("isRmFly"));
core.ui._drawRM();
break;
case 1:
core.setFlag("isDamageRight", !core.getFlag("isDamageRight"));
core.updateStatusBar();
core.ui._drawRM();
break;
case 2:
core.setFlag("isZeroWhite", !core.getFlag("isZeroWhite"));
core.updateStatusBar();
core.ui._drawRM();
break;
case 3:
core.setFlag("isNoTip", !core.getFlag("isNoTip"));
core.ui._drawRM();
break;
case 4:
core.setFlag("isCommon", !core.getFlag("isCommon"));
core.ui._drawRM();
break;
case 5:
core.status.event.selection = 9;
core.playSound('取消');
core.ui._drawSettings();
break;
}
}
}
core.actions.registerAction('keyDown', '_sys_keyDown_lockControl', core.actions._sys_keyDown_lockControl, 50);
core.actions.registerAction('keyUp', '_sys_keyUp_lockControl', core.actions._sys_keyUp_lockControl, 50);
core.actions.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30);
core.actions.registerAction('onmove', '_sys_onmove_choices', core.actions._sys_onmove_choices, 30);
main.dom.statusCanvas.onmousedown = main.dom.statusCanvas.onclick;
main.dom.statusCanvas.onclick = null;
main.dom.statusCanvas.onmousemove = function(e) {
try {
e.stopPropagation();
if (e == null) return;
var t = main.core.actions._getClickLoc(e.clientX, e.clientY);
px = Math.floor(t.x / core.domStyle.scale);
py = Math.floor(t.y / core.domStyle.scale);
if (core.status.floorId == "nandu") {
var h = -1;
if (py >= 46 && py <= 430) h = Math.floor((py - 46) / 77) + 1;
if (h > 0 && h != core.getFlag("hard") && px < 160) {
core.actions._clickAction(0, Math.floor(py / 16), 1, py);
}
}
} catch (ee) { console.error(ee) }
}
core.actions._sys_onmove = function (x, y, px, py) {
if (core.status.floorId == "nandu") {
var h = -1;
if (py >= 46 && py <= 430) h = Math.floor((py - 46) / 77) + 1;
if (h > 0 && h != core.getFlag("hard") && px < 160) {
core.actions._clickAction(0, Math.floor(py / 16), 1, py);
}
}
if (core.status.lockControl) return false;
if (core.status.preview.dragging) {
core.setViewport(core.bigmap.offsetX - px + core.status.preview.px, core.bigmap.offsetY - py + core.status.preview.py);
core.status.preview.px = px;
core.status.preview.py = py;
return true;
}
if (core.status.preview.prepareDragging) {
if (Math.abs(px - core.status.preview.px) <= 20 && Math.abs(py - core.status.preview.py) <= 20)
return true;
else core.status.preview.prepareDragging = false;
}
clearTimeout(core.timeout.onDownTimeout);
core.timeout.onDownTimeout = null;
if ((core.status.stepPostfix || []).length > 0) {
var pos = { 'x': parseInt((px + core.bigmap.offsetX) / 32), 'y': parseInt((py + core.bigmap.offsetY) / 32) };
var pos0 = core.status.stepPostfix[core.status.stepPostfix.length - 1];
var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x];
var max = 0, index = 4;
for (var ii = 0; ii < 4; ii++) {
if (directionDistance[ii] > max) {
index = ii;
max = directionDistance[ii];
}
}
pos = [{ 'x': 0, 'y': 1 }, { 'x': -1, 'y': 0 }, { 'x': 0, 'y': -1 }, { 'x': 1, 'y': 0 }, false][index]
if (pos) {
pos.x += pos0.x;
pos.y += pos0.y;
core.status.stepPostfix.push(pos);
core.fillRect('ui', pos.x * 32 + 12 - core.bigmap.offsetX, pos.y * 32 + 12 - core.bigmap.offsetY, 8, 8, '#bfbfbf');
}
}
return true;
}
core.actions.registerAction('onmove', '_sys_onmove', core.actions._sys_onmove, 0);
@ -690,7 +1107,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
top + 28, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字颜色,取消加粗 top + 28, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字颜色,取消加粗
switch (enemy.specialText.length) { switch (enemy.specialText.length) {
case 1: case 1:
core.fillText('ui', enemy.specialText[0][0] + ' ' + enemy.specialText[0][1], left + width / 2, ////单属性两个字中间空一格 core.fillText('ui', ((!core.getFlag('isCommon') || (2 != enemy.specialText[0].length)) ?
enemy.specialText[0] : enemy.specialText[0][0] + ' ' + enemy.specialText[0][1]),
left + width / 2, ////单属性两个字中间空一格
top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'), top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'),
this._buildFont(20, false), width); ////调大怪物字号,取消加粗 this._buildFont(20, false), width); ////调大怪物字号,取消加粗
break; break;
@ -908,7 +1327,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.drawPagination(info.constantsPage, info.constantsTotalPage); this.drawPagination(info.constantsPage, info.constantsTotalPage);
core.setTextAlign('ui', 'center'); core.setTextAlign('ui', 'center');
core.fillText('ui', '[装备栏]', core._PX_ - 46, 25, '#DDDDDD', this._buildFont(15, true)); //core.fillText('ui', '[装备栏]', core._PX_ - 46, 25, '#DDDDDD', this._buildFont(15, true));
core.fillText('ui', '返回游戏', core._PX_ - 46, core._PY_ - 13); core.fillText('ui', '返回游戏', core._PX_ - 46, core._PY_ - 13);
} }
@ -988,6 +1407,137 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (callback) callback(); if (callback) callback();
} }
////// “即捡即用类”道具的使用效果 //////
items.prototype.getItemEffect = function (itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items' || itemCls === "equips") {
var curr_hp = core.status.hero.hp;
var itemEffect = core.material.items[itemId].itemEffect;
if (itemEffect) {
try {
for (var i = 0; i < itemNum; ++i)
eval(itemEffect);
} catch (e) {
console.error(e);
}
}
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
var useItemEvent = core.material.items[itemId].useItemEvent;
if (useItemEvent) {
try {
core.insertAction(useItemEvent);
} catch (e) {
console.error(e);
}
}
core.updateStatusBar(false, true);
} else {
core.addItem(itemId, itemNum);
}
}
/////屏蔽装备栏
////// 点击装备栏时的打开操作 //////
events.prototype.openEquipbox = function (fromUserAction) {
if (core.isReplaying() || true) return; ////直接返回
if (!this._checkStatus('equipbox', fromUserAction)) return;
core.playSound('打开界面');
core.ui._drawEquipbox();
}
////// 工具栏界面时的点击操作 //////
actions.prototype._clickToolbox = function (x, y) {
var tools = core.getToolboxItems('tools'),
constants = core.getToolboxItems('constants');
// 装备栏
// if (x >= this.LAST - 2 && y == 0) {
// core.ui.closePanel();
// if (core.isReplaying())
// core.control._replay_equipbox();
// else
// core.openEquipbox();
// return;
// }
if (x >= this.LAST - 2 && y === core._HEIGHT_ - 1) {
core.playSound('取消');
core.ui.closePanel();
var last = core.status.route[core.status.route.length - 1] || '';
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
core.status.route.push('no');
}
core.checkAutoEvents();
return;
}
var toolsPage = core.status.event.data.toolsPage;
var constantsPage = core.status.event.data.constantsPage;
// 上一页
if (x == this._HX_ - 2 || x == this._HX_ - 3) {
if (y === core._HEIGHT_ - 1 - 5 && toolsPage > 1) {
core.status.event.data.toolsPage--;
core.playSound('光标移动');
core.ui._drawToolbox(core.status.event.selection);
}
if (y === core._HEIGHT_ - 1 && constantsPage > 1) {
core.status.event.data.constantsPage--;
core.playSound('光标移动');
core.ui._drawToolbox(core.status.event.selection);
}
}
// 下一页
if (x == this._HX_ + 2 || x == this._HX_ + 3) {
if (y === core._HEIGHT_ - 1 - 5 && toolsPage < Math.ceil(tools.length / this.LAST)) {
core.status.event.data.toolsPage++;
core.playSound('光标移动');
core.ui._drawToolbox(core.status.event.selection);
}
if (y === core._HEIGHT_ - 1 && constantsPage < Math.ceil(constants.length / this.LAST)) {
core.status.event.data.constantsPage++;
core.playSound('光标移动');
core.ui._drawToolbox(core.status.event.selection);
}
}
var index = parseInt(x / 2);
if (y === core._HEIGHT_ - 1 - 8) index += 0;
else if (y === core._HEIGHT_ - 1 - 6) index += this._HX_;
else if (y === core._HEIGHT_ - 1 - 3) index += this.LAST;
else if (y === core._HEIGHT_ - 1 - 1) index += this.LAST + this._HX_;
else index = -1;
if (index >= 0)
this._clickToolboxIndex(index);
}
////// 工具栏界面时,放开某个键的操作 //////
actions.prototype._keyUpToolbox = function (keycode) {
// if (keycode == 81) {
// core.playSound('确定');
// core.ui.closePanel();
// if (core.isReplaying())
// core.control._replay_equipbox();
// else
// core.openEquipbox();
// return;
//}
if (keycode == 84 || keycode == 27 || keycode == 88) {
core.playSound('取消');
core.ui.closePanel();
var last = core.status.route[core.status.route.length - 1] || '';
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
core.status.route.push('no');
}
core.checkAutoEvents();
return;
}
if (core.status.event.data == null) return;
if (keycode == 13 || keycode == 32 || keycode == 67) {
this._clickToolboxIndex(core.status.event.selection);
return;
}
}
}, },
"drawLight": function () { "drawLight": function () {
@ -2957,7 +3507,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// *** 下一句话可以更改你想要的显示字体 // *** 下一句话可以更改你想要的显示字体
core.setFont(ctx, "bold 11px Arial"); core.setFont(ctx, "bold 11px Arial");
// *** // ***
core.setTextAlign(ctx, "right"); core.setTextAlign(ctx, core.getFlag("isDamageRight") ? "right" : "left");
core.status.damage.data.forEach(function (one) { core.status.damage.data.forEach(function (one) {
var px = one.px, var px = one.px,
py = one.py; py = one.py;
@ -2967,7 +3517,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (px < -32 * 2 || px > core.__PX__ + 32 || py < -32 || py > core.__PY__ + 32) if (px < -32 * 2 || px > core.__PX__ + 32 || py < -32 || py > core.__PY__ + 32)
return; return;
} }
core.fillBoldText(ctx, one.text, px + 32, py, one.color); core.fillBoldText(ctx, one.text, px + (core.getFlag("isDamageRight") ? 32 : 0), py, one.color);
}); });
core.setTextAlign(ctx, 'center'); core.setTextAlign(ctx, 'center');
core.status.damage.extraData.forEach(function (one) { core.status.damage.extraData.forEach(function (one) {
@ -3360,7 +3910,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
} }
if (special === 0) { if (special === 0) {
text.push('普通'); ///////无特殊属性时增加“普通”属性显示 if (core.getFlag('isCommon')) text.push('普通'); ///////无特殊属性时增加“普通”属性显示
} }
return text; return text;
} }
@ -3392,7 +3942,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 准备渐变 // 准备渐变
this.maskPrepare = function () { this.maskPrepare = function () {
// 执行后画面将凝固 // 执行后画面将凝固
core.createCanvas("mask", 0, 0, core.__PIXELS__, core.__PIXELS__, 155); core.ui.createCanvas2("mask", 0, 0, core.__PIXELS__, core.__PIXELS__, 155);
for (var m in core.canvas) { for (var m in core.canvas) {
core.dymCanvas.mask.drawImage(core.canvas[m].canvas, 0, 0); core.dymCanvas.mask.drawImage(core.canvas[m].canvas, 0, 0);
}; };
@ -3674,7 +4224,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var _my_useS_PASS = function (keycode) { ////放开某个键 var _my_useS_PASS = function (keycode) { ////放开某个键
if (!core.getFlag('useS_PASS')) return false; if (!core.getFlag('useS_PASS')) return false;
if (keycode == 83) { ////按下S时 if (keycode == 83) { ////按下S时
core.Confirmskip(); if (core.hasAsync())
core.drawTip('请等待事件结束');
else
core.Confirmskip();
} }
}; };
core.registerAction('keyUp', 'useS_PASS', _my_useS_PASS, 100); core.registerAction('keyUp', 'useS_PASS', _my_useS_PASS, 100);
@ -3683,7 +4236,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (!core.getFlag('useS_PASS')) return false; if (!core.getFlag('useS_PASS')) return false;
if (x >= 7 && y <= 2) { if (x >= 7 && y <= 2) {
core.Confirmskip(); if (core.hasAsync())
core.drawTip('请等待事件结束');
else
core.Confirmskip();
} }
}, 100); }, 100);
@ -3976,5 +4532,47 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.relocateCanvas('ui', 0, 0); core.relocateCanvas('ui', 0, 0);
_doa.call(core.events); _doa.call(core.events);
} }
},
"怪物受击发亮": function () {
// 在此增加新插件
// 在此增加新插件
function pop() {
var ctx = core.getContextByName('pop');
if (!ctx) ctx = core.createCanvas('pop', 0, 0, core.__PIXELS__, core.__PIXELS__, 90);
core.clearMap(ctx);
if (core.status.replay.speed <= 3) {
var list = core.status.pop || [];
var count = 0;
list.forEach(function (one) {
one.frame++;
// 绘制
core.setFilter(ctx, 'brightness(' + (220 - 6 * one.frame) + '%)');
core.drawIcon(ctx, one.value, one.px, one.py, 32, 32);
if (one.frame >= 20) count++;
});
if (count > 0) list.splice(0, count);
}
}
if (!main.replayChecking) {
core.registerAnimationFrame('pop', true, pop);
}
/** 添加弹出内容 */
this.addPop = function (px, py, value, frame) {
var data = { px: px, py: py, value: value, frame: frame || 0 };
if (core.status.replay.speed <= 3) {
if (!core.status.pop) core.status.pop = [data];
else core.status.pop.push(data);
}
}
} }
} }