示例#1
0
文件: Gym.cs 项目: amelia77/NinjaRPG
        public void WorkOut(Ninja ninja)
        {
            Evil enemy = new Assassin(ninja.MentalLevel + 1);

            Arena fight = new Arena(string.Format("Training {0}", ListOfPowers[ninja.MentalLevel]), FightRulesEnum.BrutalFight, ninja, enemy);

            fight.Fight();

            if (fight.IsNinjaWiner)
            {
                if (ninja.UpForceLevel())
                {
                    ninja.GetItem(ListOfPowers[ninja.ForceLevel - 2]);
                }
            }
            else
            {
                // ToDo: for Andrei: ??any string message for the looser
            }
        }
示例#2
0
        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);
                }
            }
        }