public void RemoveViper(Viper viper, bool destroyed = false) { CurrentGameState.Dradis.RemoveComponent(viper); var modifiedViper = CurrentGameState.Vipers.FindIndex(x => x.PermanentDesignation == viper.PermanentDesignation); if (modifiedViper == -1) { return; } CurrentGameState.Vipers[modifiedViper].Status = (destroyed ? ComponentStatus.Destroyed : ComponentStatus.Damaged); }
private List <Viper> BuildVipers() { var viperLimit = ConfigurationManager.AppSettings["MaxVipers"].ParseAs <int>(); var vipers = new Viper[viperLimit]; var viperInt = 0; // This is a janky way to do a ForEach loop but this is still superior to a For loop because this is guaranteed to terminate. foreach (var viper in vipers) { var newViper = new Viper { PermanentDesignation = Guid.NewGuid(), InternalDesignation = Guid.NewGuid(), PublicDesignation = "Vigilante " + (viperInt + 1), Status = ComponentStatus.InReserve }; vipers[viperInt] = newViper; viperInt++; } return(vipers.OrderBy(x => x.InternalDesignation).ToList()); }
public static Monster CreateMonster(int level, Point location) { Pool <Monster> monsterPool = new Pool <Monster>(); if (level <= 2) { monsterPool.Add(Rat.Create(level), 20); monsterPool.Add(Lichen.Create(level), 30); monsterPool.Add(Jackal.Create(level), 25); monsterPool.Add(Kobold.Create(level), 25); } else if (level <= 4) { monsterPool.Add(Lichen.Create(level), 15); monsterPool.Add(Rat.Create(level), 16); monsterPool.Add(Jackal.Create(level), 25); monsterPool.Add(Kobold.Create(level), 25); monsterPool.Add(Goblin.Create(level), 15); monsterPool.Add(Sludge.Create(level), 3); monsterPool.Add(Wolf.Create(level), 1); } else if (level <= 6) { monsterPool.Add(Jackal.Create(level), 5); monsterPool.Add(Wolf.Create(level), 10); monsterPool.Add(Kobold.Create(level), 15); monsterPool.Add(Goblin.Create(level), 30); monsterPool.Add(Sludge.Create(level), 25); monsterPool.Add(Gnoll.Create(level), 5); monsterPool.Add(Viper.Create(level), 10); } else if (level <= 8) { monsterPool.Add(Goblin.Create(level), 8); monsterPool.Add(Slime.Create(level), 15); monsterPool.Add(Viper.Create(level), 8); monsterPool.Add(Wolf.Create(level), 20); monsterPool.Add(Gnoll.Create(level), 25); monsterPool.Add(LizardMan.Create(level), 10); monsterPool.Add(Werewolf.Create(level), 4); } else if (level <= 10) { monsterPool.Add(Ogre.Create(level), 10); monsterPool.Add(Gnoll.Create(level), 10); monsterPool.Add(Werewolf.Create(level), 20); monsterPool.Add(LizardMan.Create(level), 30); monsterPool.Add(Orc.Create(level), 20); monsterPool.Add(Dragon.Create(level), 10); } else { monsterPool.Add(Werewolf.Create(level), 20); monsterPool.Add(Ogre.Create(level), 20); monsterPool.Add(LizardMan.Create(level), 20); monsterPool.Add(Orc.Create(level), 20); monsterPool.Add(Dragon.Create(level), 30); } Monster monster = monsterPool.Get(); monster.X = location.X; monster.Y = location.Y; return(monster); }