Exemple #1
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact(hitThing);
            ThingDef def = this.def;

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();

            Pawn pawn   = this.launcher as Pawn;
            Pawn victim = hitThing as Pawn;

            if (!pawn.Spawned)
            {
                pwrVal    = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_pwr").level;
                arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr;
            }
            else
            {
                MightPowerSkill pwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBlast_pwr");
                pwrVal    = pwr.level;
                arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr;
            }

            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                pwrVal = mpwr.level;
            }

            TM_MoteMaker.MakePowerBeamMotePsionic(base.Position, map, this.def.projectile.explosionRadius * 6f, 2f, .7f, .1f, .6f);
            float angle = (Quaternion.AngleAxis(90, Vector3.up) * GetVector(pawn.Position, base.Position)).ToAngleFlat();

            GenExplosion.DoExplosion(base.Position, map, this.def.projectile.explosionRadius, TMDamageDefOf.DamageDefOf.TM_PsionicInjury, this.launcher, Mathf.RoundToInt(this.def.projectile.GetDamageAmount(1, null) * pawn.GetStatValue(StatDefOf.PsychicSensitivity, false) * (1 + (0.15f * pwrVal)) * this.arcaneDmg), 0, this.def.projectile.soundExplode, def, this.equipmentDef, this.intendedTarget.Thing, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
        }
