parent
29a14960f4
commit
c8db9d1959
@ -17,6 +17,11 @@ const (
|
|||||||
actBeer // note prev indicates whether the shell was live
|
actBeer // note prev indicates whether the shell was live
|
||||||
actCuff
|
actCuff
|
||||||
actKnife
|
actKnife
|
||||||
|
actAdrenaline
|
||||||
|
actPhone
|
||||||
|
actInverter
|
||||||
|
actPillsHeal
|
||||||
|
actPillsHurt
|
||||||
|
|
||||||
actDealerConcedes // dealer concedes
|
actDealerConcedes // dealer concedes
|
||||||
actChallengerConcedes // challenger concedes
|
actChallengerConcedes // challenger concedes
|
||||||
|
@ -19,13 +19,18 @@ func _() {
|
|||||||
_ = x[actBeer-8]
|
_ = x[actBeer-8]
|
||||||
_ = x[actCuff-9]
|
_ = x[actCuff-9]
|
||||||
_ = x[actKnife-10]
|
_ = x[actKnife-10]
|
||||||
_ = x[actDealerConcedes-11]
|
_ = x[actAdrenaline-11]
|
||||||
_ = x[actChallengerConcedes-12]
|
_ = x[actPhone-12]
|
||||||
|
_ = x[actInverter-13]
|
||||||
|
_ = x[actPillsHeal-14]
|
||||||
|
_ = x[actPillsHurt-15]
|
||||||
|
_ = x[actDealerConcedes-16]
|
||||||
|
_ = x[actChallengerConcedes-17]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _action_name = "StartShootGameEndBeerGameEndChallengerWinsDealerWinsLensCigBeerCuffKnifeDealerConcedesChallengerConcedes"
|
const _action_name = "StartShootGameEndBeerGameEndChallengerWinsDealerWinsLensCigBeerCuffKnifeAdrenalinePhoneInverterPillsHealPillsHurtDealerConcedesChallengerConcedes"
|
||||||
|
|
||||||
var _action_index = [...]uint8{0, 5, 10, 17, 28, 42, 52, 56, 59, 63, 67, 72, 86, 104}
|
var _action_index = [...]uint8{0, 5, 10, 17, 28, 42, 52, 56, 59, 63, 67, 72, 82, 87, 95, 104, 113, 127, 145}
|
||||||
|
|
||||||
func (i action) String() string {
|
func (i action) String() string {
|
||||||
if i >= action(len(_action_index)-1) {
|
if i >= action(len(_action_index)-1) {
|
||||||
|
41
game/item.go
41
game/item.go
@ -11,10 +11,14 @@ const (
|
|||||||
itemBeer
|
itemBeer
|
||||||
itemCuff
|
itemCuff
|
||||||
itemKnife
|
itemKnife
|
||||||
|
itemAdrenaline
|
||||||
|
itemPhone
|
||||||
|
itemInverter
|
||||||
|
itemPill
|
||||||
)
|
)
|
||||||
|
|
||||||
func newItem() item {
|
func newItem() item {
|
||||||
return item(rand.IntN(5)) + 1
|
return item(rand.IntN(9)) + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i item) apply(g *Match) bool {
|
func (i item) apply(g *Match) bool {
|
||||||
@ -57,12 +61,45 @@ func (i item) apply(g *Match) bool {
|
|||||||
g.action = actKnife
|
g.action = actKnife
|
||||||
g.damage = 2
|
g.damage = 2
|
||||||
return true
|
return true
|
||||||
|
case itemAdrenaline:
|
||||||
|
g.action = actAdrenaline
|
||||||
|
// TODO(zeph): implement
|
||||||
|
return true
|
||||||
|
case itemPhone:
|
||||||
|
g.action = actPhone
|
||||||
|
// TODO(zeph): implement
|
||||||
|
return true
|
||||||
|
case itemInverter:
|
||||||
|
g.action = actInverter
|
||||||
|
g.shells[0] = !g.shells[0]
|
||||||
|
return true
|
||||||
|
case itemPill:
|
||||||
|
cur := g.CurrentPlayer()
|
||||||
|
if rand.Uint64() <= (1<<65)/5 {
|
||||||
|
g.action = actPillsHeal
|
||||||
|
cur.hp = min(cur.hp+2, g.hp)
|
||||||
|
} else {
|
||||||
|
g.action = actPillsHurt
|
||||||
|
cur.hp--
|
||||||
|
}
|
||||||
|
return true
|
||||||
default:
|
default:
|
||||||
panic("shotgun: unknown item")
|
panic("shotgun: unknown item")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemNames = [...]string{"", "🔍", "🚬", "🍺", "👮", "🔪"}
|
var itemNames = [...]string{
|
||||||
|
itemNone: "",
|
||||||
|
itemLens: "🔍",
|
||||||
|
itemCig: "🚬",
|
||||||
|
itemBeer: "🍺",
|
||||||
|
itemCuff: "👮",
|
||||||
|
itemKnife: "🔪",
|
||||||
|
itemAdrenaline: "💉",
|
||||||
|
itemPhone: "📱",
|
||||||
|
itemInverter: "🧲",
|
||||||
|
itemPill: "💊",
|
||||||
|
}
|
||||||
|
|
||||||
func (i item) String() string {
|
func (i item) String() string {
|
||||||
return itemNames[i]
|
return itemNames[i]
|
||||||
|
@ -13,6 +13,10 @@ func TestItemStrings(t *testing.T) {
|
|||||||
{itemBeer, "🍺"},
|
{itemBeer, "🍺"},
|
||||||
{itemCuff, "👮"},
|
{itemCuff, "👮"},
|
||||||
{itemKnife, "🔪"},
|
{itemKnife, "🔪"},
|
||||||
|
{itemAdrenaline, "💉"},
|
||||||
|
{itemPhone, "📱"},
|
||||||
|
{itemInverter, "🧲"},
|
||||||
|
{itemPill, "💊"},
|
||||||
}
|
}
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
got := c.item.String()
|
got := c.item.String()
|
||||||
|
Loading…
Reference in New Issue
Block a user