Esempio n. 1
0
        public void CleanGraphics(Thing filth)
        {
            TM_FleckMaker.ThrowGenericFleck(FleckDefOf.MicroSparks, this.ExactPosition, this.Map, Rand.Range(.3f, .5f), .6f, .2f, .4f, Rand.Range(-400, -100), .3f, Rand.Range(0, 360), Rand.Range(0, 360));
            Vector3 angle = TM_Calc.GetVector(filth.DrawPos, this.ExactPosition);

            TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_ThickDust, filth.DrawPos, this.Map, Rand.Range(.4f, .6f), .1f, .05f, .25f, -200, 2, (Quaternion.AngleAxis(90, Vector3.up) * angle).ToAngleFlat(), Rand.Range(0, 360));
        }
Esempio n. 2
0
        protected override bool TryCastShot()
        {
            Pawn    caster            = base.CasterPawn;
            Map     map               = caster.Map;
            IntVec3 cell              = currentTarget.Cell;
            CompAbilityUserMagic comp = caster.TryGetComp <CompAbilityUserMagic>();

            pwrVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Totems, "TM_Totems", "_pwr", true);
            verVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Totems, "TM_Totems", "_ver", true);
            effVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Totems, "TM_Totems", "_eff", true);
            IntVec3 shiftPos = TM_Calc.GetEmptyCellForNewBuilding(cell, map, 2f, true, 0, true);

            if (shiftPos != null && (shiftPos.IsValid && shiftPos.Standable(map)))
            {
                AbilityUser.SpawnThings tempPod = new SpawnThings();
                tempPod.def        = TorannMagicDefOf.TM_EarthTotem;
                tempPod.spawnCount = 1;

                try
                {
                    this.totem = TM_Action.SingleSpawnLoop(caster, tempPod, shiftPos, map, 2500 + (125 * verVal), true, false, caster.Faction, false, ThingDefOf.BlocksGranite);
                    this.totem.SetFaction(caster.Faction);
                    Building_TMTotem_Earth totemBuilding = this.totem as Building_TMTotem_Earth;
                    if (totemBuilding != null)
                    {
                        totemBuilding.pwrVal = pwrVal;
                        totemBuilding.verVal = verVal;
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        Vector3 rndPos = this.totem.DrawPos;
                        rndPos.x += Rand.Range(-.5f, .5f);
                        rndPos.z += Rand.Range(-.5f, .5f);
                        TM_FleckMaker.ThrowGenericFleck(FleckDefOf.DustPuffThick, rndPos, map, Rand.Range(.6f, 1f), .1f, .05f, .05f, 0, 0, 0, Rand.Range(0, 360));
                        FleckMaker.ThrowSmoke(rndPos, map, Rand.Range(.8f, 1.2f));
                    }
                }
                catch
                {
                    comp.Mana.CurLevel += comp.ActualManaCost(TorannMagicDefOf.TM_SummonTotemEarth);
                    if (caster.IsColonist)
                    {
                        Log.Message("TM_Exception".Translate(
                                        caster.LabelShort,
                                        "Earth Totem"
                                        ));
                    }
                }
            }
            else
            {
                if (caster.IsColonist)
                {
                    Messages.Message("InvalidSummon".Translate(), MessageTypeDefOf.RejectInput);
                    comp.Mana.GainNeed(comp.ActualManaCost(TorannMagicDefOf.TM_SummonTotemEarth));
                }
            }
            return(false);
        }
