This commit is contained in:
unanmed 2024-02-05 21:38:26 +08:00
parent 84620ce779
commit 87c82aa0e2
11 changed files with 116 additions and 16 deletions

View File

@ -865,10 +865,7 @@ actions.prototype._getClickLoc = function (x, y) {
if (core.domStyle.isVertical) {
statusBar.x = 3;
statusBar.y =
core.dom.statusBar.offsetHeight +
3 +
32 * core.values.statusCanvasRowsOnMobile;
statusBar.y = core.dom.gameDraw.offsetTop;
} else {
statusBar.x = core.dom.statusBar.offsetWidth + 3;
statusBar.y = 3;

View File

@ -3709,6 +3709,7 @@ control.prototype.resize = function () {
extendToolbar = false;
BAR_WIDTH = Math.round(core._PX_ * 0.3);
}
core.domStyle.isVertical = matchMedia('(max-width: 600px)').matches;
var statusCanvas = core.flags.statusCanvas,
statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3;

View File

@ -77,7 +77,7 @@ items.prototype.getItemEffectTip = function (itemId) {
////// 使用道具 //////
items.prototype.useItem = function (itemId, noRoute, callback) {
/** @type {AllIdsOf<'items'>[]} */
const ignore = ['I560', 'I559', 'skill1', 'I642', 'I565', 'I558'];
const ignore = ['I342'];
if (
!this.canUseItem(itemId) ||
(core.isReplaying() && ignore.includes(itemId))

View File

@ -736,7 +736,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"hatred": 2,
"animateSpeed": 300,
"moveSpeed": 100,
"statusCanvasRowsOnMobile": 3,
"statusCanvasRowsOnMobile": 0,
"floorChangeTime": 500
},
"flags": {

View File

@ -492,10 +492,24 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 更新跟随者状态,并绘制
core.updateFollowers();
core.drawHero();
// 检查中毒状态的扣血和死亡
if (core.hasFlag('poison')) {
core.status.hero.statistics.poisonDamage +=
core.values.poisonDamage;
core.status.hero.hp -= core.values.poisonDamage;
if (core.status.hero.hp <= 0) {
core.status.hero.hp = 0;
core.updateStatusBar(false, true);
core.events.lose();
return;
} else {
core.updateStatusBar(false, true);
}
}
// 从v2.7开始,每一步行走不会再刷新状态栏。
// 如果有特殊要求如每走一步都加buff之类可手动取消注释下面这一句
// core.updateStatusBar(true);
// core.updateStatusBar(true, true);
// 检查自动事件
core.checkAutoEvents();
@ -519,6 +533,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 执行目标点的阻激夹域事件
core.checkBlock();
// 执行目标点的script和事件
if (!hasTrigger) core.trigger(nowx, nowy, callback);
// 检查该点是否是滑冰
@ -533,6 +548,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
);
}
// ------ 检查目标点事件 END ------ //
// 如需强行终止行走可以在这里条件判定:
// core.stopAutomaticRoute();
},

View File

@ -121,6 +121,26 @@ gameKey
name: '轻按_2',
defaults: KeyCode.Digit7
})
.register({
id: 'num1',
name: '破墙镐',
defaults: KeyCode.Digit1
})
.register({
id: 'num2',
name: '炸弹',
defaults: KeyCode.Digit2
})
.register({
id: 'num3',
name: '飞行器',
defaults: KeyCode.Digit3
})
.register({
id: 'num4',
name: '其他道具',
defaults: KeyCode.Digit3
})
.register({
id: 'mark',
name: '标记怪物',
@ -488,6 +508,42 @@ gameKey
})
.realize('comment', () => {
core.actions._clickGameInfo_openComments();
})
.realize('num1', () => {
if (core.hasItem('pickaxe')) {
core.useItem('pickaxe');
}
})
.realize('num2', () => {
if (core.hasItem('bomb')) {
core.useItem('bomb');
}
})
.realize('num3', () => {
if (core.hasItem('centerFly')) {
core.useItem('centerFly');
}
})
.realize('num4', () => {
const list: ItemIdOf<'tools' | 'constants'>[] = [
'icePickaxe',
'freezeBadge',
'earthquake',
'upFly',
'downFly',
'jumpShoes',
'lifeWand',
'poisonWine',
'weakWine',
'curseWine',
'superWine'
];
for (const id of list) {
if (core.canUseItem(id)) {
core.useItem(id);
break;
}
}
});
// ----- Storage

