Example #1
0
        public override void GiveDmg(Npc name)
        {
            if (IsSuccessful())
            {
                short dmg = GameFunctions.RndNext(10, 17);
                name.Health -= dmg;

                if (name.Health < 0)
                {
                    name.Health = 0;
                }
                else
                {
                    if (GameFunctions.RndNextDouble() > HealChance)
                    {
                        GameFunctions.AddToCombatLog($"{_name} damages {name.NpcRace} for {dmg} health, stealing 1hp");
                        Health += 1;
                    }
                    else
                    {
                        GameFunctions.AddToCombatLog($"{_name} damages {name.NpcRace} for {dmg} health");
                    }
                }

                if (Health > 100)
                {
                    Health = 100;
                }
            }
            else
            {
                GameFunctions.AddToCombatLog($"{_name} missed!");
            }
        }
Example #2
0
        public void NpcChoice(Player name)
        {
            if (HitOrHeal())
            {
                if (IsAccuracySuccessful())
                {
                    short dmg = GameFunctions.RndNext(11, 16);
                    name.Health -= dmg;

                    //clamp health to not go below 0
                    if (name.Health < 0)
                    {
                        name.Health = 0;
                    }
                    else //Gives each foe a unique roleplay element.
                    {
                        if (NpcClass == NpcClasses.Warrior)
                        {
                            GameFunctions.AddToEnemyLog($"The {NpcRace} {NpcClass} slashed their sword at you for {dmg} damage!");
                        }
                        else if (NpcClass == NpcClasses.Rogue)
                        {
                            GameFunctions.AddToEnemyLog($"The {NpcRace} {NpcClass} threw a knife at you for {dmg} damage!");
                        }
                        else if (NpcClass == NpcClasses.Mage)
                        {
                            GameFunctions.AddToEnemyLog($"The {NpcRace} {NpcClass} hurled a fireball at you for {dmg} damage!");
                        }
                    }
                }
                else
                {
                    GameFunctions.AddToEnemyLog($"{NpcRace} {NpcClass} missed!");
                }
            }
            else
            {
                short heal      = GameFunctions.RndNext(12, 16);
                short newHealth = (short)(Health + heal);

                //Clamp health to not go above 100
                if (newHealth > 100)
                {
                    newHealth = 100;
                }

                //Swap placeholder health(newHealth) back into health
                Health = newHealth;
                GameFunctions.AddToEnemyLog($"{NpcRace} {NpcClass} healed by {heal}.");
            }
        }
Example #3
0
 public override void SpecialMove(Npc name)
 {
     if (SpecialMoves > 0)
     {
         short dmg = GameFunctions.RndNext(200, 300);
         GameFunctions.AddToCombatLog($"You summon a demon which crushes the {name.NpcRace} for {dmg} damage!");
         name.Health -= dmg;
         SpecialMoves--;
     }
     else
     {
         GameFunctions.AddToCombatLog("You're out of special moves!");
     }
 }
Example #4
0
        public void DropItem(Player player)
        {
            if (GameFunctions.RndNextDouble() > _dropChance)
            {
                switch (GameFunctions.RndNext(1, 3))
                {
                case 1:
                    GameFunctions.AddToEnemyLog($"The {NpcRace} dropped a {player.HealItemsType}!");
                    player.HealItems++;
                    break;

                case 2:
                    GameFunctions.AddToEnemyLog($"The {NpcRace} dropped a potion labeled 'Special Attack!'");
                    player.SpecialMoves++;
                    break;
                }
            }
        }
Example #5
0
        //Creates random enemy class.
        public void NpcEnemyClass()
        {
            short rdmNpcClass = GameFunctions.RndNext(0, 3);

            switch (rdmNpcClass)
            {
            case 0:
                NpcClass = NpcClasses.Warrior;
                break;

            case 1:
                NpcClass = NpcClasses.Rogue;
                break;

            case 2:
                NpcClass = NpcClasses.Mage;
                break;
            }
        }
Example #6
0
        //Creates random enemy race.
        public void NpcEnemyRace()
        {
            short rdmNpcRace = GameFunctions.RndNext(0, 3);

            switch (rdmNpcRace)
            {
            case 0:
                NpcRace = NpcRaces.Skeleton;
                break;

            case 1:
                NpcRace = NpcRaces.Goblin;
                break;

            case 2:
                NpcRace = NpcRaces.Troll;
                break;
            }
        }
Example #7
0
        public override void HealSelf()
        {
            short heal      = GameFunctions.RndNext(65, 75);
            short newHealth = (short)(Health + heal);

            if (newHealth > 100)
            {
                newHealth = 100;
            }

            if (Health > 0)
            {
                Health = newHealth;
                GameFunctions.AddToCombatLog($"{_name} drank a potion for {heal} health.");
                HealItems--;
            }
            else
            {
                Health = 0;
            }
        }