Esempio n. 3
0
        public void DoSunfireActions()
        {
            List <int> removedIndex = new List <int>();

            removedIndex.Clear();
            try
            {
                for (int i = 0; i < this.sfBeams.Count; i++)
                {
                    if (sfBeamsStep[i] <= 0)
                    {
                        removedIndex.Add(i);
                    }
                    else
                    {
                        if (sfBeamsStartTick[i] <= this.age)
                        {
                            sfBeamsStep[i]--;
                            SunfireDamage(sfBeams[i].ToIntVec3());
                            TM_FleckMaker.ThrowGenericFleck(FleckDefOf.DustPuff, sfBeams[i], this.Map, .4f, .2f, .1f, .2f, Rand.Range(-100, 100), 2f, Rand.Range(0, 360), 0);
                            sfBeams[i]    += sfBeamsROM[i];
                            sfBeamsROM[i] += (sfBeamsCurve[i] * (20f - sfBeamsStep[i]));
                        }
                    }
                }
                for (int i = 0; i < removedIndex.Count; i++)
                {
                    this.sfBeamsCurve.Remove(this.sfBeamsCurve[removedIndex[i]]);
                    this.sfBeamsDest.Remove(sfBeamsDest[removedIndex[i]]);
                    this.sfBeamsROM.Remove(sfBeamsROM[removedIndex[i]]);
                    this.sfBeamsStartTick.Remove(sfBeamsStartTick[removedIndex[i]]);
                    this.sfBeamsStep.Remove(sfBeamsStep[removedIndex[i]]);
                    this.sfBeams.Remove(sfBeams[removedIndex[i]]);
                }
            }
            catch
            {
                this.ignoreAge = true;
                Destroy(DestroyMode.Vanish);
            }
        }
Esempio n. 4
0
        protected override bool TryCastShot()
        {
            Pawn p   = this.CasterPawn;
            Map  map = this.CasterPawn.Map;
            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            pawns.Clear();
            plants.Clear();
            GenClamor.DoClamor(p, this.UseAbilityProps.TargetAoEProperties.range, ClamorDefOf.Ability);
            Effecter snapeFreezeED = TorannMagicDefOf.TM_SnapFreezeED.Spawn();

            snapeFreezeED.Trigger(new TargetInfo(this.currentTarget.Cell, map, false), new TargetInfo(this.currentTarget.Cell, map, false));
            snapeFreezeED.Cleanup();
            SoundInfo info = SoundInfo.InMap(new TargetInfo(this.currentTarget.Cell, map, false), MaintenanceType.None);

            info.pitchFactor  = .4f;
            info.volumeFactor = 1.2f;
            TorannMagicDefOf.TM_WindLowSD.PlayOneShot(info);
            TargetInfo ti = new TargetInfo(this.currentTarget.Cell, map, false);

            TM_MoteMaker.MakeOverlay(ti, TorannMagicDefOf.TM_Mote_PsycastAreaEffect, map, Vector3.zero, 3f, 0f, .1f, .4f, 1.2f, -3f);
            float classBonus = 1f;

            if (p.story != null && p.story.traits != null && p.story.traits.HasTrait(TorannMagicDefOf.HeartOfFrost))
            {
                classBonus = 1.5f;
            }
            if (this.currentTarget != null && p != null && comp != null)
            {
                this.arcaneDmg = comp.arcaneDmg;
                this.TargetsAoE.Clear();
                this.FindTargets();
                float energy = -125000 * this.arcaneDmg * classBonus;
                GenTemperature.PushHeat(this.currentTarget.Cell, p.Map, energy);
                for (int i = 0; i < pawns.Count; i++)
                {
                    if (!pawns[i].RaceProps.IsMechanoid && pawns[i].RaceProps.body.AllPartsVulnerableToFrostbite.Count > 0)
                    {
                        float distanceModifier = 1f / (pawns[i].Position - currentTarget.Cell).LengthHorizontal;
                        if (distanceModifier > 1f)
                        {
                            distanceModifier = 1f;
                        }
                        int bites = Mathf.RoundToInt(Rand.Range(1f, 5f) * classBonus);
                        for (int j = 0; j < bites; j++)
                        {
                            if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, pawns[i], true)) && Rand.Chance(distanceModifier))
                            {
                                TM_Action.DamageEntities(pawns[i], pawns[i].def.race.body.AllPartsVulnerableToFrostbite.RandomElement(), Rand.Range(10, 20) * distanceModifier, 1f, DamageDefOf.Frostbite, p);
                            }
                            if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, pawns[i], true)) && Rand.Chance(distanceModifier))
                            {
                                HealthUtility.AdjustSeverity(pawns[i], HediffDefOf.Hypothermia, distanceModifier / 5f);
                            }
                        }
                    }
                }
                for (int i = 0; i < plants.Count; i++)
                {
                    float distanceModifier = 1f / (plants[i].Position - currentTarget.Cell).LengthHorizontal;
                    if (distanceModifier > 1f)
                    {
                        distanceModifier = 1f;
                    }
                    if (plants[i].def.plant.IsTree)
                    {
                        if (Rand.Chance(distanceModifier / 2f))
                        {
                            plants[i].MakeLeafless(Plant.LeaflessCause.Cold);
                        }
                    }
                    else
                    {
                        if (Rand.Chance(distanceModifier))
                        {
                            plants[i].MakeLeafless(Plant.LeaflessCause.Cold);
                        }
                    }
                    plants[i].Notify_ColorChanged();
                }
                List <IntVec3> cellList = GenRadial.RadialCellsAround(this.currentTarget.Cell, this.UseAbilityProps.TargetAoEProperties.range, true).ToList();
                bool           raining  = map.weatherManager.RainRate > 0f || map.weatherManager.SnowRate > 0f;
                for (int i = 0; i < cellList.Count; i++)
                {
                    cellList[i] = cellList[i].ClampInsideMap(map);
                    SnowUtility.AddSnowRadial(cellList[i], map, 2.4f, Rand.Range(.08f, .13f));
                    TM_FleckMaker.ThrowGenericFleck(FleckDefOf.AirPuff, cellList[i].ToVector3Shifted(), map, 2.5f, .05f, .05f, Rand.Range(2f, 3f), Rand.Range(-60, 60), .5f, -70, Rand.Range(0, 360));
                }
                List <IntVec3> windList = GenRadial.RadialCellsAround(this.currentTarget.Cell, this.UseAbilityProps.TargetAoEProperties.range + 1, true).Except(cellList).ToList();
                for (int i = 0; i < windList.Count; i++)
                {
                    windList[i] = windList[i].ClampInsideMap(map);
                    Vector3 angle = TM_Calc.GetVector(windList[i], this.currentTarget.Cell);
                    TM_FleckMaker.ThrowGenericFleck(FleckDefOf.AirPuff, windList[i].ToVector3Shifted(), map, Rand.Range(1.2f, 2f), .45f, Rand.Range(0f, .25f), .5f, -200, Rand.Range(3, 5), (Quaternion.AngleAxis(90, Vector3.up) * angle).ToAngleFlat(), Rand.Range(0, 360));
                }
            }

            this.burstShotsLeft = 0;
            return(true);
        }
