/// <summary> /// Sending ninja to fight /// </summary> /// <param name="ninja">ninja's instance</param> public void Study(Ninja ninja) { Evil enemy = new Bot(ninja.MentalLevel + 1); Arena fight = new Arena(string.Format("Learning {0}", ListOfPowers[ninja.MentalLevel]), FightRulesEnum.MentalFight, ninja, enemy); fight.Fight(); if (fight.IsNinjaWiner) { if (ninja.UpMentalLevel()) { ninja.GetItem(ListOfPowers[ninja.MentalLevel - 2]); } } else { // ToDo: for Andrei: ??any string message for the looser } }
public void Sell(ICommercial commercialItem, Ninja ninja) { // If ninja have enough money to pay, he pays if (ninja.PayForItem(commercialItem)) { // If ninja accepts the item he takes it if (ninja.GetItem(commercialItem as Item)) { int index = this.goods.IndexOf(commercialItem); this.goods.RemoveAt(index); var itemRecharge = commercialItem.Clone(); this.goods.Insert(index, itemRecharge as ICommercial); } else { // Return money ninja.GetCash(commercialItem.Price); } } }