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

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

            if (!this.initialized)
            {
                caster = this.launcher as Pawn;
                CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();
                MagicPowerSkill      pwr  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_OrbitalStrike.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_OrbitalStrike_pwr");
                MagicPowerSkill      ver  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_OrbitalStrike.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_OrbitalStrike_ver");
                verVal         = ver.level;
                pwrVal         = pwr.level;
                this.arcaneDmg = comp.arcaneDmg;
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                if (settingsRef.AIHardMode && !caster.IsColonist)
                {
                    pwrVal = 3;
                    verVal = 3;
                }
                this.angle     = Rand.Range(-3f, 3f);
                this.strikeNum = 1;
                this.CheckSpawnSustainer();
                this.strikePos     = base.Position;
                this.targettingAge = 300 - (50 * verVal);
                this.beamDuration  = 120 - (10 * verVal);
                this.radius        = this.def.projectile.explosionRadius;
                this.initialized   = true;
            }

            if (this.sustainer != null)
            {
                this.sustainer.info.volumeFactor = (this.age) / (this.beamDuration + this.targettingAge);
                this.sustainer.Maintain();
                if (this.TicksLeft <= 0)
                {
                    this.sustainer.End();
                    this.sustainer = null;
                }
            }

            if (this.age == (this.targettingAge + this.beamDuration))
            {
                TM_MoteMaker.MakePowerBeamMoteColor(this.strikePos, base.Map, this.radius * 4f, 2f, .5f, .1f, .5f, colorInt.ToColor);
                GenExplosion.DoExplosion(this.strikePos, map, this.def.projectile.explosionRadius, DamageDefOf.Bomb, this.launcher as Pawn, Mathf.RoundToInt((25 + 5 * pwrVal) * this.arcaneDmg), 0, null, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
                Effecter OSEffect = TorannMagicDefOf.TM_OSExplosion.Spawn();
                OSEffect.Trigger(new TargetInfo(this.strikePos, this.Map, false), new TargetInfo(this.strikePos, this.Map, false));
                OSEffect.Cleanup();
            }
            else
            {
                if (Find.TickManager.TicksGame % 3 == 0)
                {
                    TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_BloodSquirt, this.strikePos.ToVector3Shifted(), this.Map, .3f, .1f, 0, 0, Rand.Range(-100, 100), 0, 0, Rand.Range(0, 360));
                }
            }
        }
Exemple #2
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            if (!this.initialized)
            {
                caster = this.launcher as Pawn;
                CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();
                MagicPowerSkill      pwr  = comp.MagicData.MagicPowerSkill_HolyWrath.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_HolyWrath_pwr");
                MagicPowerSkill      ver  = comp.MagicData.MagicPowerSkill_HolyWrath.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_HolyWrath_ver");
                verVal         = ver.level;
                pwrVal         = pwr.level;
                this.arcaneDmg = comp.arcaneDmg;
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                if (settingsRef.AIHardMode && !caster.IsColonist)
                {
                    pwrVal = 1;
                    verVal = 1;
                }
                this.angle     = Rand.Range(-12f, 12f);
                this.strikeNum = 5 + pwrVal;
                IntVec3 curCell = base.Position;
                this.CheckSpawnSustainer();
                this.GetSmites(curCell, map);
                this.GetAffectedPawns(curCell, map);
                this.initialized = true;
            }

            if (this.sustainer != null)
            {
                this.sustainer.info.volumeFactor = this.age / this.timeToSmite;
                this.sustainer.Maintain();
                if (this.TicksLeft <= 0)
                {
                    this.sustainer.End();
                    this.sustainer = null;
                }
            }

            for (int j = 0; j < smitePos.Count; j++)
            {
                if (wrathAge[j] == this.timeToSmite / strikeNum)
                {
                    TM_MoteMaker.MakePowerBeamMoteColor(smitePos[j], base.Map, this.radius * 3f, 2f, .5f, .1f, .5f, colorInt.ToColor);
                    this.caster = this.launcher as Pawn;
                    CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();
                    GenExplosion.DoExplosion(smitePos[j], map, 3f, TMDamageDefOf.DamageDefOf.TM_Overwhelm, this.launcher as Pawn, Mathf.RoundToInt((12 + TMDamageDefOf.DamageDefOf.TM_Overwhelm.defaultDamage + (3 * pwrVal)) * this.arcaneDmg), 0, TorannMagicDefOf.TM_Lightning, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
                }
            }
        }
