I am trying to write a program that is a DnD Character generator.
I am having some issue with getting the feats to work the way I want them to though. Right now I have a Class array set up as the following
var feats: Feats[]; //stores Feats in an array
class Feats
{
var name: String; //name of feat
var desc: String; //description of feat
static var nameV: String = name; //for the purpose of calling on the feat outside of the class
static var selected: boolean; //determines if feat is selected is or not
}
I have a feat called “Toughness” that when selected will give the player +3Hp at first level.
The question I have is; Is there a way to call on that particular feat name and selected variable without having to use the array element?
Something along the lines of:
if(Feats.Toughness.selected)
{
startHP = 13 + modCON;
}
else
{
startHP = 10 + modCON;
}
instead of
if(feats[#].selected)
{
}
else
{
}
The reason I would like to do it the first way instead of the second is for ease of referencing them without knowing the element number in the array