78 lines
2.8 KiB
JavaScript
78 lines
2.8 KiB
JavaScript
// 复活雕像:二级科技建造石像;任何玩家死亡时自动消耗一座,原地复活(半血半饥)
|
|
// 单人模式下等于多一条命,保住"死亡删档"前的存档
|
|
const TAU = Math.PI * 2
|
|
|
|
export default {
|
|
id: 'revive',
|
|
name: '复活雕像',
|
|
desc: '建造石像,死亡时消耗一座原地复活',
|
|
factor: 1,
|
|
tag: 'content',
|
|
recipes: [
|
|
{ code: 'revivestatue', name: '复活雕像', tab: 'science', tech: 2, cost: { rock: 12, gold: 4 }, build: true, desc: '死亡时自动消耗,原地复活(半血)' },
|
|
],
|
|
icons: {
|
|
revivestatue: (c) => {
|
|
c.fillStyle = '#8d9097'
|
|
c.strokeStyle = '#1d1409'
|
|
c.lineWidth = 1.8
|
|
c.beginPath(); c.roundRect(-11, 8, 22, 6, 2); c.fill(); c.stroke()
|
|
c.beginPath(); c.moveTo(-7, 8); c.lineTo(-5, -4); c.lineTo(5, -4); c.lineTo(7, 8); c.closePath(); c.fill(); c.stroke()
|
|
c.beginPath(); c.arc(0, -9, 5.5, 0, TAU); c.fill(); c.stroke()
|
|
c.fillStyle = '#b0b4bc'
|
|
c.beginPath(); c.arc(-2, -10.5, 1.6, 0, TAU); c.fill()
|
|
},
|
|
},
|
|
ents: {
|
|
revivestatue: {
|
|
name: '复活雕像',
|
|
conf: { size: 34, struct: true },
|
|
interact(p, e, g) {
|
|
g.ptip(p, '守望雕像静静伫立(死亡时将消耗它复活)')
|
|
},
|
|
draw(ctx, e, env) {
|
|
// 底座
|
|
ctx.fillStyle = 'rgba(0,0,0,0.25)'
|
|
ctx.beginPath(); ctx.ellipse(0, 4, 20, 7, 0, 0, TAU); ctx.fill()
|
|
ctx.fillStyle = '#7d8087'
|
|
ctx.strokeStyle = '#1d1409'
|
|
ctx.lineWidth = 2
|
|
ctx.beginPath(); ctx.roundRect(-17, -4, 34, 10, 3); ctx.fill(); ctx.stroke()
|
|
// 身躯(斗篷状)
|
|
ctx.fillStyle = '#8d9097'
|
|
ctx.beginPath()
|
|
ctx.moveTo(-11, -4); ctx.quadraticCurveTo(-13, -26, -6, -32)
|
|
ctx.lineTo(6, -32); ctx.quadraticCurveTo(13, -26, 11, -4)
|
|
ctx.closePath()
|
|
ctx.fill(); ctx.stroke()
|
|
// 头
|
|
ctx.beginPath(); ctx.arc(0, -38, 8, 0, TAU); ctx.fill(); ctx.stroke()
|
|
// 高光
|
|
ctx.fillStyle = '#b0b4bc'
|
|
ctx.beginPath(); ctx.arc(-3, -40, 2.4, 0, TAU); ctx.fill()
|
|
ctx.beginPath(); ctx.ellipse(-7, -18, 2.4, 8, 0.2, 0, TAU); ctx.fill()
|
|
// 怀中微光(生命之火)
|
|
const tw = 0.5 + Math.sin((env?.time || 0) * 2.4 + e.id) * 0.5
|
|
ctx.fillStyle = `rgba(120,220,160,${0.35 + tw * 0.35})`
|
|
ctx.beginPath(); ctx.arc(0, -16, 3.4 + tw * 1.2, 0, TAU); ctx.fill()
|
|
},
|
|
},
|
|
},
|
|
hooks: {
|
|
onPlayerDeath(g, p) {
|
|
const statue = g.entities.find((e) => e.type === 'revivestatue')
|
|
if (!statue) return
|
|
g.removeEntity(statue)
|
|
p.hp = 75
|
|
p.hunger = 75
|
|
p.san = 100
|
|
p.temp = Math.max(p.temp, 12)
|
|
p.darkT = 0
|
|
g.ptip(p, '远处的复活雕像碎裂了——你重获新生!')
|
|
g.tip(`${p.name || '玩家'}被复活雕像救了回来`)
|
|
g.shake(5)
|
|
return true
|
|
},
|
|
},
|
|
}
|