HumanBreak/src/components/enemyOne.vue

236 lines
7.0 KiB
Vue
Raw Normal View History

2022-11-16 23:01:23 +08:00
<template>
2022-11-19 18:15:42 +08:00
<div
class="enemy-container"
@click="select"
@mouseenter="enter"
:selected="selected"
>
2022-11-16 23:01:23 +08:00
<div class="info">
<div class="leftbar">
<span class="name">{{ enemy.name }}</span>
<BoxAnimate
:id="enemy.id"
:width="isMobile ? 32 : 50"
:height="isMobile ? 32 : 50"
style="margin: 5%"
></BoxAnimate>
<div
class="special-text"
v-if="has(enemy.special) && enemy.special.length > 0"
>
<span
v-for="(text, i) in enemy.toShowSpecial"
2022-12-28 12:13:52 +08:00
:style="{ color: enemy.toShowColor![i] as string }"
2022-11-19 18:15:42 +08:00
>&nbsp;{{ text }}&nbsp;</span
2022-11-16 23:01:23 +08:00
>
</div>
<div class="special-text" v-else>无属性</div>
</div>
<a-divider
type="vertical"
dashed
2022-11-19 11:30:14 +08:00
style="height: 100%; margin: 0 3% 0 1%; border-color: #ddd4"
2022-11-16 23:01:23 +08:00
></a-divider>
<div class="rightbar">
<div class="detail">
<div class="detail-info">
<span style="color: lightgreen"
>生命&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.hp)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightcoral"
>攻击&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.atk)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightblue"
>防御&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.def)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightyellow"
>金币&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.money)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lawngreen"
>经验&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.money)
}}</span
>
</div>
<div class="detail-info">
<span style="color: cyan"
>{{
2022-11-19 11:30:14 +08:00
core.formatBigNumber(core.status.thisMap.ratio)
2022-11-16 23:01:23 +08:00
}}&nbsp;&nbsp;&nbsp;&nbsp;{{
2022-11-19 11:30:14 +08:00
core.formatBigNumber(enemy.defDamage)
2022-11-16 23:01:23 +08:00
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightsalmon"
>临界&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.critical)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightpink"
>减伤&nbsp;&nbsp;&nbsp;&nbsp;<span
:style="{
color:
enemy.criticalDamage < 0
? 'gold'
: 'lightpink'
}"
2022-12-28 12:13:52 +08:00
><span style="font-family: 'Fira Code'">{{
enemy.criticalDamage < 0 ? '=>' : ''
}}</span
2022-11-16 23:01:23 +08:00
>{{
core.formatBigNumber(
enemy.criticalDamage < 0
2022-12-28 12:13:52 +08:00
? -enemy.criticalDamage
: enemy.criticalDamage
2022-11-16 23:01:23 +08:00
)
}}</span
></span
>
</div>
<div class="detail-info">
2022-12-28 12:13:52 +08:00
<span :style="{color: enemy.damageColor! as string}"
2022-11-16 23:01:23 +08:00
>伤害&nbsp;&nbsp;&nbsp;&nbsp;{{
2022-12-28 12:13:52 +08:00
core.formatBigNumber(enemy.damage!)
2022-11-16 23:01:23 +08:00
}}</span
>
</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { has } from '../plugin/utils';
import BoxAnimate from '../components/boxAnimate.vue';
import { isMobile } from '../plugin/use';
const props = defineProps<{
2022-12-28 12:13:52 +08:00
enemy: DetailedEnemy;
2022-11-19 18:15:42 +08:00
selected?: boolean;
2022-11-16 23:01:23 +08:00
}>();
2022-11-19 11:30:14 +08:00
const emits = defineEmits<{
(e: 'select'): void;
2022-11-19 18:15:42 +08:00
(e: 'hover'): void;
2022-11-19 11:30:14 +08:00
}>();
2022-11-16 23:01:23 +08:00
const core = window.core;
2022-11-19 11:30:14 +08:00
/**
* 选择这个怪物时
*/
function select(e: MouseEvent) {
emits('select');
}
2022-11-19 18:15:42 +08:00
function enter() {
emits('hover');
}
2022-11-16 23:01:23 +08:00
</script>
<style lang="less" scoped>
.enemy-container {
border: 1.5px solid transparent;
border-radius: 20px;
transition: all 0.2s linear;
height: 100%;
.info {
flex-basis: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: stretch;
height: 100%;
}
}
2022-11-19 18:15:42 +08:00
.enemy-container:hover,
.enemy-container[selected='true'] {
2022-11-16 23:01:23 +08:00
border: 1.5px solid gold;
border-radius: 20px;
}
.leftbar {
2022-11-19 11:30:14 +08:00
width: 15%;
2022-11-16 23:01:23 +08:00
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
2022-11-19 11:30:14 +08:00
font-size: 2vh;
padding-left: 1%;
2022-11-16 23:01:23 +08:00
}
.name {
text-align: center;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
}
.special-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2022-11-19 11:30:14 +08:00
display: flex;
flex-direction: row;
align-items: center;
justify-items: space-between;
2022-11-16 23:01:23 +08:00
}
.rightbar {
2022-11-19 11:30:14 +08:00
font-size: 2.5vh;
2022-11-16 23:01:23 +08:00
width: 100%;
height: 100%;
padding: 1.5vh 0 1.5vh 0;
.detail {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100%;
.detail-info {
2022-11-19 11:30:14 +08:00
flex-basis: 33.3%;
2022-11-16 23:01:23 +08:00
line-height: 0;
display: flex;
flex-direction: column;
justify-content: center;
}
}
}
2022-11-19 11:30:14 +08:00
@media screen and (max-width: 600px) {
.rightbar {
font-size: 4vw;
}
.leftbar {
font-size: 2vw;
}
}
2022-11-16 23:01:23 +08:00
</style>