public static bool HandleSword(Object item) { ConsoleKeyInfo keyInfo; bool toProcessing = true; bool toPickup = false; GameRoom gm; ScreenManager.WaitForBufferClear(); //Clear Buffer gm = GameDataFactory.curr_gwinfo.GetGameRoombyNumber(GameState.currentRoom); if (GameState.CountSwordInInventory() > 0) { //************************************ PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(21) + ((Item)item).descriptions + "\r\n" + ConfigManager.GetStringResource(26) + GameState.GetFirstSwordInInventory().descriptions + "?\r\n" + ConfigManager.GetStringResource(28) + ((IWeapon)item).capableHit + "%" + "\r\n" + ConfigManager.GetStringResource(23)); PlayUIBottomItem.UpdateInstruction( PlayUIBottomItem.YES_INSTRUNCTION | PlayUIBottomItem.NO_INSTRUNCTION); PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR); //*********************************** } else { //************************************ PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(21) + ((Item)item).descriptions + "\r\n" + ConfigManager.GetStringResource(28) + ((IWeapon)item).capableHit + "%" + "\r\n" + ConfigManager.GetStringResource(22) + "\r\n" + ConfigManager.GetStringResource(23)); PlayUIBottomItem.UpdateInstruction( PlayUIBottomItem.YES_INSTRUNCTION | PlayUIBottomItem.NO_INSTRUNCTION); PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR); //*********************************** } while (toProcessing) { keyInfo = Console.ReadKey(true); switch (Char.ToUpper(keyInfo.KeyChar)) { case 'N': toProcessing = false; //*************************** PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.QUIT_INSTRUNCTION); PlayUIBottomItem.UpdateMenuOption( PlayUIBottomItem.UP_INSTRUNCTION ^ PlayUIBottomItem.DOWN_INSTRUNCTION ^ PlayUIBottomItem.RIGHT_INSTRUNCTION ^ PlayUIBottomItem.LEFT_INSTRUNCTION ); //****************************** ((IAvailable)item).SetNotAvailable(ConfigManager.ItemNotAvailableTime); break; case 'Y': toProcessing = false; toPickup = true; gm.ItemsHashTable.Remove(((Item)item).InstanceKey); //Remove from room GameState.RemoveSwordFromInventory(); GameState.inventory.Add((Item)item); ((ITakable)item).Take(); //************************************* PlayUITopItem.UpdateWeaponType(((Item)item).descriptions); PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory()); PlayUILeftPanel.UpdateWeaponTypeVal(((Item)item).descriptions); PlayUILeftPanel.UpdateWeaponrPowerLevel( Utility.getPercentageVal(((IWeapon)item).capableHit, 400)); PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.QUIT_INSTRUNCTION); PlayUIBottomItem.UpdateMenuOption( PlayUIBottomItem.UP_INSTRUNCTION ^ PlayUIBottomItem.DOWN_INSTRUNCTION ^ PlayUIBottomItem.RIGHT_INSTRUNCTION ^ PlayUIBottomItem.LEFT_INSTRUNCTION ); PlayUIRightPanel.PaintLegendOption(GameState.currentRoom); //*************************************** break; } } return(toPickup); }
public static void printInitScreen() { GameRoom gm; Player player; GameWorldInfo gwinfo; Item item; gm = GameDataFactory.curr_gwinfo.GetGameRoombyNumber(GameState.currentRoom); gwinfo = GameDataFactory.curr_gwinfo; player = GameDataFactory.curr_gwinfo.The_Player; //**************************************************************************** PlayUIBottomItem.UpdateInstruction( PlayUIBottomItem.QUIT_INSTRUNCTION //PlayUIBottomItem.UP_INSTRUNCTION ^ //PlayUIBottomItem.DOWN_INSTRUNCTION ^ //PlayUIBottomItem.RIGHT_INSTRUNCTION ^ //PlayUIBottomItem.LEFT_INSTRUNCTION ); PlayUIBottomItem.UpdateMenuOption( // PlayUIBottomItem.QUIT_INSTRUNCTION ^ PlayUIBottomItem.UP_INSTRUNCTION ^ PlayUIBottomItem.DOWN_INSTRUNCTION ^ PlayUIBottomItem.RIGHT_INSTRUNCTION ^ PlayUIBottomItem.LEFT_INSTRUNCTION ); PlayUIBottomItem.updateMessageBox( ConfigManager.GetStringResource(2) + "\n" + ConfigManager.GetStringResource(3)); PlayUITopItem.UpdateGameLevel(GameState.gameLevel); PlayUITopItem.UpdateExperienceLevel(GameState.experience); PlayUITopItem.UpdateNoOfRoom(gwinfo.NumberOfRooms); PlayUITopItem.UpdateHealthLevel(player.GetHealthLevel()); PlayUITopItem.UpdateSilverLevel(GameState.CountSilverInInventory()); PlayUITopItem.UpdateGoldLevel(GameState.CountGoldInInventory()); PlayUITopItem.UpdateHealthPotion(GameState.CountHealthPotionInInventory()); item = GameState.GetFirstArmourInInventory(); if (item != null) { PlayUITopItem.UpdateArmourType(item.descriptions); } else { PlayUITopItem.UpdateArmourType("No"); } item = GameState.GetFirstSwordInInventory(); if (item != null) { PlayUITopItem.UpdateWeaponType(item.descriptions); } else { PlayUITopItem.UpdateWeaponType("No"); } PlayUITopItem.UpdateScore(GameState.score); //************************************************************************************ }
// Main Attack Function. private static void HandleBattle(int col, int row, int room) { ConsoleKeyInfo keyInfo; bool toProcessing = true; Item weapon = null; //while (!Console.KeyAvailable && GameState.isBattleOn() && toProcessing) while (GameState.isBattleOn() && toProcessing) { if (Console.KeyAvailable) { keyInfo = Console.ReadKey(true); switch (Char.ToUpper(keyInfo.KeyChar)) { case 'A': if (GameState.GetFirstSwordInInventory() == null) { PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(51) + "\r\n" + ConfigManager.GetStringResource(52)); toProcessing = false; break; } weapon = GameState.GetFirstSwordInInventory(); if (weapon is IronSword || weapon is WoodenSword) { ((ILivingOrganism)GameState.enemyobj).getHit(((IWeapon)weapon).hitPower); //Reduce SWord Power. ((IWeapon)weapon).doHit(); PlayUIRightPanel.UpdateEnemyHealthLevel(((ILivingOrganism)GameState.enemyobj).HealthLevel); if (((ILivingOrganism)GameState.enemyobj).HealthLevel == 0) { //Enmey Health gone. //Stop the Enemy ((ILivingOrganism)GameState.enemyobj).Sleep(); ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).ItemsHashTable.Remove(GameState.enemyobj.InstanceKey); if (GameState.enemyobj is Monster) { ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).MonsterList.Remove((Monster)GameState.enemyobj); gwinfo.NumberOfMonster--; } else if (GameState.enemyobj is Globin) { ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).GlobinList.Remove((Globin)GameState.enemyobj); gwinfo.NumberOfGlobin--; } if (GameState.enemyobj is ITakable) { ((ITakable)GameState.enemyobj).Take(); } GameState.setBatteOff(); GameState.LastWin = true; GameState.ReleaseEnemies(GameState.currentRoom); //******************************************** PlayUIRightPanel.UpdateEnemyTitle(""); PlayUIRightPanel.UpdateEnemyHealthLevel(0); PlayUILeftPanel.UpdateTotalEnemyItem( ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).GlobinList.Count + ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).MonsterList.Count); PlayUILeftPanel.UpdateTotalGlobinWItem(gwinfo.NumberOfGlobin); PlayUILeftPanel.UpdateTotalMonsterItem(gwinfo.NumberOfMonster); PlayUITopItem.UpdateHealthLevel(gwinfo.The_Player.GetHealthLevel()); PlayUIRightPanel.PaintLegendOption(GameState.currentRoom); //********************************************* } if (((IWeapon)weapon).capableHit > 0) { PlayUILeftPanel.UpdateWeaponTypeVal(weapon.descriptions); PlayUILeftPanel.UpdateWeaponrPowerLevel( Utility.getPercentageVal(((IWeapon)weapon).capableHit, 400)); PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory()); } else { GameState.RemoveSwordFromInventory(); PlayUILeftPanel.UpdateWeaponTypeVal("Not Found"); PlayUILeftPanel.UpdateWeaponrPowerLevel(0); PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory()); PlayUITopItem.UpdateWeaponType("No"); } } toProcessing = false; break; /* * case 'Q': * //DEBUG * ScreenManager.WriteDebugLine("Quit Attack @@@@@@@@@@@@@@@@@@@@@@@@@@@@"); * toProcessing = false; * GameState.setBatteOff(); * //DEBUG * break; */ } } } }