diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index 7b80ce201d5fd8dfe845ca07f21a2698745a4724..a92732ab2dc707d7ea7665c76dcde5646607a62b 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -374,6 +374,155 @@ namespace Controller drawUI.drawAttackConfirm(spriteBatch, font, largeFont, largestFont, player1, graph); //draw char info screen menu drawUI.drawInfoScreen(spriteBatch, player1, font, largeFont); + Unit unit = GameState.selectedUnit; + + #region Attack menu + + Button confirmButton = unit.getButtonType(ButtonType.AttackConfirm); + Vector2 attackInfoLocation2 = new Vector2(519, 0); + + if (GameState.attackConfirmOpen && !GameState.isAnimating) + { + Unit attackedUnit = GameState.unitToAttack; + // get attack stats + bool isMagicAttack = GameFunction.isMagicalAttack(unit); + int damageDealt = DamageCalculations.getDamageDealt(unit, attackedUnit, isMagicAttack); + int hitCount = DamageCalculations.getHitCount(unit, attackedUnit); + int hitRate = DamageCalculations.getHitRate(unit, attackedUnit); + int critRate = DamageCalculations.getCritRate(unit, attackedUnit); + // get enemy counter attack stats + isMagicAttack = GameFunction.isMagicalAttack(attackedUnit); + int damageDealt2 = DamageCalculations.getDamageDealt(attackedUnit, unit, isMagicAttack); + int hitCount2 = DamageCalculations.getHitCount(attackedUnit, unit); + int hitRate2 = DamageCalculations.getHitRate(attackedUnit, unit); + int critRate2 = DamageCalculations.getCritRate(attackedUnit, unit); + + if (GameState.currentPlayer == player1) + { + spriteBatch.Draw(unit.getCharAttackInfo(), Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground texture for current character + spriteBatch.DrawString(largeFont, damageDealt.ToString(), new Vector2(180, 458), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws damage dealt + spriteBatch.DrawString(font, " x " + hitCount.ToString(), new Vector2(195, 459), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit count + spriteBatch.DrawString(largeFont, hitRate.ToString() + " %", new Vector2(170, 488), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit rate + spriteBatch.DrawString(largeFont, critRate.ToString() + " %", new Vector2(170, 518), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws crit rate + spriteBatch.DrawString(largestFont, unit.Hp.ToString(), new Vector2(342, 475), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit health + spriteBatch.DrawString(largeFont, unit.equippedWeapon.name.ToString(), new Vector2(40, 348), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit's weapon + + spriteBatch.Draw(attackedUnit.getCharAttackInfo(), attackInfoLocation2, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground for unit being attacked + spriteBatch.DrawString(largestFont, attackedUnit.Hp.ToString(), new Vector2(862, 475), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws enemy unit health + spriteBatch.DrawString(largeFont, attackedUnit.equippedWeapon.name.ToString(), new Vector2(715, 348), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit's weapon + + if (GameFunction.isEnemyUnitInRange(graph, attackedUnit, unit)) + { + spriteBatch.DrawString(largeFont, damageDealt2.ToString(), new Vector2(700, 458), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack damage + spriteBatch.DrawString(font, " x " + hitCount2.ToString(), new Vector2(715, 459), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit count + spriteBatch.DrawString(largeFont, hitRate2.ToString() + " %", new Vector2(690, 488), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit rate + spriteBatch.DrawString(largeFont, critRate2.ToString() + " %", new Vector2(690, 518), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack crit rate + } + } + + else + { + spriteBatch.Draw(attackedUnit.getCharAttackInfo(), Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground texture for current character + spriteBatch.DrawString(largeFont, damageDealt.ToString(), new Vector2(180, 458), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack damage + spriteBatch.DrawString(font, " x " + hitCount.ToString(), new Vector2(195, 459), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit count + spriteBatch.DrawString(largeFont, hitRate.ToString() + " %", new Vector2(170, 488), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit rate + spriteBatch.DrawString(largeFont, critRate.ToString() + " %", new Vector2(170, 518), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack crit rate + spriteBatch.DrawString(largestFont, attackedUnit.Hp.ToString(), new Vector2(342, 475), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws enemy unit health + spriteBatch.DrawString(largeFont, attackedUnit.equippedWeapon.name.ToString(), new Vector2(40, 348), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit's weapon + + spriteBatch.Draw(unit.getCharAttackInfo(), attackInfoLocation2, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground for current character + spriteBatch.DrawString(largestFont, unit.Hp.ToString(), new Vector2(862, 475), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit health + spriteBatch.DrawString(largeFont, unit.equippedWeapon.name.ToString(), new Vector2(715, 348), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit's weapon + + if (GameFunction.isEnemyUnitInRange(graph, unit, attackedUnit)) + { + spriteBatch.DrawString(largeFont, damageDealt.ToString(), new Vector2(700, 458), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws damage + spriteBatch.DrawString(font, " x " + hitCount.ToString(), new Vector2(715, 459), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit count + spriteBatch.DrawString(largeFont, hitRate.ToString() + " %", new Vector2(690, 488), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit rate + spriteBatch.DrawString(largeFont, critRate.ToString() + " %", new Vector2(690, 518), Color.DarkRed, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws crit rate + } + } + spriteBatch.Draw(confirmButton.getImage(), confirmButton.getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); + } + + #endregion + + #region Character Info Screen player1 + + //if player 1, prints info screen for player 1 + if ((GameState.currentPlayer == player1) && (!GameState.attackConfirmOpen)) + { + Vector2 statLocation = new Vector2(170, 535); // starting location for first stat + Vector2 statLocation2 = new Vector2(235, 535); // starting location for first stat + Vector2 increment = new Vector2(0, 20); // increment downwards for each stat + Vector2 infoLocation = new Vector2(20, 513); + int[] stats = unit.getStats(); + + for (int k = 0; k < 4; k++) //for stats - level, str, int, skill, + { + spriteBatch.DrawString(font, stats[k].ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + statLocation = statLocation + increment; //increment downwards + } + for (int t = 4; t < 7; t++) //for stats - speed, defense, resistance + { + spriteBatch.DrawString(font, stats[t].ToString(), statLocation2, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + statLocation2 = statLocation2 + increment; //increment downwards + } + + spriteBatch.DrawString(largeFont, unit.Hp.ToString(), new Vector2(278, 532), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit hp + spriteBatch.Draw(unit.getCharInfo(), infoLocation, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charInfoBackground texture + } + //else, info screen for player 2 + else + { + if (!GameState.attackConfirmOpen) + { + Vector2 statLocation = new Vector2(795, 533); //starting location for first stat + Vector2 statLocation2 = new Vector2(860, 533); //starting location for first stat + Vector2 increment = new Vector2(0, 20); //increment downwards for each stat + Vector2 infoLocation = new Vector2(635, 513); + int[] stats = unit.getStats(); + + for (int k = 0; k < 4; k++) //for stats - level, str, int, skill, + { + spriteBatch.DrawString(font, stats[k].ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + statLocation = statLocation + increment; //increment downwards + } + for (int t = 4; t < 7; t++) //for stats - speed, defense, resistance + { + spriteBatch.DrawString(font, stats[t].ToString(), statLocation2, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + statLocation2 = statLocation2 + increment; //increment downwards + } + + spriteBatch.DrawString(largeFont, unit.Hp.ToString(), new Vector2(893, 532), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit HP + spriteBatch.Draw(unit.getCharInfo(), infoLocation, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charInfoBackground texture + } + } + + #endregion + } + + #region Game Over + if (GameState.gameOver) + { + Vector2 gameOverLocation = new Vector2(-370, -300); + spriteBatch.DrawString(largestFont, "Game Over", new Vector2(350, 200), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f); //draws Game Over Text + spriteBatch.Draw(gameOver, Vector2.Zero, null, Color.White, 0, gameOverLocation, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(backGround, Vector2.Zero, null, Color.Black * 0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f); + + } + #endregion + + if (GameState.transitionTurn) + { + if (GameState.currentPlayer == player1) + { + spriteBatch.Draw(player1Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw turn transition + } + else if (GameState.currentPlayer == player2) + { + spriteBatch.Draw(player2Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw turn transition + } } //draw game over menu drawUI.drawGameOverMenu(spriteBatch, gameOver, backGround, largestFont); diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs index 3298b8b0374bb7c242a9a624703366d3aa9d4a28..ecaa035a5f444acbf6a5618450c147472cea1249 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs @@ -549,9 +549,12 @@ namespace Controller } } - // returns whether or not the unit performed a magical attack + /** + Returns whether or not the unit performed a magical attack. + \param unit Unit to check. + */ // TODO: change this function to factor the weapon type rather than unit type - private static bool isMagicalAttack(Unit unit) + public static bool isMagicalAttack(Unit unit) { if ((unit.getClass() == UnitType.Warrior) || (unit.getClass() == UnitType.Archer)) { diff --git a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs index 3a53382387840c2f9366b1c4d872791a70009b04..5c955e776323f76889ef2f9291ec8e86ce9f4ca2 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs @@ -93,8 +93,8 @@ namespace Controller // upon game over screen, detect click on exit game button if (GameState.gameOver) { - if (mouseClickCoordinates.X > 370 && mouseClickCoordinates.X < 556 && - mouseClickCoordinates.Y > 300 && mouseClickCoordinates.Y < 396) + if (currentMouseState.X > 370 && currentMouseState.X < 556 && + currentMouseState.Y > 300 && currentMouseState.Y < 396) { GameState.exitGameClicked = true; }