public void PullObject(Thing t)
        {
            Thing summonableThing = t;
            Pawn  victim          = null;

            if (summonableThing != null)
            {
                victim = t as Pawn;
                if (victim != null)
                {
                    DamageInfo dinfo2 = new DamageInfo(DamageDefOf.Stun, 10, 10, -1, this.Pawn, null, null, DamageInfo.SourceCategory.ThingOrUnknown, victim);
                    if (!victim.RaceProps.Humanlike || victim.Faction == this.Pawn.Faction)
                    {
                        FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), victim.Position, this.Pawn.Map, WipeMode.Vanish);
                        flyingObject.speed = 25;
                        flyingObject.Launch(victim, this.Pawn.Position, victim);
                    }
                    else if (victim.RaceProps.Humanlike && victim.Faction != this.Pawn.Faction && Rand.Chance(TM_Calc.GetSpellSuccessChance(this.Pawn, victim, true)))
                    {
                        FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), victim.Position, this.Pawn.Map, WipeMode.Vanish);
                        flyingObject.speed = Rand.Range(23f, 27f);
                        flyingObject.Launch(victim, this.Pawn.Position, victim);
                    }
                    else
                    {
                        MoteMaker.ThrowText(victim.DrawPos, victim.Map, "TM_ResistedSpell".Translate(), -1);
                    }
                }
            }
        }
        private void DoKnockbackAttack(IntVec3 center, IntVec3 target, float radius, float force)
        {
            this.nextKnockbackAttack = this.Props.knockbackCooldownTicks + Find.TickManager.TicksGame;
            List <IntVec3> targetCells = GenRadial.RadialCellsAround(target, radius, true).ToList();
            IntVec3        curCell     = default(IntVec3);

            for (int i = 0; i < targetCells.Count(); i++)
            {
                curCell = targetCells[i];
                if (curCell.IsValid && curCell.InBounds(this.Pawn.Map))
                {
                    Vector3 launchVector  = TM_Calc.GetVector(this.Pawn.Position, curCell);
                    Pawn    knockbackPawn = curCell.GetFirstPawn(this.Pawn.Map);
                    TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Smoke"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.6f, 1f), .01f, .01f, 1f, Rand.Range(50, 100), Rand.Range(5, 7), launchVector.ToAngleFlat(), Rand.Range(0, 360));
                    TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Smoke"), curCell.ToVector3Shifted(), this.Pawn.Map, Rand.Range(.6f, 1f), .01f, .01f, 1f, Rand.Range(50, 100), Rand.Range(5, 7), launchVector.ToAngleFlat(), Rand.Range(0, 360));
                    if (knockbackPawn != null && knockbackPawn != this.Pawn)
                    {
                        IntVec3 targetCell = knockbackPawn.Position + (force * force * launchVector).ToIntVec3();
                        bool    flag       = targetCell != null && targetCell != default(IntVec3);
                        if (flag)
                        {
                            if (knockbackPawn.Spawned && knockbackPawn.Map != null && !knockbackPawn.Dead)
                            {
                                FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), knockbackPawn.Position, knockbackPawn.Map, WipeMode.Vanish);
                                flyingObject.speed = 15 + (2 * force);
                                flyingObject.Launch(this.Pawn, targetCell, knockbackPawn);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void ThrowStone(IntVec3 origin)
        {
            SoundInfo info = SoundInfo.InMap(new TargetInfo(origin, this.caster.Map, false), MaintenanceType.None);

            info.pitchFactor  = .7f;
            info.volumeFactor = 2f;
            TorannMagicDefOf.TM_AirWoosh.PlayOneShot(info);

            CellRect cellRect = CellRect.CenteredOn(base.Position, radius);

            cellRect.ClipInsideMap(this.caster.Map);
            IntVec3 destination = cellRect.RandomCell;

            if (launchableThing != null && destination != null)
            {
                float launchAngle = (Quaternion.AngleAxis(90, Vector3.up) * TM_Calc.GetVector(origin, destination)).ToAngleFlat();
                for (int m = 0; m < 4; m++)
                {
                    TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_ThickDust"), origin.ToVector3Shifted(), this.caster.Map, Rand.Range(.4f, .7f), Rand.Range(.2f, .3f), .05f, Rand.Range(.4f, .6f), Rand.Range(-20, 20), Rand.Range(3f, 5f), launchAngle += Rand.Range(-25, 25), Rand.Range(0, 360));
                }
                FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), origin, this.caster.Map);
                flyingObject.force = this.arcaneDmg + .2f;
                flyingObject.Launch(this.caster, destination, this.launchableThing, this.spinRate);
            }
        }
Ejemplo n.º 4
0
        public void LaunchFlyingObect(IntVec3 targetCell, Pawn pawn)
        {
            bool flag = targetCell != null && targetCell != default(IntVec3);

            if (flag)
            {
                if (pawn != null && pawn.Position.IsValid && pawn.Spawned && pawn.Map != null && !pawn.Downed && !pawn.Dead)
                {
                    FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(TorannMagicDefOf.FlyingObject_Spinning, pawn.Position, pawn.Map);
                    flyingObject.Launch(pawn, targetCell, pawn);
                }
            }
        }
Ejemplo n.º 5
0
        public void LaunchFlyingObect(IntVec3 targetCell, Pawn pawn, int force)
        {
            bool flag = targetCell != null && targetCell != default(IntVec3);

            if (flag)
            {
                if (pawn != null && pawn.Position.IsValid && pawn.Spawned && pawn.Map != null && !pawn.Downed && !pawn.Dead)
                {
                    FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), pawn.Position, pawn.Map);
                    flyingObject.speed = 25 + force;
                    flyingObject.Launch(pawn, targetCell, pawn);
                }
            }
        }
