So I am trying to create a text-based adventure/dungeon crawler game. I am trying to use a similar system to what I used in a text-based Pokemon game for the storage of items, monsters, etc. Here is my functional code for the storage system in C#.
public static Dictionary<string, pokemonTrainer> pokemonTrainers = new Dictionary<string, pokemonTrainer>()
{
{"Robert", new pokemonTrainer{name="Robert",typesOfPokemon={"Plant","Normal"}, levelMultiplier=0.4}},
{"James", new pokemonTrainer{name="James",typesOfPokemon={"Plant","Normal","Water","Fire","Ice","Flying","Electric","Poison","Psychic","Fighting","Dark","Dragon","Fairy","Rock","Ghost","Ground","Bug"},levelMultiplier=0.8}}
};
I would like to create my hashtable with certain key-value pairs inside of it like what is being done in the C# code instead of just adding them with .put() is this possible? If so how would I do it? And if not what would be the best way to create a storage system like this?
If it helps at all here's my declaration for the hashtable in java,
public static Hashtable<Integer, monster> monster_data_base = new Hashtable<Integer, monster>()
{
};
and here's the monster class I would like to be the value part of the key-value pairs.
class monster
{
private int health;
private int damage;
private String name;
private int level;
monster(int health, int damage, String name, int level)
{
this.health=health;
this.damage=damage;
this.name=name;
this.level=level;
}
String get_name()
{
return name;
}
int get_health()
{
return health;
}
int get_damage()
{
return damage;
}
void change_health(int change_in_durabilty)
{
health=health+change_in_durabilty;
}
int get_level()
{
return level;
}
}