自动切换技能

This commit is contained in:
unanmed 2023-01-04 10:29:01 +08:00
parent d365569d45
commit dc6eb041df
11 changed files with 265 additions and 397 deletions

View File

@ -225,9 +225,6 @@ enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
else color = '#FF2222';
damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(enemy, 19)) damage += '+';
if (core.enemys.hasSpecial(enemy, 21)) damage += '-';
if (core.enemys.hasSpecial(enemy, 11)) damage += '^';
}
return {

View File

@ -122,15 +122,14 @@ main.floors.MT14=
}
],
"no": [
"注意:如果剧情过程中卡死,请刷新页面(不会修,根本找不到问题在哪)",
{
"type": "pauseBgm"
},
"\t[野蛮人,hero]\b[down,hero]终于逃出来了",
"\t[野蛮人,hero]\b[down,hero]太吓人了!!!",
"\t[野蛮人,hero]\b[down,hero]这下应该不会有魔物再出现了吧",
"\t[野蛮人,hero]\b[down,hero]这山都快塌了",
"\t[野蛮人,hero]\b[down,hero]天也快黑了,回家休息休息吧",
"\t[野蛮人,hero]\b[down,hero]",
"\t[野蛮人,hero]\b[down,hero]总算逃出来了。",
"\t[野蛮人,hero]\b[down,hero]没想到柴火没砍成,还碰到了狼。",
"\t[野蛮人,hero]\b[down,hero]真是倒了血霉了。",
"\t[野蛮人,hero]\b[down,hero]算了,明天再砍柴吧。",
{
"type": "setCurtain",
"color": [
@ -142,160 +141,65 @@ main.floors.MT14=
"time": 1500,
"keep": true
},
{
"type": "changeFloor",
"floorId": "MT0",
"loc": [
7,
12
],
"direction": "up"
},
{
"type": "pauseBgm"
},
{
"type": "setCurtain",
"time": 1500
},
"\t[野蛮人,hero]\b[up,hero]看来,我也需要鼓起勇气向未知的区域前进了",
"\t[野蛮人,hero]\b[up,hero]只在这附近无法再让我提升了啊",
{
"type": "setCurtain",
"color": [
0,
0,
0,
1
],
"time": 1500,
"keep": true
},
{
"type": "hideHero"
},
{
"type": "setValue",
"name": "flag:plot",
"value": "true"
},
{
"type": "function",
"function": "function(){\ncore.values.floorChangeTime = 0;\n}"
},
{
"type": "changeFloor",
"floorId": "MT14",
"loc": [
24,
7
]
},
{
"type": "playBgm",
"name": "plot1.mp3",
"keep": true
},
{
"type": "setCurtain",
"time": 2000,
"async": true
},
{
"type": "setViewport",
"dxy": [
20,
0
],
"time": 10000
},
{
"type": "setCurtain",
"color": [
0,
0,
0,
1
],
"time": 500,
"keep": true
},
{
"type": "changeFloor",
"floorId": "MT14",
"loc": [
93,
7
]
},
{
"type": "setCurtain",
"time": 500,
"async": true
},
{
"type": "setViewport",
"dxy": [
20,
0
],
"time": 10000
},
{
"type": "setCurtain",
"color": [
0,
0,
0,
1
],
"time": 500,
"keep": true
},
{
"type": "changeFloor",
"floorId": "MT15",
"loc": [
31,
7
]
},
{
"type": "setCurtain",
"time": 500,
"async": true
},
{
"type": "setViewport",
"dxy": [
20,
0
],
"time": 10000
},
{
"type": "setCurtain",
"color": [
0,
0,
0,
1
],
"time": 500,
"keep": true
},
{
"type": "waitAsync"
},
{
"type": "setText",
"align": "center"
"text": [
0,
0,
0,
1
],
"background": "winskin3.png"
},
{
"type": "scrollText",
"text": "就这样,野蛮人踏上了寻求智慧的旅途\n在那片绿色结晶的驱使下他发现了智慧的强大\n而人类历史由此转向快速发展期\n智慧终将战胜一切\n而野蛮将会挫败永世\n\n一刀一剑斩天歌随风来者是稀客\n一点智慧破苍穹万里征途犹坎坷\n回首却看山前树挥手不忘前时乐\n一鼓作气寻征途留下芳香艳人色\n\n回首处望苍穹千里共当时明月终\n\n人类正在开天辟地",
"time": 30000,
"lineHeight": 2
"type": "setGlobalAttribute",
"name": "font",
"value": "scroll"
},
"人类简史——起源篇",
{
"type": "playSound",
"name": "paper.mp3"
},
"但他已经抑制不了自己的好奇心。",
{
"type": "playSound",
"name": "paper.mp3"
},
"人类嘛,总会在好奇心的驱使下前进。",
{
"type": "playSound",
"name": "paper.mp3"
},
"但是,他们却用好奇心给自己带来了灾难,",
{
"type": "playSound",
"name": "paper.mp3"
},
"只得利用历史中的野蛮人的好奇心来拯救自己。",
{
"type": "playSound",
"name": "paper.mp3"
},
"不出所料,这个野蛮人走上了勇气之路。",
{
"type": "playSound",
"name": "paper.mp3"
},
{
"type": "setText",
"text": [
255,
255,
255,
1
],
"background": "winskin2.png"
},
{
"type": "setGlobalAttribute",
"name": "font",
"value": "normal"
},
{
"type": "changeFloor",
@ -305,29 +209,8 @@ main.floors.MT14=
7
],
"direction": "right"
},
{
"type": "function",
"function": "function(){\ncore.values.floorChangeTime = 200;\n}"
},
{
"type": "showHero"
},
{
"type": "setCurtain",
"time": 500
},
{
"type": "setText",
"align": "left"
}
]
},
"\t[野蛮人]\b[up,hero]勇气之路,我来了!",
{
"type": "setValue",
"name": "flag:plot",
"value": "false"
}
]
}

