/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here GenericEnemy.Name = "Monster"; base.Initialize(); //Creates characters on initalization //Needs some sort of file reader beforehand to input stats //For now they have defaults turn = 0; monstersKilled = 0; currentTime = 0; PlayerTarget = -1; targetting = false; BattleLog = "BATTLELOG:"; RedPotion = new Potions(0, RedBottle); GreenPotion = new Potions(1, GreenBottle); BluePotion = new Potions(2, BlueBottle); OrangePotion = new Potions(3, OrangeBottle); YellowPotion = new Potions(4, YellowBottle); PurplePotion = new Potions(5, PurpleBottle); MilkPotion = new Potions(6, MilkBottle); BlackPetalPotion = new Potions(7, BlackPetalBottle); HealerObj = new Actor("Healer"); TankObj = new Actor("Tank"); MageObj = new Actor("Mage"); DpsObj = new Actor("Warrior"); HealerObj.ActorFile("Healer"); TankObj.ActorFile("Tank"); MageObj.ActorFile("Mage"); DpsObj.ActorFile("Warrior"); GenericEnemy = new Actor("Generic"); DragonObj = new Actor("PurpleEvilDragon"); FrogObj = new Actor("RobotSnowFrog"); DragonObj.ActorFile("PurpleEvilDragon"); FrogObj.ActorFile("RobotSnowFrog"); testHeal = new Move("testHeal"); testTargetHeal = new Move("testTargetHeal"); testBash = new Move("testBash"); testCast = new Move("testCast"); testSlash = new Move("testSlash"); testFireBreath = new Move("testFireBreath"); testClaw = new Move("testClaw"); testCannon = new Move("testCannon"); testHop = new Move("testHop"); testHeal.MoveRead("testHeal"); testBash.MoveRead("testBash"); testCast.MoveRead("testCast"); testSlash.MoveRead("testSlash"); testFireBreath.MoveRead("testFireBreath"); testClaw.MoveRead("testClaw"); testCannon.MoveRead("testCannon"); testHop.MoveRead("testHop"); monsterList = new List<Actor>(); monsterList.Add(DragonObj); monsterList.Add(FrogObj); enemyAttackList = new List<Move>(); enemyAttackList.Add(testFireBreath); enemyAttackList.Add(testClaw); enemyAttackList.Add(testCannon); enemyAttackList.Add(testHop); }
public void ActorFile(string actorName) { StreamReader mySR = null; try { mySR = new StreamReader("Actor.txt"); string line; while ((line = mySR.ReadLine()) != actorName) { //Skip all character data before specified character } int i = 0; while ((line = mySR.ReadLine()) != null && i<5) { dataOrganized.Add(line); i++; } //Name = dataOrganized[0]; inventory = new Potions[3]; Health = int.Parse(dataOrganized[0]); curHealth = Health; Stamina = int.Parse(dataOrganized[1]); curStamina = Stamina; Attack = int.Parse(dataOrganized[2]); Dodge = int.Parse(dataOrganized[3]); Magic = int.Parse(dataOrganized[4]); Experience = int.Parse(dataOrganized[5]); curExperience = 0; } catch { Console.WriteLine("File not found"); } finally { if (mySR != null) mySR.Close(); } //Sets up move list so characters can pull from common move .txt for (int j = 0; j < dataOrganized.Count() - 7; j++) { moveList[j] = dataOrganized[j + 7]; } }
private void UsePotion(Potions potion, int target) { if(potion.Aoe) { HealerObj.curHealth += potion.amountHealed; HealerObj.curStamina += potion.amountStamina; TankObj.curHealth += potion.amountHealed; TankObj.curStamina += potion.amountStamina; MageObj.curHealth += potion.amountHealed; MageObj.curStamina += potion.amountStamina; DpsObj.curHealth += potion.amountHealed; DpsObj.curStamina += potion.amountStamina; } else { switch (target) { case 0: HealerObj.curHealth += potion.amountHealed; HealerObj.curStamina += potion.amountStamina; break; case 1: TankObj.curHealth += potion.amountHealed; TankObj.curStamina += potion.amountStamina; break; case 2: MageObj.curHealth += potion.amountHealed; MageObj.curStamina += potion.amountStamina; break; case 3: DpsObj.curHealth += potion.amountHealed; DpsObj.curStamina += potion.amountStamina; break; case 4: GenericEnemy.curHealth += potion.amountHealed; GenericEnemy.curStamina += potion.amountStamina; break; } } }