Esempio n. 5
0
        protected override bool TryCastShot()
        {
            bool flag = false;

            Pawn caster = base.CasterPawn;

            this.TargetsAoE.Clear();
            //this.UpdateTargets();
            FindTargets();
            CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>();

            if (this.Ability.Def == TorannMagicDefOf.TM_StayAlert || this.Ability.Def == TorannMagicDefOf.TM_StayAlert_I || this.Ability.Def == TorannMagicDefOf.TM_StayAlert_II || this.Ability.Def == TorannMagicDefOf.TM_StayAlert_III)
            {
                pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_StayAlert, "TM_StayAlert", "_pwr", true);
                flagSA = true;
            }
            if (this.Ability.Def == TorannMagicDefOf.TM_MoveOut || this.Ability.Def == TorannMagicDefOf.TM_MoveOut_I || this.Ability.Def == TorannMagicDefOf.TM_MoveOut_II || this.Ability.Def == TorannMagicDefOf.TM_MoveOut_III)
            {
                pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_MoveOut, "TM_MoveOut", "_pwr", true);
                flagMO = true;
            }
            if (this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine || this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine_I || this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine_II || this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine_III)
            {
                pwrVal  = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_HoldTheLine, "TM_HoldTheLine", "_pwr", true);
                flagHTL = true;
            }
            Effecter OrderED = TorannMagicDefOf.TM_CommanderOrderED.Spawn();

            OrderED.Trigger(new TargetInfo(caster.Position, caster.Map, false), new TargetInfo(caster.Position, caster.Map, false));
            OrderED.Cleanup();
            for (int i = 0; i < this.TargetsAoE.Count; i++)
            {
                Pawn newPawn = this.TargetsAoE[i].Thing as Pawn;
                if (newPawn.RaceProps.Humanlike && newPawn != caster)
                {
                    float socialChance = (float)(caster.skills.GetSkill(SkillDefOf.Social).Level / 20f);
                    float rChance      = Mathf.Clamp(socialChance * 2f, .1f, 1f);
                    if (!caster.IsColonist)
                    {
                        rChance = Mathf.Clamp(socialChance * 3f, .5f, 1f);
                        ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                        if (settingsRef.AIHardMode)
                        {
                            socialChance = 1f;
                        }
                    }
                    if (Rand.Chance(rChance))
                    {
                        float targetCountFactor = Mathf.Clamp(5f / (float)this.TargetsAoE.Count, .1f, 1f);
                        if (flagSA)
                        {
                            if (newPawn.needs != null && newPawn.needs.rest != null)
                            {
                                newPawn.needs.rest.CurLevel += ((0.5f * targetCountFactor) + .05f * pwrVal);
                            }
                            if (newPawn.health != null && newPawn.health.hediffSet != null)
                            {
                                HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_StayAlertHD, (.7f * targetCountFactor) + (.1f * pwrVal));
                            }
                            TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_PowerWave, newPawn.DrawPos, newPawn.Map, .8f, .2f, .1f, .1f, 0, 1f, 0, Rand.Chance(.5f) ? 0 : 180);
                        }
                        else if (flagMO)
                        {
                            if (newPawn.health != null && newPawn.health.hediffSet != null)
                            {
                                HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_MoveOutHD, Mathf.Clamp(.6f * targetCountFactor, .25f, .6f) + (.13f * pwrVal));
                            }
                            TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_PowerWave, newPawn.DrawPos, newPawn.Map, .8f, .2f, .1f, .1f, 0, 1f, 0, Rand.Chance(.5f) ? 0 : 180);
                        }
                        else if (flagHTL)
                        {
                            if (newPawn.health != null && newPawn.health.hediffSet != null)
                            {
                                HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_HTLShieldHD, Mathf.Clamp(35f * targetCountFactor, 10f, 35f) + (5f * pwrVal));
                                HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_HoldTheLineHD, Mathf.Clamp(.7f * targetCountFactor, .3f, .7f) + (.1f * pwrVal));
                                Effecter HTLShieldED = TorannMagicDefOf.TM_HTL_EffecterED.Spawn();
                                HTLShieldED.Trigger(new TargetInfo(newPawn.Position, newPawn.Map, false), new TargetInfo(newPawn.Position, newPawn.Map, false));
                                OrderED.Cleanup();
                            }
                        }

                        if (newPawn.needs != null && newPawn.needs.mood != null && newPawn.needs.mood.thoughts != null)
                        {
                            if (Rand.Chance(1f - (.2f * socialChance)))
                            {
                                float moodChance = Mathf.Clamp(TM_Calc.GetRelationsFactor(caster, newPawn), .1f, .9f);
                                if (Rand.Chance(moodChance))
                                {
                                    newPawn.needs.mood.thoughts.memories.TryGainMemory(TorannMagicDefOf.TM_TakingOrdersTD, null);
                                }
                            }
                        }
                        TM_FleckMaker.ThrowGenericFleck(FleckDefOf.LightningGlow, newPawn.DrawPos, newPawn.Map, .4f, .3f, .1f, .1f, 0, 0f, 0f, 0f);
                        TM_FleckMaker.ThrowGenericFleck(FleckDefOf.LightningGlow, newPawn.DrawPos, newPawn.Map, .7f, .2f, .1f, .1f, 0, 0f, 0f, 0f);
                        TM_FleckMaker.ThrowGenericFleck(FleckDefOf.LightningGlow, newPawn.DrawPos, newPawn.Map, 1.1f, .1f, .1f, .1f, 0, 0f, 0f, 0f);
                        TM_FleckMaker.ThrowGenericFleck(FleckDefOf.ShotFlash, newPawn.DrawPos, newPawn.Map, .4f, .3f, .1f, .1f, 0, 0f, 0f, 0f);
                    }
                    else
                    {
                        if (newPawn.IsColonist)
                        {
                            MoteMaker.ThrowText(newPawn.DrawPos, newPawn.Map, "TM_IgnoredOrder".Translate(), -1);
                        }
                    }
                }
            }
            this.PostCastShot(flag, out flag);
            return(flag);
        }