Exemple #3
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            if (!this.initialized)
            {
                if (this.launcher is Pawn)
                {
                    caster = this.launcher as Pawn;
                    CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();
                    MagicPowerSkill      ver  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Resurrection.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Resurrection_ver");
                    MagicPowerSkill      pwr  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Resurrection.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Resurrection_eff");
                    verVal = ver.level;
                    pwrVal = pwr.level;
                }
                this.angle = Rand.Range(-12f, 12f);

                IntVec3 curCell = base.Position;

                this.CheckSpawnSustainer();

                if (curCell.InBounds(map))
                {
                    Corpse       corpse = null;
                    List <Thing> thingList;
                    thingList = curCell.GetThingList(map);
                    int z = 0;
                    while (z < thingList.Count)
                    {
                        corpseThing = thingList[z];
                        if (corpseThing != null)
                        {
                            bool validator = corpseThing is Corpse;
                            if (validator)
                            {
                                corpse = corpseThing as Corpse;
                                CompRottable compRot = corpse.GetComp <CompRottable>();

                                deadPawn         = corpse.InnerPawn;
                                deadPawnPosition = corpse.Position;
                                if (deadPawn.RaceProps.IsFlesh && !TM_Calc.IsUndead(deadPawn) && compRot != null)
                                {
                                    if (!corpse.IsNotFresh())
                                    {
                                        z = thingList.Count;
                                        this.validTarget = true;
                                        corpse.SetForbidden(true);
                                    }
                                    else
                                    {
                                        Messages.Message("TM_ResurrectionTargetExpired".Translate(), MessageTypeDefOf.RejectInput);
                                    }
                                }
                                if (TM_Calc.IsUndead(deadPawn))
                                {
                                    z = thingList.Count;
                                    this.validTarget = true;
                                }
                            }
                        }
                        z++;
                    }
                }
                this.initialized = true;
            }

            if (corpseThing.Position != this.deadPawnPosition || corpseThing.Map == null)
            {
                Log.Message("Corpse was moved or destroyed during resurrection process.");
                this.age = this.timeToRaise;
            }

            if (this.validTarget)
            {
                if (this.sustainer != null)
                {
                    this.sustainer.info.volumeFactor = this.age / this.timeToRaise;
                    this.sustainer.Maintain();
                    if (this.TicksLeft <= 0)
                    {
                        this.sustainer.End();
                        this.sustainer = null;
                    }
                }

                if (this.age + 1 == this.timeToRaise)
                {
                    TM_MoteMaker.MakePowerBeamMoteColor(base.Position, base.Map, this.radius * 3f, 2f, 2f, .1f, 1.5f, colorInt.ToColor);
                    if (this.deadPawn == null)
                    {
                        if (corpseThing != null)
                        {
                            Corpse corpse = corpseThing as Corpse;
                            if (corpse != null)
                            {
                                this.deadPawn = corpse.InnerPawn;
                            }
                        }
                    }
                    if (deadPawn != null)
                    {
                        if (TM_Calc.IsUndead(deadPawn))
                        {
                            if (deadPawn.RaceProps.Humanlike)
                            {
                                GenExplosion.DoExplosion(base.Position, this.Map, Rand.Range(10, 16), TMDamageDefOf.DamageDefOf.TM_Holy, this.launcher, Mathf.RoundToInt(Rand.Range(20, 32)), 6, TMDamageDefOf.DamageDefOf.TM_Holy.soundExplosion);
                            }
                            else
                            {
                                GenExplosion.DoExplosion(base.Position, this.Map, Rand.Range(10, 16), TMDamageDefOf.DamageDefOf.TM_Holy, this.launcher, Mathf.RoundToInt(Rand.Range(16, 24)), 3, TMDamageDefOf.DamageDefOf.TM_Holy.soundExplosion);
                            }
                        }
                        else
                        {
                            if (!deadPawn.kindDef.RaceProps.Animal && deadPawn.kindDef.RaceProps.Humanlike)
                            {
                                ResurrectionUtility.ResurrectWithSideEffects(deadPawn);
                                SoundDef.Named("Thunder_OffMap").PlayOneShot(null);
                                SoundDef.Named("Thunder_OffMap").PlayOneShot(null);
                                using (IEnumerator <Hediff> enumerator = deadPawn.health.hediffSet.GetHediffs <Hediff>().GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        Hediff rec = enumerator.Current;
                                        if (rec.def.defName == "ResurrectionPsychosis")
                                        {
                                            if (Rand.Chance(verVal * .33f))
                                            {
                                                deadPawn.health.RemoveHediff(rec);
                                            }
                                        }
                                    }
                                }
                                HealthUtility.AdjustSeverity(deadPawn, HediffDef.Named("TM_ResurrectionHD"), 1f);
                                ReduceSkillsOfPawn(deadPawn, (.35f - .035f * pwrVal));
                                ApplyHealthDefects(deadPawn, .6f - (.06f * verVal), .3f - .03f * verVal);
                            }
                            if (deadPawn.kindDef.RaceProps.Animal)
                            {
                                ResurrectionUtility.Resurrect(deadPawn);
                                HealthUtility.AdjustSeverity(deadPawn, HediffDef.Named("TM_ResurrectionHD"), 1f);
                            }
                        }
                    }
                }
            }
            else
            {
                Messages.Message("TM_InvalidResurrection".Translate(
                                     caster.LabelShort
                                     ), MessageTypeDefOf.RejectInput);
                this.age = this.timeToRaise;
            }
        }
