public void Fighting(HeroClassTypes heroClassTypes, EnemyClassType enemyClassType, StateManager stateManager, int playerCombatSelecter, int enemyCombatSelecter, Hero playerHero, Enemy enemy) { { if (playerCombatSelecter == 1) { if (enemyCombatSelecter == 1) { playerHero.AttackEnemy1(heroClassTypes, enemy, enemyClassType, stateManager.AttackMissFactor()); enemy.AttackPlayer1(heroClassTypes, playerHero, enemyClassType); MenuQueries.BattleDisplayPage(heroClassTypes, playerHero, enemy, enemyClassType, false, playerCombatSelecter, enemyCombatSelecter); } else if (enemyCombatSelecter == 2) { enemy.EnemyDefend(enemyClassType, true); playerHero.AttackEnemy1(heroClassTypes, enemy, enemyClassType, stateManager.AttackMissFactor()); enemy.EnemyDefend(enemyClassType, false); MenuQueries.BattleDisplayPage(heroClassTypes, playerHero, enemy, enemyClassType, false, playerCombatSelecter, enemyCombatSelecter); } } else if (playerCombatSelecter == 2) { if (enemyCombatSelecter == 1) { playerHero.PlayerDefend(heroClassTypes, true); enemy.AttackPlayer1(heroClassTypes, playerHero, enemyClassType); playerHero.PlayerDefend(heroClassTypes, false); MenuQueries.BattleDisplayPage(heroClassTypes, playerHero, enemy, enemyClassType, false, playerCombatSelecter, enemyCombatSelecter); } else if (enemyCombatSelecter == 2) { playerHero.PlayerDefend(heroClassTypes, true); enemy.EnemyDefend(enemyClassType, true); playerHero.PlayerDefend(heroClassTypes, false); enemy.EnemyDefend(enemyClassType, false); MenuQueries.BattleDisplayPage(heroClassTypes, playerHero, enemy, enemyClassType, false, playerCombatSelecter, enemyCombatSelecter); } } else { playerHero.UseItem(heroClassTypes); } } }
public bool PlayAgain() { Console.Clear(); string playAgainOption = MenuQueries.GameOverDisplay(); Console.Clear(); if (playAgainOption.Equals("y", StringComparison.OrdinalIgnoreCase)) { return(true); } else if (playAgainOption.Equals("n", StringComparison.OrdinalIgnoreCase)) { return(false); } else { return(false); } }
public void EquipItem(ItemManager item, bool enemyAlive) { item.ItemDrop(enemyAlive, heroClassSelected); string input; if (item.ITEMDROPPED == true) { if (item.ITEMTYPEDROPPED == ItemType.Weapon) { input = MenuQueries.ItemDropped(item, heroClassSelected); if (input.Equals("y", StringComparison.OrdinalIgnoreCase)) { Weapon = item.WEAPONDROPPED; } } else if (item.ITEMTYPEDROPPED == ItemType.Armour) { input = MenuQueries.ItemDropped(item, heroClassSelected); if (input.Equals("y", StringComparison.OrdinalIgnoreCase)) { Armor = item.ARMOR_DROPPED; } } else if (item.ITEMTYPEDROPPED == ItemType.Item) { input = MenuQueries.ItemDropped(item, heroClassSelected); if (input.Equals("y", StringComparison.OrdinalIgnoreCase)) { Potion = item.POTION_DROPPED; _usableItem = true; } } } }
static void Main(string[] args) { HeroClassTypes heroClassTypes; EnemyClassType enemyClassType; StateManager stateManager = new StateManager(); ItemManager itemManager = new ItemManager(); string userInput; string userName; int playerCombatSelecter; int enemyCombatSelecter; /*NEXT ITEM * -------------> * Have hero select screne * */ do { MenuQueries.MainMenuStart(); userInput = MenuQueries.HeroSelectionDisplay(); MenuQueries.ConsoleClearResetMenu(); heroClassTypes = CharacterCreation.ConvertUserHeroTypeToEnum(userInput); userName = CharacterCreation.HeroName(); Hero playerHero = new Hero(heroClassTypes, userName); // loop for level while (playerHero.IsAlive) { MenuQueries.ConsoleClearResetMenu(); enemyClassType = CharacterCreation.GenerateEnemyType(stateManager.GenerateEnemyBasedOnCurrentGameLevel()); Enemy enemy = new Enemy(enemyClassType); MenuQueries.BattleDisplayPage(heroClassTypes, playerHero, enemy, enemyClassType, true); // loop for alive while (enemy.IsAlive && playerHero.IsAlive) { Console.WriteLine($"level is {stateManager.GAMELEVEL}"); playerCombatSelecter = MenuQueries.PlayerCombactSelection(); enemyCombatSelecter = stateManager.EnemyCombatSelecter(); stateManager.Fighting(heroClassTypes, enemyClassType, stateManager, playerCombatSelecter, enemyCombatSelecter, playerHero, enemy); stateManager.SetGameLevel(enemy.IsAlive, playerHero.IsAlive); playerHero.EquipItem(itemManager, enemy.IsAlive); playerHero.PlayerLevelManager(enemy, enemyClassType, heroClassTypes, stateManager); MenuQueries.ConsoleClearResetMenu(); MenuQueries.BattleDisplayPage(heroClassTypes, playerHero, enemy, enemyClassType, false); } } } while (stateManager.PlayAgain()); }
public void PlayerLevelManager(Enemy enemy, EnemyClassType enemyClass, HeroClassTypes heroClass, StateManager stateManager) { if (enemy.IsAlive == false) { switch (enemyClass) { case EnemyClassType.minion: PlayerExperience += 40; break; case EnemyClassType.creeper: PlayerExperience += 60; break; case EnemyClassType.skeleton: PlayerExperience += 100; break; case EnemyClassType.orc: PlayerExperience += 150; break; default: break; } } if (PlayerExperience >= _expForLevelUp) { stateManager.StoreLevelUpDataOLD(_currentLevel); PlayerLevel++; stateManager.StoreLevelUpDataNEW(_currentLevel); _expForLevelUp = _expForLevelUp + Convert.ToInt32(_expForLevelUp * 2); switch (heroClass) { case HeroClassTypes.spearman: stateManager.StoreLevelUpDataOLD(heroSpear.Health, heroSpear.Strength, heroSpear.Dexterity); heroSpear.LevelUp(); stateManager.StoreLevelUpDataNEW(heroSpear.Health, heroSpear.Strength, heroSpear.Dexterity); break; case HeroClassTypes.swordsman: stateManager.StoreLevelUpDataOLD(heroSword.Health, heroSword.Strength, heroSword.Dexterity); heroSword.LevelUp(); stateManager.StoreLevelUpDataNEW(heroSword.Health, heroSword.Strength, heroSword.Dexterity); break; case HeroClassTypes.ranger: stateManager.StoreLevelUpDataOLD(heroRanger.Health, heroRanger.Strength, heroRanger.Dexterity); heroRanger.LevelUp(); stateManager.StoreLevelUpDataNEW(heroRanger.Health, heroRanger.Strength, heroRanger.Dexterity); break; default: break; } MenuQueries.CharacterLevelUp(stateManager); Console.ReadKey(); } }
public void TogglePermission(object parameter) { MenuQueries.cambiarEstadoPermiso(SelectedRol.Id, SelectedPermission.IdSubMenu, !SelectedPermission.Estado); SelectedPermission.Estado = !SelectedPermission.Estado; }
public void GetSubMenusForRole(object parameter) { Permissions = new ObservableCollection <SubMenuPermission>(MenuQueries.getSubMenusForRole(SelectedRol.Id)); }