public Combat(ContentManager content, int height, int width, Game1 game, Player[] p, Enemy[] e) { _content = content; _height = height; _width = width; maingame = game; random = new Random(); highestMenuOption = 1; lowestMenuOption = 3; menuLayer = 0; menuoption = (int)MenuOption.Fight; prevKeyboardState = Keyboard.GetState(); currentKeyboardState = Keyboard.GetState(); thePlayers = p; theEnemies = e; messageQueue = new Queue<string>(); AddMessage("Player Turn"); ranAway = false; }
private Color StatusColor(Player player) { if (player.isFainted == true) return Color.Black; else if (((double)(player.GetPlayerStats().Health) / (double)(player.GetPlayerStats().TotalHealth)) <= .25) return Color.Red; else return Color.White; }
private void LayerZeroAction(GameTime gameTime) { if (menuoption == 1 && IsKeyClicked(Keys.Z) && thePlayers[0].hasGone == false && !thePlayers[0].isFainted) { selectedPlayer = thePlayers[0]; //thePlayers[0].hasGone = true; lastMenuChoiceTime = gameTime.TotalGameTime; ChangeLayers(1); } if (menuoption == 2 && IsKeyClicked(Keys.Z) && thePlayers[1].hasGone == false && !thePlayers[1].isFainted) { selectedPlayer = thePlayers[1]; //thePlayers[1].hasGone = true; lastMenuChoiceTime = gameTime.TotalGameTime; ChangeLayers(1); } if (menuoption == 3 && IsKeyClicked(Keys.Z) && thePlayers[2].hasGone == false && !thePlayers[2].isFainted) { selectedPlayer = thePlayers[2]; lastMenuChoiceTime = gameTime.TotalGameTime; ChangeLayers(1); } }
private void DeterminePlayerMessages(Player p) { if (p.lastPlayerHealth > p.GetPlayerStats().Health && p.GetPlayerStats().Health != 0) { AddMessage(p.Name + " took " + (p.lastPlayerHealth - p.GetPlayerStats().Health) + " damage!"); } else if (p.lastPlayerHealth < p.GetPlayerStats().Health) { AddMessage(p.Name + " recovered " + (p.GetPlayerStats().Health - p.lastPlayerHealth) + " health!"); } else if (p.GetPlayerStats().Health <= 0 && p.isFainted == false) { AddMessage(p.Name + " fainted!"); p.isFainted = true; } }
private void DetermineOtherMessages(Player p) { if (p.lastPlayerHealth == p.GetPlayerStats().Health && selectedEnemy.lastEnemyHealth == selectedEnemy.GetEnemyStats().Health) { AddMessage("No effect.."); } }
public void DrawHealthBars(int x, int y, Player p) { //player health bar spriteBatch.Draw(healthbar, new Rectangle(x, y, healthbar.Width, healthbar.Height), Color.Black); spriteBatch.Draw(healthbar, new Rectangle(x + 5, y + 5, healthbar.Width - 10, healthbar.Height - 10), Color.Gray); spriteBatch.Draw(healthbar, new Rectangle(x + 5, y + 5, (int)((healthbar.Width - 10) * ((double)p.GetPlayerStats().Health / (double)p.GetPlayerStats().TotalHealth)), healthbar.Height - 10), Color.Red); }
public Player[] CreatePlayer() { int []partyMemStats=chosenStats; partyMemStats[0]-=2; partyMemStats[1]-=2; partyMemStats[2]-=2; Texture2D[] pMember1=new Texture2D[4]{partyMember1,partyMember1,partyMember1,partyMember1}; Texture2D[] pMember2=new Texture2D[4]{partyMember2,partyMember2,partyMember2,partyMember2}; Player[] thePlayerList =new Player[3]{ new Player(chosenStats[0],chosenStats[1],chosenStats[2], playerSprites, classIdentifier[0], playerName, new Skill(Skills.Fire), new Skill(Skills.Ice)), new Player(partyMemStats, pMember1, classIdentifier[1], new Skill(Skills.Fire), new Skill(Skills.Ice)), new Player(partyMemStats, pMember2, classIdentifier[2], new Skill(Skills.Fire), new Skill(Skills.Ice)) }; return thePlayerList; }
public Skill ExecuteAI3(Player p, Enemy e) { Skill chosenSkill; int randomNumber = random.Next(1, 100); if (randomNumber > 50) { chosenSkill = skillA; } else { chosenSkill = skillB; } if (chosenSkill.isDamage) { int damage = (int)(enemyStats.Concentration * chosenSkill.skillRatio) - p.GetPlayerStats().Defence; if (damage <= 0) { damage = 1; } p.GetPlayerStats().SubtractHealth(damage); } else if (chosenSkill.isHealing) { int health = (int)(enemyStats.Concentration * chosenSkill.skillRatio); e.GetEnemyStats().addHealth(health); Console.WriteLine(health); } return chosenSkill; }
public Skill ExecuteAI2(Player p, Enemy e) { int randomNumber = random.Next(1, 100); Skill chosenSkill; if (randomNumber > 50) { chosenSkill = null; int damage = enemyStats.Attack - p.GetPlayerStats().Defence; if (damage < 0) { damage = 1; } p.GetPlayerStats().SubtractHealth(damage); } else { chosenSkill = skillA; if (skillA.isDamage) { int damage = (int)(enemyStats.Concentration * skillA.skillRatio) - p.GetPlayerStats().Defence; if (damage <= 0) { damage = 1; } p.GetPlayerStats().SubtractHealth(damage); } else if (skillA.isHealing) { int health = (int)(enemyStats.Concentration * skillA.skillRatio); e.GetEnemyStats().addHealth(health); } } return chosenSkill; }
public void ExecuteAI1(Player p) { int damage = enemyStats.Attack - p.GetPlayerStats().Defence; if (damage <= 0) { damage = 1; } p.GetPlayerStats().SubtractHealth(damage); }
//Should pass in the Player[] party from game1 public OWMenu(Player[] p) { keystate = Keyboard.GetState(); prevKeystate = keystate; party = p; }
public void ExecuteSkillB(Enemy e, Player p) { if (skillB.isDamage) { int damage = (int)(playerStats.Concentration * skillB.skillRatio) - e.GetEnemyStats().Defence; if (damage < 0) { damage = 1; } e.GetEnemyStats().SubtractHealth(damage); } else if (skillB.isHealing) { int health = (int)(playerStats.Concentration * skillB.skillRatio); p.GetPlayerStats().addHealth(health); } }