先攻优势、tip修改
This commit is contained in:
parent
7127a86aa4
commit
d940527146
@ -2357,7 +2357,7 @@ ui.prototype._drawBookDetail = function (index) {
|
||||
if (!enemy) return;
|
||||
var content = info[1].join("\n");
|
||||
core.status.event.id = 'book-detail';
|
||||
core.animateFrame.tip = null;
|
||||
core.animateFrame.tip = [];
|
||||
core.clearMap('data');
|
||||
|
||||
var left = 10, width = core._PX_ - 2 * left, right = left + width;
|
||||
@ -2583,7 +2583,7 @@ ui.prototype._drawViewMaps = function (index, x, y) {
|
||||
core.status.event.id = 'viewMaps';
|
||||
this.clearUI();
|
||||
if (index == null) return this._drawViewMaps_drawHint();
|
||||
core.animateFrame.tip = null;
|
||||
core.animateFrame.tip = [];
|
||||
core.status.checkBlock.cache = {};
|
||||
var data = this._drawViewMaps_buildData(index, x, y);
|
||||
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
|
||||
|
@ -1043,15 +1043,17 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
v.now = 0
|
||||
break
|
||||
}
|
||||
v.onAttack = false
|
||||
if (v.now === oneTurn) v.onAttack = true //增加正在攻击的标志
|
||||
|
||||
})
|
||||
const heroinfo = { hp: hero_hp, atk: hero_atk, def: hero_def, mdef: (!hero?.mdef || hero?.mdef === 100) ? hero_mdef : hero.mdef, spell: hero_spell, mhp: Math.floor(hero_spell * hero_mhp / 100), matk: Math.floor(hero_spell * hero_matk / 100), speed: hero_speed, now: 0, isAttack: false } //勇士属性
|
||||
const enemyinfo = { hp: mon_hp, atk: mon_atk, def: mon_def, mdef: mon_mdef, spell: mon_spell, speed: mon_speed, special: mon_special, now: 0, onAttack: false, isAttack: false } //怪物属性
|
||||
const enemyinfo = { hp: mon_hp, atk: mon_atk, def: mon_def, mdef: mon_mdef, spell: mon_spell, speed: mon_speed, special: mon_special, now: 0, isAttack: false } //怪物属性
|
||||
//先攻,先攻为怪物和勇士勇士行动前怪物出第一刀
|
||||
if (core.hasSpecial(mon_special, 1)) {
|
||||
enemyinfo.now = oneTurn
|
||||
enemyinfo.onAttack = true
|
||||
enemyinfo.now = oneTurn / 2
|
||||
heroinfo.now = 0
|
||||
} else {
|
||||
enemyinfo.now = 0
|
||||
heroinfo.now = oneTurn / 2
|
||||
}
|
||||
const start = [core.clone(heroinfo), core.clone(enemyinfo), core.clone(equipInfo), oneTurn] //记录开始战斗时的属性并转发
|
||||
//---第三部分:递归开始---
|
||||
@ -1070,68 +1072,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
enemy_diff = {},
|
||||
hero_animate = [],
|
||||
enemy_animate = [];
|
||||
if (enemyinfo.onAttack) { //怪物先攻的场合
|
||||
//这里计算怪物攻击时发生的各种变化,同时计入enemy_diff
|
||||
let mon_damage = 0
|
||||
let hero_damage = 0
|
||||
//伤害计算
|
||||
let per_damage = Math.max(enemyinfo.atk - heroinfo.def, 0),
|
||||
per_mdamage = Math.floor(enemyinfo.spell * (100 - heroinfo.mdef) / 100);
|
||||
|
||||
//这里记录伤害触发后的属性变化和动画,同时计入diff、damage(不要在此直接修改heroinfo和enemyinfo)
|
||||
if (core.hasSpecial(mon_special, 6)) {
|
||||
hero_damage += per_damage * enemy.n + per_mdamage * enemy.n
|
||||
} else {
|
||||
hero_damage += per_damage + per_mdamage
|
||||
}
|
||||
let animate = core.plugin.enemyanimate[enemy.id] ?? "jianji2"
|
||||
//这里可通过if更改默认的怪物攻击特效
|
||||
hero_animate.push(animate) //勇士身上绘制jianji2动画
|
||||
if (heroinfo.mhp + (hero_diff.mhp ?? 0) - hero_damage >= 0) {
|
||||
hero_diff.mhp = (hero_diff.mhp ?? 0) - hero_damage
|
||||
hero_damage = 0
|
||||
hero_diff.hp = (hero_diff.hp ?? 0) - hero_damage
|
||||
} else {
|
||||
hero_damage -= heroinfo.mhp + (hero_diff.mhp ?? 0)
|
||||
hero_diff.mhp = (hero_diff.mhp ?? 0) - heroinfo.mhp - (hero_diff.mhp ?? 0)
|
||||
|
||||
hero_diff.hp = (hero_diff.hp ?? 0) - hero_damage
|
||||
}
|
||||
|
||||
damage += hero_damage
|
||||
enemyinfo.onAttack = false
|
||||
enemyinfo.now = 0
|
||||
onattack = true
|
||||
|
||||
}
|
||||
equipInfo.forEach(v => {
|
||||
if (v.onAttack) {
|
||||
let mon_damage = 0
|
||||
let hero_damage = 0
|
||||
//这里写生效装备的技能效果,同时对双方属性的修改计入diff(不要在此直接修改heroinfo和enemyinfo)
|
||||
let animate = core.plugin.equipanimate[v.id] ?? "jianji2"
|
||||
//这里可通过if更改默认的道具特效
|
||||
enemy_animate.push(animate) //勇士身上绘制动画
|
||||
|
||||
v.now = 0
|
||||
v.onAttack = false
|
||||
onattack = true
|
||||
}
|
||||
})
|
||||
if (onattack) { //先手处理完毕后的数据处理
|
||||
heroDiffList.push(hero_diff)
|
||||
enemyDiffList.push(enemy_diff)
|
||||
heroanimateList.push(hero_animate)
|
||||
enemyanimateList.push(enemy_animate)
|
||||
//处理属性变化
|
||||
for (let v in hero_diff) {
|
||||
heroinfo[v] += hero_diff[v]
|
||||
}
|
||||
for (let v in enemy_diff) {
|
||||
enemyinfo[v] += enemy_diff[v]
|
||||
}
|
||||
continue //进入下一循环
|
||||
}
|
||||
heroinfo.now += heroinfo.speed
|
||||
enemyinfo.now += enemyinfo.speed
|
||||
equipInfo.forEach(v => {
|
||||
|
@ -4593,6 +4593,77 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
const floor = Math.floor
|
||||
Math.floor = (a) => floor(a + 1e-8)
|
||||
ui.prototype._drawTip_drawOne = function (tip, k) {
|
||||
core.setAlpha('data', tip.opacity);
|
||||
core.fillRect('data', 5, 5 + 42 * k, tip.width, 42, '#000000');
|
||||
if (tip.image)
|
||||
core.drawImage('data', tip.image, (tip.posX + tip.frame) * 32, tip.posY * tip.height, 32, 32, 10, 10 + 42 * k, 32, 32);
|
||||
core.fillText('data', tip.text, tip.textX, 33 + 42 * k, '#FFFFFF');
|
||||
core.setAlpha('data', 1);
|
||||
}
|
||||
let time=0
|
||||
control.prototype._animateFrame_tip = function (timestamp) {
|
||||
let delta
|
||||
core.animateFrame.tip??=[]
|
||||
if (core.animateFrame.tip.length === 0) return;
|
||||
|
||||
if (timestamp - time <= 30) return;
|
||||
delta = timestamp - time;
|
||||
time = timestamp;
|
||||
|
||||
|
||||
|
||||
core.setFont("data", "16px Arial");
|
||||
core.setTextAlign("data", "left");
|
||||
core.clearMap("data", 0, 0, core._PX_, core._PX_);
|
||||
core.animateFrame.tip.forEach((v, k) => {
|
||||
core.ui._drawTip_drawOne(v, k);
|
||||
if (v.stage == 1) {
|
||||
v.opacity += 0.05;
|
||||
if (v.opacity >= 0.6) {
|
||||
v.stage = 2;
|
||||
v.displayTime = 0;
|
||||
}
|
||||
} else if (v.stage == 2) {
|
||||
v.displayTime += delta;
|
||||
if (v.displayTime >= 1000) v.stage = 3;
|
||||
} else v.opacity -= 0.05;
|
||||
|
||||
})
|
||||
core.animateFrame.tip = core.animateFrame.tip.filter(v => v.opacity > 0)
|
||||
};
|
||||
core.registerAnimationFrame("tip", true, core.control._animateFrame_tip)
|
||||
ui.prototype.drawTip = function (text, id, frame) {
|
||||
text = core.replaceText(text) || "";
|
||||
var realText = this._getRealContent(text);
|
||||
var one = {
|
||||
text: text,
|
||||
textX: 21,
|
||||
width: 26 + core.calWidth('data', realText, "16px Arial"),
|
||||
opacity: 0.1,
|
||||
stage: 1,
|
||||
frame: frame || 0,
|
||||
time: 0
|
||||
};
|
||||
if (id != null) {
|
||||
var info = core.getBlockInfo(id);
|
||||
if (info == null || !info.image || info.bigImage) {
|
||||
// 检查状态栏图标
|
||||
if (core.statusBar.icons[id] instanceof Image) {
|
||||
info = { image: core.statusBar.icons[id], posX: 0, posY: 0, height: 32 };
|
||||
} else info = null;
|
||||
}
|
||||
if (info != null) {
|
||||
one.image = info.image;
|
||||
one.posX = info.posX;
|
||||
one.posY = info.posY;
|
||||
one.height = info.height;
|
||||
one.textX += 24;
|
||||
one.width += 24;
|
||||
}
|
||||
}
|
||||
core.animateFrame.tip.push(one)
|
||||
}
|
||||
},
|
||||
"额外信息": function () {
|
||||
/* 宝石血瓶左下角显示数值
|
||||
@ -21545,9 +21616,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
while (oneTurn * i / max < 15) {
|
||||
i++
|
||||
}
|
||||
if (heroInfo.onAttack) heroInfo.now *= i
|
||||
if (enemyInfo.onAttack) enemyInfo.now *= i
|
||||
equipInfo.forEach(v => { if (v.onAttack) v.now *= i })
|
||||
heroInfo.now *= i
|
||||
enemyInfo.now *= i
|
||||
equipInfo.forEach(v => { v.now *= i })
|
||||
oneTurn *= i
|
||||
let time = 0,
|
||||
farme = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user