コード例 #1
0
ファイル: EffectManager.cs プロジェクト: MirroredFate/RPG
 public void UseHeal(int effectID, Player player)
 {
     if (GetEffectType(effectID) == 2)
     {
         player.AddHealth(GetEffect(effectID).GetHealAmount());
     }
 }
コード例 #2
0
ファイル: UpgradeManager.cs プロジェクト: MirroredFate/RPG
        public Equipment Upgrade(Equipment oldEQ, Player player)
        {
            oldEQ.SetLevel(oldEQ.GetLevel() + 1);

            if (oldEQ.GetDamage() >= 1)
            {
                oldEQ.SetDamage(oldEQ.GetDamage() + oldEQ.GetLevel() * 2);
            }

            if (oldEQ.GetStaminaBonus() >= 1)
            {
                int newStam = oldEQ.GetStaminaBonus() + oldEQ.GetLevel() * 2;
                oldEQ.SetStamina(newStam);
                player.UpdateStats();
                player.AddHealth((oldEQ.GetLevel() * 2) * 10);
            }

            if (oldEQ.GetStrengthBonus() >= 1)
            {
                oldEQ.SetStrength(oldEQ.GetStrengthBonus() + oldEQ.GetLevel() * 2);
            }

            if (oldEQ.GetDefenseBonus() >= 1)
            {
                oldEQ.SetDefense(oldEQ.GetDefenseBonus() + oldEQ.GetLevel() * 2);
            }

            if (oldEQ.GetIntelligenceBonus() >= 1)
            {
                oldEQ.SetIntelligence(oldEQ.GetIntelligenceBonus() + oldEQ.GetLevel() * 2);
            }

            if (oldEQ.GetSpeedBonus() >= 1)
            {
                oldEQ.SetSpeed(oldEQ.GetSpeedBonus() + oldEQ.GetLevel() * 2);
            }

            oldEQ.SetPrice(oldEQ.GetPrice() + oldEQ.GetLevel() * oldEQ.GetPrice());
            return(oldEQ);
        }
コード例 #3
0
ファイル: ItemManager.cs プロジェクト: MirroredFate/RPG
        public void UseItem(Item item, Player player)
        {
            em.LoadEffects();
            switch (item.GetItemID())
            {
            //Small Health Potion
            case 1:
                if (player.GetHealth() >= player.GetMaxHealth())
                {
                    Console.WriteLine("|| Already Max Health!");
                }
                else
                {
                    player.AddHealth(100);
                    item.SetAmount(item.GetAmount() - 1);

                    Console.WriteLine("|| Used 1 {0}!", item.GetName());
                    Console.WriteLine("|| Recovered 100 Health!");
                }
                break;

            //Small Mana Potion
            case 2:
                if (player.GetMana() >= player.GetMaxMana())
                {
                    Console.WriteLine("|| Already Max Mana!");
                }
                else
                {
                    player.AddMana(30);
                    item.SetAmount(item.GetAmount() - 1);

                    Console.WriteLine("|| Used 1 {0}!", item.GetName());
                    Console.WriteLine("|| Recovered 30 Mana!");
                }
                break;

            //Medium Health Potion
            case 3:
                if (player.GetHealth() >= player.GetMaxHealth())
                {
                    Console.WriteLine("|| Already Max Health!");
                }
                else
                {
                    player.AddHealth(250);
                    item.SetAmount(item.GetAmount() - 1);

                    Console.WriteLine("|| Used 1 {0}!", item.GetName());
                    Console.WriteLine("|| Recovered 250 Health!");
                }
                break;

            //Medium Mana Potion
            case 4:
                if (player.GetMana() >= player.GetMaxMana())
                {
                    Console.WriteLine("|| Already Max Mana!");
                }
                else
                {
                    player.AddMana(70);
                    item.SetAmount(item.GetAmount() - 1);

                    Console.WriteLine("|| Used 1 {0}!", item.GetName());
                    Console.WriteLine("|| Recovered 70 Mana!");
                }
                break;

            default:
                Console.WriteLine("|| No item found");
                break;
            }

            player.RefreshInventory();
        }