public void ApplyStats(ExtraDamage to)
 {
     to.def              = this.damageDefStat.Def;
     to.amount           = this.amount;
     to.armorPenetration = this.armorPenetration;
     to.chance           = this.chance;
 }
 public ExtraDamageStats(ExtraDamage d)
 {
     this.damageDefStat    = Util.AssignDefStat(d.def);
     this.amount           = d.amount;
     this.armorPenetration = d.armorPenetration;
     this.chance           = d.chance;
 }
Exemple #3
0
        private void SmiteIt(Obj_AI_Base minion, ExtraDamage extraDamageInfo = null)
        {
            SpellSlot smiteSlot = GetSmiteSlot();
            int       slot      = -1;

            if (smiteSlot == SpellSlot.Q)
            {
                slot = 64;
            }
            else if (smiteSlot == SpellSlot.W)
            {
                slot = 65;
            }
            if (slot != -1)
            {
                if (extraDamageInfo == null)
                {
                    GamePacket gPacketT =
                        Activator.FixedSummonerCast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, (SpellSlot)slot));
                    gPacketT.Send();
                }
                else
                {
                    GamePacket gPacketT;
                    switch (extraDamageInfo.Type)
                    {
                    case SpellType.Active:
                        gPacketT =
                            Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId,
                                                                               extraDamageInfo.Slot));
                        gPacketT.Send();
                        break;

                    case SpellType.Skillshot:
                        gPacketT =
                            Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(0, extraDamageInfo.Slot, -1, 0, 0,
                                                                               minion.ServerPosition.X, minion.ServerPosition.Y));
                        gPacketT.Send();
                        break;

                    case SpellType.Target:
                        gPacketT =
                            Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId,
                                                                               extraDamageInfo.Slot));
                        gPacketT.Send();
                        break;
                    }
                    Utility.DelayAction.Add(
                        (int)(Game.Time /*+ (extraTimeForCast/1000)*(sender.ServerPosition.Distance(endPos)/1000)*/ +
                              (ObjectManager.Player.ServerPosition.Distance(minion.ServerPosition) / 1000)),
                        () =>
                        Activator.FixedSummonerCast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, (SpellSlot)slot))
                        .Send());
                    //gPacketT = Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, (SpellSlot)slot));
                    //gPacketT.Send();
                }
            }
        }
Exemple #4
0
        protected override void Impact(Thing hitThing)
        {
            var map      = base.Map;
            var position = base.Position;

            GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
            FleckMaker.Static(position, Map, DefDatabase <FleckDef> .GetNamed("BlastFlame"), 2);
            SoundDef.Named("Explosion_Bomb").PlayOneShot(new TargetInfo(base.Position, base.Map, false));

            this.Destroy(DestroyMode.Vanish);
            var battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, this.equipmentDef, this.def, this.targetCoverDef);

            Find.BattleLog.Add(battleLogEntry_RangedImpact);
            this.NotifyImpact(hitThing, map, position);
            if (hitThing != null)
            {
                var dinfo = new DamageInfo(this.def.projectile.damageDef, (float)base.DamageAmount, base.ArmorPenetration, this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                var pawn  = hitThing as Pawn;
                if (pawn != null)
                {
                    var mult = pawn.BodySize <= 1 ? 1 : pawn.BodySize * 2.5f;
                    dinfo.SetAmount(dinfo.Amount * mult);
                }
                hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
                if (pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f)
                {
                    pawn.stances.StaggerFor(95);
                }
                if (this.def.projectile.extraDamages == null)
                {
                    return;
                }
                using (List <ExtraDamage> .Enumerator enumerator = this.def.projectile.extraDamages.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ExtraDamage extraDamage = enumerator.Current;
                        if (Rand.Chance(extraDamage.chance))
                        {
                            var dinfo2 = new DamageInfo(extraDamage.def, extraDamage.amount, extraDamage.AdjustedArmorPenetration(), this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                            hitThing.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_RangedImpact);
                        }
                    }
                    return;
                }
            }
            SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));
            if (base.Position.GetTerrain(map).takeSplashes)
            {
                FleckMaker.WaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f);
                return;
            }
            FleckMaker.Static(this.ExactPosition, map, FleckDefOf.ShotHit_Dirt, 1f);
        }