View File

@ -16,9 +16,7 @@ export function getEnemy(
return v.x === x && v.y === y;
});
if (!enemy) {
throw new Error(
`Get null when getting enemy on '${x},${y}' in '${floorId}'`
);
return null;
}
return enemy;
}
@ -30,7 +28,7 @@ function init() {
floorId: FloorIds = core.status.floorId
) {
const enemy = getEnemy(x, y, floorId);
const { damage } = enemy.calDamage();
const { damage } = enemy!.calDamage();
return damage < core.status.hero.hp;
};
@ -47,7 +45,7 @@ function init() {
if (!core.canBattle(x, y) && !force && !core.status.event.id) {
core.stopSound();
core.playSound('操作失败');
core.drawTip('你打不过此怪物!', enemy.id);
core.drawTip('你打不过此怪物!', enemy!.id);
return core.clearContinueAutomaticRoute(callback);
}
// 自动存档
@ -98,7 +96,7 @@ function init() {
const enemy = getEnemy(data.x, data.y);
beforeBattle.push(...(floor.beforeBattle[loc] ?? []));
beforeBattle.push(...(enemy.enemy.beforeBattle ?? []));
beforeBattle.push(...(enemy!.enemy.beforeBattle ?? []));
if (beforeBattle.length > 0) {
beforeBattle.push({ type: 'battle', x: data.x, y: data.y });

View File

@ -95,6 +95,7 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
core.extractBlocks(this.floorId);
core.status.maps[this.floorId].blocks.forEach(v => {
if (v.event.cls !== 'enemy48' && v.event.cls !== 'enemys') return;
if (v.disable) return;
const enemy = core.material.enemys[v.event.id as EnemyIds];
this.list.push(
new DamageEnemy(enemy, v.x, v.y, this.floorId, this)

View File

@ -1,5 +1,6 @@
import { getEnemy } from '@/game/enemy/battle';
import { formatDamage } from '../utils';
import { DamageEnemy } from '@/game/enemy/damage';
export function init() {
core.maps._initDetachedBlock = function (
@ -36,7 +37,9 @@ export function init() {
core.hasItem('book') &&
displayDamage
) {
const enemy = getEnemy(x, y);
const enemy =
getEnemy(x, y) ??
new DamageEnemy(core.material.enemys[info.id as EnemyIds]);
const dam = enemy.calDamage();
const { damage, color } = formatDamage(dam.damage);

View File

@ -269,8 +269,7 @@ onUnmounted(() => {
#title {
margin-top: 7%;
text-align: center;
font: 4em 'normal';
font-weight: 200;
font-size: 4em;
background-image: linear-gradient(
to right,
rgb(0, 0, 0),
@ -320,6 +319,7 @@ onUnmounted(() => {
flex-direction: column;
transition: height 0.2s ease;
width: 25%;
font-size: 100%;
.start-button {
position: relative;
@ -463,4 +463,23 @@ onUnmounted(() => {
transform: translateX(-20px);
opacity: 0;
}
@media screen and (max-width: 600px) {
#start-main {
#buttons {
width: 50%;
font-size: 250%;
}
#settings {
font-size: 300%;
width: 24%;
bottom: 2%;
}
#title {
font-size: 8em;
}
}
}
</style>

View File

@ -260,6 +260,7 @@ onMounted(() => {
width: 100%;
height: 100%;
padding: 1vh 0;
font-size: 100%;
}
.status-item {
@ -342,4 +343,11 @@ onMounted(() => {
.status-debuff-value[index='2'] {
color: #c2f4e7;
}
@media screen and (max-width: 600px) {
.status-item {
font-size: 100%;
max-width: 28vw;
}
}
</style>