This commit is contained in:
AncTe committed 2024-02-05 21:38:26 +08:00
1 parent 84620ce779
commit 87c82aa0e2
11 files changed
+116 -16

No files matched your search

+56
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
+4 -6
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 });
+1
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)
+4 -1
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);
+21 -2
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>
+8
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>