Exemple #5
0
        protected override void Impact(Thing hitThing)
        {
            this.hitThing = hitThing;
            bool shielded = hitThing.IsShielded() && def.IsWeakToShields;

            LaserGunDef defWeapon = equipmentDef as LaserGunDef;
            Vector3     dir       = (destination - origin).normalized;

            dir.y = 0;

            Vector3 a = origin + dir * (defWeapon == null ? 0.9f : defWeapon.barrelLength);
            Vector3 b;

            if (hitThing == null)
            {
                b = destination;
            }
            else if (shielded)
            {
                b = hitThing.TrueCenter() - dir.RotatedBy(Rand.Range(-22.5f, 22.5f)) * 0.8f;
            }
            else if ((destination - hitThing.TrueCenter()).magnitude < 1)
            {
                b = destination;
            }
            else
            {
                b    = hitThing.TrueCenter();
                b.x += Rand.Range(-0.5f, 0.5f);
                b.z += Rand.Range(-0.5f, 0.5f);
            }

            a.y = b.y = def.Altitude;

            //    SpawnBeam(a, b);

            if (this.def.projectile.explosionRadius > 0f)
            {
                this.Explode(hitThing, false);
                GenExplosion.NotifyNearbyPawnsOfDangerousExplosive(this, this.def.projectile.damageDef, this.launcher.Faction);
            }

            Pawn pawn = launcher as Pawn;
            IDrawnWeaponWithRotation weapon = null;

            if (pawn != null && pawn.equipment != null)
            {
                weapon = pawn.equipment.Primary as IDrawnWeaponWithRotation;
            }
            if (weapon == null)
            {
                Building_LaserGun turret = launcher as Building_LaserGun;
                if (turret != null)
                {
                    weapon = turret.gun as IDrawnWeaponWithRotation;
                }
            }
            if (weapon != null)
            {
                float angle = (b - a).AngleFlat() - (intendedTarget.CenterVector3 - a).AngleFlat();
                weapon.RotationOffset = (angle + 180) % 360 - 180;
            }

            if (hitThing == null)
            {
                Rand.PushState();
                bool flag2 = this.def.causefireChance > 0f && Rand.Chance(this.def.causefireChance);
                Rand.PopState();
                if (flag2)
                {
                    FireUtility.TryStartFireIn(b.ToIntVec3(), pawn.Map, 0.01f);
                }
            }
            else
            {
                if (hitThing is Pawn && shielded)
                {
                    weaponDamageMultiplier *= def.shieldDamageMultiplier;

                    SpawnBeamReflections(a, b, 5);
                }

                Rand.PushState();
                bool flag2 = this.def.causefireChance > 0f && Rand.Chance(this.def.causefireChance);
                Rand.PopState();
                if (flag2)
                {
                    hitThing.TryAttachFire(0.01f);
                }
                AddeEffects(hitThing);
            }
            //    TriggerEffect(def.explosionEffect, b, hitThing);
            Map     map      = base.Map;
            IntVec3 position = base.Position;

            GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
            this.Destroy(DestroyMode.Vanish);
            BattleLogEntry_RangedImpact battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, this.equipmentDef, this.def, this.targetCoverDef);

            Find.BattleLog.Add(battleLogEntry_RangedImpact);
            this.NotifyImpact(hitThing, map, position);
            if (hitThing != null)
            {
                DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, (float)this.DamageAmount, this.ArmorPenetration, this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
                if (pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f)
                {
                    pawn.stances.StaggerFor(95);
                }
                if (this.def.projectile.extraDamages == null)
                {
                    return;
                }
                using (List <ExtraDamage> .Enumerator enumerator = this.def.projectile.extraDamages.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ExtraDamage extraDamage = enumerator.Current;
                        if (Rand.Chance(extraDamage.chance))
                        {
                            DamageInfo dinfo2 = new DamageInfo(extraDamage.def, extraDamage.amount, extraDamage.AdjustedArmorPenetration(), this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                            hitThing.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_RangedImpact);
                        }
                    }
                    return;
                }
            }
            SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));
            if (base.Position.GetTerrain(map).takeSplashes)
            {
                MoteMaker.MakeWaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f);
                return;
            }
            //    MoteMaker.MakeStaticMote(this.ExactPosition, map, ThingDefOf.Mote_ShotHit_Dirt, 1f);
        }
