Sign in
creature

Alpacas

by Potluck · version 1 · Checked for all ages

Woolly, long-necked and curious, humming to each other on the hill where everyone starts, in cream, fawn and brown. Hold wheat and they come to you. In survival, Interact with one to shear it for alpaca fleece (more with shears in hand), which grows back after a while. A workbench makes fleece into a warm hat and a poncho that keep the cold off at night. Bop one and it spits at you.

1--!strict
2-- Alpacas' own tests: `potluck-server --test=alpacas`.
3local test = require("@potluck/test@0.9")
4local world = require("@potluck/world@0.25")
5
6local function herd(): { number }
7 local out = {}
8 for _, k in { "Alpaca", "Fawn alpaca", "Brown alpaca" } do
9 for _, id in world.creatures(test.kind(k)) do
10 table.insert(out, id)
11 end
12 end
13 return out
14end
15
16test.case("a herd of three coats on the hill", function()
17 test.player("Ada")
18 test.wait(1)
19 test.same(#herd(), 4, "four alpacas")
20 test.same(#world.creatures(test.kind("Alpaca")), 2, "two cream ones")
21 test.same(#world.creatures(test.kind("Brown alpaca")), 1, "a brown one")
22end)
23
24test.case("shears give fleece, and it grows back", function()
25 local p = test.player("Ada", { survival = true, carrying = { Shears = 1 } })
26 test.wait(1)
27 local a = test.creature(world.creatures(test.kind("Fawn alpaca"))[1])
28 test.move(p, a.position + vector.create(1.5, 0, 0))
29 test.hold(p, "Shears")
30 test.use(p, a)
31 test.same(world.has(p, "Alpaca fleece"), 3, "three fleece with shears")
32 test.same(a.kind, "Shorn fawn alpaca", "shorn")
33 test.use(p, a)
34 test.same(world.has(p, "Alpaca fleece"), 3, "nothing more to shear")
35 test.wait(4 * 60 + 2)
36 test.same(a.kind, "Fawn alpaca", "its fleece grew back")
37end)
38
39test.case("bopped, it spits and stalks off", function()
40 local p = test.player("Ada")
41 test.wait(1)
42 local a = test.creature(herd()[1])
43 test.move(p, a.position + vector.create(1.5, 0, 0))
44 test.hit(p, a)
45 test.check(test.heard("spit") >= 1, "it spat")
46 test.wait(2)
47 test.check(vector.magnitude(a.position - p.position) > 3, "and stalked off")
48end)