Sunday, March 4, 2012

Souls for Smuggler's Shiv.js

Taking a break from Code Academy to work on a project for the D&D campaign I am running using Paizo's "Serpent's Skull" books. The players are castaways on a topical island along with a few others from their ship.

I decided I wanted to simulate what happens to those non-player characters left back at their camp next to the wreck of the Brine Demon, while the people in my game are out exploring. The program takes a starting and ending day (based on how long they have been on the island), and generates output like this:

Day 1: 8 food.
Aerys becomes shaken. She does nothing today.
Gelik remains shaken. He guards the Brine Demon campsite.
Jask remains hopeful. He keeps the camp clean and bug free.
Sasha remains hopeful. She hunts and fishes 2 food.
3 Human Zombies mindlessly stumble through the traps and are destroyed. 4 Thrunefang Cannibals watch the camp from a distance.
Gained 2 food, consumed 4 with 6 food remaining.


Day 2: 6 food.
Aerys becomes frightened. She does nothing today.
Gelik becomes frightened. He guards the Brine Demon campsite.
Jask remains hopeful. He keeps the camp clean and bug free.
Sasha remains hopeful. She hunts and fishes 4 food.
3 Dimorphodons soar lazily nearby.
Gained 4 food, consumed 4 with 6 food remaining.


Shiv processing complete! Shiv.js

I still need to add in the functions that test if they have come down with, or recovered, from some tropical disease. As their internal numbers are influenced by illness, which npc is assigned to a job may change.