Exemple #6
0
        public WeaponAmmo SaveWeaponAmmo()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_WeaponAmmo";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponAmmoID", SqlDbType.Int, WeaponAmmoID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponAmmoName", SqlDbType.VarChar, WeaponAmmoName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Cost", SqlDbType.Int, Cost.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RateOfFire", SqlDbType.VarChar, RateOfFire.ToString(), 3));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Stun", SqlDbType.Bit, Stun.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponAmmoDescription", SqlDbType.Text, WeaponAmmoDescription.ToString(), 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Weight", SqlDbType.Decimal, Weight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraDamage", SqlDbType.Bit, ExtraDamage.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraStunDamage", SqlDbType.Bit, ExtraStunDamage.ToString(), 0));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
Exemple #7
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact(hitThing);
            BattleLogEntry_RangedImpact battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, this.equipmentDef, this.def, this.targetCoverDef);

            Find.BattleLog.Add(battleLogEntry_RangedImpact);
            if (hitThing != null)
            {
                DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, (float)base.DamageAmount, base.ArmorPenetration, this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                Pawn       pawn  = hitThing as Pawn;

                if (pawn != null)
                {
                    if (pawn.RaceProps.FleshType == FleshTypeDefOf.Insectoid)
                    {
                        dinfo.SetAmount(dinfo.Amount * 6);
                    }
                    else
                    {
                        dinfo.SetAmount(dinfo.Amount * 2);
                    }
                    if (this.def.projectile.speed >= 150 && Rand.Chance(0.25f))
                    {
                        BodyPartRecord bodyPart = pawn.health.hediffSet.GetBrain();
                        if (bodyPart != null)
                        {
                            dinfo.SetHitPart(bodyPart);
                        }
                    }
                }
                DamageInfo dinfoEX = new DamageInfo(dinfo)
                {
                    Def = DamageDefOf.EMP
                };
                hitThing.TakeDamage(dinfoEX);

                hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
                if (pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f)
                {
                    pawn.stances.StaggerFor(95);
                }
                if (this.def.projectile.extraDamages == null)
                {
                    return;
                }
                using (List <ExtraDamage> .Enumerator enumerator = this.def.projectile.extraDamages.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ExtraDamage extraDamage = enumerator.Current;
                        if (Rand.Chance(extraDamage.chance))
                        {
                            DamageInfo dinfo2 = new DamageInfo(extraDamage.def, extraDamage.amount, extraDamage.AdjustedArmorPenetration(), this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                            hitThing.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_RangedImpact);
                        }
                    }
                    return;
                }
            }
            SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));
            if (base.Position.GetTerrain(map).takeSplashes)
            {
                MoteMaker.MakeWaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f);
                return;
            }
            MoteMaker.MakeStaticMote(this.ExactPosition, map, ThingDefOf.Mote_ShotHit_Dirt, 1f);

            /*Map map = base.Map;
             * base.Impact(hitThing);
             * BattleLogEntry_RangedImpact battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, this.equipmentDef, this.def, this.targetCoverDef);
             * Find.BattleLog.Add(battleLogEntry_RangedImpact);
             * if (hitThing != null)
             * {
             *  DamageDef damageDef = this.def.projectile.damageDef;
             *  float amount = (float)base.DamageAmount;
             *  float armorPenetration = base.ArmorPenetration;
             *  float y = this.ExactRotation.eulerAngles.y;
             *  Thing launcher = this.launcher;
             *  ThingDef equipmentDef = this.equipmentDef;
             *  DamageInfo dinfo = new DamageInfo(damageDef, amount, armorPenetration, y, launcher, null, equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
             *  Pawn pawn = hitThing as Pawn;
             *  if (pawn != null)
             *  {
             *      if (pawn.RaceProps.FleshType == FleshTypeDefOf.Insectoid)
             *      {
             *          dinfo.SetAmount(dinfo.Amount * 4);
             *      }
             *      else
             *      {
             *          dinfo.SetAmount(dinfo.Amount * 2);
             *      }
             *      if (this.def.projectile.speed >= 150 && Rand.Chance(0.25f))
             *      {
             *          BodyPartRecord bodyPart = pawn.health.hediffSet.GetBrain();
             *          if (bodyPart != null)
             *          {
             *              dinfo.SetHitPart(bodyPart);
             *          }
             *      }
             *  }
             *  DamageInfo dinfoEX = new DamageInfo(dinfo)
             *  {
             *      Def = DamageDefOf.EMP
             *  };
             *  hitThing.TakeDamage(dinfoEX);
             *  hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
             *  if (pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f)
             *  {
             *      pawn.stances.StaggerFor(95);
             *  }
             * }
             * else
             * {
             *  SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));
             *  MoteMaker.MakeStaticMote(this.ExactPosition, map, ThingDefOf.Mote_ShotHit_Dirt, 1f);
             *  if (base.Position.GetTerrain(map).takeSplashes)
             *  {
             *      MoteMaker.MakeWaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f);
             *  }
             * }*/
        }