View File

@ -422,6 +422,10 @@ main.floors.MT16=
"追逐的时候不能用2技能不能用楼传逃跑后要原路返回山洞",
"追逐战分为两个难度,简单难度会显示逃跑路径,困难模式不显示,困难模式逃跑成功可以获得成就",
"前方会有大约40秒的剧情之后开始追逐战并自动存档如果逃跑失败需要重打可以直接读自动存档",
"\t[野蛮人]\b[up,hero]这墙上有文字?",
"\t[野蛮人]\b[up,hero]真相就藏在智慧之塔中,而想要到达智慧之塔,你必须经过勇气的考验,通过勇气之路。",
"\t[野蛮人]\b[up,hero]智慧之塔?勇气之路?",
"\t[野蛮人]\b[up,hero]算了,先砍柴吧。",
{
"type": "hide",
"remove": true

View File

@ -17,9 +17,10 @@ main.floors.MT17=
"weather": null,
"firstArrive": [
{
"type": "function",
"function": "function(){\ncore.resetMap(\"tower6\");\n}"
"type": "setCurtain",
"time": 1000
},
"\t[野蛮人]\b[up,hero]勇气之路,智慧之塔,我来了!",
"血瓶宝石效果已变成两倍",
{
"type": "setGlobalValue",

View File

@ -13,12 +13,7 @@ main.floors.MT20=
"ratio": 2,
"defaultGround": "grass",
"bgm": "plot1.mp3",
"firstArrive": [
"\t[野蛮人]\b[up,hero]高塔?",
"\t[野蛮人]\b[up,hero]奇怪,这塔这么高,恐怕不是现在可以建造出来的",
"\t[野蛮人]\b[up,hero]这又是什么神奇的东西",
"\t[野蛮人]\b[up,hero]小心行事为好"
],
"firstArrive": null,
"eachArrive": [
{
"type": "setGlobalValue",
@ -29,24 +24,10 @@ main.floors.MT20=
"parallelDo": "",
"events": {
"6,9": [
"这是一座来自未来的高塔",
{
"type": "animate",
"name": "emm",
"loc": "hero"
},
"\t[原始人]\b[up,hero]来自未来...",
"\t[原始人]\b[up,hero]难道和那个智慧结有关?"
"万里,智慧破苍穹"
],
"8,9": [
"唯有拥有智慧之人才可进入此塔",
{
"type": "animate",
"name": "emm",
"loc": "hero"
},
"\t[原始人]\b[up,hero]拥有智慧...",
"\t[原始人]\b[up,hero]什么意思?"
"千丈,勇气贯星海"
]
},
"changeFloor": {
@ -79,7 +60,7 @@ main.floors.MT20=
[142,142,142,142,40184,40185,40202,40203,40204,40189,40190,142,142,142,142],
[142,142,142,142,40192,40193,40202,40203,40204,40197,40198,142,142,142,142],
[142,142,142,142,40200,40201,40267,40268,40269,40205,40206,142,142,142,142],
[142,142,142,142,40208,40209,40275, 91,40277,40213,40214,142,142,142,142],
[142,142,142,142,40208,40209,40275,543,40277,40213,40214,142,142,142,142],
[142,142,142,142,142,142,129, 0,129,142,142,142,142,142,142],
[142,142,142,142,142,142,142, 0,142,142,142,142,142,142,142],
[142,142,142,142,142,142,142, 0,142,142,142,142,142,142,142],
@ -121,5 +102,12 @@ main.floors.MT20=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"cannotMoveIn": {},
"bg2map": [
],
"fg2map": [
]
}

View File

@ -14,13 +14,7 @@ main.floors.tower1=
"defaultGround": "T526",
"bgm": "tower.mp3",
"firstArrive": [
"\t[原始人]\b[up,hero]智慧之塔...",
"\t[原始人]\b[up,hero]看来它认为我是拥有智慧之人啊",
"\t[原始人]\b[up,hero]那我就只好爬塔咯",
{
"type": "function",
"function": "function(){\ncore.resetMap('tower6');\n}"
}
"\t[野蛮人]\b[up,hero]这里,便是智慧之塔了"
],
"eachArrive": [],
"parallelDo": "",

View File

@ -52,7 +52,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 隐藏右下角的音乐按钮
core.dom.musicBtn.style.display = 'none';
core.dom.enlargeBtn.style.display = 'none';
if (main.mode === 'play' && !main.replayChecking) core.splitArea();
if (main.mode === 'play' && !main.replayChecking) {
core.splitArea();
core.resetFlagSettings();
}
},
win: function (reason, norank, noexit) {
// 游戏获胜事件
@ -838,8 +841,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
var hp_buff = 0,
atk_buff = 0,
def_buff = 0;
// 已经计算过的光环怪ID列表用于判定叠加
var usedEnemyIds = {};
// 检查光环和支援的缓存
var index =
x != null && y != null ? x + ',' + y : 'floor' + enemy.id;
@ -856,35 +857,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
enemy = core.material.enemys[id];
var dx = Math.abs(block.x - x),
dy = Math.abs(block.y - y);
// 检查【光环】技能数字25
if (enemy && core.hasSpecial(enemy.special, 25)) {
// 检查是否是范围光环
var inRange = enemy.range == null;
if (
enemy.range != null &&
x != null &&
y != null
) {
// 检查十字和九宫格光环
if (dx + dy <= enemy.range) inRange = true;
if (
enemy.zoneSquare &&
dx <= enemy.range &&
dy <= enemy.range
)
inRange = true;
}
// 检查是否可叠加
if (
inRange &&
(enemy.add || !usedEnemyIds[enemy.id])
) {
hp_buff += enemy.value || 0;
atk_buff += enemy.atkValue || 0;
def_buff += enemy.defValue || 0;
usedEnemyIds[enemy.id] = true;
}
}
// 检查【支援】技能数字26
if (
enemy &&
@ -966,7 +938,18 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 后面三个参数主要是可以在光环等效果上可以适用
floorId = floorId || core.status.floorId;
var hero_hp = core.getRealStatusOrDefault(hero, 'hp'),
// 怪物的各项数据
// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
const enemyInfo = core.enemys.getEnemyInfo(
enemy,
hero,
x,
y,
floorId
);
function getDamage() {
let hero_hp = core.getRealStatusOrDefault(hero, 'hp'),
hero_atk = core.getRealStatusOrDefault(hero, 'atk'),
hero_def = core.getRealStatusOrDefault(hero, 'def'),
hero_IQ = core.getRealStatusOrDefault(hero, 'mdef'),
@ -976,29 +959,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
origin_hero_atk = core.getStatusOrDefault(hero, 'atk'),
origin_hero_def = core.getStatusOrDefault(hero, 'def');
// 勇士的负属性都按0计算
hero_hp = Math.max(0, hero_hp);
hero_atk = Math.max(0, hero_atk);
hero_def = Math.max(0, hero_def);
// 怪物的各项数据
// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
var enemyInfo = core.enemys.getEnemyInfo(
enemy,
hero,
x,
y,
floorId
);
var mon_hp = enemyInfo.hp,
let mon_hp = enemyInfo.hp,
mon_atk = enemyInfo.atk,
mon_def = enemyInfo.def,
mon_special = enemyInfo.special;
var damage = 0;
let damage = 0;
// 断灭之刃技能
if (core.getFlag('bladeOn') && core.getFlag('blade')) {
var level = core.getSkillLevel()[2];
var level = core.getSkillLevel(2);
hero_atk *= 1 + 0.1 * level;
hero_def *= 1 - 0.1 * level;
}
@ -1007,10 +977,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
hero_atk *= 1 - (enemy.hungry || 0) / 100;
}
// 如果是无敌属性,且勇士未持有十字架
if (core.hasSpecial(mon_special, 20) && !core.hasItem('cross'))
return null; // 不可战斗
// 战前造成的额外伤害(可被护盾抵消)
var init_damage = 0;
@ -1045,13 +1011,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
if (hero_per_damage <= 0) return null;
// 勇士的攻击回合数;为怪物生命除以每回合伤害向上取整
var turn = Math.ceil(mon_hp / hero_per_damage);
let turn = Math.ceil(mon_hp / hero_per_damage);
// 致命一击
if (core.hasSpecial(mon_special, 1)) {
var times = Math.floor(turn / 5);
damage +=
((times * ((enemy.crit || 100) - 100)) / 100) * per_damage;
((times * ((enemy.crit || 100) - 100)) / 100) *
per_damage;
}
// 勇气之刃
if (turn > 1 && core.hasSpecial(mon_special, 10)) {
@ -1065,11 +1032,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// ------ 支援 ----- //
// 这个递归最好想明白为什么flag:__extraTurn__是怎么用的
var guards = core.getFlag(
const guards = core.getFlag(
'__guards__' + x + '_' + y,
enemyInfo.guards
);
var guard_before_current_enemy = true; // ------ 支援怪是先打(true)还是后打(false)
const guard_before_current_enemy = true; // ------ 支援怪是先打(true)还是后打(false)
turn += core.getFlag('__extraTurn__', 0);
if (guards.length > 0) {
if (!guard_before_current_enemy) {
@ -1117,7 +1084,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
}
// 生命回复
damage -= hero_recovery * turn;
if (core.getFlag('hard') == 1) damage *= 0.9;
if (core.getFlag('hard') === 1) damage *= 0.9;
return {
mon_hp: Math.floor(mon_hp),
@ -1130,6 +1097,34 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
damage: Math.floor(damage)
};
}
let damageInfo = null;
let damage = Infinity;
const skills = [['bladeOn', 'blade']];
damageInfo = getDamage();
if (damageInfo) damage = damageInfo.damage;
if (flags.autoSkill) {
for (const [unlock, condition] of skills) {
if (flags[unlock]) {
flags[condition] = true;
const info = getDamage();
const d = info?.damage;
if (d !== null && d !== void 0) {
if (d < damage) {
damage = d;
damageInfo = info;
}
}
flags[condition] = false;
}
}
return damageInfo;
} else {
return getDamage();
}
}
},
actions: {
onKeyUp: function (keyCode, altKey) {
@ -1261,12 +1256,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
core.actions._clickGameInfo_openComments();
break;
case 49: // 1: 断灭之刃
if (!flags.bladeOn) break;
if (!flags.bladeOn || flags.autoSkill) break;
core.status.route.push('key:49'); // 将按键记在录像中
core.playSound('光标移动');
if (flags.blade) flags.blade = false;
else flags.blade = true;
core.updateStatusBar(false, true);
core.updateStatusBar();
break;
case 50: // 快捷键2: 跳跃技能 || 破
if (

View File

@ -6,7 +6,7 @@
"这里显示本塔中需要注意的事项。",
"<br>",
"<br>",
"1. 本百科全书字数很多,可以选择性地阅读。",
"1. <span style=\"color: yellow\">本百科全书字数很多,可以选择性地阅读。</span>",
"<br>",
"<br>",
"2. 本塔中<span style=\"color: gold\">几乎所有 ui </span>都可以纵向滚动,如果发现显示不全,",
@ -155,7 +155,9 @@
"<br>",
"下面是本塔中新增的快捷键:",
"<br>",
"<span style=\"color: gold\">M</span>:快速标记怪物"
"<span style=\"color: gold\">M</span>:快速标记怪物",
"<br>",
"<span style=\"color: gold\">J</span>:打开技能树"
]
},
"extraAttr": {

View File

@ -8,11 +8,11 @@
<a-slider
class="slider"
v-model:value="addAtk"
:max="(originCri.at(-1)?.[0] ?? 2) - 1"
:max="ceil((originCri.at(-1)?.[0] ?? 2) / ratio) - 1"
></a-slider>
<span
>最大值&nbsp;&nbsp;&nbsp;&nbsp;{{
(originCri.at(-1)?.[0] ?? 2) - 1
ceil((originCri.at(-1)?.[0] ?? 2) / ratio) - 1
}}</span
>
</div>
@ -29,11 +29,11 @@
<a-slider
class="slider"
v-model:value="addDef"
:max="(originDef.at(-1)?.[0] ?? 2) - 1"
:max="ceil((originDef.at(-1)?.[0] ?? 2) / ratio) - 1"
></a-slider>
<span
>最大值&nbsp;&nbsp;&nbsp;&nbsp;{{
(originDef.at(-1)?.[0] ?? 2) - 1
ceil((originDef.at(-1)?.[0] ?? 2) / ratio) - 1
}}</span
>
</div>
@ -96,6 +96,7 @@ const critical = ref<HTMLCanvasElement>();
const def = ref<HTMLCanvasElement>();
const enemy = core.plugin.bookDetailEnemy;
const ceil = Math.ceil;
let originCri = getCriticalDamage(enemy);
let originDef = getDefDamage(enemy);

View File

@ -118,7 +118,7 @@ watch(nowArea, n => {
oy = 0;
scale = 3;
lastScale = 3;
if (!area[n].includes(nowFloor.value))
if (area[n] && !area[n].includes(nowFloor.value))
nowFloor.value =
area[n].find(v => v === core.status.floorId) ?? area[n][0];
});
@ -342,7 +342,7 @@ function drawRight() {
y = thumb.height / 2 - h / 2;
}
if (ratio < 1) {
w = h / ratio;
w = h * ratio;
x = thumb.width / 2 - w / 2;
}
thumbCtx.fillStyle = '#000';
@ -478,6 +478,7 @@ function locateMap(id: FloorIds) {
noBorder.value ? 5 : 0,
noBorder.value ? 0.5 : 1
);
if (!data.locs[id]) return;
const [x, y] = data.locs[id]!;
ox = (-x + data.width / 2) * scale;
oy = (-y + data.height / 2) * scale;

View File

@ -167,6 +167,8 @@ function update() {
lvName.value = core.getLvName(hero.lv);
if (flags.blade && flags.bladeOn) {
skill.value = '断灭之刃';
} else {
skill.value = '无';
}
up.value = core.getNextLvUpNeed() ?? 0;
if (core.hasFlag('spring')) {