Generates a DnD-like monster encounter from a provided set of monsters and their stats based on the capability or level of a party.
This was created throughout a number of exercises as part of CMPT 470 Winter 2021 Term.
The following can be used to build and compile the exercises:
In the ./
directory of the exercise, use following to build the program:
cargo build
Then use:
cargo run --bin $TASK $FILE
or
./target/debug/$TASK $FILE
Where $FILE
is the name/path of a monster db file, and $TASK
is one of the
following:
task1a
-- single iteration, allows repeats of monsterstask1b
-- single iteration, does not allow repeats of monsterstask2a
-- multiple encounters, allows repeats of monsterstask2b
-- multiple encounters, does not allow repeats of monsterstask3
-- the same astask2a
; all tasks now use theEncounter
struct.
./target/debug/task1a monsters.txt
will run the task 1a binary using the roster from the file monsters.txt
.
Monsters must have the following information and stats associated with them:
Name | Initiative | Armour | Attack | Challenge Rating |
---|---|---|---|---|
example_1 | -1 | 17 | 9 | 10 |
example_2 | 2 | 15 | 4 | 1 |
The Input file for the monsters should be a plain text file
with each field delineated by a space, ' '
character, like such:
monster_1 -1 17 9 10
monster_2 2 15 4 1
This repository includes:
src/lib.rs
-- the monsters librarysrc/encounter/
-- module containing the encounter representationsrc/logger/
-- module containing structs, and function related to file loggingsrc/monsters/
-- module containing the representation of the collection of monsters, and the actions that can be performed on them.src/tasks/
-- directory containing the main programs for reach taskCargo.toml
-- the cargo imports