public Monster(Monster m) { name = m.name; abilities = new AbilityList(m.abilities); stats = new StatList(m.stats); level = m.level; idx = m.idx; type = new Type(m.type); }
public Monster(string monsterName) { for (int i = 0; i < DataClass.masterMonsterList.Count; i++) { if (DataClass.masterMonsterList[i].name.Equals(monsterName)) { name = DataClass.masterMonsterList[i].name; abilities = new AbilityList(DataClass.masterMonsterList[i].abilities); stats = DataClass.masterMonsterList[i].stats; } } }
void loadMasterMonsterList() { string[] s = File.ReadAllLines(monsterFile); int numArgs = 10; for (int i = 0; i < s.Length; i += numArgs) { //grabs stat values int offset1; int[] statValues = new int[StatList.statNames.Length]; for (offset1 = 1; offset1 <= statValues.Length; offset1++) { statValues[offset1 - 1] = int.Parse(s[i + offset1]); } Type type = new Type(s[i + offset1]); offset1++; //gets the names of the monster's abilities int offset2 = offset1; string[] abilityNames = new string[AbilityList.getAbilityLimit()]; for (; offset2 < offset1 + AbilityList.getAbilityLimit(); offset2++) { abilityNames[offset2 - offset1] = s[i + offset2]; } //puts the abilities into the monsters ability list List <Ability> abilityList = new List <Ability>(); for (int j = 0; j < AbilityList.getAbilityLimit(); j++) { if (!abilityNames[j].Equals("none")) { for (int m = 0; m < masterAbilityList.Count; m++) { if (abilityNames[j].Equals(masterAbilityList[m].name)) { abilityList.Add(masterAbilityList[m]); } } } } StatList stats = new StatList(statValues); AbilityList abilities = new AbilityList(abilityList); Monster mon = new Monster(s[i], stats, type, abilities, i / numArgs); masterMonsterList.Add(mon); } }
public AbilityList(AbilityList a) { abilityList = new List <Ability>(a.abilityList); emptyAbilities = a.emptyAbilities; }