示例#1
0
        public DamageProps CalculateDamage(MaterialCollision[] collisions)
        {
            if (!_isFullySetUp || collisions.Length == 0)
            {
                return(null);
            }

            double damangeMult = GetDamageMultiplier();

            if (Math1D.IsNearZero(damangeMult))
            {
                return(null);
            }

            var avgCollision = MaterialCollision.GetAverageCollision(collisions, _bot.PhysicsBody);

            //TODO: See if this position is along the ramming direction

            double speed = avgCollision.Item2 / 10;     // a speed of 10 is considered an average impact speed

            double damage = speed * damangeMult;

            DamageProps retVal = new DamageProps(avgCollision.Item1, damage);

            // The act of hitting something needs to stop the ram, otherwise, they just keep pushing against the item
            // and continue to do damage
            StopRamming();

            return(retVal);
        }
示例#2
0
        public DamageProps GetDamage(DamageProps multipliers)
        {
            double?kinetic = null;

            if (this.Kinetic != null)
            {
                kinetic = this.Kinetic.Value * (multipliers.Kinetic ?? 1d);
            }

            double?pierce = null;

            if (this.Pierce != null)
            {
                pierce = this.Pierce.Value * (multipliers.Pierce ?? 1d);
            }

            double?slash = null;

            if (this.Slash != null)
            {
                slash = this.Slash.Value * (multipliers.Slash ?? 1d);
            }

            return(new DamageProps(this.Position, kinetic, pierce, slash));
        }
示例#3
0
        public static (bool isDead, DamageProps actualDamage) DoDamage(ITakesDamage item, DamageProps damage)
        {
            if (damage == null)
            {
                return(false, damage);
            }

            DamageProps damageActual = damage.GetDamage(item.ReceiveDamageMultipliers);

            // Remove the damage.  If something was returned, that means hitpoints are zero
            return(item.HitPoints.RemoveQuantity(damageActual.GetDamage(), false) > 0, damageActual);
        }
示例#4
0
 public static DamageProps GetMerged(DamageProps damage1, DamageProps damage2)
 {
     return(GetMerged(new[] { damage1, damage2 }));
 }