add 新增圣光、透视技能

This commit is contained in:
yupi 2022-09-18 00:41:14 +08:00
parent 0cf6b3a9c2
commit ce8bd53827
2 changed files with 47 additions and 4 deletions

View File

@ -47,6 +47,14 @@ const useGame = () => {
// 操作历史(存储点击的块) // 操作历史(存储点击的块)
let opHistory: BlockType[] = []; let opHistory: BlockType[] = [];
// region 道具相关
const isHolyLight = ref(false);
const canSeeRandom = ref(false);
// endregion
/** /**
* *
* @param width * @param width
@ -281,14 +289,15 @@ const useGame = () => {
* @param force * @param force
*/ */
const doClickBlock = (block: BlockType, randomIdx = -1, force = false) => { const doClickBlock = (block: BlockType, randomIdx = -1, force = false) => {
// 已经输了 / 已经被点击 / 有上层块,不能再点击 // 已经输了 / 已经被点击 / 有上层块(且非强制和圣光),不能再点击
if ( if (
currSlotNum.value >= gameConfig.slotNum || currSlotNum.value >= gameConfig.slotNum ||
block.status !== 0 || block.status !== 0 ||
(block.lowerThanBlocks.length > 0 && !force) (block.lowerThanBlocks.length > 0 && !force && !isHolyLight.value)
) { ) {
return; return;
} }
isHolyLight.value = false;
// 修改元素状态为已点击 // 修改元素状态为已点击
block.status = 1; block.status = 1;
// 移除当前元素 // 移除当前元素
@ -456,6 +465,24 @@ const useGame = () => {
} }
}; };
/**
*
*
* @desc
*/
const doHolyLight = () => {
isHolyLight.value = true;
};
/**
*
*
* @desc
*/
const doSeeRandom = () => {
canSeeRandom.value = !canSeeRandom.value;
};
// endregion // endregion
return { return {
@ -469,12 +496,16 @@ const useGame = () => {
opHistory, opHistory,
totalBlockNum, totalBlockNum,
clearBlockNum, clearBlockNum,
isHolyLight,
canSeeRandom,
doClickBlock, doClickBlock,
doStart, doStart,
doShuffle, doShuffle,
doBroke, doBroke,
doRemove, doRemove,
doRevert, doRevert,
doHolyLight,
doSeeRandom,
}; };
}; };

View File

@ -19,7 +19,9 @@
<div <div
v-if="block.status === 0" v-if="block.status === 0"
class="block level-block" class="block level-block"
:class="{ disabled: block.lowerThanBlocks.length > 0 }" :class="{
disabled: !isHolyLight && block.lowerThanBlocks.length > 0,
}"
:data-id="block.id" :data-id="block.id"
:style="{ :style="{
zIndex: 100 + block.level, zIndex: 100 + block.level,
@ -53,7 +55,11 @@
v-for="num in Math.max(randomBlock.length - 1, 0)" v-for="num in Math.max(randomBlock.length - 1, 0)"
:key="num" :key="num"
class="block disabled" class="block disabled"
></div> >
<span v-if="canSeeRandom">
{{ randomBlock[num].type }}
</span>
</div>
</div> </div>
</a-row> </a-row>
<!-- 槽位 --> <!-- 槽位 -->
@ -69,6 +75,8 @@
<a-button size="small" @click="doRemove">移出</a-button> <a-button size="small" @click="doRemove">移出</a-button>
<a-button size="small" @click="doShuffle">洗牌</a-button> <a-button size="small" @click="doShuffle">洗牌</a-button>
<a-button size="small" @click="doBroke">破坏</a-button> <a-button size="small" @click="doBroke">破坏</a-button>
<a-button size="small" @click="doHolyLight">圣光</a-button>
<a-button size="small" @click="doSeeRandom">透视</a-button>
</a-space> </a-space>
</div> </div>
</div> </div>
@ -91,12 +99,16 @@ const {
heightUnit, heightUnit,
totalBlockNum, totalBlockNum,
clearBlockNum, clearBlockNum,
isHolyLight,
canSeeRandom,
doClickBlock, doClickBlock,
doStart, doStart,
doShuffle, doShuffle,
doBroke, doBroke,
doRemove, doRemove,
doRevert, doRevert,
doHolyLight,
doSeeRandom,
} = useGame(); } = useGame();
/** /**