Exemple #8
0
        /// <summary>
        /// Saves the weapon.
        /// </summary>
        /// <returns>Weapon Object</returns>
        public Weapon SaveWeapon()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_Weapon";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponID", SqlDbType.Int, WeaponID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponName", SqlDbType.VarChar, WeaponName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponTypeID", SqlDbType.Int, WeaponTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponSizeID", SqlDbType.Int, WeaponSizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Cost", SqlDbType.Int, Cost.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RateOfFire", SqlDbType.VarChar, RateOfFire.ToString(), 3));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DamageDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Stun", SqlDbType.Bit, Stun.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieNumber", SqlDbType.Int, DamageDieNumber.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@StunDieType", SqlDbType.Int, DamageDieType.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDescription", SqlDbType.Text, WeaponDescription.ToString(), 4000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Weight", SqlDbType.Decimal, Weight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponProficiencyFeatID", SqlDbType.Int, WeaponProficiencyFeatID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EmplacementPoints", SqlDbType.Int, EmplacementPoints.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DoubleWeapon", SqlDbType.Bit, DoubleWeapon.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AreaOfAttack", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Accurate", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Inaccurate", SqlDbType.Bit, AreaOfAttack.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Slugthrower", SqlDbType.Bit, Slugthrower.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RequiresSeperateAmmo", SqlDbType.Bit, RequiresSeperateAmmo.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraDamage", SqlDbType.Bit, ExtraDamage.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ExtraStunDamage", SqlDbType.Bit, ExtraStunDamage.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
