public string PurchaseGladiator(Gladiator boughtGladiator) { if (boughtGladiator.Value <= Player.Gold) { boughtGladiator.InPlayersTeam = true; Player.MySchool.Add(boughtGladiator); Gladiator gladToRemove = null; foreach (Gladiator glad in Stock) { if (boughtGladiator.Name == glad.Name) { gladToRemove = glad; break; } } Stock.Remove(gladToRemove); Player.Gold -= boughtGladiator.Value; string output = "You have bought " + gladToRemove.Name + " for " + gladToRemove.Value + "gold."; return(output); } else { return("You can't afford this gladiator."); } }
public static int GladiatorDamageCalculator(Gladiator attacker, Gladiator defender) { int weaponDamage = RandomNumberGenerator.RandomNumber(attacker.WeaponEquipped.MinDamage, attacker.WeaponEquipped.MaxDamage); int damageDealt = (attacker.AttackDamage) * weaponDamage; int damageTaken = damageDealt / defender.ArmourEquipped.ArmourValue; defender.CurrentHP -= damageTaken; return(damageTaken); }
public static List <Gladiator> PopulateListOfGladiators(int numberOfGladiators, int townID, string exp, string weapons, string armours) { List <Gladiator> list = new List <Gladiator>(); StreamReader readerName = new StreamReader("gladiatorNamesList" + townID + ".txt"); List <string> names = new List <string>(); while (!readerName.EndOfStream) { names.Add(readerName.ReadLine()); } readerName.Close(); StreamReader readerDescription = new StreamReader("gladiatorDescriptionList" + townID + ".txt"); List <string> descriptions = new List <string>(); while (!readerDescription.EndOfStream) { descriptions.Add(readerDescription.ReadLine()); } string[] stringEXPs = exp.Split('|'); List <int> EXPs = new List <int>(); foreach (string exps in stringEXPs) { EXPs.Add(Int32.Parse(exps)); } char[] WeaponIDs = weapons.ToCharArray(); char[] ArmourIDS = armours.ToCharArray(); for (int i = 0; i < numberOfGladiators; i++) { int nameNumber = RandomNumberGenerator.RandomNumber(0, names.Count - 1); int descriptionNumber = RandomNumberGenerator.RandomNumber(0, descriptions.Count - 1); Gladiator tempGlad = new Gladiator(names[nameNumber], descriptions[descriptionNumber]); tempGlad.EXP = EXPs[i]; tempGlad.LevelUpGladiator(); tempGlad.WeaponEquipped = WeaponByID((int)Char.GetNumericValue(WeaponIDs[i])); tempGlad.ArmourEquipped = ArmourByID((int)Char.GetNumericValue(ArmourIDS[i])); list.Add(tempGlad); } return(list); }
public static Gladiator PickGladiatorFromDGV(bool myGladList, string gladName) { List <Gladiator> toUse = new List <Gladiator>(); if (myGladList) { toUse = Player.MySchool; } else { toUse = Player.CurrentTown.GladiatorShop.Stock; } Gladiator currentGladiator = Gladiator.GladiatorByName(gladName, toUse); return(currentGladiator); }
public BattleTile(Panel panelIn, Occupied state, int height, int width, int x, int y, int mapSquare, RichTextBox rtbbattleMonitor, BattleTile selectedTile, List <Gladiator> myTeam, List <Gladiator> enemyTeam, BattleTile[,] arena, int yHeight) { Button = new Button(); gladiator = null; Height = height; Width = width; TopLoc = height * y; LeftLoc = width * x; X = x + 1; Y = yHeight - y; rtbBattleMonitor = rtbbattleMonitor; SelectedTile = selectedTile; MyTeam = myTeam; EnemyTeam = enemyTeam; ArenaField = arena; Button.Click += new EventHandler(buttonClicked); switch (mapSquare) { case 0: { Button.BackColor = Color.Aqua; break; } case 1: { Button.BackColor = Color.Aquamarine; break; } } Button.Height = Height; Button.Width = Width; Button.Left = LeftLoc; Button.Top = TopLoc; Button.Refresh(); }