示例#1
0
        // FUNCTIONS

        public override void Activate(Creature user)
        {
            bool   identified = Identified;
            string text       = "";

            Identify();
            switch (potionType)
            {
            case (PotionType.Healing):
                user.ChangeResource(Resource.HP, effect);
                text = "You feel a bit healthier! That must have been a potion of healing.";
                break;

            case (PotionType.MajorHealing):
                user.ChangeResource(Resource.HP, effect);
                text = "You feel a lot healthier! That must have been a potion of major healing.";
                break;

            case (PotionType.Magicka):
                user.ChangeResource(Resource.MP, effect);
                text = "Your connection to the aether has become a bit stronger! That must have been a potion of magicka.";
                break;

            case (PotionType.MajorMagicka):
                user.ChangeResource(Resource.MP, effect);
                text = "Your connection to the aether has become a lot stronger! That must have been a potion of major magicka.";
                break;

            case (PotionType.Energy):
                user.ChangeResource(Resource.SP, effect);
                text = "You feel less tired! That must have been a potion of energy.";
                break;

            case (PotionType.MajorEnergy):
                user.ChangeResource(Resource.SP, effect);
                text = "You feel rejuvenated! That must have been a potion of major energy.";
                break;
            }
            if (!identified)
            {
                Menus.DisplayIdentified(text);
            }
        }
示例#2
0
        // FUNCTIONS //

        public void Apply(Creature victim)
        {
            string victimText = $"{victim.Name}";
            string userText   = $"{user.Name}";

            if (victimHPDamageType != DamageType.None)
            {
                int damageTaken = victim.Defend(victimHPDamageType, victimResourceDamage[0], victim.Position);
                victimText += $" recieved {damageTaken} {victimHPDamageType.ToString()} damage,";
            }
            if (victimResourceDamage[1] > 0)
            {
                victim.ChangeResource(Resource.MP, -victimResourceDamage[1]);
                victimText += $" lost {victimResourceDamage[1]} magicka,";
            }
            if (victimResourceDamage[2] > 0)
            {
                victim.ChangeResource(Resource.SP, -victimResourceDamage[2]);
                victimText += $" lost {victimResourceDamage[2]} stamina,";
            }
            if (victimResourceHealing[0] > 0)
            {
                victim.ChangeResource(Resource.HP, victimResourceHealing[0]);
                victimText += $" had {victimResourceHealing[0]} health restored,";
            }
            if (victimResourceHealing[1] > 0)
            {
                victim.ChangeResource(Resource.MP, victimResourceHealing[1]);
                victimText += $" had {victimResourceHealing[1]} magicka restored,";
            }
            if (victimResourceHealing[2] > 0)
            {
                victim.ChangeResource(Resource.SP, victimResourceHealing[2]);
                victimText += $" had {victimResourceHealing[2]} stamina restored,";
            }
            if (userResourceHealing[0] > 0)
            {
                user.ChangeResource(Resource.SP, userResourceHealing[0]);
                userText += $" recieved {userResourceHealing[0]} health,";
            }
            if (userResourceHealing[1] > 0)
            {
                user.ChangeResource(Resource.SP, userResourceHealing[1]);
                userText += $" recieved {userResourceHealing[1]} magicka,";
            }
            if (userResourceHealing[2] > 0)
            {
                user.ChangeResource(Resource.SP, userResourceHealing[2]);
                userText += $" recieved {userResourceHealing[2]} stamina,";
            }

            if (!victimText.Equals($"{victim.Name}"))
            {
                victimText = victimText.Substring(0, victimText.LastIndexOf(','));
                if (victimText.Contains(","))
                {
                    int commaIndex = victimText.LastIndexOf(',');
                    victimText = victimText.Substring(0, commaIndex) + " and " + victimText.Substring(commaIndex + 2, victimText.Length - (commaIndex + 2));
                }
                victimText += $" from {name}.";
                Program.MsgConsole.WriteLine(victimText);
            }
            if (!userText.Equals($"{user.Name}"))
            {
                userText = userText.Substring(0, userText.LastIndexOf(','));
                if (userText.Contains(","))
                {
                    int commaIndex = userText.LastIndexOf(',');
                    userText = userText.Substring(0, commaIndex) + " and " + userText.Substring(commaIndex + 2, userText.Length - (commaIndex + 2));
                }
                userText += $" from {name}.";
                Program.MsgConsole.WriteLine(userText);
            }

            turns--;
            if (turns == 0)
            {
                victim.Effects.Remove(this);
            }
        }
示例#3
0
        // FUNCTIONS

        public override void Activate(Creature user)
        {
            user.ChangeResource(Resource.HV, (int)(Weight * 100));
        }