Exemple #9
0
 private void Game_OnGameUpdate(EventArgs args)
 {
     if (!IsActive() || !AutoSmiteActivator.GetMenuItem("SAssembliesActivatorsAutoSmiteKeyActive").GetValue <KeyBind>().Active)
     {
         return;
     }
     foreach (Obj_AI_Minion minion in ObjectManager.Get <Obj_AI_Minion>())
     {
         List <Obj_AI_Minion> min = ObjectManager.Get <Obj_AI_Minion>().ToList();
         if (Vector3.Distance(ObjectManager.Player.ServerPosition, minion.ServerPosition) < 750 &&
             minion.Health > 0 && minion.IsVisible)
         {
             int         smiteDamage     = GetSmiteDamage();
             ExtraDamage extraDamageInfo = null;
             int         extraDamage     = 0;
             if (AutoSmiteActivator.GetMenuItem("SAssembliesActivatorsAutoSmiteAutoSpell").GetValue <bool>())
             {
                 extraDamageInfo = GetExtraDamage(minion);
                 if (extraDamageInfo != null)
                 {
                     extraDamage = (int)extraDamageInfo.Damage;
                 }
             }
             if (minion.Health <= smiteDamage)
             {
                 if (!AutoSmiteActivator.GetMenuItem("SAssembliesActivatorsAutoSmiteSmallCampsActive").GetValue <bool>())
                 {
                     foreach (string monster in _usefulMonsters)
                     {
                         if (minion.SkinName == monster)
                         {
                             SmiteIt(minion);
                         }
                     }
                 }
                 else
                 {
                     foreach (string monster in _monsters)
                     {
                         if (minion.SkinName == monster)
                         {
                             SmiteIt(minion);
                         }
                     }
                 }
             }
             else if (extraDamageInfo != null && minion.Health <= smiteDamage + extraDamage)
             {
                 if (Vector3.Distance(ObjectManager.Player.ServerPosition, minion.ServerPosition) <
                     extraDamageInfo.Range + minion.BoundingRadius)
                 {
                     foreach (string monster in _usefulMonsters)
                     {
                         if (minion.SkinName == monster)
                         {
                             SmiteIt(minion, extraDamageInfo);
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #10
0
        private void SmiteIt(Obj_AI_Base minion, ExtraDamage extraDamageInfo = null)
        {
            SpellSlot smiteSlot = GetSmiteSlot();
            if (smiteSlot != SpellSlot.Unknown)
            {
                if (extraDamageInfo == null)
                {
                    GamePacket gPacketT =
                        Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, smiteSlot));
                    gPacketT.Send();
                    ObjectManager.Player.SummonerSpellbook.CastSpell(smiteSlot, minion);
                }
                else
                {
                    GamePacket gPacketT;
                    switch (extraDamageInfo.Type)
                    {
                        case SpellType.Active:
                            gPacketT =
                                Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId,
                                    extraDamageInfo.Slot));
                            gPacketT.Send();
                            ObjectManager.Player.SummonerSpellbook.CastSpell(smiteSlot, minion);
                            break;

                        case SpellType.Skillshot:
                            gPacketT =
                                Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(0, extraDamageInfo.Slot, -1, 0, 0,
                                    minion.ServerPosition.X, minion.ServerPosition.Y));
                            gPacketT.Send();
                            ObjectManager.Player.SummonerSpellbook.CastSpell(smiteSlot, minion);
                            break;

                        case SpellType.Target:
                            gPacketT =
                                Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId,
                                    extraDamageInfo.Slot));
                            ObjectManager.Player.SummonerSpellbook.CastSpell(smiteSlot, minion);
                            gPacketT.Send();
                            break;
                    }
                    Utility.DelayAction.Add(
                        (int) (Game.Time /*+ (extraTimeForCast/1000)*(sender.ServerPosition.Distance(endPos)/1000)*/+
                               (ObjectManager.Player.ServerPosition.Distance(minion.ServerPosition)/1000)),
                        () =>
                            Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, smiteSlot))
                                .Send());
                    ObjectManager.Player.SummonerSpellbook.CastSpell(smiteSlot, minion);
                    //gPacketT = Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(minion.NetworkId, (SpellSlot)slot));
                    //gPacketT.Send();
                }
            }
        }