Esempio n. 1
0
        /// <summary>
        /// First unit strike second unit
        /// </summary>
        /// <param name="parAttacker">Attacker Unit</param>
        /// <param name="parDefencer">Defencer Unit</param>
        /// <returns></returns>
        private bool FirstStrikeSecond(Unit parAttacker, Unit parDefencer)
        {
            parDefencer.SetDamage(parAttacker.GetDamageNext(false, parDefencer), parAttacker.MagicAttack);

            if (parAttacker.PoisonStrike == true && parDefencer.Undead == false)
                parDefencer.Poisoned = true;

            if (parAttacker.ManaBurn == true)
            {
                parDefencer.ManaCurrent = 0;
                parDefencer.ManaBurned = true;
            }

            if (parAttacker.DeathGaze > 0
                && (parAttacker.DeathGaze / 100 > (parDefencer.HealthCurrent / parDefencer.HealthMax)))
                return true;

            if (parDefencer.HealthCurrent <= 0)
            {
                return true;
            }
            return false;
        }
Esempio n. 2
0
 /// <summary>
 /// Calc damage to current monster
 /// </summary>
 /// <param name="info">Is for information</param>
 /// <param name="parMonster">Monster</param>
 /// <returns>Points of damage</returns>
 public virtual int GetDamageNext(bool info, Unit parMonster)
 {
     if (parMonster != null)
         return DamageBase * (100 -
             (MagicAttack ? parMonster.ResistMagic : parMonster.ResistPhysical)) / 100;;
     return DamageBase;
 }
Esempio n. 3
0
 /// <summary>
 /// Check vilible blocks around monster
 /// </summary>
 /// <param name="parMonster">Monster</param>
 /// <returns>All blocks around monster is visible</returns>
 public bool VisibleAroundMonster(Unit parMonster)
 {
     bool visibleAroundMonster = true;
     if (parMonster.Rectangle.X > 0 && parMonster.Rectangle.Y > 0)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE) - 1,
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE) - 1] == 1;
     if (parMonster.Rectangle.X > 0)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE) - 1,
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE)] == 1;
     if (parMonster.Rectangle.X > 0 && parMonster.Rectangle.Y < Constants.MAP_SIZE - 1)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE) - 1,
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE) + 1] == 1;
     if (parMonster.Rectangle.Y > 0)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE),
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE) - 1] == 1;
     visibleAroundMonster = visibleAroundMonster
         && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE),
             (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE)] == 1;
     if (parMonster.Rectangle.Y < Constants.MAP_SIZE - 1)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE),
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE) + 1] == 1;
     if (parMonster.Rectangle.X < Constants.MAP_SIZE - 1 && parMonster.Rectangle.Y > 0)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE) + 1,
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE) - 1] == 1;
     if (parMonster.Rectangle.X < Constants.MAP_SIZE - 1)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE) + 1,
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE)] == 1;
     if (parMonster.Rectangle.X < Constants.MAP_SIZE - 1 && parMonster.Rectangle.Y < Constants.MAP_SIZE - 1)
         visibleAroundMonster = visibleAroundMonster
             && map.visible[(parMonster.Rectangle.X / Constants.TEXTURE_SIZE) + 1,
                 (parMonster.Rectangle.Y / Constants.TEXTURE_SIZE) + 1] == 1;
     return visibleAroundMonster;
 }
Esempio n. 4
0
        /// <summary>
        /// Calc damage to current monster
        /// </summary>
        /// <param name="info">Is for information</param>
        /// <param name="parMonster">Monster</param>
        /// <returns>Points of damage</returns>
        public override int GetDamageNext(bool info, Unit parMonster)
        {
            int ret = DamageBase;
            ret += DamageBase * (DamageBonus + DamageNextBonus) / 100;
            if (Might)
                ret += DamageBase * 30 / 100;

            if (!info)
            {
                Might = false;
                DamageNextBonus = 0;
            }

            if (parMonster != null)
                ret = ret * (100 - (MagicAttack
                    ? parMonster.ResistMagic : parMonster.ResistPhysical)) / 100;

            return ret;
        }