Exemple #4
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            if (!this.initialized)
            {
                caster = this.launcher as Pawn;
                CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();
                MagicPowerSkill      ver  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Resurrection.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Resurrection_ver");
                verVal     = ver.level;
                this.angle = Rand.Range(-12f, 12f);

                Thing   corpseThing = null;
                IntVec3 curCell     = base.Position;

                this.CheckSpawnSustainer();

                if (curCell.InBounds(map) && curCell.IsValid)
                {
                    Corpse       corpse = null;
                    List <Thing> thingList;
                    thingList = curCell.GetThingList(map);
                    int z = 0;
                    while (z < thingList.Count)
                    {
                        corpseThing = thingList[z];
                        if (corpseThing != null)
                        {
                            bool validator = corpseThing is Corpse;
                            if (validator)
                            {
                                corpse   = corpseThing as Corpse;
                                deadPawn = corpse.InnerPawn;
                                if (deadPawn.RaceProps.IsFlesh)
                                {
                                    if (!corpse.IsNotFresh())
                                    {
                                        z = thingList.Count;
                                        this.validTarget = true;
                                    }
                                    else
                                    {
                                        Messages.Message("TM_ResurrectionTargetExpired".Translate(), MessageTypeDefOf.RejectInput);
                                    }
                                }
                            }
                        }
                        z++;
                    }
                }
                this.initialized = true;
            }

            if (this.validTarget)
            {
                if (this.sustainer != null)
                {
                    this.sustainer.info.volumeFactor = this.age / this.timeToRaise;
                    this.sustainer.Maintain();
                    if (this.TicksLeft <= 0)
                    {
                        this.sustainer.End();
                        this.sustainer = null;
                    }
                }

                if (this.age + 1 == this.timeToRaise)
                {
                    TM_MoteMaker.MakePowerBeamMoteColor(base.Position, base.Map, this.radius * 3f, 2f, 2f, .1f, 1.5f, colorInt.ToColor);
                    if (!deadPawn.kindDef.RaceProps.Animal && deadPawn.kindDef.RaceProps.Humanlike)
                    {
                        ResurrectionUtility.ResurrectWithSideEffects(deadPawn);
                        SoundDef.Named("Thunder_OffMap").PlayOneShot(null);
                        SoundDef.Named("Thunder_OffMap").PlayOneShot(null);
                        using (IEnumerator <Hediff> enumerator = deadPawn.health.hediffSet.GetHediffs <Hediff>().GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                Hediff rec = enumerator.Current;
                                if (rec.def.defName == "ResurrectionPsychosis" || rec.def.defName == "Blindness")
                                {
                                    if (Rand.Chance(verVal * .33f))
                                    {
                                        deadPawn.health.RemoveHediff(rec);
                                    }
                                }
                            }
                        }
                        HealthUtility.AdjustSeverity(deadPawn, HediffDef.Named("TM_ResurrectionHD"), 1f);
                    }
                    if (deadPawn.kindDef.RaceProps.Animal)
                    {
                        ResurrectionUtility.Resurrect(deadPawn);
                        HealthUtility.AdjustSeverity(deadPawn, HediffDef.Named("TM_ResurrectionHD"), 1f);
                    }
                }
            }
            else
            {
                Messages.Message("TM_InvalidResurrection".Translate(new object[]
                {
                    caster.LabelShort
                }), MessageTypeDefOf.RejectInput);
                this.age = this.timeToRaise;
            }
            this.age++;
        }