private static void PopulateQuests() { Quest clearAlchemistGarden = new Quest( QUESTS.ALCHEMIST_GARDEN, "Clear the alchemist's garden", "Kill rats in the alchemist's garden and bring back 3 rat tails. You will receive a healing potion and 10 gold pieces.", 20, 10); clearAlchemistGarden.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEMS.RAT_TAIL), 3)); clearAlchemistGarden.RewardItem = ItemByID(ITEMS.HEALING_POTION); Quest clearFarmersField = new Quest( QUESTS.FARMERS_FIELD, "Clear the farmer's field", "Kill snakes in the farmer's field and bring back 3 snake fangs. You will receive an adventurer's pass and 20 gold pieces.", 20, 20); clearFarmersField.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEMS.SNAKE_FANG), 3)); clearFarmersField.RewardItem = ItemByID(ITEMS.ADVENTURER_PASS); Quests.Add(clearAlchemistGarden); Quests.Add(clearFarmersField); }
private void GivePlayerQuest(Quest quest) { // player doesn't have quest // display messages RaiseMessage("You receive the " + quest.Name + " quest."); RaiseMessage(quest.Description); RaiseMessage("To complete it, return with:"); foreach (QuestCompletionItem qci in quest.QuestCompletionItems) { if (qci.Quantity == 1) { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.Name); } else { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.NamePlural); } } RaiseMessage(""); // add the quest to players quest list Quests.Add(new PlayerQuest(quest)); }
public void Gameover() { if (CurrentHitPoints <= 0) { // Display message RaiseMessage("The " + _currentMonster.Name + " killed you."); RaiseMessage("Let's begin again."); RaiseMessage("You wake up in your home.", true); } // Reset all values and clear all items and quests Inventory.Clear(); Inventory.Add(new InventoryItem(World.ItemByID(World.ITEM_ID_RUSTY_SWORD), 1)); Quests.Clear(); Gold = 0; AddExperiencePoints(-ExperiencePoints); // Make sure all the databound objects update by calling this AllChange(); // Move player to "Home" MoveHome(); }
public Location(int id, string name, string description, Item itemRequiredToEnter = null, Quests questAvailableHere = null, Monster monsterLivingHere = null) { ID = id; name = Name; Description = description; ItemRequiredToEnter = itemRequiredToEnter; QuestAvailableHere = questAvailableHere; MonsterLivingHere = monsterLivingHere; }
public bool CompletedThisQuest(Quest quest) { if (HasThisQuest(quest)) { return(Quests.First(q => q.Details.ID == quest.ID).IsCompleted); } return(false); }
private void MarkPlayerQuestCompleted(Quest quest) { PlayerQuest playerQuest = Quests.SingleOrDefault(pq => pq.Details.ID == quest.ID); if (playerQuest != null) { playerQuest.IsCompleted = true; } }
public void MarkQuestComplete(Quest quest) { // mark quest as completed PlayerQuest playerQuest = Quests.SingleOrDefault(pq => pq.Details.ID == quest.ID); if (playerQuest != null) { playerQuest.IsCompleted = true; } }
public void MarkQuestCompleted(Quest quest) { // Обходи списъка с quests и намери quest-ът, който току що завърши PlayerQuest playerQuest = Quests.SingleOrDefault(pq => pq.Details.ID == quest.ID); if (playerQuest != null) { playerQuest.IsCompleted = true; // Отбележи го като completed } }
public void AddQuest(Quest quest) { bool hasQuest = Quests.Exists(playerQuest => playerQuest.Details.ID == quest.ID); if (!hasQuest) { PlayerQuest newQuest = new PlayerQuest(quest); Quests.Add(newQuest); } }
public void MarkQuestCompleted(Quest quest) { // Find the quest in the player's quest list PlayerQuest playerQuest = Quests.SingleOrDefault(pq => pq.Details.ID == quest.ID); if (playerQuest != null) { playerQuest.IsCompleted = true; } }
public void RemoveQuest(Quest quest) { foreach (PlayerQuest pq in Quests) { if (pq.Details.ID == quest.ID) { Quests.Remove(pq); break; } } }
public void UpdateQuest(int questID, int state) { PlayerQuest playerQuest = Quests.SingleOrDefault( pq => pq.ID == questID); if (playerQuest == null) { Quests.Add(new PlayerQuest(World.GetQuest(questID), state, false)); } else { playerQuest.State = state; } }
public void MarkQuestCompleted(Quest quest) { // NOTE: If the player does not have 'quest', this will do nothing // Find the quest in the player's quest list PlayerQuest playerQuest = Quests.SingleOrDefault( pq => pq.Details.ID == quest.ID); if (playerQuest != null) { // if we found the quest in player's quest list, complete it playerQuest.IsCompleted = true; } }
private void GiveQuestToPlayer(Quest quest) { RaiseMessage("You receive the " + quest.Name + " quest.", false); RaiseMessage(quest.Description, false); RaiseMessage("To complete it, return with:", false); foreach (QuestCompletionItem qci in quest.QuestCompletionItems) { RaiseMessage(string.Format("{0} {1}", qci.Quantity, qci.Quantity == 1 ? qci.Details.Name : qci.Details.NamePlural)); } RaiseMessage("", false); Quests.Add(new PlayerQuest(quest)); }
// mark the specified quest as completed and give the player the rewards public void CompleteQuest(int questID) { PlayerQuest playerQuest = Quests.SingleOrDefault( pq => pq.ID == questID); if (playerQuest != null) { foreach (var item in playerQuest.Data.RewardItems) { AddItemToInventory(item.Data, item.Quantity); } AddCombatExperience(playerQuest.Data.RewardXP); Gold += playerQuest.Data.RewardGold; playerQuest.IsComplete = true; } }
private void GiveQuestToPlayer(Quest quest, TTS tts) { RaiseMessage("Tens uma missão nova: " + quest.Name + "."); RaiseMessage(quest.Description); RaiseMessage("Para completá-la, volta com:"); string items = ""; foreach (QuestCompletionItem qci in quest.QuestCompletionItems) { items += string.Format("{0} {1}", qci.Quantity, qci.Quantity == 1 ? qci.Details.Name : qci.Details.NamePlural); items += ","; RaiseMessage(string.Format("{0} {1}", qci.Quantity, qci.Quantity == 1 ? qci.Details.Name : qci.Details.NamePlural)); } RaiseMessage(""); Quests.Add(new PlayerQuest(quest)); tts.Speak(text + " e tens uma missão nova: " + quest.Name + "." + " Para completá-la, volta com: " + items); text = ""; }
private void GiveQuestToPlayer(Quest quest) { RaiseMessage("You receive the " + quest.Name + " quest."); RaiseMessage(quest.Description); RaiseMessage("To complete it, return with:"); foreach (QuestCompletionItem qci in quest.QuestCompletionItems) { if (qci.Quantity == 1) { RaiseMessage(qci.Quantity + " " + qci.Details.Name); } else { RaiseMessage(qci.Quantity + " " + qci.Details.NamePlural); } } RaiseMessage(""); Quests.Add(new PlayerQuest(quest)); }
private static void PopulateQuests() { Quest helpLibrarian = new Quest( QUEST_ID_HELP_LIBRARIAN, "Kill the bandits in the librarian's Zen garden (some of them can have a stolen Black pearl)", "Kill the bandits in the library and bring back 3 Bandits' heads to the librarian for proof that you're not one of them. You will receive a healing potion and 10 gold.", 40, 20); helpLibrarian.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_BANDIT_HEAD), 3)); helpLibrarian.RewardItem = ItemByID(ITEM_ID_HEALING_POTION); Quest clearFarmersField = new Quest( QUEST_ID_CLEAR_FARMERS_FIELD, "Clear the farmer's field", "Kill the serpents in the farmer's field and bring back 3 serpent fangs. You will receive an adventurer's pass and 20 gold pieces.", 30, 10); clearFarmersField.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_SERPENT_FANG), 3)); clearFarmersField.RewardItem = ItemByID(ITEM_ID_ADVENTURER_KEY); Quests.Add(helpLibrarian); Quests.Add(clearFarmersField); }
private void GiveQuestToPlayer(Location newLocation) { // Display the messages RaiseMessage("You receive the " + newLocation.QuestAvailableHere.Name + " quest."); RaiseMessage(newLocation.QuestAvailableHere.Description); RaiseMessage("To complete it, return with:"); foreach (QuestCompletionItem qci in newLocation.QuestAvailableHere.QuestCompletionItems) { if (qci.Quantity == 1) { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.Name); } else { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.NamePlural); } } // Add the quest to the player's quest list Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere)); }
public void MoveTo(Location newLocation) { if (!HasRequiredItemToEnterThisLocation(newLocation)) { RaiseMessage("你必須" + newLocation.ItemRequiredToEnter.Name + "才能進入此區域"); return; } CurrentLocation = newLocation; CurrentHitPoints = MaxHitPoints; if (newLocation.QuestAvailableHere != null) { bool playerAlreadyHasQuest = HasThisQuest(newLocation.QuestAvailableHere); bool playerAlreadyCompleteQuest = CompletedThisQuest(newLocation.QuestAvailableHere); if (playerAlreadyHasQuest) { if (!playerAlreadyCompleteQuest) { bool playerHasAllItemsToCompleteQuest = HasAllQuestCompletedItem(newLocation.QuestAvailableHere); if (playerHasAllItemsToCompleteQuest) { RaiseMessage(""); RaiseMessage("你完成了" + newLocation.QuestAvailableHere.Name + "任務"); RemoveQuestCompletionItems(newLocation.QuestAvailableHere); RaiseMessage("妳得到了: " + newLocation.QuestAvailableHere.RewardEXP.ToString() + "經驗值"); RaiseMessage("以及" + newLocation.QuestAvailableHere.RewardGold + "黃金"); RaiseMessage(newLocation.QuestAvailableHere.RewardItem.Name, true); AddEXPPoints(newLocation.QuestAvailableHere.RewardEXP); Gold += newLocation.QuestAvailableHere.RewardGold; AddItemToInventory(newLocation.QuestAvailableHere.RewardItem); MarkQuestCompleted(newLocation.QuestAvailableHere); } } } else { RaiseMessage("你得到了" + newLocation.QuestAvailableHere.Name + "任務"); RaiseMessage(newLocation.QuestAvailableHere.Description); RaiseMessage("為了完成任務,需要物品:"); foreach (QuestCompletionItem qui in newLocation.QuestAvailableHere.QuestCompletionItems) { if (qui.Quantity == 1) { RaiseMessage(qui.Quantity + " " + qui.Details.Name); } else { RaiseMessage(qui.Quantity + " " + qui.Details.NamePlural); } } RaiseMessage(" "); Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere)); } } if (newLocation.MonsterLivingHere != null) { RaiseMessage("你看到了" + newLocation.MonsterLivingHere.Name); Monster standardMonster = World.MonsterByID(newLocation.MonsterLivingHere.ID); _currentMonster = new Monster(standardMonster.ID, "standardMonster.Name", standardMonster.MaxDamage, standardMonster.RewardEXP, standardMonster.RewardGold, standardMonster.CurrentHitPoints, standardMonster.MaxHitPoints); foreach (LootItem lootItem in standardMonster.LootTable) { _currentMonster.LootTable.Add(lootItem); } } else { _currentMonster = null; } }
private bool PlayerHasNotCompleted(Quest quest) { return Quests.Any(pq => pq.Details.ID == quest.ID && !pq.IsCompleted); }
private bool PlayerDoesNotHaveThisQuest(Quest quest) { return Quests.All(pq => pq.Details.ID != quest.ID); }
public bool HasThisQuest(Quest quest) { return(Quests.Any(pq => pq.Details.ID == quest.ID)); }
public bool PlayerNotCompletedThisQuest(Quest quest) { return(Quests.Any(pq => pq.Details.ID == quest.ID && !pq.IsCompleted)); }
public bool IsQuestCompleted(Quest quest) { return(Quests.Exists(playerQuest => playerQuest.Details.ID == quest.ID && playerQuest.IsCompleted)); }
/* Function to move the player to a new location */ public void MoveTo(Location newLocation) { //Does the location have any required items if (!HasRequiredItemToEnterThisLocation(newLocation)) { // rtbMessages.Text += "You must have a " + newLocation.ItemRequiredToEnter.Name + " to enter this location." + Environment.NewLine; return; } // Update the player's current location CurrentLocation = newLocation; // Show/hide available movement buttons // btnNorth.Visible = (newLocation.LocationToNorth != null); // btnEast.Visible = (newLocation.LocationToEast != null); // btnSouth.Visible = (newLocation.LocationToSouth != null); // btnWest.Visible = (newLocation.LocationToWest != null); // Display current location name and description // rtbLocation.Text = newLocation.Name + Environment.NewLine; // rtbLocation.Text += newLocation.Description + Environment.NewLine; // Completely heal the player CurrentHitPoints = MaximumHitPoints; // Update Hit Points in UI // lblHitPoints.Text = _player.CurrentHitPoints.ToString(); // data binding takes care of this // Does the location have a quest? if (newLocation.QuestAvailableHere != null) { // See if the player already has the quest, and if they've completed it bool playerAlreadyHasQuest = HasThisQuest(newLocation.QuestAvailableHere); bool playerAlreadyCompletedQuest = CompletedThisQuest(newLocation.QuestAvailableHere); // See if the player already has the quest if (playerAlreadyHasQuest) { // If the player has not completed the quest yet if (!playerAlreadyCompletedQuest) { // See if the player has all the items needed to complete the quest bool playerHasAllItemsToCompleteQuest = HasAllQuestCompletionItems(newLocation.QuestAvailableHere); // The player has all items required to complete the quest if (playerHasAllItemsToCompleteQuest) { completeQuest(newLocation); } } } else { // The player does not already have the quest // Display the messages /* rtbMessages.Text += "You received the " + newLocation.QuestAvailableHere.Name + " quest." + Environment.NewLine; * rtbMessages.Text += newLocation.QuestAvailableHere.Description + Environment.NewLine; * rtbMessages.Text += "To complete this, come back with:" + Environment.NewLine; */ foreach (QuestCompletionItem qci in newLocation.QuestAvailableHere.QuestCompletionItems) { if (qci.Quantity == 1) { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.Name + Environment.NewLine); } else { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.NamePlural + Environment.NewLine); } } // rtbMessages.Text += Environment.NewLine; // Add the quest to the player's quest list Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere)); } } // Does the location have a monster? if (newLocation.MonsterLivingHere != null) { RaiseMessage("You see a " + newLocation.MonsterLivingHere.Name + "!" + Environment.NewLine); // Make a new monster and add its loot table, using the values from the standard monster in the World.Monster list Monster standardMonster = World.MonsterByID(newLocation.MonsterLivingHere.ID); _currentMonster = new Monster(standardMonster.ID, standardMonster.Name, standardMonster.MaximumDamage, standardMonster.RewardExperiencePoints, standardMonster.RewardGold, standardMonster.CurrentHitPoints, standardMonster.MaximumHitPoints); foreach (LootItem lootItem in standardMonster.LootTable) { _currentMonster.LootTable.Add(lootItem); } // Prepare UI for combat /* cboWeapons.Visible = Weapons.Any(); * cboPotions.Visible = Potions.Any(); * btnUseWeapon.Visible = Weapons.Any(); * btnUsePotion.Visible = Potions.Any();*/ } else { _currentMonster = null; /*cboWeapons.Visible = false; * cboPotions.Visible = false; * btnUseWeapon.Visible = false; * btnUsePotion.Visible = false;*/ } }
public void MoveTo(Location newLocation) { //Does the location have any required items if (!HasRequiredItemToEnterThisLocation(newLocation)) { RaiseMessage("You must have a " + newLocation.ItemRequiredToEnter.Name + " to enter this location."); RaiseMessage(""); return; } // Update player's current location CurrentLocation = newLocation; // Completely heal the player CurrentHitPoints = MaximumHitPoints; // Does the location have a quest? if (newLocation.QuestAvailableHere != null) { // See if the player already has the quest, and if they've complete it bool playerAlreadyHasQuest = HasThisQuest(newLocation.QuestAvailableHere); bool playerAlreadyCompletedQuest = CompletedThisQuest(newLocation.QuestAvailableHere); // See if the player already has the quest if (playerAlreadyHasQuest) { // If player has not completed the quest if (!playerAlreadyCompletedQuest) { // See if the player has all the items needed to complete the quest bool playerHasAllItemsToCompleteQuest = HasAllQuestCompletionItems(newLocation.QuestAvailableHere); // The player has all items required to complete the quest if (playerHasAllItemsToCompleteQuest) { //Display message RaiseMessage(""); RaiseMessage("You complete the " + newLocation.QuestAvailableHere.Name + " quest."); //Remove quest items from inventory RemoveQuestCompletionItems(newLocation.QuestAvailableHere); //Give quest rewards RaiseMessage("You receive: "); RaiseMessage(newLocation.QuestAvailableHere.RewardGold.ToString() + " gold"); RaiseMessage(newLocation.QuestAvailableHere.RewardExperiencePoints.ToString() + " experience points"); RaiseMessage(newLocation.QuestAvailableHere.RewardItem.Name); //RaiseMessage(""); AddExperiencePoints(newLocation.QuestAvailableHere.RewardExperiencePoints); Gold += newLocation.QuestAvailableHere.RewardGold; //Add the reward item to the player's inventory AddItemToInventory(newLocation.QuestAvailableHere.RewardItem); // Mark the quest as completed MarkQuestCompleted(newLocation.QuestAvailableHere); } } } else { //The player does not already have the quest //Display the messages RaiseMessage(""); RaiseMessage("You receive the " + newLocation.QuestAvailableHere.Name + " quest."); RaiseMessage(newLocation.QuestAvailableHere.Description); RaiseMessage("To complete it, return with:"); foreach (QuestCompletionItem qci in newLocation.QuestAvailableHere.QuestCompletionItems) { if (qci.Quantity == 1) { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.Name); } else { RaiseMessage(qci.Quantity.ToString() + " " + qci.Details.NamePlural); } } RaiseMessage(""); //Add the quest to the player's quest list Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere)); } } //Does the location have a monster? if (newLocation.MonsterLivingHere != null) { RaiseMessage("You see a " + newLocation.MonsterLivingHere.Name); //Make a new monster, using values from the standard monster in the Worls.Moster list Monster standardMonster = World.MonsterByID(newLocation.MonsterLivingHere.ID); _currentMonster = new Monster(standardMonster.ID, standardMonster.Name, standardMonster.MaximumDamage, standardMonster.RewardExperiencePoints, standardMonster.RewardGold, standardMonster.CurrentHitPoints, standardMonster.MaximumHitPoints); foreach (LootItem lootItem in standardMonster.LootTable) { _currentMonster.LootTable.Add(lootItem); } } else { _currentMonster = null; } }
/*Quest Information * ==================*/ public bool HasThisQuest(Quest quest) { return(Quests.Exists(playerQuest => playerQuest.Details.ID == quest.ID)); }
public void MoveTo(Location newLocation) { // 1.1) Новото място има ли критерии (required items)? if (!HasRequiredItemToEnterThisLocation(newLocation)) { // 1.1.1) Играчът няма нужният предмет за преминаване, следователно извежда съобщение и прекъсва Moving процеса (излиза от MoveTo функцията) //rtbMessages.Text += "You must have a " + newLocation.ItemRequiredToEnter.Name + " to enter this location." + Environment.NewLine; RaiseMessage("You must have a " + newLocation.ItemRequiredToEnter.Name + " to enter this location."); return; } // 1.1.2) Играчът има нужният предмет за преминаване щом не е минал през горния return // Обнови местоположението на играча CurrentLocation = newLocation; // 100% heal повреме на транспорта (героят се чувства отпочинал и зареден) CurrentHitPoints = MaximumHitPoints; // Отбележи промяната на HP на героя на екрана //lblHitPoints.Text = player.CurrentHitPoints.ToString(); // 1.2) Тази нова локация има ли quest? if (newLocation.QuestAvailableHere != null) { // 1.2.1) Играчът притежава ли този quest //флаг дали играчът притежава quest-а bool playerAlreadyHasQuest = HasThisQuest(newLocation.QuestAvailableHere); //флаг дали играчът е завършил quest-a bool playerAlreadyCompletedQuest = CompletedThisQuest(newLocation.QuestAvailableHere); // Ако играчът притежава quest-a if (playerAlreadyHasQuest) { // Играчът не е проверявал дали quest-a е завършен и все още е маркиран като незавършен if (!playerAlreadyCompletedQuest) { // Флаг дали играчът притежава ВСИЧКИ (като бройка) quest items, нужни като критерии за завършването на quest-a bool playerHasAllItemsToCompleteQuest = HasAllQuestCompletionItems(newLocation.QuestAvailableHere); // 1.2.1.1.1.1) Играчът е изпълнил критериите за завършване на quest if (playerHasAllItemsToCompleteQuest) { // 1.2.1.1.1.1.1) Изведи съобщение RaiseMessage(""); // за да добави нов ред RaiseMessage("You complete the '" + newLocation.QuestAvailableHere.Name + "' quest."); // 1.2.1.1.1.1.2) Премахни quest items от Inventory на играча RemoveQuestCompletionItems(newLocation.QuestAvailableHere); // 1.2.1.1.1.1.3) Дай награда (увеличи gold, xp и евентуално добави Item/s в Inventory) // Съобщение RaiseMessage("You receive: "); RaiseMessage(newLocation.QuestAvailableHere.RewardExperiencePoints + " experience points"); RaiseMessage(newLocation.QuestAvailableHere.RewardGold + " gold"); RaiseMessage(newLocation.QuestAvailableHere.RewardItem.Name, true); // addExtraNewLine=true, за да добави допълнителен празен ред накрая //xp/gold награда AddExperiencePoints(newLocation.QuestAvailableHere.RewardExperiencePoints); Gold += newLocation.QuestAvailableHere.RewardGold; //UpdatePlayerStats(); // Добави Item награда, ако има такава (засега правя реализация със задължителен Item reward, примерно potion) AddItemToInventory(newLocation.QuestAvailableHere.RewardItem); // 1.2.1.1.1.1.3) Маркирай quest-a като завършен (completed) MarkQuestCompleted(newLocation.QuestAvailableHere); } } } else { // 1.2.2) Играчът няма в quest log-a дадения quest // 1.2.2.1) Изведи съобщение RaiseMessage("You receive the " + newLocation.QuestAvailableHere.Name + " quest."); RaiseMessage(newLocation.QuestAvailableHere.Description); RaiseMessage("To complete it, return with:"); foreach (QuestCompletionItem qci in newLocation.QuestAvailableHere.QuestCompletionItems) { if (qci.Quantity == 1) { RaiseMessage(qci.Quantity + " " + qci.Details.Name); } else { RaiseMessage(qci.Quantity + " " + qci.Details.NamePlural); } } RaiseMessage(""); // 1.2.2.2) Добави го в quest log-a Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere)); } } // 1.3) Тази нова локация има ли enemy (enemies)? if (newLocation.EnemyLivingHere != null) { // 1.3.1.1) Съобщение RaiseMessage("You see a " + newLocation.EnemyLivingHere.Name); // 1.3.1.2) Създай противник, използвайки стойностите на стандартен противник от списъка с противници World.Enemies Enemy standardEnemy = World.EnemyByID(newLocation.EnemyLivingHere.ID); currentEnemy = new Enemy(standardEnemy.ID, standardEnemy.Name, standardEnemy.MaximumDamage, standardEnemy.RewardExperiencePoints, standardEnemy.RewardGold, standardEnemy.CurrentHitPoints, standardEnemy.MaximumHitPoints); foreach (LootItem lootItem in standardEnemy.LootTable) { currentEnemy.LootTable.Add(lootItem); } // 1.3.1.3) Обнови потребителския интерфейс // автоматично с propertychanged event } else { // 1.3.2) Ако няма enemy currentEnemy = null; // 1.3.2.1) Скрий опциите за атака // автоматично } // 1.4) Обнови Inventory //UpdateInventoryListInUI(); // 1.5) Oбнови quest log //UpdateQuestListInUI(); // 1.6) Oбнови списъка с оръжията и в момента equipped (weapons' combobox) //UpdateWeaponListInUI(); // 1.7) Oбнови списъка с Potions //UpdatePotionListInUI(); }
public void MoveTo(Location newLocation) { if (!HasRequiredItemToEnterThisLocation(newLocation)) { RaiseMessage("You must have a " + newLocation.ItemRequeredToEnter.Name + " to enter this location."); return; } CurrentLocation = newLocation; CurrentHitPoints = MaximumHitPoints; if (newLocation.QuestAvailableHere != null) { bool playerAlreadyHasQuest = HasThisQuest(newLocation.QuestAvailableHere); bool playerAlreadyCompletedQuest = CompletedThisQuest(newLocation.QuestAvailableHere); if (playerAlreadyHasQuest) { if (!playerAlreadyCompletedQuest) { bool playerHasAllItemsToCompleteQuest = HasAllQuestCompletionItems(newLocation.QuestAvailableHere); if (playerHasAllItemsToCompleteQuest) { RaiseMessage(""); RaiseMessage("You complete the " + newLocation.QuestAvailableHere.Name + " quest."); RemoveQuestCompletionItems(newLocation.QuestAvailableHere); RaiseMessage("You receive: "); RaiseMessage(newLocation.QuestAvailableHere.RewardExperiancePoints.ToString() + " experience points"); RaiseMessage(newLocation.QuestAvailableHere.RewardGold.ToString() + " gold"); RaiseMessage(newLocation.QuestAvailableHere.RewardItem.Name, true); AddExperiancePoint(newLocation.QuestAvailableHere.RewardExperiancePoints); Gold += newLocation.QuestAvailableHere.RewardGold; AddItemToInventory(newLocation.QuestAvailableHere.RewardItem); MarkQuestCompleted(newLocation.QuestAvailableHere); } } } else { RaiseMessage("You receive the " + newLocation.QuestAvailableHere.Name + " quest."); RaiseMessage(newLocation.QuestAvailableHere.Description); RaiseMessage("To complete it, return with:" + Environment.NewLine); foreach (QuestCompetionItem questCompetionItem in newLocation.QuestAvailableHere.QuestCompetionItems) { if (questCompetionItem.Quantity == 1) { RaiseMessage(questCompetionItem.Quantity.ToString() + " " + questCompetionItem.Details.Name); } else { RaiseMessage(questCompetionItem.Quantity.ToString() + " " + questCompetionItem.Details.NamePlural); } } RaiseMessage(""); Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere)); } } if (newLocation.MonsterLivingHere != null) { RaiseMessage("You see a" + newLocation.MonsterLivingHere.Name); Monster standardMonster = World.MonsterByID(newLocation.MonsterLivingHere.ID); _currentMonster = new Monster(standardMonster.ID, standardMonster.Name, standardMonster.MaximumDamage, standardMonster.RewardExperiancePoints, standardMonster.RewardGold, standardMonster.CurrentHitPoints, standardMonster.MaximumHitPoints); foreach (LootItem lootItem in standardMonster.LootTable) { _currentMonster.LootTable.Add(lootItem); } } else { _currentMonster = null; } }