private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs) { MonsterLootPayoutNotification(); CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); CurrentPlayer.ReceiveGold(CurrentMonster.Gold); foreach(GameItem gameItem in CurrentMonster.Inventory) { CurrentPlayer.AddItemToInventory(gameItem); } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) { //Check player's quests and get the first one where the quest ID matches and is not completed QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); //If player has a quest in their quest list and it isn't completed if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { //Remove items required for quest from player's inventory foreach (ItemQuantity itemQuantity in quest.ItemsToComplete) { for (int i = 0; i < itemQuantity.Quantity; i++) { //get first item from player's inventory where the itemtypeid matches CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID)); } } RaiseMessage(""); RaiseMessage($"You completed the '{quest.Name}' quest"); //Give the player the quest rewards RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points"); CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"You receive {quest.RewardGold} gold"); CurrentPlayer.ReceiveGold(quest.RewardGold); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); CurrentPlayer.AddItemToInventory(rewardItem); RaiseMessage($"You receive a {rewardItem.Name}"); } //Mark quest as completed questToComplete.IsCompleted = true; } } } }
private void OnCurrentMonsterKilled(object sender, System.EventArgs e) { RaiseMessage(""); RaiseMessage($"You defeated the {CurrentMonster.NAME}!"); RaiseMessage($"You receive {CurrentMonster.REWARDEXP} experience points"); CurrentPlayer.AddExperience(CurrentMonster.GOLD); RaiseMessage($"You receive {CurrentMonster.GOLD} gold."); CurrentPlayer.ReceiveGold(CurrentMonster.GOLD); foreach (GameItem gameitem in CurrentMonster.INV.ITEMS) { CurrentPlayer.AddItemToInventory(gameitem); RaiseMessage($"You receive one {gameitem.NAME}"); } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { CurrentPlayer.RemoveItemsFromInventory(quest.ItemsToComplete); RaiseMessage(""); RaiseMessage($"Dokončil si '{quest.Name}' úkol"); // Give the player the quest rewards RaiseMessage($"Dostal si {quest.RewardExperiencePoints} XP"); CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"Dostal si {quest.RewardGold} zlatých"); CurrentPlayer.ReceiveGold(quest.RewardGold); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); RaiseMessage($"Dostal si {rewardItem.Name}"); CurrentPlayer.AddItemToInventory(rewardItem); } // Mark the Quest as completed questToComplete.IsCompleted = true; AttunementFactory.attunements.ForEach(delegate(Attunement att) { if (att.AttunementQuest == quest) { att.CompleteAttunement(att); } }); } } } }
public void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs) { RaiseMessage(""); RaiseMessage($"Pobjedio si {CurrentMonster.Name}!"); RaiseMessage($"Dobio si {CurrentMonster.RewardExperiencePoints} xp-a!"); CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); RaiseMessage($"Dobio si {CurrentMonster.Gold} golda!"); CurrentPlayer.RecieveGold(CurrentMonster.Gold); foreach (GameItem gameItem in CurrentMonster.Inventory) { RaiseMessage($"Dobio si jedan {gameItem.Name}."); CurrentPlayer.AddItemToInventory(gameItem); } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { //remove quest items from player's inventory foreach (ItemQuantity itemQuantity in quest.ItemsToComplete) { for (int i = 0; i < itemQuantity.Quantity; i++) { CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID)); } } RaiseMessage(""); RaiseMessage($"You completed the '{quest.Name}' quest"); //Give rewards RaiseMessage($"You recieve {quest.RewardExperiencePoints} experience"); CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"You recieve {quest.RewardGold} gold"); CurrentPlayer.ReceiveGold(quest.RewardGold); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); RaiseMessage($"You recieve {rewardItem.Name}"); CurrentPlayer.AddItemToInventory(rewardItem); } //Mark quest as completed questToComplete.IsCompleted = true; } } } }
private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs) { RaiseMessage(""); RaiseMessage($"Zabil si {CurrentMonster.Name}!"); RaiseMessage($"Dostal si {CurrentMonster.RewardExperiencePoints} XP."); CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); RaiseMessage($"Dostal si {CurrentMonster.Gold} zlatých."); CurrentPlayer.ReceiveGold(CurrentMonster.Gold); foreach (GameItem gameItem in CurrentMonster.Inventory) { RaiseMessage($"Dostal si {gameItem.Name}."); CurrentPlayer.AddItemToInventory(gameItem); } }
private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs) { RaiseMessage(""); RaiseMessage($"You defeated the {CurrentMonster.Name}!"); RaiseMessage($"You receive {CurrentMonster.RewardExperiencePoints} experience points."); CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); RaiseMessage($"You receive {CurrentMonster.Gold} gold."); CurrentPlayer.ReceiveGold(CurrentMonster.Gold); foreach (GameItem gameItem in CurrentMonster.Inventory) { RaiseMessage($"You receive one {gameItem.Name}."); CurrentPlayer.AddItemToInventory(gameItem); } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) // for each quest available in curent location... { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); // Check players quests and get first one with matches ID and is not completed // If player has already completed quest, this will return Default (as no new quest for Player to complete) if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { // Remove the quest completion items from the player's inventory foreach (ItemQuantity itemQuantity in quest.ItemsToComplete) { for (int i = 0; i < itemQuantity.Quantity; i++) { CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID)); } } RaiseMessage(""); RaiseMessage($"You completed the '{quest.Name}' quest"); //Give the player the quest rewards RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points"); CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"You receive {quest.RewardGold} gold"); CurrentPlayer.ReceiveGold(quest.RewardGold); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); RaiseMessage($"You receive a {rewardItem.Name}"); CurrentPlayer.AddItemToInventory(rewardItem); } //Marking Quest as completed questToComplete.IsCompleted = true; } } } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { // Removaj quest completion iteme igracu foreach (ItemQuantity itemQuantity in quest.ItemsToComplete) { for (int i = 0; i < itemQuantity.Quantity; i++) { CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID)); } } RaiseMessage(""); RaiseMessage($"Zavrsio si '{quest.Name}' quest"); // Daj playeru reward RaiseMessage($"Dobio si {quest.RewardExperiencePoints} xp-a"); CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"Dobio si {quest.RewardGold} golda"); CurrentPlayer.RecieveGold(quest.RewardGold); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); RaiseMessage($"Dobio si {rewardItem.Name}"); CurrentPlayer.AddItemToInventory(rewardItem); } // Markuj quest kao compelted questToComplete.IsCompleted = true; } } } }
// Quest Handling Functions private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { // Remove the quest completion items from the player's inventory foreach (ItemQuantity itemQuantity in quest.ItemsToComplete) { for (int i = 0; i < itemQuantity.Quantity; i++) { CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID)); } } //Notify Player of Quest Completion QuestCompletionNotification(quest.Name, quest.RewardExperiencePoints, quest.RewardGold); // Give the player the quest rewards CurrentPlayer.AddExperience(quest.RewardExperiencePoints); CurrentPlayer.ReceiveGold(quest.RewardGold); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); QuestCompletionRewardItemNotification(rewardItem.Name); CurrentPlayer.AddItemToInventory(rewardItem); } // Mark the Quest as completed questToComplete.IsCompleted = true; } } } }
private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs) { RaiseMessage(""); RaiseMessage($"Well done you slaughter an innocent {CurrentMonster.Name}. How could you..."); RaiseMessage($"I suppose you want a reward, you heartless murderer. Have {CurrentMonster.RewardExperiencePoints} XP"); CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); RaiseMessage($"And {CurrentMonster.Gold} gold."); CurrentPlayer.RecieveGold(CurrentMonster.Gold); foreach (GameItem gameItem in CurrentMonster.Inventory) { RaiseMessage($"You recieved one {gameItem.Name}."); CurrentPlayer.AddItemToInventory(gameItem); } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvaliable) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { // Remove the quest completion items from the player's inventory CurrentPlayer.RemoveItemsFromInventory(quest.ItemsToComplete); RaiseMessage(""); RaiseMessage($"You completed the '{quest.Name}' quest"); // Give the player the quest rewards CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points"); CurrentPlayer.Gold += quest.RewardGold; RaiseMessage($"You receive {quest.RewardGold} gold"); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); CurrentPlayer.AddItemToInventory(rewardItem); RaiseMessage($"You receive a {rewardItem.Name}"); } // Mark the Quest as completed questToComplete.IsCompleted = true; } } } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QuestsAvailableHere) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete)) { CurrentPlayer.RemoveItemsFromInventory(quest.ItemsToComplete); RaiseMessage(""); RaiseMessage($"You completed the '{quest.Name}' quest."); //give player the rewards RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points."); CurrentPlayer.AddExperience(quest.RewardExperiencePoints); RaiseMessage($"You receive {quest.RewardTokens} tokens."); CurrentPlayer.ReceiveTokens(quest.RewardTokens); foreach (ItemQuantity itemQuantity in quest.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); RaiseMessage($"You receive a {rewardItem.Name}"); CurrentPlayer.AddItemToInventory(rewardItem); } //mark as complete questToComplete.IsCompleted = true; } } } }
private void CompleteQuestAtLocation() { foreach (Quests quests in CurrentLocation.QuestsAvailableHere) { QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quests.ID && !q.IsCompleted); if (questToComplete != null) { if (CurrentPlayer.HasAllTheseItems(quests.ItemsToComplete)) { //Fjerne de relevante quest ting så questen kan blive gennemført CurrentPlayer.RemoveItemsFromInventory(quests.ItemsToComplete); RaiseMessage(""); RaiseMessage($"You have competed the {quests.Name} quest!"); //Giver spilleren belønning RaiseMessage($"You recieve {quests.RewardExperiencePoints} experience!"); CurrentPlayer.AddExperience(quests.RewardExperiencePoints); RaiseMessage($"And you recieve {quests.RewardGold} gold!"); CurrentPlayer.ReceiveGold(quests.RewardGold); foreach (ItemQuantity itemQuantity in quests.RewardItems) { GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID); CurrentPlayer.AddItemToInventory(rewardItem); RaiseMessage($"And a {rewardItem.Name}!"); } //Sætter Questen som gennemført questToComplete.IsCompleted = true; } } } }
private void CompleteQuestsAtLocation() { foreach (Quest quest in CurrentLocation.QUESTSAVAILABLEHERE) { QuestStatus questToComplete = CurrentPlayer.QUESTS.FirstOrDefault(q => q.PLAYERQUEST.ID == quest.ID && !q.ISCOMPLETED); if (questToComplete != null) { if (CurrentPlayer.INV.HasAllTheseItems(quest.ITEMSTOCOMPLETE)) { CurrentPlayer.RemoveItemsFromInventory(quest.ITEMSTOCOMPLETE); RaiseMessage(""); RaiseMessage($"You completed '{quest.NAME}' quest."); //give the player the quest rewards RaiseMessage($"You receive {quest.REWARDEXP} experience points."); CurrentPlayer.AddExperience(quest.REWARDEXP); RaiseMessage($"You receive {quest.REWARDGOLD} gold."); CurrentPlayer.ReceiveGold(quest.REWARDGOLD); foreach (ItemQuantity itemquantity in quest.REWARDITEMS) { GameItem rewardItem = ItemFactory.CreateGameItem(itemquantity.ITEMID); CurrentPlayer.AddItemToInventory(rewardItem); RaiseMessage($"You receive a {rewardItem.NAME}"); } //mark the quest as completed questToComplete.ISCOMPLETED = true; } } } }
//I want to modify this function such that Weapon damage is doubled when the d20 roll is a 20 //I probably need to make a local variable in PlayerAccuracyCalculations to hold the roll, then call it here. //Then, I'd make a check for whether or not it was a nat20 public void PlayerAttackDamageCalculation() { int damageDealtToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage) + StatisticsCalculator.AbilityScoreCalculator(CurrentPlayer.Strength); PlayerAttackSuccessNotification(damageDealtToMonster); CurrentMonster.TakeDamage(damageDealtToMonster); if (CurrentMonster.IsDead) { CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); CurrentPlayer.ReceiveGold(CurrentMonster.Gold); foreach (GameItem gameItem in CurrentMonster.Inventory) { CurrentPlayer.AddItemToInventory(gameItem); } GetMonsterAtLocation(); return; } else //Monster's Turn { MonsterAccuracyCalculation(); if (MonsterAccuracyCalculation()) { MonsterAttackDamageCalculation(); } else { MonsterAttackFailureNotification(); } } }