Ejemplo n.º 6
0
        public void LaunchFlyingObect(IntVec3 targetCell, Thing thing)
        {
            bool flag = targetCell != null && targetCell != default(IntVec3);

            if (flag)
            {
                if (thing != null && thing.Position.IsValid && !this.Destroyed && thing.Spawned && thing.Map != null)
                {
                    FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), thing.Position, thing.Map);
                    flyingObject.speed = 22;
                    flyingObject.Launch(caster, targetCell, thing);
                }
            }
        }
        public void LaunchFlyingObect(IntVec3 targetCell, Pawn pawn)
        {
            bool flag = targetCell != null && targetCell != default(IntVec3);

            if (flag)
            {
                if (pawn != null && pawn.Position.IsValid && pawn.Spawned && pawn.Map != null && !pawn.Downed && !pawn.Dead)
                {
                    if (ModCheck.Validate.GiddyUp.Core_IsInitialized())
                    {
                        ModCheck.GiddyUp.ForceDismount(pawn);
                    }
                    FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(TorannMagicDefOf.FlyingObject_Spinning, pawn.Position, pawn.Map);
                    flyingObject.Launch(pawn, targetCell, pawn);
                }
            }
        }
        private void DoRangedAttack(LocalTargetInfo target)
        {
            bool flag = target.Cell != default(IntVec3);

            if (flag)
            {
                SoundInfo info = SoundInfo.InMap(new TargetInfo(this.Pawn.Position, this.Pawn.Map, false), MaintenanceType.None);
                info.pitchFactor  = .7f;
                info.volumeFactor = 2f;
                TorannMagicDefOf.TM_AirWoosh.PlayOneShot(info);

                CellRect cellRect = CellRect.CenteredOn(target.Cell, 3);
                cellRect.ClipInsideMap(this.Pawn.Map);
                IntVec3 destination = cellRect.RandomCell;

                if (launchableThing != null && destination != null)
                {
                    float launchAngle = (Quaternion.AngleAxis(90, Vector3.up) * TM_Calc.GetVector(this.Pawn.Position, destination)).ToAngleFlat();
                    for (int m = 0; m < 4; m++)
                    {
                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_ThickDust"), this.Pawn.Position.ToVector3Shifted(), this.Pawn.Map, Rand.Range(.4f, .7f), Rand.Range(.2f, .3f), .05f, Rand.Range(.4f, .6f), Rand.Range(-20, 20), Rand.Range(3f, 5f), launchAngle += Rand.Range(-25, 25), Rand.Range(0, 360));
                    }
                    FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Spinning"), this.Pawn.Position, this.Pawn.Map);
                    flyingObject.force = 1.4f;
                    flyingObject.Launch(this.Pawn, destination, this.launchableThing.SplitOff(1), Rand.Range(45, 65));
                }
                else if (launchableThing == null && destination != null)
                {
                    float launchAngle = (Quaternion.AngleAxis(90, Vector3.up) * TM_Calc.GetVector(this.Pawn.Position, destination)).ToAngleFlat();
                    for (int m = 0; m < 4; m++)
                    {
                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_ThickDust"), this.Pawn.Position.ToVector3Shifted(), this.Pawn.Map, Rand.Range(.4f, .7f), Rand.Range(.2f, .3f), .05f, Rand.Range(.4f, .6f), Rand.Range(-20, 20), Rand.Range(3f, 5f), launchAngle += Rand.Range(-25, 25), Rand.Range(0, 360));
                    }
                    FlyingObject_Spinning flyingObject = (FlyingObject_Spinning)GenSpawn.Spawn(ThingDef.Named("FlyingObject_SpinningBone"), this.Pawn.Position, this.Pawn.Map);
                    flyingObject.force = 1.4f;
                    flyingObject.Launch(this.Pawn, destination, null, Rand.Range(120, 150));
                }
            }
        }