Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Hollow Knight: a check of the Snail Shaman's temple

Mason363a7296b6bf697
diff --git a/games/hollowknight/tests/check.py b/games/hollowknight/tests/check.py
index cb6856c3..4d9cd601 100644
--- a/games/hollowknight/tests/check.py
+++ b/games/hollowknight/tests/check.py
@@ -17,6 +17,8 @@
overcharmed on the fifth try and off again, kept by Home in the inventory and a load
- the stag stations: each seen (their blanker faded out), come in by its gate, by the stag (called by its bell) and
loaded at its bench
+- the Snail Shaman's temple, played as one game: his spell taken, the Elder Baldur killed, his talk opening the gate, and
+ so after a save and a load too; its lifeblood cocoon broken through a load and a rest there, whole after another bench
- the way to the False Knight, played room by room as one game (the Knight unhurt): from a new game's fall into King's
Pass, and from the Aspid Hunters' arena by the hot spring, to his arena, where he comes down
- every room played with its enemies hit, in a new game and after the bosses, drawn whole and fast (as a slow
@@ -81,6 +83,9 @@ def main():
with tempfile.TemporaryDirectory() as saves:
rc, out = play("--gates", "stations", env={"HKSAVES": saves})
results.append(report("stag stations: seen, the rides", rc, out, ("FAIL",)))
+ with tempfile.TemporaryDirectory() as saves:
+ rc, out = play("--gates", "shaman", env={"HKSAVES": saves})
+ results.append(report("the Snail Shaman: his spell, the Elder Baldur, his gate, saved and loaded", rc, out, ("FAIL",)))
rc, out = play("--gates", "way")
results.append(report("the way to the False Knight", rc, out, ("FAIL",)))
# the soul orb: dark inside with no soul, its liquid white in it when full (in the screen's pixels at its middle)
diff --git a/games/hollowknight/tests/play.c b/games/hollowknight/tests/play.c
index 45d6d506..8530d1a5 100644
--- a/games/hollowknight/tests/play.c
+++ b/games/hollowknight/tests/play.c
@@ -402,6 +402,162 @@ static int stations_test(void) {
return station_fails ? 1 : 0;
}
+/* the Snail Shaman (Mason363/NumPlay#245), played in his temple from a new game: in by its left gate, his talk, his
+ * spell summoned and taken (the Knight up again behind the bone gate), his talk through it; the Elder Baldur killed by
+ * Vengeful Spirit, his talk opening the gate; saved and loaded, the gate still open, the Baldur still gone. Then as #245
+ * had it: the Baldur killed, the game saved and loaded before the Shaman is told, his talk then; the lifeblood cocoon
+ * broken there before, broken still after the load and a rest at his bench, whole again after a rest at another (the
+ * Knight put by the Baldur and the cocoon: the climbs are not what is checked) */
+static int shaman_fails;
+static void shaman_check(bool ok, const char *what) {
+ printf("%s shaman: %s (shaman %d, fireball %d, in %s at %.2f,%.2f)\n", ok ? "ok " : "FAIL", what, g_pd.shaman,
+ g_pd.fireball_level, room_name(g_room.id), g_hero.body.x, g_hero.body.y);
+ shaman_fails += !ok;
+}
+static bool hero_free(void) {
+ const Hero *h = &g_hero;
+ return h->accepting_input && !h->control_relinquished && h->state != HS_NO_INPUT && !dialogue_box_shown();
+}
+static void walk_to(float x) {
+ for (int t = 0; t < 600 && fabsf(g_hero.body.x - x) > 0.2f; t++) run_ticks(1, g_hero.body.x < x ? K_RIGHT : K_LEFT);
+ run_ticks(30, 0);
+}
+static void put_at(float x, float y) {
+ g_hero.body.x = x, g_hero.body.y = y, g_hero.body.vx = g_hero.body.vy = 0;
+ run_ticks(60, 0);
+}
+/* (Up, then OK on each page while his box is up: true once it came up and went, the Knight free again) */
+static bool shaman_talk(void) {
+ run_ticks(3, K_UP);
+ bool shown = false;
+ for (int t = 0; t < 4000; t += 40) {
+ run_ticks(40, 0);
+ shown |= dialogue_box_shown();
+ if (shown && hero_free()) return true;
+ if (dialogue_box_shown()) run_ticks(2, K_OK | K_JUMP);
+ }
+ return false;
+}
+static const Ent *temple_ent(int kind, int a) {
+ int n;
+ const Ent *es = room_ents(&n);
+ for (int i = 0; i < n; i++)
+ if (es[i].type == ENT_OBJ && es[i].flags == kind && (a < 0 || es[i].a == a)) return &es[i];
+ return NULL;
+}
+static bool gate_shut(void) { return phys_ray(44, 8.6f, -1, 0, 4, CF_SOLID, NULL); } /* (the bone gate, at 42.4) */
+/* (by the Elder Baldur, on its right, Vengeful Spirit cast at it (the soul given) until the Shaman hears of it) */
+static void kill_baldur(void) {
+ put_at(64, 21.5f);
+ run_ticks(2, K_LEFT);
+ for (int k = 0; k < 12 && g_pd.shaman != 4 && g_pd.shaman != 5; k++) {
+ g_pd.mp = 33;
+ run_ticks(3, K_FOCUS | K_SPELL);
+ run_ticks(60, 0);
+ }
+ run_ticks(100, 0);
+}
+static bool baldur_gone(void) {
+ /* (dead in the save; its block off: the Knight walks on past where it was) */
+ const Ent *b = temple_ent(OK_ENEMY, EK_ELDERBALDUR);
+ put_at(58, 21.5f);
+ walk_to(47.5f);
+ return b && persist_get(b->persist) && g_hero.body.x < 48.5f;
+}
+static bool rest_at(int room, float x, float y) {
+ game_enter(room, x, y, true);
+ run_ticks(60, 0);
+ run_ticks(3, K_UP);
+ run_ticks(150, 0);
+ bool rested = pd_flag(PDF_AT_BENCH);
+ run_ticks(3, K_RIGHT);
+ run_ticks(60, 0);
+ return rested;
+}
+static int shaman_test(void) {
+ if (getenv("HKSAVES")) {
+ extern void host_save_dir(const char *d);
+ host_save_dir(getenv("HKSAVES"));
+ }
+ shielded = true;
+ game_new();
+ save_select(SAVE_SLOTS - 1);
+ game_enter_gate(ROOM_CROSSROADS_SHAMANTEMPLE, "left1");
+ run_ticks(100, 0);
+ walk_to(21.8f);
+ shaman_check(shaman_talk() && g_pd.shaman == 1, "met, his spell summoned");
+ /* (the spell: under it, a jump; its message, dismissed; the Knight gets up) */
+ walk_to(19.5f);
+ run_ticks(20, K_JUMP);
+ for (int t = 0; t < 2000 && !msg_shown(); t++) run_ticks(1, 0);
+ run_ticks(400, 0);
+ run_ticks(2, K_JUMP);
+ for (int t = 0; t < 40 && !(g_pd.shaman == 2 && hero_free()); t++) {
+ run_ticks(50, 0);
+ run_ticks(3, K_RIGHT);
+ }
+ shaman_check(g_pd.fireball_level == 1 && g_pd.shaman == 2 && hero_free() && g_hero.body.x > 43,
+ "Vengeful Spirit taken, the Knight up behind the gate");
+ walk_to(43.2f);
+ shaman_check(shaman_talk() && g_pd.shaman == 3 && gate_shut(), "his talk through the gate");
+ save_game(); /* (kept for #245's way, below) */
+ kill_baldur();
+ shaman_check(g_pd.shaman == 4, "the Elder Baldur killed, the Shaman told");
+ put_at(46, 8.5f);
+ walk_to(43.2f);
+ shaman_check(shaman_talk() && g_pd.shaman == 6 && !gate_shut(), "his talk, the gate opened");
+ walk_to(38);
+ shaman_check(g_hero.body.x < 40, "through the gate");
+ save_select(SAVE_SLOTS - 2);
+ save_game();
+ game_new();
+ shaman_check(save_load(SAVE_SLOTS - 2) && game_respawn(), "saved, a new game, loaded");
+ run_ticks(200, 0);
+ shaman_check(g_room.id == ROOM_CROSSROADS_SHAMANTEMPLE && g_pd.shaman == 6 && !gate_shut(), "loaded: the gate open");
+ walk_to(21.8f); /* (back where he was met, once the gate is open) */
+ shaman_check(shaman_talk() && g_pd.shaman == 6 && !gate_shut(), "loaded: his talk where he was met");
+ shaman_check(baldur_gone(), "loaded: the Elder Baldur gone");
+ /* (#245's way: the save before the Baldur loaded; the cocoon broken; the Baldur killed; saved and loaded) */
+ game_new();
+ save_select(SAVE_SLOTS - 1);
+ shaman_check(save_load(SAVE_SLOTS - 1) && game_respawn() && g_pd.shaman == 3, "the save before the Baldur loaded");
+ run_ticks(200, 0);
+ const Ent *cocoon = temple_ent(OK_COCOON, -1);
+ put_at(38.5f, 46.5f);
+ run_ticks(3, K_UP | K_ATTACK);
+ run_ticks(100, 0);
+ shaman_check(cocoon && persist_get(cocoon->persist), "the lifeblood cocoon broken");
+ kill_baldur();
+ shaman_check(g_pd.shaman == 4, "the Elder Baldur killed again");
+ save_game();
+ game_new();
+ shaman_check(save_load(SAVE_SLOTS - 1) && game_respawn(), "saved, a new game, loaded");
+ run_ticks(200, 0);
+ shaman_check(g_pd.shaman == 4 && gate_shut() && persist_get(cocoon->persist), "loaded: the gate shut, the cocoon broken");
+ walk_to(43.2f);
+ shaman_check(shaman_talk() && g_pd.shaman == 6 && !gate_shut(), "loaded: his talk, the gate opened");
+ shaman_check(baldur_gone(), "loaded: the Elder Baldur gone");
+ /* (his bench, beyond the gate: the cocoon in its room stays broken; another's: whole again) */
+ shaman_check(rest_at(ROOM_CROSSROADS_SHAMANTEMPLE, 15.09f, 8) && persist_get(cocoon->persist),
+ "rested at his bench: the cocoon broken still");
+ shaman_check(rest_at(ROOM_CROSSROADS_47, 29.34f, 7) && !persist_get(cocoon->persist),
+ "rested at another bench: the cocoon whole again");
+ /* (broken again, saved away from a bench (as Home does) and loaded at that bench: whole again, Init Resting's) */
+ game_enter(ROOM_CROSSROADS_SHAMANTEMPLE, 38.5f, 46.5f, true);
+ run_ticks(60, 0);
+ run_ticks(3, K_UP | K_ATTACK);
+ run_ticks(100, 0);
+ bool broken = persist_get(cocoon->persist);
+ save_game();
+ game_new();
+ shaman_check(broken && save_load(SAVE_SLOTS - 1) && game_respawn(), "broken again, saved, a new game, loaded");
+ run_ticks(200, 0);
+ shaman_check(g_room.id == ROOM_CROSSROADS_47 && !persist_get(cocoon->persist), "loaded at that bench: the cocoon whole");
+ shielded = false;
+ printf("shaman: %d failing\n", shaman_fails);
+ return shaman_fails ? 1 : 0;
+}
+
/* the ground's seams, as the calculator rounds: from many places in every room the Knight lands on the ground, then is
* put a few float steps lower (as near as rounding leaves him), and must walk both ways where no wall stops him; and
* jumping at a wall, put a few steps nearer it, he must fall back down, not hang on it */
@@ -790,6 +946,7 @@ static int gates_test(const char *which) {
if (!strcmp(which, "arenas")) return arenas_test();
if (!strcmp(which, "charms")) return charms_test();
if (!strcmp(which, "stations")) return stations_test();
+ if (!strcmp(which, "shaman")) return shaman_test();
if (!strncmp(which, "wander:", 7)) { /* (wander:ROOM|all:seed:ticks) */
char room[64];
int seed = 1, ticks = 6000;