🗡️地牢寻宝终极V3
by TurboFalcon96276 lines9.1 KB
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
地牢寻宝终极V3
<style>
*{margin:0;padding:0;box-sizing:border-box;font-family:system-ui, sans-serif;}
html{background:#0f172a !important;}
body{
background:#0f172a !important;
color:#fff;
padding:25px 18px;
min-height:100vh;
font-size:17px;
}
h2{text-align:center;margin-bottom:15px;font-size:24px;color:#facc15;}
.text-box{
background:#1e293b;
padding:18px;
border-radius:12px;
margin-bottom:15px;
line-height:1.7;
}
.status{
background:#1e293b;
padding:12px;
border-radius:10px;
margin-bottom:15px;
line-height:1.8;
}
.btn{
width:100%;
padding:15px;
margin:8px 0;
font-size:16px;
background:#334155;
color:white;
border:none;
border-radius:10px;
}
.btn:active{background:#f59e0b;color:#000;font-weight:bold;}
</style>
</head>
<body>
<h2>👑 地牢寻宝·终极V3</h2>
<div class="text-box" id="text"></div>
<div class="status" id="status"></div>
<div id="buttons"></div>
<script>
// 终极全套数据
let hp = 5;
let maxHp = 5;
let gold = 0;
let potion = 1;
let atk = 2;
let weapon = "徒手";
let hasKey = false;
let bossDead = false;
const textEl = document.getElementById("text");
const statusEl = document.getElementById("status");
const btnBox = document.getElementById("buttons");
// 刷新状态栏
function refreshUI(){
statusEl.innerHTML = `
❤️生命:${hp}/${maxHp} 💰金币:${gold}<br>
🧪药水:${potion} ⚔️攻击:${atk}(${weapon})<br>
🔑钥匙:${hasKey?"✅已获得":"❌未获得"} 👹BOSS:${bossDead?"✅已击杀":"❌存活"}
`;
}
function show(txt,opts){
textEl.innerText = txt;
btnBox.innerHTML = "";
opts.forEach(opt=>{
let b = document.createElement("button");
b.className="btn";
b.innerText=opt.name;
b.onclick = opt.action;
btnBox.appendChild(b);
})
}
function lose(){
show("💀你倒在了冰冷的地牢中,冒险结束!",[{name:"🔄重新开局",action:start}]);
}
// 随机陷阱
function randomTrap(){
let r = Math.random();
if(r<0.2){
hp-=1; refreshUI();
return "💥触发落石陷阱!-1生命";
}else if(r<0.4){
hp-=1; refreshUI();
return "☠️吸入毒雾!-1生命";
}else{
return "✅一路安全,没有陷阱!";
}
}
// 随机宝箱
function randomBox(){
let r = Math.random();
if(r<0.3){
gold+=12; refreshUI();
return "🎁超级宝箱!开出12金币!";
}else if(r<0.5){
potion+=1; refreshUI();
return "🎁宝箱开出治疗药水!";
}else if(r<0.6){
atk+=1; weapon="锋利短刀"; refreshUI();
return "🎁开出短刀!攻击力+1!";
}else{
gold+=5; refreshUI();
return "🎁普通宝箱,获得5金币!";
}
}
// 隐藏密室触发
function secretRoom(nextGo){
if(Math.random()<0.25){
show("✨你发现墙壁有裂缝!【隐藏秘密密室】!\n里面堆满了古老宝藏!",[
{name:"💰搜刮密室",action:()=>{
gold+=20; maxHp+=1; hp=maxHp; refreshUI();
show("🎉密室大丰收!金币+20、最大生命+1、血量回满!",[{name:"离开密室",action:nextGo}]);
}}
])
return true;
}
return false;
}
// 开局
function start(){
hp=5;maxHp=5;gold=0;potion=1;atk=2;weapon="徒手";hasKey=false;bossDead=false;
refreshUI();
show("你踏入危机四伏的终极地牢!\n前路布满陷阱、宝藏与强大魔物!",[
{name:"①左侧乱石通道",action:road1},
{name:"②中央幽灵长廊",action:road2},
{name:"③右侧木箱密道",action:road3}
])
}
function road1(){
let msg = randomTrap();
if(hp<=0){lose();return;}
if(secretRoom(hall))return;
show(msg+"\n通道尽头直通地牢大厅!",[{name:"继续前进",action:hall}]);
}
function road2(){
if(secretRoom(hall))return;
show("幽蓝长廊涌出寒气!一只亡灵守卫挡路!",[
{name:"⚔️战斗守卫",action:()=>{
if(Math.random()*atk>2){
gold+=10; refreshUI();
show("✅凭借战力斩杀守卫!获得10金币!",[{name:"前往大厅",action:hall}]);
}else{
hp-=2; refreshUI();
if(hp<=0){lose();return;}
show("❌被守卫重创!-2生命!",[{name:"前往大厅",action:hall}]);
}
}},
{name:"🏃悄悄溜走",action:()=>{show("你躲开守卫,抵达大厅!",[{name:"进入大厅",action:hall}])}}
])
}
function road3(){
if(secretRoom(hall))return;
let msg = randomBox();
show(msg,[{name:"前往大厅",action:hall}]);
}
// 主大厅(核心枢纽)
function hall(){
refreshUI();
show("📍地牢中央大厅\n可前往:商店补给、搜寻钥匙、挑战BOSS、探索密道",[
{name:"🏪终极商店(买装备)",action:shop},
{name:"🔍搜寻黄金门钥匙",action:findKey},
{name:"👹挑战地牢BOSS",action:bossFight},
{name:"🧪使用药水回血",action:usePotion}
])
}
// 超级商店
function shop(){
show("🏪地牢终极商店\n1.小药水=5金(回2血)\n2.精铁剑=15金(攻击+3)\n3.圣剑=30金(攻击+6)\n4.满血药剂=20金",[
{name:"🧪购买药水(5金)",action:()=>{
if(gold>=5){gold-=5;potion++;refreshUI();show("✅购买成功!",[{name:"返回大厅",action:hall}]);}
else show("❌金币不足!",[{name:"返回大厅",action:hall}]);
}},
{name:"⚔️购买精铁剑(15金)",action:()=>{
if(gold>=15){gold-=15;atk+=3;weapon="精铁剑";refreshUI();show("✅装备精铁剑!攻击大幅提升!",[{name:"返回大厅",action:hall}]);}
else show("❌金币不足!",[{name:"返回大厅",action:hall}]);
}},
{name:"✨购买圣剑(30金)",action:()=>{
if(gold>=30){gold-=30;atk+=6;weapon="神圣圣剑";refreshUI();show("✅获得神器圣剑!战力爆表!",[{name:"返回大厅",action:hall}]);}
else show("❌金币不足!",[{name:"返回大厅",action:hall}]);
}},
{name:"💖满血药剂(20金)",action:()=>{
if(gold>=20){gold-=20;hp=maxHp;refreshUI();show("✅血量完全恢复!",[{name:"返回大厅",action:hall}]);}
else show("❌金币不足!",[{name:"返回大厅",action:hall}]);
}},
{name:"🚪离开商店",action:hall}
])
}
// 使用药水
function usePotion(){
if(potion>0){
potion--;hp+=2;if(hp>maxHp)hp=maxHp;
refreshUI();
show("💚喝下药水,恢复2点生命!",[{name:"返回大厅",action:hall}]);
}else{
show("😥没有药水了!",[{name:"返回大厅",action:hall}]);
}
}
// 找钥匙
function findKey(){
if(hasKey){
show("✅你已经拥有钥匙了!",[{name:"返回大厅",action:hall}]);
return;
}
let msg = randomTrap();
if(hp<=0){lose();return;}
if(Math.random()>0.25){
hasKey=true; refreshUI();
show(msg+"\n🎉你在石缝中找到了黄金门钥匙!",[{name:"返回大厅",action:hall}]);
}else{
show(msg+"\n没找到钥匙,再试试!",[{name:"继续搜寻",action:findKey}]);
}
}
// 终极BOSS战
function bossFight(){
if(bossDead){
show("✅暗影魔王已被你斩杀!地牢恢复平静!",[{name:"前往终极宝藏",action:win}]);
return;
}
show("👹【暗影魔王】现身!终极决战开始!\n魔王血量极高,伤害恐怖!",[
{name:"⚔️全力开战",action:()=>{
let power = Math.random()*atk + atk;
if(power>=6){
bossDead=true;gold+=50;refreshUI();
show("🔥爆发超强战力!斩杀暗影魔王!\n获得50巨额金币!",[{name:"返回大厅",action:hall}]);
}else{
hp-=3;refreshUI();
if(hp<=0){lose();return;}
show("💥魔王重击了你!-3生命!勉强存活!",[{name:"撤退回血",action:hall}]);
}
}},
{name:"🛡️暂避锋芒",action:()=>{show("你暂时撤退修整!",[{name:"返回大厅",action:hall}])}}
])
}
// 最终通关
function win(){
if(!hasKey){
show("❌没有钥匙,无法打开终极宝藏门!先去找钥匙!",[{name:"返回大厅",action:hall}]);
return;
}
show("🔑使用钥匙开启黄金大门!\n🏆你征服了整座地牢,成为终极冒险家!\n所有宝藏归你所有!",[
{name:"🔁开启新的冒险",action:start}
])
}
// 启动游戏
start();
</script>
</body>
</html>Game Source: 🗡️地牢寻宝终极V3
Creator: TurboFalcon96
Libraries: none
Complexity: complex (276 lines, 9.1 KB)
The full source code is displayed above on this page.
Remix Instructions
To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: v3-turbofalcon96" to link back to the original. Then publish at arcadelab.ai/publish.