Exemple #2
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact(hitThing);
            ThingDef def = this.def;

            Pawn pawn = this.launcher as Pawn;

            if (!pawn.Spawned)
            {
                //pwrVal = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_pwr").level;
                pwrVal    = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm, "TM_PsionicStorm", "_pwr", true);
                arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr;
            }
            else
            {
                //MightPowerSkill pwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBlast_pwr");
                pwrVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast, "TM_PsionicBlast", "_pwr", true);
                //pwrVal = pwr.level;
                arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr;
            }

            //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            //{
            //    MightPowerSkill mpwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
            //    pwrVal = mpwr.level;
            //}

            TM_MoteMaker.MakePowerBeamMotePsionic(base.Position, map, this.def.projectile.explosionRadius * 6f, 2f, .7f, .1f, .6f);
            GenExplosion.DoExplosion(base.Position, map, this.def.projectile.explosionRadius, TMDamageDefOf.DamageDefOf.TM_PsionicInjury, this.launcher, Mathf.RoundToInt(this.def.projectile.GetDamageAmount(1, null) * pawn.GetStatValue(StatDefOf.PsychicSensitivity, false) * (1 + (0.15f * pwrVal)) * this.arcaneDmg), 0, this.def.projectile.soundExplode, def, this.equipmentDef, this.intendedTarget.Thing, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
        }
 private void ExplosiveStepFinal(float forwardMagnitude)
 {
     this.shouldDrawPawn = true;
     this.drawTicks      = 60;
     this.speed          = 20;
     TM_MoteMaker.MakePowerBeamMotePsionic(base.Position, this.Map, 10f, 2f, .7f, .1f, .6f);
     GenExplosion.DoExplosion(base.Position, this.Map, 1.7f, TMDamageDefOf.DamageDefOf.TM_PsionicInjury, this.pawn, Mathf.RoundToInt(Rand.Range(10, 16) * (1 + .1f * pwrVal) * this.arcaneDmg), 0, this.def.projectile.soundExplode, def, null, null, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
     this.origin        = this.ExactPosition;
     this.destination   = this.origin + (this.direction * forwardMagnitude);
     this.ticksToImpact = this.StartingTicksToImpact;
 }
 private void ExplosiveStep(float forwardMagnitude)
 {
     this.drawTicks = 120;
     this.speed     = 40;
     TM_MoteMaker.MakePowerBeamMotePsionic(base.Position, this.Map, 10f, 2f, .7f, .1f, .6f);
     GenExplosion.DoExplosion(base.Position, this.Map, 1.7f, TMDamageDefOf.DamageDefOf.TM_PsionicInjury, this.pawn, Mathf.RoundToInt(Rand.Range(8, 14) * (1 + .1f * pwrVal) * this.arcaneDmg), 0, this.def.projectile.soundExplode, def, null, null, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
     TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_PsiCurrent"), this.ExactPosition, this.Map, Rand.Range(.3f, .5f), .1f, 0f, .1f, 0, 4f, this.trueAngle, this.trueAngle);
     TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_PsiCurrent"), this.ExactPosition, this.Map, Rand.Range(.5f, .6f), .1f, .04f, .1f, 0, 7f, this.trueAngle, this.trueAngle);
     TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_PsiCurrent"), this.ExactPosition, this.Map, Rand.Range(.7f, .8f), .1f, .08f, .1f, 0, 10f, this.trueAngle, this.trueAngle);
     this.origin        = this.ExactPosition;
     this.destination   = this.origin + (this.direction * forwardMagnitude);
     this.ticksToImpact = this.StartingTicksToImpact;
 }
Exemple #5
0
        protected new void Impact(Thing hitThing)
        {
            bool flag = hitThing == null;

            if (flag)
            {
                Pawn pawn;
                bool flag2 = (pawn = (base.Position.GetThingList(base.Map).FirstOrDefault((Thing x) => x == this.assignedTarget) as Pawn)) != null;
                if (flag2)
                {
                    hitThing = pawn;
                }
            }
            bool hasValue = this.impactDamage.HasValue;

            if (hasValue)
            {
                bool flag3 = this.damageLaunched;
                if (flag3)
                {
                    hitThing.TakeDamage(this.impactDamage.Value);
                }

                bool flag4 = this.explosion;
                if (flag4)
                {
                    GenExplosion.DoExplosion(base.Position, base.Map, 0.9f, DamageDefOf.Stun, this, -1, 0, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
                }
            }
            TM_MoteMaker.MakePowerBeamMotePsionic(this.ExactPosition.ToIntVec3(), this.Map, 10f, 2f, .7f, .1f, .6f);
            //GenExplosion.DoExplosion(this.ExactPosition.ToIntVec3(), this.Map, 1.7f, TMDamageDefOf.DamageDefOf.TM_PsionicInjury, this.pawn, Rand.Range(8, 12) + 2*this.effVal, 0, this.def.projectile.soundExplode, def, null, null, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
            SearchForTargets(base.Position, 1.7f, this.Map);
            GenSpawn.Spawn(this.flyingThing, base.Position, base.Map);
            ModOptions.Constants.SetPawnInFlight(false);
            Pawn p = this.flyingThing as Pawn;

            if (p.IsColonist)
            {
                p.drafter.Drafted = true;
                if (this.isSelected)
                {
                    CameraJumper.TryJumpAndSelect(p);
                }
                if (this.oldjobTarget != null && !this.oldjobTarget.Destroyed)
                {
                    Job job = new Job(JobDefOf.AttackMelee, this.oldjobTarget);
                    p.jobs.TryTakeOrderedJob(job, JobTag.DraftedOrder);
                }
            }
            this.Destroy(DestroyMode.Vanish);
        }
Exemple #6
0
        public override void CompPostTick(ref float severityAdjustment)
        {
            if (base.Pawn != null & base.parent != null && !this.Pawn.Dead)
            {
                if (!initialized)
                {
                    initialized = true;
                    this.Initialize();
                }
                base.CompPostTick(ref severityAdjustment);

                if (Find.TickManager.TicksGame % 60 == 0 && initialized)
                {
                    DeterminePsionicHD();
                    severityAdjustment += (this.Pawn.GetStatValue(StatDefOf.PsychicSensitivity, false) * Rand.Range(.04f, .12f));
                    if (Find.Selector.FirstSelectedObject == this.Pawn)
                    {
                        HediffStage hediffStage = this.Pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).CurStage;
                        hediffStage.label = this.parent.Severity.ToString("0.00") + "%";
                    }

                    Hediff hediff = this.Pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_Artifact_PsionicBoostHD);
                    float  maxSev = 100;
                    if (hediff != null)
                    {
                        maxSev += hediff.Severity;
                    }
                    this.parent.Severity = Mathf.Clamp(this.parent.Severity, 0, maxSev);
                }

                if (base.Pawn.Spawned && !this.Pawn.Downed && base.Pawn.Map != null && comp != null)
                {
                    if (this.doPsionicAttack)
                    {
                        this.ticksTillPsionicStrike--;
                        if (this.ticksTillPsionicStrike <= 0)
                        {
                            this.doPsionicAttack = false;
                            if (threat != null && !threat.Destroyed && !threat.Dead && !threat.Downed)
                            {
                                TM_MoteMaker.MakePowerBeamMotePsionic(threat.DrawPos.ToIntVec3(), threat.Map, 2f, 2f, .7f, .1f, .6f);
                                DamageInfo dinfo2 = new DamageInfo(TMDamageDefOf.DamageDefOf.TM_PsionicInjury, Rand.Range(6, 12) * this.Pawn.GetStatValue(StatDefOf.PsychicSensitivity, false) + (2 * VerVal), 0, -1, this.Pawn, null, null, DamageInfo.SourceCategory.ThingOrUnknown, this.threat);
                                this.threat.TakeDamage(dinfo2);
                            }
                        }
                    }

                    if (comp.usePsionicAugmentationToggle && this.Pawn.drafter != null && this.Pawn.CurJob != null)
                    {
                        if (Find.TickManager.TicksGame % 600 == 0 && !this.Pawn.Drafted)
                        {
                            if (this.parent.Severity >= 95 && this.Pawn.CurJob.targetA != null && this.Pawn.CurJob.targetA.Thing != null)
                            {
                                if ((this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal > 20 && (this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal < 300 && this.Pawn.CurJob.locomotionUrgency >= LocomotionUrgency.Jog && this.Pawn.CurJob.bill == null)
                                {
                                    this.parent.Severity -= 10f;
                                    if (this.EffVal == 0)
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD"), 1f + .02f * this.EffVal);
                                    }
                                    else if (this.EffVal == 1)
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD_I"), 1f + .02f * this.EffVal);
                                    }
                                    else if (this.EffVal == 2)
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD_II"), 1f + .02f * this.EffVal);
                                    }
                                    else
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD_III"), 1f + .02f * this.EffVal);
                                    }
                                    for (int i = 0; i < 12; i++)
                                    {
                                        float direction = Rand.Range(0, 360);
                                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                    }
                                    comp.MightUserXP += Rand.Range(10, 15);
                                }
                                if ((this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal < 2 && (this.Pawn.CurJob.bill != null || this.Pawn.CurJob.def.defName == "Sow" || this.Pawn.CurJob.def.defName == "FinishFrame" || this.Pawn.CurJob.def.defName == "Deconstruct" || this.Pawn.CurJob.def.defName == "Repair" || this.Pawn.CurJob.def.defName == "Clean" || this.Pawn.CurJob.def.defName == "Mine" || this.Pawn.CurJob.def.defName == "SmoothFloor" || this.Pawn.CurJob.def.defName == "SmoothWall" || this.Pawn.CurJob.def.defName == "Harvest" || this.Pawn.CurJob.def.defName == "HarvestDesignated" || this.Pawn.CurJob.def.defName == "CutPlant" || this.Pawn.CurJob.def.defName == "CutPlantDesignated"))
                                {
                                    this.parent.Severity -= 12f;
                                    if (this.PwrVal == 0)
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD"), 1f + .02f * this.PwrVal);
                                    }
                                    else if (this.PwrVal == 1)
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD_I"), 1f + .02f * this.PwrVal);
                                    }
                                    else if (this.PwrVal == 2)
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD_II"), 1f + .02f * this.PwrVal);
                                    }
                                    else
                                    {
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD_III"), 1f + .02f * this.PwrVal);
                                    }
                                    for (int i = 0; i < 12; i++)
                                    {
                                        float direction = Rand.Range(0, 360);
                                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                    }
                                    comp.MightUserXP += Rand.Range(10, 15);
                                }
                            }
                        }

                        if (this.parent.Severity >= 20)
                        {
                            if (Find.TickManager.TicksGame % 180 == 0 && (this.Pawn.Drafted || !this.Pawn.IsColonist) && ((this.Pawn.equipment.Primary != null && !this.Pawn.equipment.Primary.def.IsRangedWeapon) || this.Pawn.equipment.Primary == null))
                            {
                                if (this.Pawn.CurJob.targetA != null && this.Pawn.CurJob.targetA.Thing != null && this.Pawn.CurJob.targetA.Thing is Pawn && this.Pawn.CurJobDef == JobDefOf.AttackMelee)
                                {
                                    //Log.Message("performing psionic dash - curjob " + this.Pawn.CurJob);
                                    //Log.Message("curjob def " + this.Pawn.CurJob.def.defName);
                                    //Log.Message("target " + this.Pawn.CurJob.targetA.Thing);
                                    //Log.Message("target range " + (this.Pawn.CurJob.targetA.Thing.Position - this.Pawn.Position).LengthHorizontal);
                                    Pawn  targetPawn     = this.Pawn.CurJob.targetA.Thing as Pawn;
                                    float targetDistance = (this.Pawn.Position - targetPawn.Position).LengthHorizontal;
                                    if (targetDistance > 3 && targetDistance < (12 + EffVal) && targetPawn.Map != null && !targetPawn.Downed)
                                    {
                                        for (int i = 0; i < 12; i++)
                                        {
                                            float direction = Rand.Range(0, 360);
                                            TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                        }
                                        FlyingObject_PsionicLeap flyingObject = (FlyingObject_PsionicLeap)GenSpawn.Spawn(ThingDef.Named("FlyingObject_PsionicLeap"), this.Pawn.Position, this.Pawn.Map);
                                        flyingObject.Launch(this.Pawn, this.Pawn.CurJob.targetA.Thing, this.Pawn);
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicHD"), -3f);
                                        comp.Stamina.CurLevel -= .03f;
                                        comp.MightUserXP      += Rand.Range(20, 30);
                                    }
                                }
                            }

                            if (this.nextPsionicAttack < Find.TickManager.TicksGame && this.Pawn.Drafted && comp.usePsionicMindAttackToggle)
                            {
                                if (this.Pawn.CurJob.def != TorannMagicDefOf.JobDriver_PsionicBarrier && VerVal > 0)
                                {
                                    this.threat = TM_Calc.FindNearbyEnemy(this.Pawn, 20 + (2 * verVal)); // GetNearbyTarget(20 + (2 * VerVal));
                                    if (threat != null)
                                    {
                                        //start psionic attack; ends after delay
                                        SoundInfo info = SoundInfo.InMap(new TargetInfo(this.Pawn.Position, this.Pawn.Map, false), MaintenanceType.None);
                                        TorannMagicDefOf.TM_Implosion.PlayOneShot(info);
                                        Effecter psionicAttack = TorannMagicDefOf.TM_GiantExplosion.Spawn();
                                        psionicAttack.Trigger(new TargetInfo(threat.Position, threat.Map, false), new TargetInfo(threat.Position, threat.Map, false));
                                        psionicAttack.Cleanup();
                                        for (int i = 0; i < 12; i++)
                                        {
                                            float direction = Rand.Range(0, 360);
                                            TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                        }
                                        float weaponModifier = 1;
                                        if (this.Pawn.equipment.Primary != null)
                                        {
                                            if (this.Pawn.equipment.Primary.def.IsRangedWeapon)
                                            {
                                                StatModifier wpnMass = this.Pawn.equipment.Primary.def.statBases.FirstOrDefault((StatModifier x) => x.stat.defName == "Mass");
                                                weaponModifier = Mathf.Clamp(wpnMass.value, .8f, 6);
                                            }
                                            else //assume melee weapon
                                            {
                                                StatModifier wpnMass = this.Pawn.equipment.Primary.def.statBases.FirstOrDefault((StatModifier x) => x.stat.defName == "Mass");
                                                weaponModifier = Mathf.Clamp(wpnMass.value, .6f, 4);
                                            }
                                        }
                                        else //unarmed
                                        {
                                            weaponModifier = .4f;
                                        }
                                        this.nextPsionicAttack = Find.TickManager.TicksGame + (int)(Mathf.Clamp((600 - (60 * verVal)) * weaponModifier, 120, 900));
                                        float energyCost = Mathf.Clamp((10f - VerVal) * weaponModifier, 2f, 12f);
                                        HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicHD"), -energyCost);
                                        comp.MightUserXP           += Rand.Range(8, 12);
                                        this.doPsionicAttack        = true;
                                        this.ticksTillPsionicStrike = 24;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #7
0
        public override void CompPostTick(ref float severityAdjustment)
        {
            if (this.Pawn.Spawned && !this.Pawn.Dead && !this.Pawn.Downed)
            {
                base.CompPostTick(ref severityAdjustment);
                if (base.Pawn != null & base.parent != null)
                {
                    if (!initialized)
                    {
                        initialized = true;
                        this.Initialize();
                    }
                }

                CompAbilityUserMight comp = this.Pawn.GetComp <CompAbilityUserMight>();
                if (this.doPsionicAttack)
                {
                    this.ticksTillPsionicStrike--;
                    if (this.ticksTillPsionicStrike <= 0)
                    {
                        this.doPsionicAttack = false;
                        MightPowerSkill ver = comp.MightData.MightPowerSkill_PsionicAugmentation.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicAugmentation_ver");
                        if (!threat.Destroyed && !threat.Dead)
                        {
                            TM_MoteMaker.MakePowerBeamMotePsionic(threat.DrawPos.ToIntVec3(), threat.Map, 2f, 2f, .7f, .1f, .6f);
                            DamageInfo dinfo2 = new DamageInfo(TMDamageDefOf.DamageDefOf.TM_PsionicInjury, Rand.Range(6, 12) + (2 * ver.level), 0, -1, this.Pawn, null, null, DamageInfo.SourceCategory.ThingOrUnknown, this.threat);
                            this.threat.TakeDamage(dinfo2);
                        }
                    }
                }

                if (Find.TickManager.TicksGame % 60 == 0)
                {
                    severityAdjustment += (this.Pawn.GetStatValue(StatDefOf.PsychicSensitivity, false) * Rand.Range(.04f, .12f));
                    if (Find.Selector.FirstSelectedObject == this.Pawn)
                    {
                        HediffStage hediffStage = this.Pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).CurStage;
                        hediffStage.label = this.parent.Severity.ToString("0.00") + "%";
                    }
                }

                if (comp.usePsionicAugmentationToggle)
                {
                    if (Find.TickManager.TicksGame % 600 == 0 && !this.Pawn.Drafted)
                    {
                        if (this.parent.Severity >= 95 && this.Pawn.CurJob.targetA.Thing != null)
                        {
                            DeterminePsionicHD();
                            if ((this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal > 20 && (this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal < 300 && this.Pawn.CurJob.locomotionUrgency >= LocomotionUrgency.Jog && this.Pawn.CurJob.bill == null)
                            {
                                this.parent.Severity -= 10f;
                                if (this.EffVal == 0)
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD"), 1f + .02f * this.EffVal);
                                }
                                else if (this.EffVal == 1)
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD_I"), 1f + .02f * this.EffVal);
                                }
                                else if (this.EffVal == 2)
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD_II"), 1f + .02f * this.EffVal);
                                }
                                else
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicSpeedHD_III"), 1f + .02f * this.EffVal);
                                }
                                for (int i = 0; i < 12; i++)
                                {
                                    float direction = Rand.Range(0, 360);
                                    TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                }
                            }

                            if (this.Pawn.CurJob.targetA.Thing != null && (this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal < 2 && this.Pawn.CurJob.bill != null)
                            {
                                this.parent.Severity -= 6f;
                                if (this.PwrVal == 0)
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD"), 1f + .02f * this.PwrVal);
                                }
                                else if (this.PwrVal == 1)
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD_I"), 1f + .02f * this.PwrVal);
                                }
                                else if (this.PwrVal == 2)
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD_II"), 1f + .02f * this.PwrVal);
                                }
                                else
                                {
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicManipulationHD_III"), 1f + .02f * this.PwrVal);
                                }
                                for (int i = 0; i < 12; i++)
                                {
                                    float direction = Rand.Range(0, 360);
                                    TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                }
                            }
                        }
                    }

                    if (this.parent.Severity >= 20)
                    {
                        DeterminePsionicHD();
                        if (Find.TickManager.TicksGame % 180 == 0 && (this.Pawn.Drafted || !this.Pawn.IsColonist) && this.Pawn.equipment.Primary != null && !this.Pawn.equipment.Primary.def.IsRangedWeapon)
                        {
                            if (this.Pawn.CurJob.targetA.Thing != null && this.Pawn.CurJob.targetA.Thing is Pawn)
                            {
                                float targetDistance = (this.Pawn.Position - this.Pawn.CurJob.targetA.Thing.Position).LengthHorizontal;
                                if (targetDistance > 3 && targetDistance < (12 + EffVal))
                                {
                                    for (int i = 0; i < 12; i++)
                                    {
                                        float direction = Rand.Range(0, 360);
                                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                    }
                                    FlyingObject_PsionicLeap flyingObject = (FlyingObject_PsionicLeap)GenSpawn.Spawn(ThingDef.Named("FlyingObject_PsionicLeap"), this.Pawn.Position, this.Pawn.Map);
                                    flyingObject.Launch(this.Pawn, this.Pawn.CurJob.targetA.Thing, this.Pawn);
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicHD"), -5f);
                                }
                            }
                        }

                        if (Find.TickManager.TicksGame % (600 - (60 * VerVal)) == 0 && this.Pawn.Drafted)
                        {
                            if (this.Pawn.CurJob.def != TorannMagicDefOf.JobDriver_PsionicBarrier && VerVal > 0)
                            {
                                this.threat = GetNearbyTarget(20 + (4 * VerVal));
                                if (threat != null)
                                {
                                    //start psionic attack; ends after delay
                                    SoundInfo info = SoundInfo.InMap(new TargetInfo(this.Pawn.Position, this.Pawn.Map, false), MaintenanceType.None);
                                    TorannMagicDefOf.TM_Implosion.PlayOneShot(info);
                                    Effecter psionicAttack = TorannMagicDefOf.TM_GiantExplosion.Spawn();
                                    psionicAttack.Trigger(new TargetInfo(threat.Position, threat.Map, false), new TargetInfo(threat.Position, threat.Map, false));
                                    psionicAttack.Cleanup();
                                    for (int i = 0; i < 12; i++)
                                    {
                                        float direction = Rand.Range(0, 360);
                                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Psi"), this.Pawn.DrawPos, this.Pawn.Map, Rand.Range(.1f, .4f), 0.2f, .02f, .1f, 0, Rand.Range(8, 10), direction, direction);
                                    }
                                    HealthUtility.AdjustSeverity(this.Pawn, HediffDef.Named("TM_PsionicHD"), -(9f - VerVal));
                                    this.doPsionicAttack        = true;
                                    this.ticksTillPsionicStrike = 24;
                                }
                            }
                        }
                    }
                }
            }
        }