public EventCard(string name, Texture2D cardTexture, Texture2D cardBack, Dictionary <string, Button> buttons, Dictionary <string, Die> combatDice, Dictionary <string, SoundEffect> dieSounds, Dictionary <string, Texture2D> dieTextures) : base(name, cardTexture, cardBack, buttons) { eventCardTurnState = new EventCardTurnState(); CurrentButtons = new List <Button>(); Buttons = buttons; CombatDice = combatDice; DieSounds = dieSounds; DieTextures = dieTextures; EventDie = new Die(DieTextures, 840, 400); }
//---------------------- METHODS ----------------------------- public override bool HandleCard(Player player, MouseState current, MouseState previous, float xPos, float yPos) { XPos = xPos; YPos = yPos; CurrentMouseState = current; PreviousMouseState = previous; switch (eventCardTurnState) { case EventCardTurnState.INITIAL_ROLL: SkillCheck = false; HandleButtons(player); return(false); case EventCardTurnState.ROLLANIMATION: if (AnimationCounter < 60) { RollAnimation(); } else { if (SkillCheck) { SkillCheckResult = player.playerDice.RollDice(); EventDie.CurrentTexture = EventDie.DieTextures["Roll " + SkillCheckResult]; if (SkillCheckResult <= player.Rank) { CurrentButtons.Clear(); LoadSkillCheckButtons(); eventCardTurnState = EventCardTurnState.ADJUSTOPTION; } else { eventCardTurnState = EventCardTurnState.HANDLE_EVENT; } AnimationCounter = 0; } else { Option = player.playerDice.RollDice(); EventDie.CurrentTexture = EventDie.DieTextures["Roll " + Option]; LoadInitialRollButtons(Option); eventCardTurnState = EventCardTurnState.SKILL_CHECK; AnimationCounter = 0; } } return(false); case EventCardTurnState.SKILL_CHECK: HandleButtons(player); return(false); case EventCardTurnState.ADJUSTOPTION: HandleButtons(player); return(false); case EventCardTurnState.HANDLE_EVENT: HandleButtons(player); return(false); case EventCardTurnState.FIGHT_MONSTER: HandleButtons(player); return(false); case EventCardTurnState.COMBAT: if (CurrentCombat.HandleCombat(player, CurrentMouseState, PreviousMouseState, XPos, yPos, false, true)) { eventCardTurnState = EventCardTurnState.COMPLETE; } return(false); case EventCardTurnState.COMPLETE: return(true); default: return(false); } }
// Constructor public EventCard(string name, Texture2D cardTexture, Texture2D cardBack, Dictionary <string, Button> buttons) : base(name, cardTexture, cardBack, buttons) { eventCardTurnState = new EventCardTurnState(); CurrentButtons = new List <Button>(); }
public void HandleButtons(Player player) { if (SingleMouseClick()) { switch (eventCardTurnState) { case EventCardTurnState.INITIAL_ROLL: if (XPos > 770 && XPos < 1018 && YPos > 600 && YPos < 672) { eventCardTurnState = EventCardTurnState.ROLLANIMATION; } break; case EventCardTurnState.SKILL_CHECK: DieSoundPlayed = false; if (XPos > 770 && XPos < 1018 && YPos > 600 && YPos < 672) { SkillCheck = true; eventCardTurnState = EventCardTurnState.ROLLANIMATION; } break; case EventCardTurnState.ADJUSTOPTION: DieSoundPlayed = false; switch (Option) { case 1: if (XPos > 650 && XPos < 730 && YPos > 300 && YPos < 380) { player.Food += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 730 && XPos < 810 && YPos > 300 && YPos < 380) { player.Health += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 1050 && XPos < 1130 && YPos > 300 && YPos < 380) { eventCardTurnState = EventCardTurnState.FIGHT_MONSTER; } break; case 2: if (XPos > 650 && XPos < 730 && YPos > 300 && YPos < 380) { player.Food += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 730 && XPos < 810 && YPos > 300 && YPos < 380) { player.Health += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 810 && XPos < 890 && YPos > 300 && YPos < 380) { player.Gold += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 3: if (XPos > 730 && XPos < 810 && YPos > 300 && YPos < 380) { player.Health += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 810 && XPos < 890 && YPos > 300 && YPos < 380) { player.Gold += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 890 && XPos < 970 && YPos > 300 && YPos < 380) { player.Experience += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 4: if (XPos > 810 && XPos < 890 && YPos > 300 && YPos < 380) { player.Gold += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 890 && XPos < 970 && YPos > 300 && YPos < 380) { player.Experience += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 970 && XPos < 1050 && YPos > 300 && YPos < 380) { player.Armor += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 5: if (XPos > 890 && XPos < 970 && YPos > 300 && YPos < 380) { player.Experience += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 970 && XPos < 1050 && YPos > 300 && YPos < 380) { player.Armor += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 1050 && XPos < 1130 && YPos > 300 && YPos < 380) { eventCardTurnState = EventCardTurnState.FIGHT_MONSTER; } break; case 6: if (XPos > 970 && XPos < 1050 && YPos > 300 && YPos < 380) { player.Armor += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } if (XPos > 1050 && XPos < 1130 && YPos > 300 && YPos < 380) { eventCardTurnState = EventCardTurnState.FIGHT_MONSTER; } if (XPos > 650 && XPos < 730 && YPos > 300 && YPos < 380) { player.Food += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } break; default: break; } break; case EventCardTurnState.HANDLE_EVENT: switch (Option) { case 1: if (XPos > 650 && XPos < 730 && YPos > 300 && YPos < 380) { player.Food += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 2: if (XPos > 730 && XPos < 810 && YPos > 300 && YPos < 380) { player.Health += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 3: if (XPos > 810 && XPos < 890 && YPos > 300 && YPos < 380) { player.Gold += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 4: if (XPos > 890 && XPos < 970 && YPos > 300 && YPos < 380) { player.Experience += 2; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 5: if (XPos > 970 && XPos < 1050 && YPos > 300 && YPos < 380) { player.Armor += 1; eventCardTurnState = EventCardTurnState.COMPLETE; } break; case 6: if (XPos > 1050 && XPos < 1130 && YPos > 300 && YPos < 380) { eventCardTurnState = EventCardTurnState.FIGHT_MONSTER; } break; default: break; } break; case EventCardTurnState.FIGHT_MONSTER: if (XPos > 770 && XPos < 1018 && YPos > 600 && YPos < 672) { CurrentCombat = new Combat(Buttons, CombatDice, DieSounds); eventCardTurnState = EventCardTurnState.COMBAT; } break; } } }