Esempio n. 6
0
        protected override bool TryCastShot()
        {
            Pawn p   = this.CasterPawn;
            Map  map = this.CasterPawn.Map;
            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            corpses.Clear();
            pawns.Clear();
            plants.Clear();
            GenClamor.DoClamor(p, this.UseAbilityProps.TargetAoEProperties.range, ClamorDefOf.Ability);
            Effecter igniteED = TorannMagicDefOf.TM_IgniteED.Spawn();

            igniteED.Trigger(new TargetInfo(this.currentTarget.Cell, map, false), new TargetInfo(this.currentTarget.Cell, map, false));
            igniteED.Cleanup();
            SoundInfo info = SoundInfo.InMap(new TargetInfo(this.currentTarget.Cell, map, false), MaintenanceType.None);

            info.pitchFactor  = 1.1f;
            info.volumeFactor = 1.8f;
            TorannMagicDefOf.TM_FireWooshSD.PlayOneShot(info);
            TargetInfo ti = new TargetInfo(this.currentTarget.Cell, map, false);

            TM_MoteMaker.MakeOverlay(ti, TorannMagicDefOf.TM_Mote_PsycastAreaEffect, map, Vector3.zero, .2f, 0f, .1f, .4f, .4f, 4.3f);
            float classBonus = 1f;

            if (p.story != null && p.story.traits != null && p.story.traits.HasTrait(TorannMagicDefOf.InnerFire))
            {
                classBonus = 1.5f;
            }
            if (this.currentTarget != null && p != null && comp != null)
            {
                this.arcaneDmg = comp.arcaneDmg;
                this.TargetsAoE.Clear();
                this.FindTargets();
                float energy = 200000 * this.arcaneDmg * classBonus;
                GenTemperature.PushHeat(this.currentTarget.Cell, p.Map, energy);
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                for (int i = 0; i < pawns.Count; i++)
                {
                    if (!pawns[i].RaceProps.IsMechanoid)
                    {
                        float distanceModifier = (classBonus) / (pawns[i].Position - currentTarget.Cell).LengthHorizontal;
                        if (distanceModifier > 1f)
                        {
                            distanceModifier = 1f;
                        }
                        if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, pawns[i], true)) && Rand.Chance(distanceModifier))
                        {
                            pawns[i].TryAttachFire(Rand.Range(distanceModifier / 2f, distanceModifier));
                        }
                    }
                }
                for (int i = 0; i < corpses.Count; i++)
                {
                    //if (corpses[i].CanEverAttachFire())
                    //{
                    float distanceModifier = 1f / (corpses[i].Position - currentTarget.Cell).LengthHorizontal;
                    //    corpses[i].TryAttachFire(Rand.Range(distanceModifier / 2f, distanceModifier));
                    FireUtility.TryStartFireIn(corpses[i].Position, map, Rand.Range(distanceModifier / 2f, distanceModifier));
                    //}
                }
                for (int i = 0; i < plants.Count; i++)
                {
                    float distanceModifier = 1f / (plants[i].Position - currentTarget.Cell).LengthHorizontal;
                    if (distanceModifier > 1f)
                    {
                        distanceModifier = 1f;
                    }
                    if (plants[i].def.plant.IsTree)
                    {
                        if (Rand.Chance(distanceModifier / 2f))
                        {
                            plants[i].TryAttachFire(Rand.Range(distanceModifier / 3f, distanceModifier / 2f));
                            FireUtility.TryStartFireIn(plants[i].Position, map, Rand.Range(distanceModifier / 3f, distanceModifier / 2f));
                        }
                    }
                    else
                    {
                        if (Rand.Chance(distanceModifier))
                        {
                            plants[i].TryAttachFire(Rand.Range(distanceModifier / 2f, distanceModifier));
                            FireUtility.TryStartFireIn(plants[i].Position, map, Rand.Range(distanceModifier / 2f, distanceModifier));
                        }
                    }
                }
                List <IntVec3> cellList = GenRadial.RadialCellsAround(this.currentTarget.Cell, this.UseAbilityProps.TargetAoEProperties.range, true).ToList();
                bool           raining  = map.weatherManager.RainRate > 0f || map.weatherManager.SnowRate > 0f;
                for (int i = 0; i < cellList.Count; i++)
                {
                    cellList[i] = cellList[i].ClampInsideMap(map);
                    if (cellList[i].GetSnowDepth(map) > 0f)
                    {
                        map.snowGrid.SetDepth(cellList[i], 0f);
                        FleckMaker.ThrowSmoke(cellList[i].ToVector3Shifted(), map, Rand.Range(.8f, 1.6f));
                        Thing smoke = ThingMaker.MakeThing(ThingDefOf.Gas_Smoke, null);
                        GenSpawn.Spawn(smoke, cellList[i], map, WipeMode.Vanish);
                    }
                    else if (raining || cellList[i].GetTerrain(map).IsWater)
                    {
                        Thing smoke = ThingMaker.MakeThing(ThingDefOf.Gas_Smoke, null);
                        GenSpawn.Spawn(smoke, cellList[i], map, WipeMode.Vanish);
                    }
                    TM_FleckMaker.ThrowGenericFleck(FleckDefOf.AirPuff, cellList[i].ToVector3Shifted(), map, 2.5f, .05f, .05f, Rand.Range(2f, 3f), Rand.Range(-60, 60), .5f, -70, Rand.Range(0, 360));
                }
            }

            this.burstShotsLeft = 0;
            return(true);
        }
