Esempio n. 1
0
        public int GetSpecDefenseBonus(CombatType?combatType)
        {
            // https://asheron.fandom.com/wiki/Announcements_-_2013/02_-_Balance_of_Power

            // New bonus added to specialized defenses against damage of their respective attack type. (Applied in both PvE & PvP)

            // - Specialized Melee Defense skill now adds 1 Damage Rating Resist for every 60 pts against melee attacks
            // - Specialized Missile Defense skill now adds 1 Damage Rating Resist for every 50 pts against missile attacks
            // - Specialized Magic Defense skill now adds 1 Damage Rating Resist for every 50 pts against magic attacks

            // only applies to players
            if (combatType == null || !(this is Player player))
            {
                return(0);
            }

            var skill         = GetDefenseSkill(combatType.Value);
            var creatureSkill = player.GetCreatureSkill(skill);

            // ensure defense skill is specialized
            if (creatureSkill.AdvancementClass != SkillAdvancementClass.Specialized)
            {
                return(0);
            }

            var divisor = skill == Skill.MeleeDefense ? 60 : 50;

            // floor?
            return((int)creatureSkill.Base / divisor);
        }
        public int GetDamageResistRating(CombatType?combatType = null, bool directDamage = true)
        {
            // get from base properties (monsters)?
            var damageResistRating = DamageResistRating ?? 0;

            // additive enchantments
            var enchantments = EnchantmentManager.GetRating(PropertyInt.DamageResistRating);

            // equipment ratings
            // TODO: caching?
            var equipment = EquippedObjects.Values.Sum(i => i.GearDamageResist ?? 0);

            // nether DoTs as negative DRR?
            // TODO: this should be factored in as a separate nether damage rating...
            var netherDotDamageRating = directDamage ? EnchantmentManager.GetNetherDotDamageRating() : 0;

            var augBonus    = 0;
            var lumAugBonus = 0;
            var specBonus   = 0;

            if (this is Player player)
            {
                augBonus    = player.AugmentationDamageReduction * 3;
                lumAugBonus = player.LumAugDamageReductionRating;
                specBonus   = GetSpecDefenseBonus(combatType);
            }

            return(damageResistRating + equipment + enchantments - netherDotDamageRating + augBonus + lumAugBonus + specBonus);
        }
Esempio n. 3
0
        public int GetDamageResistRating(CombatType?combatType = null)
        {
            // get from base properties (monsters)?
            var damageResistRating = DamageResistRating ?? 0;

            // additive enchantments
            var enchantments = EnchantmentManager.GetRating(PropertyInt.DamageResistRating);

            // nether DoTs as negative DRR?
            // TODO: this should be factored in as a separate nether damage rating...
            var netherDotDamageRating = EnchantmentManager.GetNetherDotDamageRating();

            var augBonus    = 0;
            var lumAugBonus = 0;
            var specBonus   = 0;

            if (this is Player player)
            {
                augBonus    = player.AugmentationDamageReduction * 3;
                lumAugBonus = player.LumAugDamageReductionRating;
                specBonus   = GetSpecDefenseBonus(combatType);
            }

            return(damageResistRating + enchantments - netherDotDamageRating + augBonus + lumAugBonus + specBonus);
        }
Esempio n. 4
0
    public static InGameCard CreateCard(
        CardRow cardRow,
        String id,
        IList <CombatType> combatTypes,
        IList <CardAttribute> attributes,
        int?basePower,
        int?currentPower,
        String faction,
        CombatType?reviveRow)
    {
        GameObject cardObject = Instantiate((GameObject)Resources.Load("InGameCard"), cardRow.transform);
        InGameCard card       = cardObject.GetComponent <InGameCard>();

        card.cardObject   = cardObject;
        card.id           = id;
        card.combatTypes  = new List <CombatType>(combatTypes);
        card.attributes   = new List <CardAttribute>(attributes);
        card.basePower    = basePower;
        card.currentPower = currentPower;
        card.faction      = faction;
        card.reviveRow    = reviveRow;
        card.cardRow      = cardRow;
        card.image        = Resources.Load <Sprite>("CardImages/" + id);
        return(card);
    }
        public float GetDamageResistRatingMod(CombatType?combatType = null, bool directDamage = true)
        {
            var damageResistRating = GetDamageResistRating(combatType, directDamage);

            var allowBug = PropertyManager.GetBool("allow_negative_rating_curve").Item;

            return(GetNegativeRatingMod(damageResistRating, allowBug));
        }
