/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { KeyboardState keyBoard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || keyBoard.IsKeyDown(Keys.Escape)) this.Exit(); switch (currentGameState) { #region Game State: Character Creation case GameState.CharacterCreation: #region Choosing number of players/heroes/classes #region Step 1: Select Number of Heroes if (creationStep == 1) // Choosing the number of heroes to play the game with { messages.Add(new Message("Choose The", windlassFont36, new Vector2(creationRec.X + creationRec.Width / 2, (int)(creationRec.Y + creationRec.Height * 0.25)))); messages.Add(new Message("Number Of Heroes", windlassFont36, new Vector2(creationRec.X + creationRec.Width / 2, (int)(creationRec.Y + creationRec.Height * 0.35)))); if (!createdStep1) { numOfPlayerTokens.Add(new Token(creationRec, 2, creationRec.Width / 4 - 50, (int)(creationRec.Height * 0.55f) - 50, new Rectangle(918, 584, 100, 100))); numOfPlayerTokens.Add(new Token(creationRec, 3, creationRec.Width / 2 - 50, (int)(creationRec.Height * 0.55f) - 50, new Rectangle(918, 684, 100, 100))); numOfPlayerTokens.Add(new Token(creationRec, 4, (int)(creationRec.Width * 0.75f - 50), (int)(creationRec.Height * 0.55f) - 50, new Rectangle(918, 784, 100, 100))); createdStep1 = true; } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Token numPlayers in numOfPlayerTokens) { if (numPlayers.DrawRectangle.Contains(mouse.X, mouse.Y)) { numHeroesPlaying = numPlayers.Variable; creationStep = 2; messages.Clear(); } } chosenHeroArchtype.Add(-1); chosenHeroArchtype.Add(-1); chosenHeroName.Add(-1); chosenHeroName.Add(-1); chosenHeroClass.Add(-1); chosenHeroClass.Add(-1); if (numHeroesPlaying >= 3) { chosenHeroArchtype.Add(-1); chosenHeroName.Add(-1); chosenHeroClass.Add(-1); } if (numHeroesPlaying == 4) { chosenHeroArchtype.Add(-1); chosenHeroName.Add(-1); chosenHeroClass.Add(-1); } checkVariousItems(mouse); } } } #endregion #region Step 2: Choose the Archetype else if (creationStep == 2) // Choosing the Archtype to play the game with, repeated min 2 times, max 4 times { messages.Add(new Message("Choose An Archetype", windlassFont36, new Vector2(creationRec.X + creationRec.Width / 2, (int)(creationRec.Y + creationRec.Height * 0.25)))); messages.Add(new Message("For Hero " + creatingHeroNumber, windlassFont36, new Vector2(creationRec.X + creationRec.Width / 2, (int)(creationRec.Y + creationRec.Height * 0.35)))); foreach (Token choseArchetype in chooseArchetype) choseArchetype.Active = true; if (numOfHealers == 2) { chooseArchetype[0].Active = false; chooseArchetype[0].SourceRectangleY = 128; } if (numOfMages == 2) { chooseArchetype[1].Active = false; chooseArchetype[1].SourceRectangleY = 128; } if (numOfScouts == 2) { chooseArchetype[2].Active = false; chooseArchetype[2].SourceRectangleY = 128; } if (numOfWarriors == 2) { chooseArchetype[3].Active = false; chooseArchetype[3].SourceRectangleY = 128; } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Token chosenArchetype in chooseArchetype) { if (chosenArchetype.DrawRectangle.Contains(mouse.X, mouse.Y) && chosenArchetype.Active) { if (chosenArchetype.Variable == 1) numOfHealers++; else if (chosenArchetype.Variable == 2) numOfMages++; else if (chosenArchetype.Variable == 3) numOfScouts++; else numOfWarriors++; chosenHeroArchtype[creatingHeroNumber - 1] = chosenArchetype.Variable; creationStep = 3; messages.Clear(); foreach (Token choseArchetype in chooseArchetype) choseArchetype.Active = false; } } } } } #endregion #region Step 3: Choose the Hero else if (creationStep == 3) // Choosing the Hero for the given Archtype, repeated min 2 times, max 4 times { string archetypeName = GetArchetypeName(); bool ashPicked = false, avPicked = false, leoPicked = false, tarPicked = false, jainPicked = false, tomPicked = false, grisPicked = false, synPicked = false; messages.Add(new Message("Choose A " + archetypeName + " Hero", windlassFont36, new Vector2(creationRec.X + creationRec.Width / 2, (int)(creationRec.Y + creationRec.Height * 0.25)))); if (!loadedOnce) { for (int x = 0; x < chosenHeroName.Count; x++) { switch (chosenHeroName[x]) { case 1: ashPicked = true; break; case 2: avPicked = true; break; case 3: leoPicked = true; break; case 4: tarPicked = true; break; case 5: jainPicked = true; break; case 6: tomPicked = true; break; case 7: grisPicked = true; break; case 8: synPicked = true; break; default: break; } } if (archetypeName == "Healer") { if(!ashPicked) chooseHero.Add(new Token(creationRec, 1, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 0, 320, 256))); else chooseHero.Add(new Token(creationRec, 1, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 0, 320, 256))); if (!avPicked) chooseHero.Add(new Token(creationRec, 2, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 256, 320, 256))); else chooseHero.Add(new Token(creationRec, 2, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 256, 320, 256))); } else if (archetypeName == "Mage") { if(!leoPicked) chooseHero.Add(new Token(creationRec, 3, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 512, 320, 256))); else chooseHero.Add(new Token(creationRec, 3, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 512, 320, 256))); if(!tarPicked) chooseHero.Add(new Token(creationRec, 4, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 768, 320, 256))); else chooseHero.Add(new Token(creationRec, 4, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 768, 320, 256))); } else if (archetypeName == "Scout") { if (!jainPicked) chooseHero.Add(new Token(creationRec, 5, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 0, 320, 256))); else chooseHero.Add(new Token(creationRec, 5, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 0, 320, 256))); if (!tomPicked) chooseHero.Add(new Token(creationRec, 6, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 256, 320, 256))); else chooseHero.Add(new Token(creationRec, 6, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 256, 320, 256))); } else if (archetypeName == "Warrior") { if (!grisPicked) chooseHero.Add(new Token(creationRec, 7, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 512, 320, 256))); else chooseHero.Add(new Token(creationRec, 7, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 512, 320, 256))); if (!synPicked) chooseHero.Add(new Token(creationRec, 8, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(0, 768, 320, 256))); else chooseHero.Add(new Token(creationRec, 8, (int)(creationRec.Width * 0.55f), (int)(creationRec.Height * 0.333f), new Rectangle(320, 768, 320, 256))); } loadedOnce = true; foreach (Token hSheet in chooseHero) { foreach (int chosenHero in chosenHeroName) if (chosenHero == hSheet.Variable) hSheet.Active = false; } } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Token chosenHero in chooseHero) { if (chosenHero.DrawRectangle.Contains(mouse.X, mouse.Y) && chosenHero.Active) { chosenHeroName[creatingHeroNumber - 1] = chosenHero.Variable; creationStep = 4; messages.Clear(); } } foreach (Token choseHero in chooseHero) choseHero.Active = false; chooseHero.Clear(); loadedOnce = false; } } } #endregion #region Step 4: Choose the Class else if (creationStep == 4) { string archetypeName = GetArchetypeName(); bool ssPicked = false, dePicked = false, rmPicked = false, necPicked = false, thPicked = false, wlPicked = false, bsPicked = false, knPicked = false; messages.Add(new Message("Choose A " + archetypeName + " Class", windlassFont36, new Vector2(creationRec.X + creationRec.Width / 2, (int)(creationRec.Y + creationRec.Height * 0.25)))); #region Hero Classes if (!loadedOnce) { for (int x = 0; x < chosenHeroClass.Count; x++) { switch (chosenHeroClass[x]) { case 1: ssPicked = true; break; case 2: dePicked = true; break; case 3: necPicked = true; break; case 4: rmPicked = true; break; case 5: thPicked = true; break; case 6: wlPicked = true; break; case 7: bsPicked = true; break; case 8: knPicked = true; break; default: break; } } if (archetypeName == "Healer") { if(!ssPicked) chooseClass.Add(new Token(creationRec, 1, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(512, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 1, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(512, 128, 64, 64))); if (!dePicked) chooseClass.Add(new Token(creationRec, 2, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(512, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 2, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(512, 128, 64, 64))); messages.Add(new Message("Disciple - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height / 2))); messages.Add(new Message("Spirit Speaker - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height * 0.7f))); } else if (archetypeName == "Mage") { if (!necPicked) chooseClass.Add(new Token(creationRec, 3, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(576, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 3, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(576, 128, 64, 64))); if (!rmPicked) chooseClass.Add(new Token(creationRec, 4, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(576, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 4, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(576, 128, 64, 64))); messages.Add(new Message("Necromancer - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height / 2))); messages.Add(new Message("Runemaster - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height * 0.7f))); } else if (archetypeName == "Scout") { if (!thPicked) chooseClass.Add(new Token(creationRec, 5, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(640, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 5, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(640, 128, 64, 64))); if (!wlPicked) chooseClass.Add(new Token(creationRec, 6, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(640, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 6, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(640, 128, 64, 64))); messages.Add(new Message("Thief - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height / 2))); messages.Add(new Message("Wildlander - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height * 0.7f))); } else if (archetypeName == "Warrior") { if (!bsPicked) chooseClass.Add(new Token(creationRec, 7, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(704, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 7, (int)(creationRec.Width * 0.15f), (int)(creationRec.Height * 0.3), new Rectangle(704, 128, 64, 64))); if (!knPicked) chooseClass.Add(new Token(creationRec, 8, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(704, 64, 64, 64))); else chooseClass.Add(new Token(creationRec, 8, (int)(creationRec.Width * 0.11f), (int)(creationRec.Height * 0.5), new Rectangle(704, 128, 64, 64))); messages.Add(new Message("Berserker - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height / 2))); messages.Add(new Message("Knight - <insert class definition here>", windlassFont14, new Vector2(GameConstants.HALF_WINDOW_WIDTH(), creationRec.Height * 0.7f))); } loadedOnce = true; foreach (Token pickClass in chooseClass) { foreach (int pickedClass in chosenHeroClass) if (pickedClass == pickClass.Variable) pickClass.Active = false; } } #endregion if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Token chosenClass in chooseClass) { if (chosenClass.DrawRectangle.Contains(mouse.X, mouse.Y) && chosenClass.Active) { chosenHeroClass[creatingHeroNumber - 1] = chosenClass.Variable; messages.Clear(); creatingHeroNumber++; creationStep = 2; } } foreach (Token chosenClass in chooseClass) chosenClass.Active = false; chooseClass.Clear(); loadedOnce = false; } } } #endregion if (creatingHeroNumber > numHeroesPlaying) { finishedSelectingHeroes = true; numHeroTurns = numHeroesPlaying; creationStep = -1; } #endregion #region Adding Hero Sheets if (finishedSelectingHeroes) { while (loadTokensSheets < numHeroesPlaying) { for (int x = 0; x < numHeroesPlaying; x++) { // variable for setting up selected heroes/classes theClassName = GetClassName(chosenHeroClass[x]); Rectangle drawingTokenRec = new Rectangle((int)((GameConstants.WINDOW_WIDTH / 2) - ((GameConstants.WINDOW_WIDTH * 0.333f) / 2)), (int)(GameConstants.DRAWING_TOKEN_START_Y), (int)(GameConstants.WINDOW_WIDTH * 0.333f), 64); float multiplier; if (numHeroesPlaying == 2) multiplier = 0.333f; else if (numHeroesPlaying == 3) multiplier = 0.25f; else multiplier = 0.2f; int xLoc = (int)(((x + 1) * multiplier) * drawingTokenRec.Width); int yLoc = 0; hpBars.Add(new Token(hpBarSource, hpBarLocation)); stamBars.Add(new Token(stamBarSource, stamBarLocation)); hpBars[x].Active = false; stamBars[x].Active = false; switch (chosenHeroName[x] - 1) { #region Creating sheets/tokens case 0: // Ashrian heroSheets.Add(new HeroSheet(theClassName, "healer", "Ashrian", 10, 4, 5, 4, 3, 2, 2, 4, "Status", "Activation", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); heroTokens.Add(new Token("Ashrian", x + 1, tiles[0], 10, 4, 5, new Rectangle(0, 0, 64, 64))); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(0, 0, 64, 64))); break; case 1: // Avric heroSheets.Add(new HeroSheet(theClassName, "healer", "Avric", 12, 4, 4, 4, 4, 2, 3, 2, "Surge", "Activation", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(64, 0, 64, 64))); heroTokens.Add(new Token("Avric", x + 1, tiles[0], 12, 4, 4, new Rectangle(64, 0, 64, 64))); break; case 2: // Leoric heroSheets.Add(new HeroSheet(theClassName, "mage", "Leoric", 8, 5, 4, 4, 2, 1, 5, 3, "Distance", "Activation", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(128, 0, 64, 64))); heroTokens.Add(new Token("Leoric", x + 1, tiles[0], 8, 5, 4, new Rectangle(128, 0, 64, 64))); break; case 3: // Tarha heroSheets.Add(new HeroSheet(theClassName, "mage", "Tarha", 10, 4, 4, 4, 3, 2, 4, 2, "Reroll", "Activation", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(192, 0, 64, 64))); heroTokens.Add(new Token("Tarha", x + 1, tiles[0], 10, 4, 4, new Rectangle(192, 0, 64, 64))); break; case 4: // Jain heroSheets.Add(new HeroSheet(theClassName, "scout", "Jain", 8, 5, 5, 4, 2, 2, 3, 4, "Damage", "Activation", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(256, 0, 64, 64))); heroTokens.Add(new Token("Jain", x + 1, tiles[0], 8, 5, 5, new Rectangle(256, 0, 64, 64))); break; case 5: // Tomble heroSheets.Add(new HeroSheet(theClassName, "scout", "Tomble", 8, 5, 4, 4, 3, 1, 2, 5, "Adjacent", "Activation", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(320, 0, 64, 64))); heroTokens.Add(new Token("Tomble", x + 1, tiles[0], 8, 5, 4, new Rectangle(320, 0, 64, 64))); break; case 6: // Grisban heroSheets.Add(new HeroSheet(theClassName, "warrior", "Grisban", 14, 4, 3, 4, 3, 5, 2, 1, "Recover", "Passive", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(384, 0, 64, 64))); heroTokens.Add(new Token("Grisban", x + 1, tiles[0], 14, 4, 3, new Rectangle(384, 0, 64, 64))); break; case 7: // Syndrael heroSheets.Add(new HeroSheet(theClassName, "warrior", "Syndrael", 12, 4, 4, 4, 2, 4, 3, 2, "Stationary", "Passive", GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT)); drawingTokens.Add(new Token(drawingTokenRec, x + 1, xLoc, yLoc, new Rectangle(448, 0, 64, 64))); heroTokens.Add(new Token("Syndrael", x + 1, tiles[0], 12, 4, 4, new Rectangle(448, 0, 64, 64))); break; default: break; #endregion } loadTokensSheets++; } if (loadTokensSheets >= numHeroesPlaying) { if (numHeroTurns == 3) { foreach (Token olToken in overlordTokens) if (olToken.Name == "doom") olToken.X = overlordTrack.DrawRectangle.X + overlordTrack.DrawRectangle.Width - 149; } else if (numHeroTurns == 4) { foreach (Token olToken in overlordTokens) if (olToken.Name == "doom") olToken.X = overlordTrack.DrawRectangle.X + overlordTrack.DrawRectangle.Width - 225; } } } if (!loadedOnce) { messages.Add(new Message(heroSheets[buySkill].Name + " has 1 EXP to start the quest with. Either select\na skill to spend it OR hit End to store it.", windlassFont14, centerWindowMessage)); foreach (Token skillCard in heroSheets[buySkill].PickedClass.AllSkillCards) skillCard.Active = true; loadedOnce = true; } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Token skillCard in heroSheets[buySkill].PickedClass.AllSkillCards) { if(skillCard.DrawRectangle.Contains(mouse.X, mouse.Y)){ int theVariable = skillCard.Variable; if (theVariable < 4) { Rectangle secondSkill; if (heroSheets[buySkill].PickedClass.ClassName == "necromancer") secondSkill = new Rectangle(GameConstants.MAIN_SKILL_LOC_X + (GameConstants.MAIN_SKILL_BUFFER_X * 2), GameConstants.WINDOW_HEIGHT - 192, 128, 192); else secondSkill = new Rectangle(GameConstants.MAIN_SKILL_LOC_X + GameConstants.MAIN_SKILL_BUFFER_X, GameConstants.WINDOW_HEIGHT - 192, 128, 192); heroSheets[buySkill].PickedClass.SkillList.Add(new Token(secondSkill, theVariable, 0, 0, skillCard.SourceRectangle)); messages.Clear(); buySkill++; loadedOnce = false; } else messages.Add(new Message("That skill is to expensive to purchase right now, choose again.", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y - 50))); } } if(endToken.DrawRectangle.Contains(mouse.X, mouse.Y)){ messages.Clear(); heroSheets[buySkill].PickedClass.CurrentExp++; messages.Add(new Message(heroSheets[buySkill].Name + " has stored the EXP for later.", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y = 50))); buySkill++; loadedOnce = false; } } } if(buySkill == numHeroesPlaying) currentGameState = GameState.InitializeRoom; } #endregion break; #endregion #region Game State: Initialize Room case GameState.InitializeRoom: switch(currentRoom){ case "The Onset": monsterTokens.Add(new Token("zombie", new Rectangle(960, 64, 64, 64), true, 0, tiles[0], GameConstants.MONSTER_LOC_19B[0, 0, 0], GameConstants.MONSTER_LOC_19B[0, 0, 1], GameConstants.ZOMBIE_FLESH_W, GameConstants.ZOMBIE_FLESH_BARGH_H, 0, 0, 0)); monsterTokens.Add(new Token("barghest", new Rectangle(513, 256, 128, 64), true, 3, tiles[0], GameConstants.MONSTER_LOC_19B[1, 0, 0], GameConstants.MONSTER_LOC_19B[1, 0, 1], GameConstants.BARGH_W, GameConstants.ZOMBIE_FLESH_BARGH_H, 0, 0, 0)); if (heroTokens.Count >= 3) { monsterTokens.Add(new Token("zombie", new Rectangle(896, 64, 64, 64), false, 0, tiles[0], GameConstants.MONSTER_LOC_19B[0, 1, 0], GameConstants.MONSTER_LOC_19B[0, 1, 1], GameConstants.ZOMBIE_FLESH_W, GameConstants.ZOMBIE_FLESH_BARGH_H, 0, 0, 0)); monsterTokens.Add(new Token("barghest", new Rectangle(512, 192, 128, 64), false, 3, tiles[0], GameConstants.MONSTER_LOC_19B[1, 1, 0], GameConstants.MONSTER_LOC_19B[1, 1, 1], GameConstants.BARGH_W, GameConstants.ZOMBIE_FLESH_BARGH_H, 0, 0, 0)); } if (heroTokens.Count == 4) { monsterTokens.Add(new Token("zombie", new Rectangle(896, 64, 64, 64), false, 0, tiles[0], GameConstants.MONSTER_LOC_19B[0, 2, 0], GameConstants.MONSTER_LOC_19B[0, 2, 1], GameConstants.ZOMBIE_FLESH_W, GameConstants.ZOMBIE_FLESH_BARGH_H, 0, 0, 0)); monsterTokens.Add(new Token("barghest", new Rectangle(512, 192, 128, 64), false, 3, tiles[0], GameConstants.MONSTER_LOC_19B[1, 2, 0], GameConstants.MONSTER_LOC_19B[1, 2, 1], GameConstants.BARGH_W, GameConstants.ZOMBIE_FLESH_BARGH_H, 0, 0, 0)); } searchTokens.Add(new Token(new Rectangle(960, 0, 64, 64), endCaps[0], 0, 64, 0)); break; default: break; } foreach (Token mToken in monsterTokens) { if (mToken.Name == "barghest" && !barghestFound) { addMonsterSheet(mToken.Name); barghestFound = true; } else if (mToken.Name == "flesh moulder" && !fleshFound) { addMonsterSheet(mToken.Name); fleshFound = true; } else if (mToken.Name == "shadow dragon" && !dragonFound) { addMonsterSheet(mToken.Name); dragonFound = true; } else if (mToken.Name == "zombie" && !zombieFound) { addMonsterSheet(mToken.Name); zombieFound = true; } foreach (MonsterSheet mSheet in monsterSheet) { if (mToken.Name == mSheet.Name) { if (mToken.IsMaster) { mToken.HP = mSheet.MasHP; mToken.Movement = mSheet.MasMove; } else { mToken.HP = mSheet.MinHP; mToken.Movement = mSheet.MinMove; } } } } currentGameState = GameState.StartingPositions; break; #endregion #region Game State: Place Hero Starting Positions case GameState.StartingPositions: int placeX = tiles[0].X + 128, placeY = tiles[0].Y; if (!loadedOnce) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 2; x++) { floorHighlights.Add(new Token(new Rectangle(704, 0, 64, 64), new Rectangle(placeX + (x * 64), placeY + (y * 64), 64, 64))); } } loadedOnce = true; } messages.Add(new Message("Place " + heroSheets[heroPlacementCount].Name + " in a red starting square.", windlassFont23, centerWindowMessage)); if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Token floorLight in floorHighlights) { if (floorLight.DrawRectangle.Contains(mouse.X, mouse.Y)) { heroTokens[heroPlacementCount].DrawRectangle = floorLight.DrawRectangle; heroTokens[heroPlacementCount].OriginalDrawRect = heroTokens[heroPlacementCount].DrawRectangle; heroTokens[heroPlacementCount].LocationX = heroTokens[heroPlacementCount].DrawRectangle.X + 32; heroTokens[heroPlacementCount].LocationY = heroTokens[heroPlacementCount].DrawRectangle.Y + 32; heroTokens[heroPlacementCount].OriginalLocation = heroTokens[heroPlacementCount].Location; heroPlacementCount++; messages.Clear(); } } } } if (heroPlacementCount >= numHeroesPlaying) { currentGameState = GameState.HeroTurn; loadedOnce = false; floorHighlights.Clear(); } break; #endregion #region Game State: Hero Turn case GameState.HeroTurn: #region Fade Delay mFadeDelay -= gameTime.ElapsedGameTime.TotalSeconds; if (mFadeDelay <= 0) { mFadeDelay = 0.015; mAlphaValue += mFadeIncrement; // Below is used for a pulsing effect. // TODO: Make a 2nd series for a glowing ring on selected hero token //if (mAlphaValue >= 225 || mAlphaValue <= 0) mFadeIncrement *= -1; } #endregion switch(currentHeroState) { #region Selecting Hero case HeroState.SelectHero: if (!heroTokenClicked) { messages.Add(new Message("Click a hero token for turn #" + currentHeroTurn, windlassFont23, centerWindowMessage)); } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; checkVariousItems(mouse); foreach (Token drawingToken in drawingTokens) { if (drawingToken.DrawRectangle.Contains(mouse.X, mouse.Y)) { heroNumPosition = drawingToken.Variable - 1; selectedHeroName = heroTokens[heroNumPosition].Name; heroTokenClicked = true; messages.Clear(); heroSheets[heroNumPosition].ActiveSheet = true; currentHeroState = HeroState.StartTurnAbility; drawingToken.Active = false; } } } } break; #endregion #region Start of Turn abilities case HeroState.StartTurnAbility: if (familiarActive && !familiarActed && heroSheets[heroNumPosition].PickedClass.ClassName == "necromancer") { messages.Add(new Message("Activate the reanimate before the necromancers turn?", windlassFont23, centerWindowMessage)); } else { currentHeroState = HeroState.RefreshCards; if (familiarActive && familiarActed) familiarActed = false; } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; checkVariousItems(mouse); foreach (Token yesNo in yesNoList) { if (yesNo.DrawRectangle.Contains(mouse.X, mouse.Y)) { messages.Clear(); int answer = yesNo.Variable; if (answer == 0) currentHeroState = HeroState.FamiliarActions; else { familiarActed = true; } } } } } break; #endregion #region Familiar Actions case HeroState.FamiliarActions: choosingAction = false; Token target; if (!loadedOnce) { foreach (Token action in actionButtons) action.Active = false; actionButtons[0].Active = true; actionButtons[2].Active = true; loadedOnce = true; } else familiarAttacked = true; if (heroSheets[heroNumPosition].PickedClass.ClassName == "necromancer" && familiarActionSheetOn) messages.Add(new Message("Reanimate actions.", windlassFont14, actionWindowTop)); if (familiarAction == "attacking") { familiarChoosing = true; messages.Add(new Message("Select a target to attack.", windlassFont23, centerWindowMessage)); } else if(familiarAction == "moving") { familiarChoosing = true; messages.Add(new Message("Select an area to move too.", windlassFont23, centerWindowMessage)); } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; //if(!familiarAttacking || !familiarMoving) checkVariousItems(mouse); #region Checking for Action Click foreach (Token action in actionButtons) { messages.Clear(); if (action.DrawRectangle.Contains(mouse.X, mouse.Y)) { if (action.Variable == 1 && action.Active) { if (heroSheets[heroNumPosition].PickedClass.ClassName == "necromancer") { familiarDie1 = new Dice(0); familiarDie2 = new Dice(1); if (heroSheets[heroNumPosition].PickedClass.SkillsOwned[5]) familiarDie3 = new Dice(2); } DetermineRanges(1, "familiar", heroTokens[heroTokens.Count - 1].DrawRectangle, "Familiar"); familiarAction = "attacking"; } else if (action.Variable == 3 && action.Active) { DetermineRanges(heroTokens[heroTokens.Count - 1].Movement, "familiar", heroTokens[heroTokens.Count - 1].DrawRectangle, "Familiar"); familiarAction = "moving"; } familiarActionSheetOn = false; action.Active = false; } } #endregion #region Checking for Floor Tile Click foreach (Token floorLight in floorHighlights) { if (floorLight.DrawRectangle.Contains(mouse.X, mouse.Y)) { #region Attacking if (familiarAction == "attacking") { foreach (Token mToken in monsterTokens) { if (mToken.DrawRectangle.Contains(mouse.X, mouse.Y)) { familiarChoosing = false; if(calcAttack) { target = mToken; RollAttack(familiarDie1); RollAttack(familiarDie2); if (familiarDie3 != null && familiarDie3.DieColor >= 0) { RollAttack(familiarDie3); } string monsterName = mToken.Name; foreach (MonsterSheet mSheet in monsterSheet) { targetMonsterSheet = mSheet; if (mSheet.Name == monsterName) { int monDie1 = -1, monDie2 = -1; if (mToken.IsMaster) { monDie1 = mSheet.MasDef1; if (mSheet.MasDef2 >= 0) monDie2 = mSheet.MasDef2; } else { monDie1 = mSheet.MinDef1; if (mSheet.MinDef2 >= 0) monDie2 = mSheet.MinDef2; } defenseDice1 = new Dice(monDie1); RollDefense(defenseDice1); if (monDie2 >= 0) { defenseDice2 = new Dice(monDie2); RollDefense(defenseDice2); } } } messages.Clear(); if(totalSurge > 0) totalAttack++; int totalDamageDealt = totalAttack - totalDefense; messages.Add(new Message("Reanimate dealt " + (totalDamageDealt) + " damage to the " + target.Name + ".", windlassFont23, centerWindowMessage)); if (totalSurge > 0) messages.Add(new Message("+1 Damage added from available surge", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 30))); if (totalDamageDealt > 0) mToken.HP -= totalDamageDealt; if (mToken.HP <= 0) { mToken.Active = false; messages.Add(new Message("The " + mToken.Name + " was defeated!", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 60))); } familiarAttacked = true; familiarAction = ""; } } } } #endregion #region Moving else if(familiarAction == "moving") { familiarChoosing = false; familiarActionSheetOn = false; messages.Clear(); if (floorLight.Active && !floorLight.Occupied) { heroTokens[heroTokens.Count - 1].NewSetTarget(new Vector2(floorLight.DrawRectangle.Center.X, floorLight.DrawRectangle.Center.Y)); heroMoving = true; } familiarMoved = true; familiarAction = ""; } #endregion } } #endregion #region Checking for End Button Click if (endToken.DrawRectangle.Contains(mouse.X, mouse.Y)) { foreach (Tile tile in tiles) if (heroTokens[heroTokens.Count - 1].DrawRectangle.Intersects(tile.DrawRectangle)) heroTokens[heroTokens.Count - 1].adjustPosition(tile.DrawRectangle); foreach (Tile endCap in endCaps) if (heroTokens[heroTokens.Count - 1].DrawRectangle.Intersects(endCap.DrawRectangle)) heroTokens[heroTokens.Count - 1].adjustPosition(endCap.DrawRectangle); familiarActionSheetOn = true; floorHighlights.Clear(); if (familiarAttacked && familiarMoved) { familiarActed = true; messages.Clear(); floorHighlights.Clear(); loadedOnce = false; heroMoving = false; foreach (Token action in actionButtons) action.Active = true; ClearDiceRolls(); checkActionPoints(heroSheets[heroNumPosition]); } } #endregion } } if (familiarActed) { ResetFamiliar(); checkActionPoints(heroSheets[heroNumPosition]); } break; #endregion #region Refresh Cards case HeroState.RefreshCards: for (int x = 0; x < 9; x++) { heroSheets[heroNumPosition].PickedClass.SkillsExhausted[x] = false; } currentHeroState = HeroState.EquipItems; break; #endregion #region Equip Items case HeroState.EquipItems: HeroClass thatHeroClass = heroSheets[heroNumPosition].PickedClass; if (heroSheets[heroNumPosition].PickedClass.BackPack.Count > 0) { if (!loadedOnce) { messages.Clear(); messages.Add(new Message("Choose what you would like to equip. When you're\ndone, click exit to finish equipping", windlassFont14, centerWindowMessage)); loadedOnce = true; } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; foreach (Equipment bagItem in thatHeroClass.BackPack) { if (bagItem.DrawRectangle.Contains(mouse.X, mouse.Y)) { listIndex = thatHeroClass.BackPack.IndexOf(bagItem); if (bagItem.Type == "melee" || bagItem.Type == "range" || bagItem.Type == "shield") { if (bagItem.Hands == 1) { if (thatHeroClass.NumHandsUsed == 1 && bagItem.Type == "melee") { if (thatHeroClass.CurrentWeapon.SlotUsed && !thatHeroClass.OffHand.SlotUsed) thatHeroClass.AddNewItem(bagItem, "off hand"); else thatHeroClass.AddNewItem(bagItem, "main"); } else if (thatHeroClass.NumHandsUsed == 1 && bagItem.Type == "shield") { if (!thatHeroClass.OffHand.SlotUsed) thatHeroClass.OffHand = bagItem; else { tempEquipHold2 = thatHeroClass.OffHand; thatHeroClass.AddNewItem(bagItem, "shield"); } } else if (thatHeroClass.NumHandsUsed == 2) { if (bagItem.Type == "melee") { if (thatHeroClass.CurrentWeapon.Hands == 2) { tempEquipHold2 = thatHeroClass.CurrentWeapon; thatHeroClass.AddNewItem(bagItem, "main"); } else { messages.Add(new Message("Click an equiped weapon to replace.", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 60))); selectionNeeded = true; tempEquipHold = bagItem; } } else { if (thatHeroClass.CurrentWeapon.Hands == 2) tempEquipHold2 = thatHeroClass.CurrentWeapon; else tempEquipHold2 = thatHeroClass.OffHand; thatHeroClass.AddNewItem(bagItem, "shield"); } } } else // Bag item uses 2 hands { if (thatHeroClass.CurrentWeapon.SlotUsed) tempEquipHold2 = thatHeroClass.CurrentWeapon; if (thatHeroClass.OffHand != null) tempEquipHold2 = thatHeroClass.OffHand; thatHeroClass.AddNewItem(bagItem, "main"); } } else if (bagItem.Type == "armor") { if (thatHeroClass.Armor.SlotUsed) { tempEquipHold2 = thatHeroClass.Armor; thatHeroClass.AddNewItem(bagItem, "armor"); } else thatHeroClass.Armor = bagItem; } else if (bagItem.Type == "trinket") { if (!thatHeroClass.Trinket1.SlotUsed && !thatHeroClass.Trinket2.SlotUsed) thatHeroClass.Trinket1 = bagItem; else if (!thatHeroClass.Trinket1.SlotUsed && thatHeroClass.Trinket2.SlotUsed) thatHeroClass.Trinket1 = bagItem; else if (thatHeroClass.Trinket1.SlotUsed && !thatHeroClass.Trinket2.SlotUsed) thatHeroClass.Trinket2 = bagItem; else { messages.Add(new Message("Click an equipped trinket to replace.", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 60))); selectionNeeded = true; tempEquipHold = bagItem; } } } } if (selectionNeeded) { listIndex = thatHeroClass.BackPack.IndexOf(tempEquipHold); if (thatHeroClass.CurrentWeapon.DrawRectangle.Contains(mouse.X, mouse.Y)) { tempEquipHold2 = thatHeroClass.CurrentWeapon; thatHeroClass.AddNewItem(tempEquipHold, "main"); } else if (thatHeroClass.OffHand.DrawRectangle.Contains(mouse.X, mouse.Y)) { tempEquipHold2 = thatHeroClass.OffHand; thatHeroClass.AddNewItem(tempEquipHold, "off hand"); } else if (thatHeroClass.Trinket1.DrawRectangle.Contains(mouse.X, mouse.Y)) { tempEquipHold2 = thatHeroClass.Trinket1; thatHeroClass.AddNewItem(tempEquipHold, "trinket 1"); } else { tempEquipHold2 = thatHeroClass.Trinket2; thatHeroClass.AddNewItem(tempEquipHold, "trinket 2"); } messages.RemoveAt(messages.Count - 1); } if (endToken.DrawRectangle.Contains(mouse.X, mouse.Y)) { if (!selectionNeeded) thatHeroClass.BackPack.RemoveAt(listIndex); messages.Clear(); currentHeroState = HeroState.SelectActions; thatHeroClass.BackPack.Add(tempEquipHold2); } } } } else currentHeroState = HeroState.SelectActions; break; #endregion #region Selecting an Action case HeroState.SelectActions: if (heroTokenClicked && choosingAction) { messages.Add(new Message("Choose an Action", windlassFont23, actionWindowTop)); messages.Add(new Message(selectedHeroName + ": " + heroSheets[heroNumPosition].ActionPoints + " Action Point(s)", windlassFont14, actionWindowBottom)); } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; checkVariousItems(mouse); foreach (Token actButton in actionButtons) { if (actButton.DrawRectangle.Contains(mouse.X, mouse.Y)) { selectedActionNumber = actButton.Variable; loadedOnce = false; if (selectedActionNumber == 1) { loadedOnce = true; floorHighlights.Clear(); } GetHeroActionState(selectedActionNumber); choosingAction = false; currentHeroState = HeroState.PerformAction; if (familiarActive) familiarActed = false; messages.Clear(); } } } } break; #endregion #region Performing the Action case HeroState.PerformAction: Rectangle tokenPosition = heroTokens[heroNumPosition].DrawRectangle; HeroSheet thisHeroSheet = heroSheets[heroNumPosition]; HeroClass currentHeroClass = heroSheets[heroNumPosition].PickedClass; Token currentHeroToken = heroTokens[heroNumPosition]; string archetype = heroSheets[heroNumPosition].Archetype; switch (currentHeroActionState) { #region Attack Action case HeroActionState.AttackAction: if (!weaponPicked) { floorHighlights.Clear(); messages.Add(new Message("Select a weapon to attack with.", windlassFont23, centerWindowMessage)); } if (!loadedOnce) { #region Loading target select message and determining range messages.Clear(); messages.Add(new Message("Select a target to attack.", windlassFont23, centerWindowMessage)); DetermineRanges(attackRange, archetype, tokenPosition, "Attack"); loadedOnce = true; #endregion } if (!calcAttack && attackHit && LoSFound) { #region Reviewing attack if (totalSurge > 0 && !loadSurgeOnce) { #region checking surges loadSurgeOnce = true; hasSurges = true; messages.Add(new Message("Number of surges to use: " + totalSurge, windlassFont14, actionWindowTop)); if (removeSurgeNumber >= 0 && surgeList.Count > 0) { surgeList.RemoveAt(removeSurgeNumber); surgeList.Insert(removeSurgeNumber, ""); } #endregion } else if (totalSurge <= 0) { #region post surge check, finalizing attack attackHit = false; hasSurges = false; surgeList.Clear(); surgeListRect.Clear(); int rangeToTarget = DetermineDistanceLong(heroTokens[heroNumPosition], targetMonsterToken); if (totalRange >= rangeToTarget) { if (totalDefense < 0) totalDefense = 0; int totalDmg = totalAttack - totalDefense; if (totalDmg > 0) targetMonsterToken.HP -= totalDmg; messages.Add(new Message(totalDmg.ToString(), windlassFont36, new Vector2(targetMonsterToken.DrawRectangleX + (targetMonsterToken.DrawRectangle.Width /2) , targetMonsterToken.DrawRectangleY + targetMonsterToken.DrawRectangle.Height / 2))); if (targetMonsterToken.HP <= 0) { targetMonsterToken.Active = false; checkWeaponBonus(targetMonsterToken, attackingWeapon); messages.Add(new Message("The " + targetMonsterToken.Name + " has been defeated!", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 30))); UpdateLootTrackWindow(targetMonsterToken); } } else attackHit = false; #endregion } if(!awardingLoot) messages.Add(new Message("Rng: " + totalRange + " Dmg: " + totalAttack + " Srg: " + totalSurge + " Def: " + totalDefense, windlassFont23, centerWindowMessage)); #endregion } if (!calcAttack && !attackHit && totalRange == 0) messages.Add(new Message("Attack missed...", windlassFont23, centerWindowMessage)); if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; //checkVariousItems(mouse); #region Checks for main hand weapon click if (currentHeroClass.CurrentWeaponRect.Contains(mouse.X, mouse.Y) && !weaponPicked) { addSurgeUsage(currentHeroClass.CurrentWeapon, heroSheets[heroNumPosition], heroTokens[heroNumPosition]); attackRange = currentHeroClass.MainAttackRange; weaponPicked = true; weaponUsed = "main"; loadedOnce = false; attackingWeapon = currentHeroClass.CurrentWeapon; messages.Clear(); } #endregion #region Checks for off hand weapon click if (currentHeroClass.OffHandRect.Contains(mouse.X, mouse.Y) && !weaponPicked && (currentHeroClass.OffHand.Type == "melee" || currentHeroClass.OffHand.Type == "range")){ addSurgeUsage(currentHeroClass.OffHand, heroSheets[heroNumPosition], heroTokens[heroNumPosition]); attackRange = currentHeroClass.OffAttackRange; weaponPicked = true; weaponUsed = "off"; loadedOnce = false; messages.Clear(); attackingWeapon = currentHeroClass.OffHand; } #endregion #region Checks for end button click if (endToken.DrawRectangle.Contains(mouse.X, mouse.Y)) { weaponPicked = false; loadedOnce = false; calcAttack = true; attackHit = true; hasSurges = false; loadSurgeOnce = false; LoSFound = false; ClearDiceRolls(); removeSurgeNumber = -1; messages.Clear(); floorHighlights.Clear(); thisHeroSheet.ActionPoints--; checkActionPoints(heroSheets[heroNumPosition]); } #endregion #region Checks for surge button click foreach(Token surge in surgeListRect) { if (surge.DrawRectangle.Contains(mouse.X, mouse.Y)) { messages.Clear(); loadSurgeOnce = false; removeSurgeNumber = surge.Variable - 1; if (surgeList[removeSurgeNumber].ToString() != "") { UseSurge(surgeList[removeSurgeNumber], targetMonsterToken); totalSurge--; } } } #endregion #region Checks for monster token click for attack // Checks each monster for click and rolls damage based on weapon used and defense of monster foreach (Token mToken in monsterTokens) { if (mToken.DrawRectangle.Contains(mouse.X, mouse.Y) && weaponPicked) { messages.Clear(); if (attackingWeapon.Type == "melee") { calcAttack = true; LoSFound = true; } else { dots.Clear(); #region Checking LoS on Ranged weapons bool foundLoS; List<Vector2> heroPoints = new List<Vector2>(); heroPoints.Add(new Vector2(currentHeroToken.DrawRectangle.X, currentHeroToken.DrawRectangle.Y)); heroPoints.Add(new Vector2(currentHeroToken.DrawRectangle.X + 64, currentHeroToken.DrawRectangle.Y)); heroPoints.Add(new Vector2(currentHeroToken.DrawRectangle.X, currentHeroToken.DrawRectangle.Y + 64)); heroPoints.Add(new Vector2(currentHeroToken.DrawRectangle.X + 64, currentHeroToken.DrawRectangle.Y + 64)); List<Vector2> monsterPoints = new List<Vector2>(); monsterPoints.Add(new Vector2(mToken.DrawRectangle.X, mToken.DrawRectangle.Y)); monsterPoints.Add(new Vector2(mToken.DrawRectangle.X + 64, mToken.DrawRectangle.Y)); monsterPoints.Add(new Vector2(mToken.DrawRectangle.X, mToken.DrawRectangle.Y + 64)); monsterPoints.Add(new Vector2(mToken.DrawRectangle.X + 64, mToken.DrawRectangle.Y + 64)); for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { foundLoS = DetermineLineOfSight((int)heroPoints[y].X, (int)heroPoints[y].Y, (int)monsterPoints[x].X, (int)monsterPoints[x].Y); if (foundLoS) { LoSFound = true; calcAttack = true; break; } } if (LoSFound) break; } if (!LoSFound) { messages.Add(new Message("Line of sight could not be found to the " + mToken.Name + ".\nSelect another target within range.", windlassFont14, centerWindowMessage)); } #endregion } if (calcAttack && LoSFound) { messages.Clear(); targetMonsterToken = mToken; if (weaponUsed == "main") { attackDice1 = currentHeroClass.MainDie1; attackDice2 = currentHeroClass.MainDie2; attackDice3 = currentHeroClass.MainDie3; } else { attackDice1 = currentHeroClass.OffDie1; attackDice2 = currentHeroClass.OffDie2; attackDice3 = currentHeroClass.OffDie3; } RollAttack(attackDice1); //messages.Add(new Message("Side: "+(attackDice1.RandomSide+1)+"Rng: "+attackDice1.Range+" Atk: "+attackDice1.Attack+" Srg: "+attackDice1.Surge, windlassFont14, new Vector2(300, 50))); checkWeaponBonus(targetMonsterToken, attackingWeapon); if (attackDice2.DieColor >= 0) { RollAttack(attackDice2); //messages.Add(new Message("Side: " + (attackDice2.RandomSide + 1) + "Rng: " + attackDice2.Range + " Atk: " + attackDice2.Attack + " Srg: " + attackDice2.Surge, windlassFont14, new Vector2(300, 100))); } if (attackDice3.DieColor >= 0) { RollAttack(attackDice3); } string monsterName = mToken.Name; foreach (MonsterSheet mSheet in monsterSheet) { targetMonsterSheet = mSheet; if (mSheet.Name == monsterName) { int monDie1 = -1, monDie2 = -1; if (mToken.IsMaster) { monDie1 = mSheet.MasDef1; if (mSheet.MasDef2 >= 0) monDie2 = mSheet.MasDef2; } else { monDie1 = mSheet.MinDef1; if (mSheet.MinDef2 >= 0) monDie2 = mSheet.MinDef2; } defenseDice1 = new Dice(monDie1); RollDefense(defenseDice1); if (monDie2 >= 0) { defenseDice2 = new Dice(monDie2); RollDefense(defenseDice2); } } } calcAttack = false; } } } #endregion #region Checks for reward click if (awardingLoot) { bool lootTaken = false; foreach (Card loot in awardedShopCards) if (loot.DrawRectangle.Contains(mouse.X, mouse.Y)) { currentHeroClass.AddToBackPack(loot); awardedCardHold = loot; lootTaken = true; } if (lootTaken) { awardedShopCards.Remove(awardedCardHold); foreach (Card loot in awardedShopCards) { if (currentAct == 1) { shop1Deck.putCardBack(loot); shop1Deck.Shuffle(random); } else { shop2Deck.putCardBack(loot); shop2Deck.Shuffle(random); } } lootTaken = false; awardingLoot = false; messages.Clear(); } } #endregion } } break; #endregion #region Search Action case HeroActionState.SearchAction: int searchRange = thisHeroSheet.SearchRange; if (!weaponPicked) { messages.Add(new Message("Select a search token within range.", windlassFont23, centerWindowMessage)); } if (!loadedOnce) { DetermineRanges(searchRange, archetype, tokenPosition, "Search"); loadedOnce = true; } int searchCoinIndex = 0; if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; //checkVariousItems(mouse); foreach (Token searchCoin in searchTokens) { if (searchCoin.DrawRectangle.Contains(mouse.X, mouse.Y)) { if (!searchedOnce) { weaponPicked = true; messages.Clear(); messages.Add(new Message(thisHeroSheet.Name + " found...", windlassFont23, centerWindowMessage)); searchDeck.pullSearchCard(thisHeroSheet); searchedOnce = true; if (thisHeroSheet.PickedClass.SearchCards[thisHeroSheet.PickedClass.SearchCards.Count - 1].Name == "Treasure Chest") { thisHeroSheet.PickedClass.SearchCards.RemoveAt(thisHeroSheet.PickedClass.SearchCards.Count - 1); if (currentAct == 1) shop1Deck.pullShopCard(thisHeroSheet); else shop2Deck.pullShopCard(thisHeroSheet); } } searchTokenClicked = true; searchCoinIndex = searchCoin.Variable; } } foreach (Card displayedCard in searchDeck.DiscardDeck) { if (displayedCard.DrawRectangle.Contains(mouse.X, mouse.Y)) { weaponPicked = false; displayedCard.Active = false; searchTokenClicked = false; loadedOnce = false; messages.Clear(); searchTokens.RemoveAt(searchCoinIndex); thisHeroSheet.ActionPoints--; checkActionPoints(heroSheets[heroNumPosition]); } } } } break; #endregion #region Move Action case HeroActionState.MoveAction: int movementPoints = heroTokens[heroNumPosition].Movement; if (movementPoints == 0) { movementButtons[0].Active = false; movementButtons[1].Active = false; zeroMovementPoints = true; } if (!loadedOnce) { DetermineRanges(movementPoints, archetype, tokenPosition, "Move"); loadedOnce = true; } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; //checkVariousItems(mouse); foreach (Token hToken in heroTokens) { foreach (Token floorLight in floorHighlights) if (floorLight.DrawRectangle.Contains(mouse.X, mouse.Y) && floorLight.Active && !floorLight.Occupied && selectedHeroName == hToken.Name) { hToken.NewSetTarget(new Vector2(floorLight.DrawRectangle.Center.X, floorLight.DrawRectangle.Center.Y)); heroMoving = true; messages.Add(new Message(hToken.Name + " used " + hToken.MovementUsed + " MP.", windlassFont14, new Vector2(20, 200), 0)); } } #region Checking Movement Buttons foreach (Token moveButton in movementButtons) { if(moveButton.DrawRectangle.Contains(mouse.X, mouse.Y)){ int moveValue = moveButton.Variable; currentHeroToken.Active = true; currentHeroToken.MovementPath.Clear(); heroMoving = false; if (moveValue == 1) { currentHeroToken.Location = currentHeroToken.OriginalLocation; currentHeroToken.DrawRectangle = currentHeroToken.OriginalDrawRect; } else if (moveValue == 2) { floorHighlights.Clear(); //currentHeroToken.OriginalLocation = currentHeroToken.Location; //currentHeroToken.OriginalDrawRect = currentHeroToken.DrawRectangle; choosingAction = true; loadedOnce = false; foreach (Tile tile in tiles) if (currentHeroToken.DrawRectangle.Intersects(tile.DrawRectangle)) currentHeroToken.adjustPosition(tile.DrawRectangle); foreach (Tile endCap in endCaps) if (currentHeroToken.DrawRectangle.Intersects(endCap.DrawRectangle)) currentHeroToken.adjustPosition(endCap.DrawRectangle); currentHeroToken.Movement -= currentHeroToken.MovementUsed; currentHeroActionState = HeroActionState.ChooseAction; currentHeroState = HeroState.SelectActions; } else { floorHighlights.Clear(); //currentHeroToken.OriginalLocation = currentHeroToken.Location; //currentHeroToken.OriginalDrawRect = currentHeroToken.DrawRectangle; loadedOnce = false; foreach (Tile tile in tiles) if (currentHeroToken.DrawRectangle.Intersects(tile.DrawRectangle)) currentHeroToken.adjustPosition(tile.DrawRectangle); foreach (Tile endCap in endCaps) if (currentHeroToken.DrawRectangle.Intersects(endCap.DrawRectangle)) currentHeroToken.adjustPosition(endCap.DrawRectangle); if (movementPoints == 0) { movementButtons[0].Active = true; movementButtons[1].Active = true; zeroMovementPoints = false; } currentHeroToken.Movement = thisHeroSheet.MaxMovement; currentHeroToken.MovementUsed = 0; zeroMovementPoints = false; thisHeroSheet.ActionPoints--; checkActionPoints(thisHeroSheet); } } } #endregion } } break; #endregion case HeroActionState.SpecialAction: currentHeroState = HeroState.SelectActions; break; #region Rest Action case HeroActionState.RestAction: if (!loadedOnce) { thisHeroSheet.Resting = true; loadedOnce = true; thisHeroSheet.ActionPoints--; messages.Clear(); messages.Add(new Message(thisHeroSheet.Name + " is resting this round", windlassFont23, centerWindowMessage)); } GeneralMouseClick(mouse); break; #endregion #region Stand Up Action case HeroActionState.StandUpAction: if (!loadedOnce) { Dice hpDie1 = new Dice(1), hpDie2 = new Dice(1); int totalHPRecovered = 0, totalStaminaRecovered = 0; hpDie1.RollDie(random.Next(0, 6)); attackDiceList.Add(hpDie1); totalHPRecovered += hpDie1.Attack; totalStaminaRecovered += hpDie1.Surge; hpDie2.RollDie(random.Next(0, 6)); attackDiceList.Add(hpDie2); totalHPRecovered += hpDie2.Attack; totalStaminaRecovered += hpDie2.Surge; messages.Clear(); messages.Add(new Message(thisHeroSheet.Name + " has recovered " + totalHPRecovered + " hit points & " + totalStaminaRecovered + " stamina", windlassFont23, centerWindowMessage)); thisHeroSheet.ActionPoints -= 2; loadedOnce = true; } GeneralMouseClick(mouse); break; #endregion #region Ability & Skill Action case HeroActionState.PerformArrowAbilitySkillAction: if (!skillPicked) { messages.Add(new Message("Select a skill to use.", windlassFont23, centerWindowMessage)); } if (skillNotExhausted) { #region Skill Number Check #region Starting Skill Check (0) if (skillUsed == 0) { if (currentHeroClass.ClassName == "disciple" && skillPicked) { DetermineRanges(1, archetype, tokenPosition, "Skill Use"); messages.Add(new Message("Select a target to heal", windlassFont23, centerWindowMessage)); } else if (currentHeroClass.ClassName == "necromancer") { DetermineRanges(1, archetype, tokenPosition, "Skill Use"); messages.Add(new Message("Select a location for the reanimate", windlassFont23, centerWindowMessage)); } else if (currentHeroClass.ClassName == "thief" && skillPicked) { thisHeroSheet.SearchRange = 3; if (!usedSkillOnce) { changeHpStaminaBar(currentHeroToken, -1, heroNumPosition, "stamina"); usedSkillOnce = true; } skillUsed = -1; skillPicked = false; currentHeroActionState = HeroActionState.SearchAction; } else if (currentHeroClass.ClassName == "berserker" && skillPicked) { totalAttack += 1; changeHpStaminaBar(currentHeroToken, -1, heroNumPosition, "stamina"); skillUsed = -1; skillPicked = false; currentHeroActionState = HeroActionState.AttackAction; messages.Clear(); loadedOnce = true; } else if (currentHeroClass.ClassName == "knight" && skillPicked) { DetermineRanges(3, archetype, tokenPosition, "Skill Use"); messages.Add(new Message("Select the closest empty location within range\nthat is adjacent to a hero token and to a monster", windlassFont23, centerWindowMessage)); } } #endregion #region Skill 1 used else if (skillUsed == 1) { } #endregion #endregion } if (mouse.LeftButton == ButtonState.Pressed && leftButtonReleased) { leftClickStarted = true; leftButtonReleased = false; } else if (mouse.LeftButton == ButtonState.Released) { leftButtonReleased = true; if (leftClickStarted) { leftClickStarted = false; //checkVariousItems(mouse); #region Skill Card Click Check foreach (Token skills in currentHeroClass.SkillList) if (skills.DrawRectangle.Contains(mouse.X, mouse.Y)) { skillPicked = true; skillUsed = skills.Variable; if (thisHeroSheet.PickedClass.SkillsExhausted[skillUsed]) { messages.Clear(); messages.Add(new Message("This skill is exhausted. Pick another or\nselect a new action.", windlassFont23, centerWindowMessage)); skillNotExhausted = false; } else { skillNotExhausted = true; messages.Clear(); } } #endregion #region Hero Token Click Check foreach (Token hToken in heroTokens) { if (hToken.DrawRectangle.Contains(mouse.X, mouse.Y)) { switch (skillUsed) { case 0: if (currentHeroClass.ClassName == "disciple") { thisHeroSheet.PickedClass.SkillsExhausted[0] = true; skillPicked = false; changeHpStaminaBar(currentHeroToken, -1, heroNumPosition, "stamina"); messages.Clear(); Dice healing = new Dice(1); RollAttack(healing); attackDiceList.Add(healing); messages.Add(new Message(hToken.Name + " has been healed\nfor " + totalAttack + " damage.", windlassFont23, centerWindowMessage)); hToken.HP += totalAttack; floorHighlights.Clear(); thisHeroSheet.PickedClass.SkillsExhausted[0] = true; thisHeroSheet.ActionPoints--; totalAttack = 0; skillUsed = -1; checkActionPoints(thisHeroSheet); } break; default: break; } } } #endregion #region Floor Highlight Click Check foreach (Token floorLight in floorHighlights) { if (floorLight.DrawRectangle.Contains(mouse.X, mouse.Y)) { switch (skillUsed) { case 0: if (currentHeroClass.ClassName == "necromancer") { skillPicked = false; skillUsed = -1; changeHpStaminaBar(currentHeroToken, -1, heroNumPosition, "stamina"); heroTokens.Add(new Token(floorLight.DrawRectangle, 5, 0, 0, new Rectangle(768, 776, 64, 64))); Token reanimate = heroTokens[heroTokens.Count - 1]; reanimate.HP = 4; reanimate.Movement = 3; reanimate.DrawRectangle = floorLight.DrawRectangle; reanimate.OriginalDrawRect = reanimate.DrawRectangle; reanimate.LocationX = reanimate.DrawRectangle.X + 32; reanimate.LocationY = reanimate.DrawRectangle.Y + 32; reanimate.OriginalLocation = reanimate.Location; reanimate.HalfDrawRectWidth = reanimate.SourceRectangle.Width / 2; reanimate.HalfDrawRectHeight = reanimate.SourceRectangle.Height / 2; messages.Clear(); familiarActive = true; thisHeroSheet.ActionPoints--; checkActionPoints(thisHeroSheet); } else // Knight Advance { skillPicked = false; currentHeroToken.DrawRectangle = floorLight.DrawRectangle; skillUsed = -1; changeHpStaminaBar(currentHeroToken, -1, heroNumPosition, "stamina"); messages.Clear(); currentHeroActionState = HeroActionState.AttackAction; } break; default: break; } } } #endregion #region Reset button click if(movementButtons[0].DrawRectangle.Contains(mouse.X, mouse.Y)){ skillPicked = false; skillNotExhausted = false; messages.Clear(); checkActionPoints(thisHeroSheet); } #endregion } } break; #endregion case HeroActionState.OpenCloseDoorAction: currentHeroState = HeroState.SelectActions; break; case HeroActionState.ReviveHeroAction: currentHeroState = HeroState.SelectActions; break; default: break; } break; #endregion #region Ending Hero Turn case HeroState.EndTurn: heroTokenClicked = false; heroSheets[heroNumPosition].ActiveSheet = false; if (currentHeroTurn > numHeroTurns) { currentHeroTurn = 1; foreach (HeroSheet hSheet in heroSheets) hSheet.ActionPoints = 2; foreach (Token drawToken in drawingTokens) drawToken.Active = true; currentHeroState = HeroState.SelectHero; currentGameState = GameState.OverlordTurn; } else currentHeroState = HeroState.SelectHero; break; #endregion default: break; } break; #endregion #region Game State: Overlord Turn case GameState.OverlordTurn: //messages.Add(new Message("Overlord turn coming soon!", windlassFont36, centerWindowMessage)); //if (timer > 5000) { currentGameState = GameState.HeroTurn; timer = 0; messages.Clear(); } //else timer += gameTime.ElapsedGameTime.Milliseconds; switch (currentOLState) { case OverlordState.ActiveEffect: messages.Add(new Message("Room activation effects coming soon!", windlassFont36, centerWindowMessage)); if (timer > 5000) { currentOLState = OverlordState.Fate; timer = 0; messages.Clear(); } else timer += gameTime.ElapsedGameTime.Milliseconds; break; case OverlordState.Fate: messages.Add(new Message("Fate check coming soon!", windlassFont36, centerWindowMessage)); if (timer > 5000) { currentOLState = OverlordState.MonsterActivation; timer = 0; messages.Clear(); } else timer += gameTime.ElapsedGameTime.Milliseconds; break; case OverlordState.MonsterActivation: if (fleshFound) { } if (dragonFound) { } if (zombieFound) { } if (barghestFound) { } messages.Add(new Message("Monster activation coming soon!", windlassFont36, centerWindowMessage)); if (timer > 5000) { currentOLState = OverlordState.ActiveEffect; currentGameState = GameState.HeroTurn; timer = 0; messages.Clear(); } else timer += gameTime.ElapsedGameTime.Milliseconds; break; } break; #endregion default: break; } // Clean out dead monster tokens for (int i = monsterTokens.Count - 1; i >= 0; i--) if (!monsterTokens[i].Active) monsterTokens.RemoveAt(i); // Update Game items if(heroMoving) foreach(Token hToken in heroTokens) if(selectedHeroName == hToken.Name) hToken.Update2(gameTime); //foreach(Token mToken in monsterTokens) mToken.Update(gameTime); //overlordTrack.Update(gameTime); //lootTrack.Update(gameTime); base.Update(gameTime); }
/// <summary> /// Checks the used weapon for any bonuses /// </summary> /// <param name="monsterToken">Monster being affected by the attack</param> /// <param name="weaponUsed">The weapon being used to check for bonuses</param> private void checkWeaponBonus(Token monsterToken, Equipment weaponUsed) { //if (attackHit && thisHeroSheet.PickedClass.ClassName == "thief") //{ // if (thisHeroSheet.PickedClass.CurrentWeapon.Bonus1 == "adjacent1dmg" || thisHeroSheet.PickedClass.OffHand.Bonus1 == "adjacent1dmg") // { // DetermineRanges(1, "scout", heroTokens[heroNumPosition].DrawRectangle, ""); // foreach (Token floorLight in floorHighlights) if (floorLight.DrawRectangle.Intersects(monsterToken.DrawRectangle)) // { // totalAttack += 1; // messages.Add(new Message("+1 Damage has been added from\nthe throwing knives bonus.", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 60))); // } // floorHighlights.Clear(); // } //} if (weaponUsed.Bonus1 != "") { switch (weaponUsed.Bonus1) { case "adjacent1dmg": DetermineRanges(1, "scout", heroTokens[heroNumPosition].DrawRectangle, ""); foreach (Token floorLight in floorHighlights) if (floorLight.DrawRectangle.Intersects(monsterToken.DrawRectangle)) { totalAttack += 1; messages.Add(new Message("+1 Damage has been added from the throwing knives bonus.", windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 60))); } floorHighlights.Clear(); break; case "heal1": if (monsterToken.HP < 1) changeHpStaminaBar(heroTokens[heroNumPosition], 1, heroNumPosition, "hp"); break; default: break; } messages.Add(new Message(weaponUsed.Bonus1, windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 75))); } if (weaponUsed.Bonus2 != "") messages.Add(new Message(weaponUsed.Bonus1, windlassFont14, new Vector2(centerWindowMessage.X, centerWindowMessage.Y + 85))); }
/// <summary> /// Gets the starting weapon sprite /// </summary> /// <param name="content">A string to determin the chosen class</param> private void loadStartingGear(string pickedClass) { Rectangle startingSkillRect = new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT); int xLoc = GameConstants.MAIN_SKILL_LOC_X, yLoc = GameConstants.WINDOW_HEIGHT - 192, xPos = 0, yPos = 0, counter = 0; switch (pickedClass) { case "disciple": numHandsUsed = 2; currentWeapon = GameConstants.DISCIPLE_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 0, 128, 192); offHand = GameConstants.DISCIPLE_SHIELD; offHand.EquipmentSpriteRect = new Rectangle(128, 0, 128, 192); offHand.SlotUsed = true; xPos = 256; yPos = 0; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(256, 0, 128, 192))); break; case "spirit speaker": numHandsUsed = 2; currentWeapon = GameConstants.SPIRIT_SPEAKER_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 192, 128, 192); xPos = 256; yPos = 192; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(128, 192, 128, 192))); break; case "necromancer": numHandsUsed = 2; currentWeapon = GameConstants.NECROMANCER_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 384, 128, 192); xPos = 384; yPos = 384; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(128, 384, 128, 192))); skillList.Add(new Token(startingSkillRect, -1, xLoc + GameConstants.MAIN_SKILL_BUFFER_X, yLoc, new Rectangle(256, 384, 128, 192))); break; case "runemaster": numHandsUsed = 2; currentWeapon = GameConstants.RUNEMASTER_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 576, 128, 192); xPos = 256; yPos = 576; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(128, 576, 128, 192))); break; case "thief": numHandsUsed = 1; currentWeapon = GameConstants.THIEF_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 0, 128, 192); trinket1 = GameConstants.THIEF_TRINKET; trinket1.EquipmentSpriteRect = new Rectangle(128, 0, 128, 192); trinket1.SlotUsed = true; numOfTrinketsUsed++; xPos = 384; yPos = 0; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(256, 0, 128, 192))); break; case "wildlander": numHandsUsed = 2; currentWeapon = GameConstants.WILDLANDER_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 192, 128, 192); xPos = 256; yPos = 192; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(128, 192, 128, 192))); break; case "berserker": numHandsUsed = 2; currentWeapon = GameConstants.BERSERKER_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 384, 128, 192); xPos = 256; yPos = 384; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(128, 384, 128, 192))); break; case "knight": numHandsUsed = 2; currentWeapon = GameConstants.KNIGHT_WEAPON; currentWeapon.EquipmentSpriteRect = new Rectangle(0, 576, 128, 192); offHand = GameConstants.KNIGHT_SHIELD; offHand.EquipmentSpriteRect = new Rectangle(128, 576, 128, 192); offHand.SlotUsed = true; xPos = 384; yPos = 576; for (int x = 1; x <= 8; x++) { skillSpriteSourceRect[x - 1] = new Rectangle(xPos, yPos, 128, 192); xPos += 128; } skillList.Add(new Token(startingSkillRect, 0, xLoc, yLoc, new Rectangle(256, 576, 128, 192))); break; default: break; } for (int y = 0; y < 2; y++) { for (int x = 0; x < 4; x++) { allSkillCards.Add(new Token(new Rectangle(GameConstants.HALF_WINDOW_WIDTH() - 280 + (140 * x), GameConstants.HALF_WINDOW_HEIGHT() - 200 + (200 * y), 128, 192), counter+1, 0, 0, skillSpriteSourceRect[counter])); counter++; } } foreach (Token skillCard in allSkillCards) skillCard.Active = false; }
/// <summary> /// Determines what surges are available for the current hero to use /// </summary> /// <param name="equipment">Weapon being used with surge options</param> /// <param name="heroSheet">Used to determine if specific hero sheets are active for extra surge uses</param> /// <param name="heroToken">The hero token using the surge</param> private void addSurgeUsage(Equipment equipment, HeroSheet heroSheet, Token heroToken) { surgeList.Add("Restore 1 Stamina"); if (heroSheet.MaxHP != heroToken.HP) foreach (Token hToken in heroTokens) if (hToken.Name == "Avric") { int avricRange = DetermineDistanceLong(heroToken, hToken); if (avricRange <= 3) surgeList.Add("Restore 1 Damage"); } if (heroSheet.PickedClass.ClassName == "runemaster") surgeList.Add("Suffer 1 Stamina to\ngain +2 Damage"); string surge1 = equipment.Surge1, surge2 = equipment.Surge2, surge3 = equipment.Surge3; surgeList.Add(surge1 = GetSurgeName(surge1)); if (surge2 != "") surgeList.Add(surge2 = GetSurgeName(surge2)); if (surge3 != "") surgeList.Add(surge3 = GetSurgeName(surge3)); for (int x = 0; x < surgeList.Count; x++) surgeListRect.Add(new Token(actionChoiceRect, x + 1, (int)(GameConstants.ACTION_MESSAGE_X_LEFT) - 35, (int)(GameConstants.ACTION_TOKEN_Y_START + (GameConstants.ACTION_TOKEN_Y_BUFFER * x) + 11), new Rectangle(0, 884, 250, 23))); }
/// <summary> /// Changes the weapon selected with the correct hand. /// </summary> /// <param name="bagCard">The weapon to be swapped in</param> /// <param name="location">The position to be placed in: main/off hand, armor, trinket 1/2</param> public void AddNewItem(Equipment bagCard, string location) { Rectangle sourceRect = bagCard.SourceRect; if (location == "main") { currentWeapon = bagCard; mainDie1 = new Dice(currentWeapon.Dice1); mainDie2 = new Dice(currentWeapon.Dice2); mainDie3 = new Dice(currentWeapon.Dice3); currentWeapon.Surge1 = bagCard.Surge1; currentWeapon.Surge2 = bagCard.Surge2; currentWeapon.Surge3 = bagCard.Surge3; currentWeapon.Bonus1 = bagCard.Bonus1; currentWeapon.Bonus2 = bagCard.Bonus2; currentWeapon.Hands = bagCard.Hands; currentWeapon.Trait1 = bagCard.Trait1; currentWeapon.Trait1 = bagCard.Trait1; currentWeapon.SourceRect = sourceRect; } else if (location == "off hand") { offHand = bagCard; offDie1 = new Dice(offHand.Dice1); offDie2 = new Dice(offHand.Dice2); offDie3 = new Dice(offHand.Dice3); offHand.Surge1 = bagCard.Surge1; offHand.Surge2 = bagCard.Surge2; offHand.Surge3 = bagCard.Surge3; offHand.Bonus1 = bagCard.Bonus1; offHand.Bonus2 = bagCard.Bonus2; offHand.Hands = bagCard.Hands; offHand.Trait1 = bagCard.Trait1; offHand.Trait1 = bagCard.Trait1; offHand.SourceRect = sourceRect; } else if (location == "shield") { offHand = bagCard; offDie1 = new Dice(offHand.Dice1); offDie2 = new Dice(offHand.Dice2); offDie3 = new Dice(offHand.Dice3); offHand.Trait1 = bagCard.Trait1; offHand.Hands = bagCard.Hands; offHand.Trait1 = bagCard.Trait1; offHand.SourceRect = sourceRect; } else if (location == "armor") { armor = bagCard; armor.Bonus1 = bagCard.Bonus1; armor.Bonus2 = bagCard.Bonus2; armor.Dice1 = bagCard.Dice1; armor.Type = bagCard.Type; armor.SourceRect = sourceRect; } else if (location == "trinket 1") { trinket1 = bagCard; trinket1.Type = bagCard.Type; trinket1.Bonus1 = bagCard.Bonus1; trinket1.Bonus2 = bagCard.Bonus2; trinket1.Trait1 = bagCard.Trait1; trinket1.SourceRect = sourceRect; } else if (location == "trinket 2") { trinket2 = bagCard; trinket2.Type = bagCard.Type; trinket2.Bonus1 = bagCard.Bonus1; trinket2.Bonus2 = bagCard.Bonus2; trinket2.Trait1 = bagCard.Trait1; trinket2.SourceRect = sourceRect; } }