Esempio n. 7
0
        private void DoTeachingEffects(Pawn student)
        {
            int     effectNum   = Rand.RangeInclusive(0, 4);
            Color   randomColor = new Color(Rand.Range(0f, 1f), Rand.Range(0f, 1f), Rand.Range(0f, 1f), Rand.Range(.7f, 1f));
            Vector3 drawPos;
            int     rangeMax = Rand.Range(8, 15);

            if (Rand.Chance(.5f))
            {
                drawPos = this.pawn.DrawPos;
            }
            else
            {
                drawPos = student.DrawPos;
            }

            if (effectNum == 0)
            {
                for (int i = 0; i < rangeMax; i++)
                {
                    float    direction = Rand.Range(0, 360);
                    ThingDef mote      = new ThingDef();
                    mote = ThingDef.Named("Mote_Psi_Grayscale");
                    mote.graphicData.color = randomColor;
                    TM_MoteMaker.ThrowGenericMote(mote, drawPos, this.pawn.Map, Rand.Range(.1f, .3f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                    SoundInfo info = SoundInfo.InMap(new TargetInfo(this.pawn.Position, this.pawn.Map, false), MaintenanceType.None);
                    info.pitchFactor  = 1.5f;
                    info.volumeFactor = .6f;
                    TorannMagicDefOf.ItemEnchanted.PlayOneShot(info);
                }
            }
            else if (effectNum == 1)
            {
                for (int i = 0; i < rangeMax / 2; i++)
                {
                    float   direction = Rand.Range(-20, 20);
                    Vector3 rndPos    = drawPos;
                    rndPos.x += Rand.Range(-1f, 1f);
                    rndPos.z += Rand.Range(-1f, 1f);
                    FleckDef mote = FleckDefOf.MicroSparks;
                    TM_FleckMaker.ThrowGenericFleck(mote, rndPos, this.pawn.Map, Rand.Range(.6f, .9f), 0.4f, .1f, .8f, 0, Rand.Range(1, 1.5f), direction, direction);
                    SoundInfo info = SoundInfo.InMap(new TargetInfo(this.pawn.Position, this.pawn.Map, false), MaintenanceType.None);
                    info.pitchFactor  = .75f;
                    info.volumeFactor = 1.2f;
                    TorannMagicDefOf.TM_AirWoosh.PlayOneShot(info);
                }
            }
            else if (effectNum == 2)
            {
                for (int i = 0; i < rangeMax; i++)
                {
                    float   direction = Rand.Range(10, 20);
                    Vector3 rndPos    = drawPos;
                    rndPos.x += Rand.Range(-2f, 2f);
                    rndPos.z += Rand.Range(-2f, 2f);
                    ThingDef mote = ThingDefOf.Gas_Smoke;
                    TM_MoteMaker.ThrowGenericMote(mote, rndPos, this.pawn.Map, Rand.Range(1f, 1.4f), 0.7f, .2f, .9f, Rand.Range(0, 200), Rand.Range(.3f, .6f), direction, direction);
                    SoundInfo info = SoundInfo.InMap(new TargetInfo(this.pawn.Position, this.pawn.Map, false), MaintenanceType.None);
                    info.pitchFactor  = 1.4f;
                    info.volumeFactor = .5f;
                    SoundDefOf.Artillery_ShellLoaded.PlayOneShot(info);
                }
            }
            else if (effectNum == 3)
            {
                for (int i = 0; i < rangeMax; i++)
                {
                    float   direction = Rand.Range(0, 360);
                    Vector3 rndPos    = drawPos;
                    rndPos.x += Rand.Range(-.3f, .3f);
                    rndPos.z += Rand.Range(-.3f, .3f);
                    ThingDef mote = ThingDef.Named("Mote_Shadow");
                    TM_MoteMaker.ThrowGenericMote(mote, rndPos, this.pawn.Map, Rand.Range(1f, 1.4f), 0.4f, Rand.Range(.1f, .4f), Rand.Range(.2f, .6f), Rand.Range(-100, 100), Rand.Range(1.2f, 2f), direction, direction);
                    SoundInfo info = SoundInfo.InMap(new TargetInfo(this.pawn.Position, this.pawn.Map, false), MaintenanceType.None);
                    info.pitchFactor  = .8f;
                    info.volumeFactor = 1.2f;
                    TorannMagicDefOf.TM_Vibration.PlayOneShot(info);
                }
            }
            else if (effectNum == 4)
            {
                for (int i = 0; i < rangeMax; i++)
                {
                    float   direction = Rand.Range(-20, 20);
                    Vector3 rndPos    = drawPos;
                    rndPos.x += Rand.Range(-1f, 1f);
                    rndPos.z += Rand.Range(-1f, 1f);
                    ThingDef mote = ThingDef.Named("Mote_Twinkle");
                    TM_MoteMaker.ThrowGenericMote(mote, rndPos, this.pawn.Map, Rand.Range(.2f, .7f), Rand.Range(.2f, .6f), Rand.Range(0f, .8f), Rand.Range(.5f, .8f), Rand.Range(-50, 50), Rand.Range(.5f, 1f), direction, direction);
                    SoundInfo info = SoundInfo.InMap(new TargetInfo(this.pawn.Position, this.pawn.Map, false), MaintenanceType.None);
                    info.pitchFactor  = 1.2f;
                    info.volumeFactor = .6f;
                    TorannMagicDefOf.TM_Gong.PlayOneShot(info);
                }
            }
        }