Esempio n. 6
0
        public float GetMaxRange()
        {
            // FIXME
            var  it        = 0;
            bool?isVisible = null;

            while (CurrentAttack == CombatType.Magic)
            {
                // select a magic spell
                //CurrentSpell = GetRandomSpell();
                if (CurrentSpell.IsProjectile)
                {
                    if (isVisible == null)
                    {
                        isVisible = IsDirectVisible(AttackTarget);
                    }

                    // ensure direct los
                    if (!isVisible.Value)
                    {
                        // reroll attack type
                        CurrentAttack = GetNextAttackType();
                        it++;

                        // max iterations to melee?
                        if (it >= 10)
                        {
                            //log.Warn($"{Name} ({Guid}) reached max iterations");
                            CurrentAttack = CombatType.Melee;

                            var powerupTime = (float)(PowerupTime ?? 1.0f);
                            var failDelay   = ThreadSafeRandom.Next(0.0f, powerupTime);

                            NextMoveTime = Timers.RunningTime + failDelay;
                        }
                        continue;
                    }
                }
                return(GetSpellMaxRange());
            }

            if (CurrentAttack == CombatType.Missile)
            {
                /*var weapon = GetEquippedWeapon();
                 * if (weapon == null) return MaxMissileRange;
                 *
                 * var maxRange = weapon.GetProperty(PropertyInt.WeaponRange) ?? MaxMissileRange;
                 * return Math.Min(maxRange, MaxMissileRange);     // in-game cap @ 80 yds.*/
                return(GetMaxMissileRange());
            }
            else
            {
                return(MaxMeleeRange);   // distance_to_target?
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Called after attack has completed
        /// </summary>
        public void ResetAttack()
        {
            // wait for missile to strike
            //if (CurrentAttack == CombatType.Missile)
            //return;

            IsTurning = false;
            IsMoving  = false;

            CurrentAttack = null;
            MaxRange      = 0.0f;
        }
Esempio n. 8
0
        public float GetMaxRange()
        {
            // FIXME
            var it = 0;

            while (CurrentAttack == CombatType.Magic)
            {
                // select a magic spell
                //CurrentSpell = GetRandomSpell();
                var currentSpell = GetCurrentSpell();

                if (currentSpell.IsProjectile)
                {
                    // ensure direct los
                    if (!IsDirectVisible(AttackTarget))
                    {
                        // reroll attack type
                        CurrentAttack = GetNextAttackType();
                        it++;

                        // max iterations to melee?
                        if (it >= 30)
                        {
                            CurrentAttack = CombatType.Melee;
                        }

                        continue;
                    }
                }
                return(GetSpellMaxRange());
            }

            if (CurrentAttack == CombatType.Missile)
            {
                /*var weapon = GetEquippedWeapon();
                 * if (weapon == null) return MaxMissileRange;
                 *
                 * var maxRange = weapon.GetProperty(PropertyInt.WeaponRange) ?? MaxMissileRange;
                 * return Math.Min(maxRange, MaxMissileRange);     // in-game cap @ 80 yds.*/
                return(GetMaxMissileRange());
            }
            else
            {
                return(MaxMeleeRange);   // distance_to_target?
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Returns the damage type for the currently equipped weapon / ammo
        /// </summary>
        /// <param name="multiple">If true, returns all of the damage types for the weapon</param>
        public virtual DamageType GetDamageType(bool multiple = false, CombatType?combatType = null)
        {
            // old method, keeping intact for monsters
            var weapon = GetEquippedWeapon();
            var ammo   = GetEquippedAmmo();

            if (weapon == null)
            {
                return(DamageType.Bludgeon);
            }

            if (combatType == null)
            {
                combatType = GetCombatType();
            }

            var damageSource = combatType == CombatType.Melee || ammo == null || !weapon.IsAmmoLauncher ? weapon : ammo;

            var damageTypes = damageSource.W_DamageType;

            // returning multiple damage types
            if (multiple)
            {
                return(damageTypes);
            }

            // get single damage type
            var motion = CurrentMotionState.MotionState.ForwardCommand.ToString();

            foreach (DamageType damageType in Enum.GetValues(typeof(DamageType)))
            {
                if ((damageTypes & damageType) != 0)
                {
                    // handle multiple damage types
                    if (damageType == DamageType.Slash && motion.Contains("Thrust"))
                    {
                        continue;
                    }

                    return(damageType);
                }
            }
            return(damageTypes);
        }
Esempio n. 10
0
        public DamageType GetDamageType(BiotaPropertiesBodyPart attackPart, CombatType?combatType = null)
        {
            var weapon = GetEquippedWeapon();

            if (weapon != null)
            {
                return(GetDamageType(false, combatType));
            }
            else
            {
                var damageType = (DamageType)attackPart.DType;

                if (damageType.IsMultiDamage())
                {
                    damageType = damageType.SelectDamageType();
                }

                return(damageType);
            }
        }