From aecc4ca9fb5784aa35de8584ecf0775df489bb92 Mon Sep 17 00:00:00 2001 From: Susan Yuen <susan_loves_cheese@hotmail.com> Date: Tue, 15 Nov 2016 15:57:07 -0500 Subject: [PATCH] Cleaned up formatting of all code. --- src/Blaze-Brigade/Blaze_Brigade/Archer.cs | 9 +- .../Blaze_Brigade/DamageCalculations.cs | 15 +- src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs | 15 +- src/Blaze-Brigade/Blaze_Brigade/Game.cs | 159 +++++++++--------- .../Blaze_Brigade/GameFunction.cs | 4 +- src/Blaze-Brigade/Blaze_Brigade/GameState.cs | 6 +- src/Blaze-Brigade/Blaze_Brigade/HowToPlay.cs | 6 +- src/Blaze-Brigade/Blaze_Brigade/HowToPlay2.cs | 6 +- src/Blaze-Brigade/Blaze_Brigade/Mage.cs | 37 ++-- src/Blaze-Brigade/Blaze_Brigade/MainMenu.cs | 14 +- src/Blaze-Brigade/Blaze_Brigade/Node.cs | 2 +- src/Blaze-Brigade/Blaze_Brigade/Unit.cs | 37 ++-- src/Blaze-Brigade/Blaze_Brigade/Warrior.cs | 10 +- 13 files changed, 155 insertions(+), 165 deletions(-) diff --git a/src/Blaze-Brigade/Blaze_Brigade/Archer.cs b/src/Blaze-Brigade/Blaze_Brigade/Archer.cs index 610211f..a1f16b2 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Archer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Archer.cs @@ -11,7 +11,7 @@ using System.Diagnostics; namespace Model { /// <summary> - /// The Warrior model class, extends Unit + /// The Archer model class, extends Unit /// This unit has a high skill and speed, and excels in dealing accurate ranged, high critical, physical attacks, but suffers from overall defense against physical attacks. /// </summary> class Archer : Unit @@ -42,7 +42,7 @@ namespace Model Sets and returns a unit's Level */ public int Level { get; set; } - private readonly int movability = 4; // Warrior movement is permanently set to 4 + private readonly int movability = 4; // Archer movement is permanently set to 4 private Weapon[] equipableWeapons; // Array of all equipable weapons /** returns weapon the unit is currently equipping @@ -56,7 +56,7 @@ namespace Model private int currentFrame; // the current frame the sprite is on /** - * The constructor for Unit Warrior + * The constructor for Unit Archer * @param spriteImage The character sprite * @param attackButton The dropdownmenu attack button texture * @param moveButton The dropdownmenu move button texture @@ -89,7 +89,7 @@ namespace Model position = new Tuple<int, int>(positionX, positionY); currentFrame = 1; setButtonCoordinates(pixelCoordinates); - setInitialStats(); //sets initial warrior stats + setInitialStats(); // sets initial archer stats } //sets initial unit stats @@ -419,7 +419,6 @@ namespace Model */ public void animate(Direction direction) { - #region Walking Down if (direction == Direction.Down) // for going down { diff --git a/src/Blaze-Brigade/Blaze_Brigade/DamageCalculations.cs b/src/Blaze-Brigade/Blaze_Brigade/DamageCalculations.cs index 4f930ce..6dd1291 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/DamageCalculations.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/DamageCalculations.cs @@ -16,8 +16,9 @@ namespace Model *@param defender The unit defending against the attack *@param physOrMagic Boolean that tells the controller if it's physical or magical damage to be calculated */ - public static int getDamageDealt(Unit attacker, Unit defender, bool physOrMagic){ - if(physOrMagic== false) + public static int getDamageDealt(Unit attacker, Unit defender, bool physOrMagic) + { + if (physOrMagic == false) { int damage = attacker.Str - defender.Def; if (damage < 0)// to prevent attacks from healing if defense is higher then attack @@ -43,7 +44,8 @@ namespace Model if (hitRate > 100) //to prevent hit rate over 100% { hitRate = 100; - }else if (hitRate < 0) //to prevent hit rate under 0% + } + else if (hitRate < 0) //to prevent hit rate under 0% { hitRate = 0; } @@ -57,8 +59,8 @@ namespace Model */ public static int getCritRate(Unit attacker, Unit defender) { - - int critRate = (int)Math.Round((((attacker.Skill / 3.0) - (defender.Skill / 3.0) + 1.0) * 0.1) * 100.0); + + int critRate = (int)Math.Round((((attacker.Skill / 3.0) - (defender.Skill / 3.0) + 1.0) * 0.1) * 100.0); if (critRate > 100) //to prevent crit rate over 100% { critRate = 100; @@ -109,7 +111,7 @@ namespace Model } else { - if(critOrNot > critRate) //if attack doesn't crit + if (critOrNot > critRate) //if attack doesn't crit { return rawDamage * numOfAttacks; //return the damage * number of attacks calculated from above } @@ -118,7 +120,6 @@ namespace Model return rawDamage * numOfAttacks * 2; //returns the damage * number of attacks *2 for critical for damage dealt elsewise } } - } } } diff --git a/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs b/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs index 3519559..3f37170 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/DrawClass.cs @@ -23,7 +23,7 @@ namespace View { for (int i = 0; i < player.getNumOfUnits(); i++) { - Unit unit = player.getUnits().ElementAt(i); //gets unit at i + Unit unit = player.getUnits().ElementAt(i); // gets unit at i if (unit.Alive) { spriteBatch.Draw(unit.getSpriteImage(), unit.PixelCoordinates, @@ -114,16 +114,16 @@ namespace View public static void drawInventoryMenu(SpriteBatch spriteBatch, SpriteFont font) { Unit unit = GameState.selectedUnit; - unit.setButtonCoordinates(unit.PixelCoordinates); //update button positions - Button[] unitButtons = unit.getButtons(); //for each inventory button + unit.setButtonCoordinates(unit.PixelCoordinates); // update button positions + Button[] unitButtons = unit.getButtons(); // for each inventory button for (int i = 5; i < 9; i++) { - if (unitButtons[i].Active) //if inventory menu buttons are active + if (unitButtons[i].Active) // if inventory menu buttons are active { - if (unitButtons[i].hasItem) //if current menu button actually has an item stored in it + if (unitButtons[i].hasItem) // if current menu button actually has an item stored in it { spriteBatch.DrawString(font, unitButtons[i].weapon.name.ToString(), unitButtons[i].getPixelCoordinates() + (new Vector2(15, 5)), Color.Black, 0, - Vector2.Zero, 1f, SpriteEffects.None, 0f); //draws item stored in unitButtons[i] + Vector2.Zero, 1f, SpriteEffects.None, 0f); // draws item stored in unitButtons[i] spriteBatch.Draw(unitButtons[i].getImage(), unitButtons[i].getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.1f); } } @@ -173,7 +173,6 @@ namespace View */ public static void drawEndTurnButton(SpriteBatch spriteBatch, Texture2D endTurnButton) { - spriteBatch.Draw(endTurnButton, GameState.endTurnButtonLocation, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0); } @@ -189,7 +188,6 @@ namespace View */ public static void drawAttackConfirm(SpriteBatch spriteBatch, SpriteFont font, SpriteFont largeFont, SpriteFont largestFont, Player player1, Graph graph) { - Unit unit = GameState.selectedUnit; Unit attackedUnit = GameState.unitToAttack; Button confirmButton = unit.getButtonType(ButtonType.AttackConfirm); @@ -345,7 +343,6 @@ namespace View */ public static void drawTurnTransition(SpriteBatch spriteBatch, Texture2D player1Transition, Texture2D player2Transition, Player player1) { - if (GameState.currentPlayer == player1) { spriteBatch.Draw(player1Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw turn transition diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index e755462..bf44a61 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -21,33 +21,26 @@ using System.Threading; /// View will be displayed to the user. /// </summary> namespace Controller - { /// <summary> /// Main Controller for game /// </summary> public class Game : Microsoft.Xna.Framework.Game { - #region Variables - static Game instance; - - public static Game Instance - { - get { return instance; } - } + public static Game Instance { get; set; } // gets and sets singleton instance of Game - GameMenuState currentGameState = GameMenuState.MainMenu; // game starts in main menu screen - MainMenu mMenu; // main menu variable - View.HowToPlay tut; // instruction screen variable - View.HowToPlay2 tut2; // instruction 2 screen variable - View.HowToPlay3 tut3; // instruction 3 screen variable - Graph graph; + GameMenuState currentGameState = GameMenuState.MainMenu; // game starts in main menu screen + MainMenu mMenu; // main menu variable + View.HowToPlay tut; // instruction screen variable + View.HowToPlay2 tut2; // instruction 2 screen variable + View.HowToPlay3 tut3; // instruction 3 screen variable + Graph graph; // graph representing the map Player player1; Player player2; - Camera camera; + GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D backGround, moveableNode, attackableNode, gameOver, endTurnButton, player1Transition, player2Transition; @@ -63,8 +56,7 @@ namespace Controller // constructor for game public Game() { - instance = this; - + Instance = this; graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = GameState.SCREEN_HEIGHT; graphics.PreferredBackBufferHeight = GameState.SCREEN_WIDTH; @@ -86,6 +78,7 @@ namespace Controller MyGameForm.Opacity = 0; // hides the game window until it's set to visible base.Initialize(); } + /** loads required textures and values for starting game */ @@ -96,7 +89,7 @@ namespace Controller initializeGame(); - backGround = Content.Load<Texture2D>("Game_Map"); // load background + backGround = Content.Load<Texture2D>("Game_Map"); // load background moveableNode = Content.Load<Texture2D>("moveableNode"); attackableNode = Content.Load<Texture2D>("attackableNode"); gameOver = Content.Load<Texture2D>("exit_game"); @@ -104,23 +97,23 @@ namespace Controller player1Transition = Content.Load<Texture2D>("player1turn"); player2Transition = Content.Load<Texture2D>("player2turn"); - font = Content.Load<SpriteFont>("PixelFont"); //loads font PixelFont - largeFont = Content.Load<SpriteFont>("PixelFontLarge"); //loads font PixelFont - largestFont = Content.Load<SpriteFont>("PixelFontLargest"); //loads font PixelFont + font = Content.Load<SpriteFont>("PixelFont"); // loads font PixelFont + largeFont = Content.Load<SpriteFont>("PixelFontLarge"); // loads font PixelFont + largestFont = Content.Load<SpriteFont>("PixelFontLargest"); // loads font PixelFont - graphics.PreferredBackBufferWidth = GameState.SCREEN_WIDTH; // width of screen - graphics.PreferredBackBufferHeight = GameState.SCREEN_HEIGHT; //height of screen + graphics.PreferredBackBufferWidth = GameState.SCREEN_WIDTH; // width of screen + graphics.PreferredBackBufferHeight = GameState.SCREEN_HEIGHT; // height of screen - IsMouseVisible = true; // sets mouse visibility to true - graphics.ApplyChanges(); // load images + IsMouseVisible = true; // sets mouse visibility to true + graphics.ApplyChanges(); // load images } //initializes players and units private void initializeGame() { - camera = new View.Camera(); - + camera = new Camera(); graph = new Graph(50, 32); // create graph + setObstacles(graph); // set players player1 = new Player(); @@ -135,8 +128,6 @@ namespace Controller player2.addUnit(getNewUnit(UnitType.Warrior, new Vector2(8 * 32f, 8 * 32f), player2)); player2.addUnit(getNewUnit(UnitType.Mage, new Vector2(8 * 32f, 6 * 32f), player2)); player2.addUnit(getNewUnit(UnitType.Archer, new Vector2(8 * 32f, 10 * 32f), player2)); - setObstacles(graph); - } /** @@ -146,10 +137,12 @@ namespace Controller { #region Exiting Game // allows the game to exit - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == Microsoft.Xna.Framework.Input.ButtonState.Pressed) - this.Exit(); + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) + { + Exit(); + } - if (this.IsActive) + if (IsActive) { // call mouse handler if game window is active MouseHandler.updateMouse(graph, camera); @@ -158,29 +151,29 @@ namespace Controller if (GameState.exitGameClicked) { - this.Exit(); + Exit(); } #region Game States MouseState mouse = Mouse.GetState(); - //Lists possible game states + // lists possible game states switch (currentGameState) { - case GameMenuState.MainMenu: // if mouse is clicked... call method - mMenu.Show(); // show main menu - if (mMenu.start == true) //if New game is selected + case GameMenuState.MainMenu: // if mouse is clicked... call method + mMenu.Show(); // show main menu + if (mMenu.start == true) //if New game is selected { - mMenu.Hide(); //close Main Menu screen - tut.Hide(); //close How To Play Menu + mMenu.Hide(); // close Main Menu screen + tut.Hide(); // close How To Play Menu Form GameForm = (Form)Form.FromHandle(Window.Handle); - GameForm.Opacity = 100; // make screen show - currentGameState = GameMenuState.Playing; //set game state to Playing + GameForm.Opacity = 100; // make screen show + currentGameState = GameMenuState.Playing; // set game state to Playing break; } - if (mMenu.getInstruct() == true) //if How to Play is selected + if (mMenu.getInstruct() == true) // if How to Play is selected { - mMenu.Hide(); //hide visibility of menu window - currentGameState = GameMenuState.HowToPlay; //change game state to How To Play + mMenu.Hide(); // hide visibility of menu window + currentGameState = GameMenuState.HowToPlay; // change game state to How To Play break; } if (mMenu.quit == true) // if quit clicked @@ -190,55 +183,55 @@ namespace Controller } break; - case GameMenuState.HowToPlay: // if true.. load new image... - tut.Show(); //set visibility of how to play window to true + case GameMenuState.HowToPlay: // if true.. load new image... + tut.Show(); // set visibility of how to play window to true mMenu.setInstructFalse(); - if (tut.getNext() == true) //if How to Play is selected + if (tut.getNext() == true) // if How to Play is selected { - tut.Hide(); //hide visibility of menu window - currentGameState = GameMenuState.HowToPlay2; //change game state to How To Play + tut.Hide(); // hide visibility of menu window + currentGameState = GameMenuState.HowToPlay2; // change game state to How To Play break; } - if (tut.getQuit() == true) // if quit clicked + if (tut.getQuit() == true) // if quit clicked { tut.setQuitFalse(); - tut.Hide(); //hide - currentGameState = GameMenuState.MainMenu; //changes state back to main menu + tut.Hide(); // hide + currentGameState = GameMenuState.MainMenu; // changes state back to main menu break; } break; - case GameMenuState.HowToPlay2: // if true.. load new image... - tut2.Show(); //set visibility of how to play window to true + case GameMenuState.HowToPlay2: // if true.. load new image... + tut2.Show(); // set visibility of how to play window to true tut.setNextFalse(); - if (tut2.getNext() == true) //if How to Play is selected + if (tut2.getNext() == true) // if How to Play is selected { - tut2.Hide(); //hide visibility of menu window - currentGameState = GameMenuState.HowToPlay3; //change game state to How To Play + tut2.Hide(); // hide visibility of menu window + currentGameState = GameMenuState.HowToPlay3; // change game state to How To Play break; } if (tut2.getQuit() == true) // if quit clicked { tut2.setQuitFalse(); - tut2.Hide(); //hide - currentGameState = GameMenuState.HowToPlay; //changes state back to main menu + tut2.Hide(); // hide + currentGameState = GameMenuState.HowToPlay; // changes state back to main menu break; } break; - case GameMenuState.HowToPlay3: // if true.. load new image... - tut3.Show(); //set visibility of how to play window to true + case GameMenuState.HowToPlay3: // if true.. load new image... + tut3.Show(); // set visibility of how to play window to true tut2.setNextFalse(); if (tut3.getQuit() == true) // if quit clicked { tut3.setQuitFalse(); - tut3.Hide(); //hide - currentGameState = GameMenuState.HowToPlay2; //changes state back to main menu + tut3.Hide(); // hide + currentGameState = GameMenuState.HowToPlay2; // changes state back to main menu break; } break; - case GameMenuState.Playing: // if true.. load new image... + case GameMenuState.Playing: // if true.. load new image... backGround = Content.Load<Texture2D>("Game_Map"); // load background if (GameFunction.isTurnOver()) @@ -322,7 +315,7 @@ namespace Controller protected override void Draw(GameTime gameTime) { // draw elements that are affected by camera (scrollable) - #region Scrollable elements + #region Scrollable Elements spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.TransformMatrix); // only draw objects relevent to current game state @@ -376,7 +369,7 @@ namespace Controller #endregion // draw elements not affected by camera (fixed on window) - #region Elements unaffected by Camera + #region Elements Unaffected by Camera spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null); // Note: we don't pass in camera matrix //for when unit is selected @@ -465,7 +458,7 @@ namespace Controller #region Character Info Screen player1 - //if player 1, prints info screen for player 1 + // 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 @@ -474,40 +467,40 @@ namespace Controller Vector2 infoLocation = new Vector2(20, 513); int[] stats = unit.getStats(); - for (int k = 0; k < 4; k++) //for stats - level, str, int, skill, + 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 + statLocation = statLocation + increment; // increment downwards } - for (int t = 4; t < 7; t++) //for stats - speed, defense, resistance + 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 + 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 + 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, 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 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, + 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 + statLocation = statLocation + increment; // increment downwards } - for (int t = 4; t < 7; t++) //for stats - speed, defense, resistance + 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 + 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 @@ -522,7 +515,7 @@ namespace Controller 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.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); @@ -533,11 +526,11 @@ namespace Controller { if (GameState.currentPlayer == player1) { - spriteBatch.Draw(player1Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw turn transition + 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 + spriteBatch.Draw(player2Transition, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); // draw turn transition } } //draw game over menu diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs index 039025b..a4c86d9 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/GameFunction.cs @@ -432,7 +432,7 @@ namespace Controller GameState.attackSelect = true; break; #endregion - + #region Attack Confirm Button // if confirm attack clicked case ButtonType.AttackConfirm: @@ -473,7 +473,7 @@ namespace Controller enemyUnit.setCurrentFrame(1); } #endregion - + bool magicalAttack = isMagicalAttack(unit); // find what attack type unit is making int damageDealt = DamageCalculations.finalDamage(unit, enemyUnit, magicalAttack); // gets damage dealt GameState.lastAttackingUnit = unit; diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs index a38f860..e1ff392 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs @@ -105,7 +105,8 @@ namespace Model { currentPlayerDamageDealt = "Miss"; } - else { + else + { currentPlayerDamageDealt = value; } } @@ -138,7 +139,8 @@ namespace Model { enemyPlayerDamageDealt = "Miss"; } - else { + else + { enemyPlayerDamageDealt = value; } } diff --git a/src/Blaze-Brigade/Blaze_Brigade/HowToPlay.cs b/src/Blaze-Brigade/Blaze_Brigade/HowToPlay.cs index 98c944b..2aecec3 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/HowToPlay.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/HowToPlay.cs @@ -15,8 +15,8 @@ namespace View /// </summary> public partial class HowToPlay : Form { - public bool quit = false; // boolean that checks is quit button is clicked - public bool next = false; // boolean that checks is next button is clicked + public bool quit = false; // boolean that checks is quit button is clicked + public bool next = false; // boolean that checks is next button is clicked /** Constructor for HowToPlay window @@ -32,7 +32,7 @@ namespace View */ private void Exit_Click(object sender, EventArgs e) { - quit = true; + quit = true; } /** checks if Game State is no longer inside How To Play diff --git a/src/Blaze-Brigade/Blaze_Brigade/HowToPlay2.cs b/src/Blaze-Brigade/Blaze_Brigade/HowToPlay2.cs index 26a56d0..66d7224 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/HowToPlay2.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/HowToPlay2.cs @@ -15,8 +15,8 @@ namespace View /// </summary> public partial class HowToPlay2 : Form { - public bool quit = false; // boolean that checks is quit button is clicked - public bool next = false; // boolean that checks is next button is clicked + public bool quit = false; // boolean that checks is quit button is clicked + public bool next = false; // boolean that checks is next button is clicked /** Constructor for HowToPlay2 window @@ -55,7 +55,7 @@ namespace View */ private void next_Click(object sender, EventArgs e) { - next = true; // check if user clicks next + next = true; // check if user clicks next } /** checks if Game State is no longer inside How To Play diff --git a/src/Blaze-Brigade/Blaze_Brigade/Mage.cs b/src/Blaze-Brigade/Blaze_Brigade/Mage.cs index 00c4ec8..166e156 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Mage.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Mage.cs @@ -42,7 +42,7 @@ namespace Model Sets and returns a unit's Level */ public int Level { get; set; } - private readonly int movability = 4; // Warrior movement is permanently set to 4 + private readonly int movability = 4; // Mage movement is permanently set to 4 private Weapon[] equipableWeapons; // Array of all equipable weapons /** returns weapon the unit is currently equipping @@ -89,10 +89,10 @@ namespace Model position = new Tuple<int, int>(positionX, positionY); currentFrame = 1; setButtonCoordinates(pixelCoordinates); - setInitialStats(); //sets initial warrior stats + setInitialStats(); // sets initial mage stats } - //sets initial unit stats + // sets initial unit stats public void setInitialStats() { Alive = true; @@ -108,7 +108,7 @@ namespace Model /* Sets the new strength value - \n Gets the effective strength -> Unit strength + weapon strength + \n Gets the effective strength -> Unit strength + weapon strength */ public int Str { @@ -124,7 +124,7 @@ namespace Model /* Sets the new intelligence value - \n Gets the effective intelligence -> Unit intelligence + weapon intelligence + \n Gets the effective intelligence -> Unit intelligence + weapon intelligence */ public int Int { @@ -140,7 +140,7 @@ namespace Model /* Sets the new skill value - \n Gets the effective skill -> Unit skill + weapon skill + \n Gets the effective skill -> Unit skill + weapon skill */ public int Skill { @@ -156,7 +156,7 @@ namespace Model /* Sets the hp of the unit. - \n Gets the unit's hp. + \n Gets the unit's hp. */ public int Hp { @@ -184,7 +184,7 @@ namespace Model } /** - returns all stats as an array + Returns all stats as an array */ public int[] getStats() { @@ -227,23 +227,23 @@ namespace Model { switch (buttonType) { - case ButtonType.Attack: // if attack clicked + case ButtonType.Attack: // if attack clicked return buttons[0].getImage(); - case ButtonType.Move: // if moved is clicked + case ButtonType.Move: // if moved is clicked return buttons[1].getImage(); - case ButtonType.Items: // if item is clicked + case ButtonType.Items: // if item is clicked return buttons[2].getImage(); - case ButtonType.Wait: // if wait is clicked + case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.AttackConfirm: // if attack confirm is clicked + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); - case ButtonType.Inventory1: // if item1 clicked + case ButtonType.Inventory1: // if item1 clicked return buttons[5].getImage(); - case ButtonType.Inventory2: // if item2 is clicked + case ButtonType.Inventory2: // if item2 is clicked return buttons[6].getImage(); - case ButtonType.Inventory3: // if item3 is clicked + case ButtonType.Inventory3: // if item3 is clicked return buttons[7].getImage(); - case ButtonType.Inventory4: // if item4 is clicked + case ButtonType.Inventory4: // if item4 is clicked return buttons[8].getImage(); default: return null; @@ -315,7 +315,7 @@ namespace Model /** returns the pixel coordinate of the unit - \n sets the pixel coordinate, and also sets Position (which is the tile location of that coordinate) + \n sets the pixel coordinate, and also sets Position (which is the tile location of that coordinate) */ public Vector2 PixelCoordinates { @@ -419,7 +419,6 @@ namespace Model */ public void animate(Direction direction) { - #region Walking Down if (direction == Direction.Down) // for going down { diff --git a/src/Blaze-Brigade/Blaze_Brigade/MainMenu.cs b/src/Blaze-Brigade/Blaze_Brigade/MainMenu.cs index a1bee03..21a86d4 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MainMenu.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MainMenu.cs @@ -19,10 +19,10 @@ namespace View /// </summary> public partial class MainMenu : Form { - public bool start = false; //boolean that checks if start button is clicked - public bool instruct = false; // boolean that checks if instruct button is clicked - public bool quit = false; // boolean that checks if quit button is clicked - public bool load = false; // boolean that checks if load button is clicked + public bool start = false; // boolean that checks if start button is clicked + public bool instruct = false; // boolean that checks if instruct button is clicked + public bool quit = false; // boolean that checks if quit button is clicked + public bool load = false; // boolean that checks if load button is clicked /** Constructor for Main Menu window @@ -49,7 +49,7 @@ namespace View */ private void howToPlay_Click(object sender, EventArgs e) { - instruct = true; // + instruct = true; } /** @@ -57,7 +57,7 @@ namespace View */ public void setInstructFalse() { - instruct = false; + instruct = false; } /** @@ -73,7 +73,7 @@ namespace View */ private void Exit_Click(object sender, EventArgs e) { - quit = true; // check if user quits + quit = true; // check if user quits } } } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Node.cs b/src/Blaze-Brigade/Blaze_Brigade/Node.cs index 411274c..55e315d 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Node.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Node.cs @@ -57,7 +57,7 @@ namespace Model */ public Vector2 getPosition() { - Vector2 position = new Vector2(getPositionX()*32, getPositionY()*32); + Vector2 position = new Vector2(getPositionX() * 32, getPositionY() * 32); return position; } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Unit.cs b/src/Blaze-Brigade/Blaze_Brigade/Unit.cs index 0b76db1..d45a10c 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Unit.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Unit.cs @@ -7,8 +7,7 @@ using Microsoft.Xna.Framework; using View; /// <summary> -/// The model in MVC. These classes contain the structure of the game, and will be controlled by Controller, -/// and displayed in View. +/// The model in MVC. These classes contain the structure of the game, and will be controlled by Controller, and displayed in View. /// </summary> namespace Model @@ -28,47 +27,47 @@ namespace Model Sets and returns whether or not unit is alive */ bool Alive { get; set; } - + /** Sets and returns a unit's HP */ int Hp { get; set; } - + /** Sets and returns a unit's Strength */ int Str { get; set; } - + /** Sets and returns a unit's Intelliegence */ int Int { get; set; } - + /** Sets and returns a unit's Skill */ int Skill { get; set; } - + /** Sets and returns a unit's Speed */ int Speed { get; set; } - + /** Sets and returns a unit's Defense */ int Def { get; set; } - + /** Sets and returns a unit's Resistance */ int Res { get; set; } - + /** Sets and returns a unit's Level */ int Level { get; set; } - + /** Returns the unit's movability range on grid (number of spaces the unit can move in one turn) */ @@ -106,7 +105,7 @@ namespace Model * @param direction The direction the unit is moving in */ void animate(Direction direction); - + /** returns the sprite image of the unit */ @@ -130,8 +129,8 @@ namespace Model /** gets and sets unit's position by tile */ - Tuple<int, int> Position { get; set;} - + Tuple<int, int> Position { get; set; } + /** returns the pixel coordinate of the unit */ @@ -140,8 +139,8 @@ namespace Model /** returns the dropdown menu buttons of the unit */ - Button[] getButtons(); - + Button[] getButtons(); + /** Returns the button type * @param buttonType The button to return (Move, Attack, Item, Wait, and attack confirm) @@ -168,11 +167,11 @@ namespace Model returns unit's class (warrior, mage, archer) */ UnitType getClass(); - + } /** defines the possible classes of a unit */ - enum UnitType { Warrior, Archer, Mage }; - enum Direction { Down, Left, Right, Up}; + enum UnitType { Warrior, Archer, Mage }; + enum Direction { Down, Left, Right, Up }; } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs index c31d733..5731fad 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs @@ -20,7 +20,7 @@ namespace Model Sets and returns whether or not unit is alive */ public bool Alive { get; set; } - + private int str; // unit strength private int intelligence; // unit intelliegence private int skill; // unit skill @@ -42,13 +42,13 @@ namespace Model /** Sets and returns a unit's Level */ - public int Level { get; set; } + public int Level { get; set; } private readonly int movability = 4; // Warrior movement is permanently set to 4 private Weapon[] equipableWeapons; // Array of all equipable weapons /** returns weapon the unit is currently equipping */ - public Weapon equippedWeapon { get; set; } + public Weapon equippedWeapon { get; set; } private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit @@ -69,7 +69,7 @@ namespace Model * @param coordinates The unit's current coordinate on screen * @param player The player of which the unit belongs to */ - public Warrior(Texture2D spriteImage, Button[] unitButtons, Texture2D charInfo, + public Warrior(Texture2D spriteImage, Button[] unitButtons, Texture2D charInfo, Texture2D charAttackInfo, Vector2 coordinates) { this.spriteImage = spriteImage; @@ -392,7 +392,7 @@ namespace Model buttons[4].setPixelCoordinates(330, 120); for (int i = 5; i < 9; i++) { - buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 160), (int)(pixelCoordinates.Y + (i * 32-96))); + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 160), (int)(pixelCoordinates.Y + (i * 32 - 96))); } } -- GitLab