Skip to content

Battles ~ Current Battle Structs 2022

nmkhan100 edited this page Apr 29, 2022 · 34 revisions

Relevant Structs in Other Modules Related To Battle

We are identifying which data structures that are related to the battle class. We have located where they are and provided a short description of what they are and how we might be able to integrate our data structures with them.

Data Structures in Game State

Game

Player

There are a lot of structs that have different purposes all dedicated to stats. One thing that stands out is that everything is in a hash table form.

stats_global_t/stats_global_hash_t

Makes up a hash table that keeps track of all stats available in the game. Also keeps track of all the values in the game. If we want to implement more stats, we must make sure that this global stat struct can be able to deal with other stats. Currently uses a string to store the name for the stat.

stats_t/stats_hash_t

Represents a singular stat of a player. Has a maximum value, a current value, and a modifier attached to it. Unlike the stat_t data type in Battles, this is a singular data type, almost as if it is used to make stats. In order to make this aligned, we could make a battle_stats struct instead that is dedicated for stats for battling.

stat_mod_t

Represents a modification to a stat. Has a duration as well as a pointer to the stat that it is affecting. Seems like it is similar to our stat_changes struct except it is specified to a singular stat and seems to be a linked list. Our implementations seem to be very different from one another and we will need to take time to consider how we should deal with this conflict.

Items

Data Structures in Class

Class

Data Structures in NPC

NPC Battle Struct

npc_battle

This struct contains information used for battles with non-player characters. It consists of pointers to a stat struct and moves struct, difficulty level of ai, hostility level of the character, and the health level when the character will surrender. It also has the NPC health level, which might not be necessary considering there’s a pointer to a stat struct, which has this information in the struct. A lot of these elements could be replaced with a combatant struct as it has most of these elements in the structure.

Clone this wiki locally