Exemple #1
0
        public short duration;//set duration to -1 for infinite;

        public void updatePassive(BaseGameEntity user)
        {
            if (duration > 0)
            {
                duration--;
            }
            else if (duration == 0)
            {
                user.passives.Remove(this);
            }
        }
Exemple #2
0
 public virtual void addStats(BaseGameEntity user)
 {
 }
Exemple #3
0
 public virtual void useSpell(Hero user, BaseGameEntity target)
 {
 }
Exemple #4
0
 public override void useSpell(Hero user, BaseGameEntity target)
 {
 }
Exemple #5
0
        public override void Attack(BaseGameEntity user, byte weapon)
        {
            short dmg;

            //Check if it is a range weapon, use range dmg if it is.

            if (user.equipment[weapon] != null && user.equipment[weapon].range > 1)
            {
                dmg = user.rangedAttack;
            }
            else
            {
                dmg = user.meleeAttack;
            }

            //Check if it is a crit, double damage
            byte rng = RNG.RollDice(100);

            if (rng < user.critChance)
            {
                dmg *= 2;
            }

            //BaseGameEntity target = getunitat pos+direction
            //for range, gå åt direction, ta närmsta unit.
            //if target != null {
            rng = RNG.RollDice(100);

            //return (new AttackParameters((byte)dmg, user.equipment[weapon]));
            AttackParameters AttackParamCalc = new AttackParameters((byte)dmg, user.equipment[weapon]);

            targetDebuff = AttackParamCalc.weapon.targetDebuffs;
            damage       = AttackParamCalc.dmg;
            range        = AttackParamCalc.weapon.range;
            // Change later - Add arrows
            #region dmgCalc

            /*//if because otherwise it would heal someone with high armor.
             *
             *  //Apply debuffs on target
             *  if (user.equipment[weapon] != null)
             *      target.passives.Add(user.equipment[weapon].targetDebuffs);
             *
             *  target.lastHitBy = user;
             */
            //user?
            //return(dmg, equipment[weapon].range, equipment[weapon].targetDebuffs;

            foreach (Monster snubbe in Wizard.units)
            {
                int posY = (int)pos.Y;
                int posX = (int)pos.X;
                if (posX != snubbe.pos.X || posY != snubbe.pos.Y)
                {
                    switch (dir)
                    {
                    case 0:
                        while (--posY >= (pos.Y - range))
                        {
                            if (posX == snubbe.pos.X && posY == snubbe.pos.Y)
                            {
                                // WE FOUND A DUDE IN HERE. HUEHUEHEUHEUHEUEHUEHUEHEUHEUHEUEHUEHUHEHEHUEHEUHEHUEHUEHUEHEHUHEUHEHOOOHUHEEHUE
                                if (rng > snubbe.dodgeChance)
                                {
                                    if (user.meleeAttack - snubbe.armor > 0)
                                    {
                                        snubbe.hp -= (short)(dmg - snubbe.armor);
                                    }
                                }    //add dodged
                                else
                                {
                                    Console.WriteLine("Dodge");
                                }
                                break;
                            }
                        }
                        break;

                    case 1:
                        while (++posX <= (pos.X + range))
                        {
                            if (posX == snubbe.pos.X && posY == snubbe.pos.Y)
                            {
                                // WE FOUND A DUDE IN HERE. HUEHUEHEUHEUHEUEHUEHUEHEUHEUHEUEHUEHUHEHEHUEHEUHEHUEHUEHUEHEHUHEUHEHOOOHUHEEHUE
                                if (rng > snubbe.dodgeChance)
                                {
                                    if (user.meleeAttack - snubbe.armor > 0)
                                    {
                                        snubbe.hp -= (short)(dmg - snubbe.armor);
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("Dodge");
                                }
                                break;
                            }
                        }
                        break;

                    case 2:
                        while (++posY <= (pos.Y + range))
                        {
                            if (posX == snubbe.pos.X && posY == snubbe.pos.Y)
                            {
                                // WE FOUND A DUDE IN HERE. HUEHUEHEUHEUHEUEHUEHUEHEUHEUHEUEHUEHUHEHEHUEHEUHEHUEHUEHUEHEHUHEUHEHOOOHUHEEHUE'
                                if (rng > snubbe.dodgeChance)
                                {
                                    if (user.meleeAttack - snubbe.armor > 0)
                                    {
                                        snubbe.hp -= (short)(dmg - snubbe.armor);
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("Dodge");
                                }
                                break;
                            }
                        }
                        break;

                    case 3:
                        while (--posX >= (pos.X - range))
                        {
                            if (posX == snubbe.pos.X && posY == snubbe.pos.Y)
                            {
                                // WE FOUND A DUDE IN HERE. HUEHUEHEUHEUHEUEHUEHUEHEUHEUHEUEHUEHUHEHEHUEHEUHEHUEHUEHUEHEHUHEUHEHOOOHUHEEHUE                                    Console.WriteLine("HIT");
                                if (rng > snubbe.dodgeChance)
                                {
                                    if (user.meleeAttack - snubbe.armor > 0)
                                    {
                                        snubbe.hp -= (short)(dmg - snubbe.armor);
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("Dodge");
                                }
                                break;
                            }
                        }
                        break;

                    default:
                        Console.WriteLine("Non existing direction received.");
                        break;
                    }
                }
            }
        }