Battles ~ User Stories Review 2022 - uchicago-cs/chiventure GitHub Wiki
This page documents the state of the RPG battles User Stories at the beginning of the Spring term of 2022.
User story 1: I want to choose to battle NPCs so that we can interact with them.
This has been implemented. I have not found where the battle infrastructure is integrated into the world (i.e. the functionality is dependent on a working npc dialogue system that is integrated with the parser and all) but all of the structs and functions I linked here seem well-set up:
in npc the npc struct holds a boolean field will_battle and a pointer to an npc_battle struct in npc_battle there is an npc_battle struct that contains the stats and abilities of an npc. it also contains a function that transfers the items held by an npc from its inventory into a room in dialogue a leaf of a dialogue tree can hold START_BATTLE in battle_flow there is a set_battle function that takes an npc and translates it into a combatant struct within a battle struct.
User Story 2: I want to encounter random NPC battles so that the user can level up and be challenged.
Fatimah, Emilio and I have come to the conclusion that the mechanism to start battles in which an NPC randomly comes up to a player (think wild Pokémon encounters) has not yet been implemented. Since the function to start a battle has been implemented in the battle_flow, we believe that we will need to work with the open-world team to create scenarios that will trigger an NPC to automatically start a battle.
User Story 3: I want my items to affect the battles so that 1) Items increase my battle stats such as strength or health and 2) Items are requirements for possible attacks.
Items are defined in game-state with relevant functions for use and removal. The struct for moves in the battle_moves module takes a pointer to a battle_item struct as a parameter and the battle_logic module has functions for finding, using, and removing items. In battle_logic, consume_battle_item allows items to increase stats and use_battle_item allows them to be used to inflict damage, fulfilling the first request. As for the second, battle_flow_item in the battle_flow module seems to prevent moves that require an item from being used when that item is not present. This story appears to be fully implemented.
User story 4: I want my battles to be turn-based so that: Battles alternate between player and NPC, starting turn potentially based on a speed stat
There are functions for running individual iterations of a turn loop, but there is no overall 'run_battle' function to run the battle loop.
battle_flow has a battle_flow_move function that carries out a turn. there is also a function for carrying out an npc move.
battle_logic has a goes_first function that determines which player goes first based on speed stats.
User Story 5: I want different kinds of attacks so that: -There is Offensive vs. Defensive -Variable categories allow for unlimited elements / types / classes of moves (e.g. regular, special, magic, ninja, water)
The battle_moves module contains functions that create and initialize a move_t struct, which contains a field that is true if the move is offensive or false if the move is defensive. While there are test moves for the paladin, cleric, bard, and wizard classes, there is no set system for implementing moves that are categorized in multiple different classes such as a paladin with water magic moves, or for implementing moves of specific classes other than those four. We think we might need to collaborate with the rpg skill-tree team to implement this.
User Story 6: I want status effects so that moves can cause / clear status effects.
There is no implementation of a character being able to have a status, inflicting/curing statuses with moves or items, or statuses affecting stats/moves. We would need to modify existing structs to add a new status_effect struct and fields along with create functions for applying, removing, and activating the effects of statuses after coming up with a list of statuses to implement.
User story 7: I want moves to have a counter of uses so that it limits their use.
There is a move struct in battle_structs but it does not contain a counter of uses, so this has not been implemented yet.
User Story 8: I want these as possible actions when I type into the terminal so that I can use: - MOVES - USE [MOVE] -- uses a move - LIST -- lists all of my moves (cap at N moves) - INFO [MOVE] -- lists information about move - ITEMS - USE “name of item” - LIST -- lists my items - INFO -- lists information about an item - ENEMY - STATUS -- gives any effects currently on them - INFO -- lists information about the enemy (hp, attack, etc.)
This is partially implemented. In action_management, there is an enum with different actions that a player can take, which includes USE. Moreover, the battle_structs module has structs for each move and each item that include a description field. Battle_logic even includes checks for making sure the inputted move exists. Currently, there is no way to see the enemy's status, but this may be combined with enemy info for the sake of simplicity. We will need to work with the CLI team to create a function that lists the items or moves of a player or enemy when prompted with the command line.
User Story 9: I want custom death results or messages so that we know if 1) The NPC or player dies or 2) The NPC or player is “defeated”.
The battle_over function in the battle_logic module determines whether a battle is in progress or has been won by the player or enemy. print_battle_winner in the battle_print module takes a player- or enemy-won battle end status and prints a message, but the specific message is hard-coded; we would need to modify the function to take in a string template from the developer so they can customize battle messages.
User Story 10: Battle Example (See User Stories)
The general flow of the battle seems to be compatible with what we have seen and all of the features included are ones that are either already implemented or on the wishlist; however, the stats used in the example are different from the ones actually implemented in the code and we would like to look into what stat spread offers the most streamlined implementation for us and creative freedom for developers.