public bool ExecuteExchange() { //checks that both heroes still have the gold and items to be traded if (hero1.getGold() < goldToHero2 || hero2.getGold() < goldToHero1 || falcon.getUsedToday()) { return(false); } foreach (Item i in itemsToHero2) { if (!hero1.IsCarrying(i)) { return(false); } } foreach (Item i in itemsToHero1) { if (!hero2.IsCarrying(i)) { return(false); } } //executes the trade if (tradeStatus == TradeStatus.Final) { //removes items hero1.setGold(hero1.getGold() - goldToHero2); hero2.setGold(hero2.getGold() - goldToHero1); foreach (Item i in itemsToHero2) { hero1.DiscardItem(i); } foreach (Item i in itemsToHero1) { hero2.DiscardItem(i); } //adds items hero1.IncrementGold(goldToHero1); hero2.IncrementGold(goldToHero2); foreach (Item i in itemsToHero1) { hero1.addItem(i); } foreach (Item i in itemsToHero2) { hero2.addItem(i); } falcon.setUsedToday(true); return(true); } else { return(false); } }