コード例 #1
0
        private void Initialize(Pawn pawn)
        {
            GenClamor.DoClamor(this.launcher, 5f, ClamorDefOf.Impact);
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();

            pwr = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Overwhelm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Overwhelm_pwr");
            ver = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Overwhelm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Overwhelm_ver");
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            pwrVal = pwr.level;
            verVal = ver.level;
            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            this.arcaneDmg = comp.arcaneDmg;
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }
            this.strikeNum = 1;
            initialized    = true;
        }
コード例 #2
0
ファイル: Verb_TimeMark.cs プロジェクト: Lucas559-noob/TMagic
        protected override bool TryCastShot()
        {
            bool result = false;

            map  = this.CasterPawn.Map;
            comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill pwr = comp.MagicData.MagicPowerSkill_Recall.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Recall_pwr");

            pwrVal = pwr.level;

            if (this.CasterPawn != null && !this.CasterPawn.Downed && comp != null)
            {
                SetRecallHediffs();
                SetRecallNeeds();
                SetRecallPosition();
                comp.recallSet        = true;
                comp.recallExpiration = Mathf.RoundToInt(Find.TickManager.TicksGame + (20 * 2500 * (1 + (.2f * pwrVal))));
                TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_AlterFate, CasterPawn.DrawPos, this.CasterPawn.Map, 1f, .2f, 0, 1f, Rand.Range(-500, 500), 0, 0, Rand.Range(0, 360));
                MoteMaker.ThrowHeatGlow(this.CasterPawn.Position, this.CasterPawn.Map, 1.4f);
            }
            else
            {
                Log.Warning("failed to TryCastShot");
            }

            this.burstShotsLeft = 0;
            return(result);
        }
コード例 #3
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            //GenExplosion.DoExplosion(base.Position, map, this.def.projectile.explosionRadius, DamageDefOf.Bomb, this.launcher, SoundDefOf.PlanetkillerImpact, def, this.equipmentDef, null, 0f, 1, false, null, 0f, 1);
            GenExplosion.DoExplosion(base.Position, map, this.def.projectile.explosionRadius, DamageDefOf.Bomb, this.launcher, this.def.projectile.damageAmountBase, SoundDefOf.PlanetkillerImpact, def, this.equipmentDef, null, 0f, 1, false, null, 0f, 1, 0.1f, true);
            CellRect cellRect = CellRect.CenteredOn(base.Position, 6);

            cellRect.ClipInsideMap(map);
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            Pawn pawn = this.launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Fireball.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Fireball_pwr");
            MagicPowerSkill      ver  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Fireball.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Fireball_ver");

            pwrVal = pwr.level;
            verVal = ver.level;
            if (settingsRef.AIHardMode && !pawn.IsColonistPlayerControlled)
            {
                pwrVal = 3;
                verVal = 3;
            }
            for (int i = 0; i < (pwrVal * 4); i++)
            {
                IntVec3 randomCell = cellRect.RandomCell;
                if (randomCell.IsValid && randomCell.InBounds(map))
                {
                    this.FireExplosion(randomCell, map, 2.2f, ver);
                }
            }
        }
コード例 #4
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;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Firebolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Firebolt_pwr");

            //GenExplosion.DoExplosion(base.Position, map, 0.4f, TMDamageDefOf.DamageDefOf.Firebolt, this.launcher, this.def.projectile.soundExplode, def, this.equipmentDef, null, 0f, 1, false, null, 0f, 1);
            GenExplosion.DoExplosion(base.Position, map, 0.4f, TMDamageDefOf.DamageDefOf.Firebolt, this.launcher, this.def.projectile.damageAmountBase, this.def.projectile.soundExplode, def, this.equipmentDef, null, 0f, 1, false, null, 0f, 1, 0.6f, false);
            CellRect cellRect = CellRect.CenteredOn(base.Position, 3);

            cellRect.ClipInsideMap(map);

            victim = base.Position.GetFirstPawn(map);
            if (victim != null)
            {
                int dmg = (this.def.projectile.damageAmountBase / 2) * pwr.level;  //projectile = 22
                if (settingsRef.AIHardMode && !pawn.IsColonistPlayerControlled)
                {
                    dmg += 10;
                }
                damageEntities(victim, dmg, TMDamageDefOf.DamageDefOf.Firebolt);
            }
        }
コード例 #5
0
        protected override bool TryCastShot()
        {
            Pawn caster = base.CasterPawn;
            Pawn pawn   = this.currentTarget.Thing as Pawn;

            comp = caster.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill bpwr = comp.MagicData.MagicPowerSkill_BloodGift.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_BloodGift_pwr");
            MagicPowerSkill pwr  = comp.MagicData.MagicPowerSkill_BloodShield.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_BloodShield_pwr");

            pwrVal = pwr.level;
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (caster.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                pwrVal = caster.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr").level;
            }
            if (settingsRef.AIHardMode && !caster.IsColonist)
            {
                pwrVal = 3;
            }
            this.arcaneDmg  = comp.arcaneDmg;
            this.arcaneDmg *= 1f + (.1f * bpwr.level);

            if (pawn != null && pawn != this.CasterPawn)
            {
                ApplyBloodShield(pawn);
            }
            else
            {
                Messages.Message("TM_InvalidTarget".Translate(this.CasterPawn.LabelShort, TorannMagicDefOf.TM_BloodShield.label), MessageTypeDefOf.RejectInput);
            }

            return(true);
        }
コード例 #6
0
        protected void FireExplosion(IntVec3 pos, Map map, float radius, MagicPowerSkill ver)
        {
            ThingDef def = this.def;

            if (verVal == 0)
            {
                Explosion(pos, map, radius, DamageDefOf.Flame, this.launcher, null, def, this.equipmentDef, ThingDefOf.Mote_ExplosionFlash, 0.3f, 1, false, null, 0f, 1);
            }
            else if (verVal == 1)
            {
                Explosion(pos, map, radius, TMDamageDefOf.DamageDefOf.TM_Fireball_I, this.launcher, null, def, this.equipmentDef, ThingDefOf.Mote_ExplosionFlash, 0.5f, 1, false, null, 0f, 1);
            }
            else if (verVal == 2)
            {
                Explosion(pos, map, radius, TMDamageDefOf.DamageDefOf.TM_Fireball_II, this.launcher, null, def, this.equipmentDef, ThingDefOf.Mote_ExplosionFlash, 0.8f, 1, false, null, 0f, 1);
            }
            else if (verVal == 3)
            {
                Explosion(pos, map, radius, TMDamageDefOf.DamageDefOf.TM_Fireball_III, this.launcher, null, def, this.equipmentDef, ThingDefOf.Mote_ExplosionFlash, 1.1f, 1, false, null, 0f, 1);
            }
            else
            {
                Log.Message("Fireball Versatility level not recognized: " + verVal);
            }
        }
コード例 #7
0
ファイル: Verb_DeathMark.cs プロジェクト: SihvMan/TMagic
        protected override bool TryCastShot()
        {
            bool result = false;

            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            pwr = comp.MagicData.MagicPowerSkill_DeathMark.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_DeathMark_pwr");
            ver = comp.MagicData.MagicPowerSkill_DeathMark.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_DeathMark_ver");


            if (this.currentTarget != null && base.CasterPawn != null)
            {
                Pawn p   = this.CasterPawn;
                Map  map = this.CasterPawn.Map;
                this.TargetsAoE.Clear();
                this.UpdateTargets();
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                for (int i = 0; i < this.TargetsAoE.Count; i++)
                {
                    if (this.TargetsAoE[i].Thing is Pawn)
                    {
                        Pawn victim = this.TargetsAoE[i].Thing as Pawn;
                        if (!victim.RaceProps.IsMechanoid)
                        {
                            HealthUtility.AdjustSeverity(victim, HediffDef.Named("TM_DeathMarkCurse"), Rand.Range(1f + pwr.level, 4 + 2 * pwr.level));
                            TM_MoteMaker.ThrowSiphonMote(victim.DrawPos, victim.Map, 1f);
                            if (comp.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_LichHD"), false))
                            {
                                comp.PowerModifier += 1;
                            }

                            if (Rand.Chance(ver.level * .2f))
                            {
                                if (Rand.Chance(ver.level * .1f)) //terror
                                {
                                    HealthUtility.AdjustSeverity(victim, HediffDef.Named("TM_Terror"), Rand.Range(3f * ver.level, 5f * ver.level));
                                    TM_MoteMaker.ThrowDiseaseMote(victim.DrawPos, victim.Map, 1f, .5f, .2f, .4f);
                                    MoteMaker.ThrowText(victim.DrawPos, victim.Map, "Terror", -1);
                                }
                                if (Rand.Chance(ver.level * .1f)) //berserk
                                {
                                    if (victim.mindState != null && victim.RaceProps != null && victim.RaceProps.Humanlike)
                                    {
                                        victim.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, "cursed", true, false, null);
                                        MoteMaker.ThrowMicroSparks(victim.DrawPos, victim.Map);
                                        MoteMaker.ThrowText(victim.DrawPos, victim.Map, "Berserk", -1);
                                    }
                                }
                            }
                        }
                    }
                }

                result = true;
            }

            this.burstShotsLeft = 0;
            //this.ability.TicksUntilCasting = (int)base.UseAbilityProps.SecondsToRecharge * 60;
            return(result);
        }
コード例 #8
0
        public void Launch(Thing launcher, Vector3 origin, LocalTargetInfo targ, Thing flyingThing, DamageInfo?newDamageInfo = null)
        {
            bool spawned = flyingThing.Spawned;

            pawn = launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();

            this.arcaneDmg = comp.arcaneDmg;
            MagicPowerSkill pwr = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_EyeOfTheStorm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_EyeOfTheStorm_pwr");
            MagicPowerSkill ver = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_EyeOfTheStorm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_EyeOfTheStorm_ver");

            verVal = ver.level;
            pwrVal = pwr.level;
            if (spawned)
            {
                flyingThing.DeSpawn();
            }
            this.launcher     = launcher;
            this.origin       = origin;
            this.impactDamage = newDamageInfo;
            this.flyingThing  = flyingThing;
            bool flag = targ.Thing != null;

            if (flag)
            {
                this.assignedTarget = targ.Thing;
            }
            this.destination   = targ.Cell.ToVector3Shifted() + new Vector3(Rand.Range(-0.3f, 0.3f), 0f, Rand.Range(-0.3f, 0.3f));
            this.ticksToImpact = this.StartingTicksToImpact;
            this.Initialize();
        }
コード例 #9
0
        public override void Impact_Override(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact_Override(hitThing);

            Pawn pawn = this.launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_LightningBolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightningBolt_pwr");
            MagicPowerSkill      ver  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_LightningBolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightningBolt_ver");

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            pwrVal = pwr.level;
            verVal = ver.level;
            if (settingsRef.AIHardMode && !pawn.IsColonistPlayerControlled)
            {
                pwrVal = 3;
                verVal = 3;
            }
            bool flag = hitThing != null;

            if (flag)
            {
                int        damageAmountBase = this.def.projectile.damageAmountBase + (pwrVal * 9);
                DamageInfo dinfo            = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown);
                hitThing.TakeDamage(dinfo);

                bool flag2 = this.canStartFire && Rand.Range(0f, 1f) > this.startFireChance;
                if (flag2)
                {
                    hitThing.TryAttachFire(0.05f);
                }
                Pawn hitTarget;
                bool flag3 = (hitTarget = (hitThing as Pawn)) != null;
                if (flag3)
                {
                    this.PostImpactEffects(this.launcher as Pawn, hitTarget);
                    MoteMaker.ThrowMicroSparks(this.destination, base.Map);
                    MoteMaker.MakeStaticMote(this.destination, base.Map, ThingDefOf.Mote_ShotHit_Dirt, 1f);
                }
            }
            else
            {
                MoteMaker.MakeStaticMote(this.ExactPosition, base.Map, ThingDefOf.Mote_ShotHit_Dirt, 1f);
                MoteMaker.ThrowMicroSparks(this.ExactPosition, base.Map);
            }
            for (int i = 0; i <= verVal; i++)
            {
                SoundInfo info = SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None);
                SoundDefOf.Thunder_OnMap.PlayOneShot(info);
            }
            CellRect cellRect = CellRect.CenteredOn(hitThing.Position, 2);

            cellRect.ClipInsideMap(map);
            for (int i = 0; i < Rand.Range(verVal, verVal * 4); i++)
            {
                IntVec3 randomCell = cellRect.RandomCell;
                this.StaticExplosion(randomCell, map, 0.4f);
            }
        }
コード例 #10
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));
                }
            }
        }
コード例 #11
0
        protected override bool TryCastShot()
        {
            bool result = false;

            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            pwr = comp.MagicData.MagicPowerSkill_DeathMark.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_DeathMark_pwr");
            ver = comp.MagicData.MagicPowerSkill_DeathMark.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_DeathMark_ver");


            if (this.currentTarget != null && base.CasterPawn != null)
            {
                Pawn p   = this.CasterPawn;
                Map  map = this.CasterPawn.Map;
                this.TargetsAoE.Clear();
                this.UpdateTargets();
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                for (int i = 0; i < this.TargetsAoE.Count; i++)
                {
                    if (this.TargetsAoE[i].Thing is Pawn)
                    {
                        Pawn victim = this.TargetsAoE[i].Thing as Pawn;
                        if (!p.IsColonistPlayerControlled && settingsRef.AIHardMode)
                        {
                            if (Rand.Chance(.4f + .1f * (pwr.level)))
                            {
                                HealthUtility.AdjustSeverity(victim, TorannMagicDefOf.TM_DeathMarkHD, 6 - (ver.level * 2));
                                TM_MoteMaker.ThrowPoisonMote(victim.Position.ToVector3(), victim.Map, 1.5f);
                                TM_MoteMaker.ThrowPoisonMote(victim.Position.ToVector3(), victim.Map, 1.5f);
                            }
                            else
                            {
                                MoteMaker.ThrowText(victim.Position.ToVector3Shifted(), victim.Map, "TM_ResistedSpell".Translate(), -1);
                            }
                        }
                        else
                        {
                            if (Rand.Chance(.2f + .1f * (pwr.level)))
                            {
                                HealthUtility.AdjustSeverity(victim, TorannMagicDefOf.TM_DeathMarkHD, 15 - (ver.level * 2));
                                TM_MoteMaker.ThrowPoisonMote(victim.Position.ToVector3(), victim.Map, 1.5f);
                                TM_MoteMaker.ThrowPoisonMote(victim.Position.ToVector3(), victim.Map, 1.5f);
                            }
                            else
                            {
                                MoteMaker.ThrowText(victim.Position.ToVector3Shifted(), victim.Map, "TM_ResistedSpell".Translate(), -1);
                            }
                        }
                    }
                }

                result = true;
            }


            this.burstShotsLeft = 0;
            //this.ability.TicksUntilCasting = (int)base.UseAbilityProps.SecondsToRecharge * 60;
            return(result);
        }
コード例 #12
0
        public void Launch(Thing launcher, Vector3 origin, LocalTargetInfo targ, Thing flyingThing, DamageInfo?newDamageInfo = null)
        {
            bool spawned = flyingThing.Spawned;

            pawn = launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();

            foreach (MagicPower current in comp.MagicData.MagicPowersN)
            {
                if ((current.abilityDef == TorannMagicDefOf.TM_DeathBolt || current.abilityDef == TorannMagicDefOf.TM_DeathBolt_I || current.abilityDef == TorannMagicDefOf.TM_DeathBolt_II || current.abilityDef == TorannMagicDefOf.TM_DeathBolt_III))
                {
                    if (current.level == 0)
                    {
                        this.radius = 1.4f;
                    }
                    else if (current.level == 1)
                    {
                        this.radius = 2f;
                    }
                    else if (current.level == 2)
                    {
                        this.radius = 2f;
                    }
                    else
                    {
                        this.radius = 2.4f;
                    }
                }
            }

            this.arcaneDmg = comp.arcaneDmg;
            MagicPowerSkill pwr = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_DeathBolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_DeathBolt_pwr");
            MagicPowerSkill ver = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_DeathBolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_DeathBolt_ver");

            verVal = ver.level;
            pwrVal = pwr.level;
            if (spawned)
            {
                flyingThing.DeSpawn();
            }
            this.launcher     = launcher;
            this.origin       = origin;
            this.impactDamage = newDamageInfo;
            this.speed        = this.def.projectile.speed;
            this.flyingThing  = flyingThing;
            bool flag = targ.Thing != null;

            if (flag)
            {
                this.assignedTarget = targ.Thing;
            }
            float distanceAccuracyModifier = (targ.Cell.ToVector3Shifted() - this.launcher.Position.ToVector3Shifted()).MagnitudeHorizontal() * .1f;

            this.destination   = targ.Cell.ToVector3Shifted() + new Vector3(Rand.Range(-distanceAccuracyModifier, distanceAccuracyModifier), 0f, Rand.Range(-distanceAccuracyModifier, distanceAccuracyModifier));
            this.ticksToImpact = this.StartingTicksToImpact;
            this.Initialize();
        }
コード例 #13
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact(hitThing);

            Pawn pawn = this.launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_LightningStorm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightningStorm_pwr");
            MagicPowerSkill      ver  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_LightningStorm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightningStorm_ver");

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            pwrVal = pwr.level;
            verVal = ver.level;
            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            this.arcaneDmg = comp.arcaneDmg;
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }

            duration = 480 + (verVal * 60);
            CellRect cellRect = CellRect.CenteredOn(base.Position, 8);

            cellRect.ClipInsideMap(map);

            if (this.primed == true)
            {
                if (((this.boltDelay + this.lastStrike) < this.age))
                {
                    IntVec3 randomCell = cellRect.RandomCell;
                    if (randomCell.IsValid && randomCell.InBounds(base.Map))
                    {
                        Map.weatherManager.eventHandler.AddEvent(new WeatherEvent_LightningStrike(map, randomCell));
                        this.LightningBlast(pwrVal, randomCell, map, 2.2f);
                        strikeInt++;
                        this.lastStrike = this.age;
                        this.boltDelay  = Rand.Range(8 - (pwrVal), 40 - (pwrVal * 4));

                        bool flag1 = this.age <= duration;
                        if (!flag1)
                        {
                            this.primed = false;
                            map.weatherDecider.DisableRainFor(0);
                            map.weatherDecider.StartNextWeather();
                        }
                    }
                }
            }
        }
コード例 #14
0
        protected override bool TryCastShot()
        {
            bool            flag = false;
            MagicPowerSkill bpwr = base.CasterPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_BloodGift.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_BloodGift_pwr");
            MagicPowerSkill pwr  = base.CasterPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_BloodForBlood.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_BloodForBlood_pwr");
            MagicPowerSkill ver  = base.CasterPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_BloodForBlood.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_BloodForBlood_ver");

            verVal = ver.level;
            pwrVal = pwr.level;
            if (base.CasterPawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = base.CasterPawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = base.CasterPawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            this.arcaneDmg  = base.CasterPawn.GetComp <CompAbilityUserMagic>().arcaneDmg;
            this.arcaneDmg *= 1 + (.1f * bpwr.level);
            if (this.currentTarget.Thing != null && this.currentTarget.Thing is Pawn)
            {
                Pawn victim = this.currentTarget.Thing as Pawn;
                if (victim.RaceProps.BloodDef != null && victim != this.CasterPawn)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        TM_MoteMaker.ThrowBloodSquirt(victim.DrawPos, victim.Map, Rand.Range(.6f, .9f));
                    }

                    HealthUtility.AdjustSeverity(victim, TorannMagicDefOf.TM_BloodForBloodHD, (.5f + (.1f * pwrVal)) * this.arcaneDmg);
                    if (victim.Faction == null && victim.RaceProps != null && victim.RaceProps.Animal && victim.mindState != null)
                    {
                        victim.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter, null, true, false, null);
                    }
                    HediffComp_BloodForBlood comp = victim.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_BloodForBloodHD, false).TryGetComp <HediffComp_BloodForBlood>();
                    if (comp != null)
                    {
                        comp.linkedPawn = this.CasterPawn;
                        if (victim.IsColonist && !base.CasterPawn.IsColonist)
                        {
                            TM_Action.SpellAffectedPlayerWarning(victim);
                        }
                    }
                    else
                    {
                        Messages.Message("TM_InvalidTarget".Translate(this.CasterPawn.LabelShort, TorannMagicDefOf.TM_BloodForBlood.label), MessageTypeDefOf.RejectInput);
                    }
                }
                else
                {
                    Messages.Message("TM_InvalidTarget".Translate(this.CasterPawn.LabelShort, TorannMagicDefOf.TM_BloodForBlood.label), MessageTypeDefOf.RejectInput);
                }
            }

            this.PostCastShot(flag, out flag);
            return(flag);
        }
コード例 #15
0
        protected override void Impact(Thing hitThing)
        {
            ThingDef def = this.def;

            if (!this.initialized)
            {
                this.pawn = this.launcher as Pawn;
                this.map  = this.pawn.Map;
                CompAbilityUserMagic   comp        = pawn.GetComp <CompAbilityUserMagic>();
                MagicPowerSkill        pwr         = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_LightSkip.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightSkip_pwr");
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                pwrVal         = pwr.level;
                this.arcaneDmg = comp.arcaneDmg;
                if (settingsRef.AIHardMode && !pawn.IsColonist)
                {
                    pwrVal = 1;
                    verVal = 1;
                }
                this.draftFlag   = this.pawn.drafter != null ? this.pawn.Drafted : false;
                this.initialized = true;
            }

            if (!launchedFlag)
            {
                Pawn pawnToSkip = this.pawn;
                Pawn mount      = null;
                ModOptions.Constants.SetPawnInFlight(true);
                if (ModCheck.Validate.GiddyUp.Core_IsInitialized())
                {
                    mount = ModCheck.GiddyUp.GetMount(this.pawn);
                    ModCheck.GiddyUp.ForceDismount(pawn);
                }
                Thing           pod  = ThingMaker.MakeThing(TorannMagicDefOf.TM_LightPod, null);
                CompLaunchable  podL = pod.TryGetComp <CompLaunchable>();
                CompTransporter podT = podL.Transporter;
                GenSpawn.Spawn(pod, pawnToSkip.Position, pawnToSkip.Map, WipeMode.Vanish);
                podT.groupID = 11;
                pawnToSkip.DeSpawn();
                if (mount != null)
                {
                    mount.DeSpawn();
                    podT.innerContainer.TryAddOrTransfer(mount);
                }
                podT.innerContainer.TryAddOrTransfer(pawnToSkip);
                GlobalTargetInfo gti = new GlobalTargetInfo(base.Position, base.Map, false);
                LaunchLightPod(pod, podT, gti.Tile, gti.Cell);
                launchedFlag = true;
            }

            if (launchedFlag)
            {
                this.age++;
                this.Destroy(DestroyMode.Vanish);
            }
        }
コード例 #16
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            GenClamor.DoClamor(this, 5.1f, ClamorDefOf.Impact);
            if (initialized)
            {
                Destroy();
            }

            if (!initialized)
            {
                this.initialized = true;
                SpawnThings spawnThing = new SpawnThings();
                pawn = this.launcher as Pawn;
                MagicPowerSkill        pwr         = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_SummonPoppi.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_SummonPoppi_pwr");
                MagicPowerSkill        ver         = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_SummonPoppi.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_SummonPoppi_ver");
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                pwrVal         = pwr.level;
                verVal         = ver.level;
                this.arcaneDmg = pawn.GetComp <CompAbilityUserMagic>().arcaneDmg;
                if (settingsRef.AIHardMode && !pawn.IsColonist)
                {
                    pwrVal = 1;
                    verVal = 1;
                }
                CellRect cellRect = CellRect.CenteredOn(this.Position, 4);
                cellRect.ClipInsideMap(map);

                IntVec3       centerCell = cellRect.CenterCell;
                System.Random random     = new System.Random();
                random = new System.Random();

                for (int i = 0; i < 4 + pwrVal; i++)
                {
                    centerCell = cellRect.RandomCell;
                    if (centerCell.IsValid && centerCell.InBounds(pawn.Map) && centerCell.Standable(pawn.Map) && !centerCell.Fogged(pawn.Map))
                    {
                        spawnThing.factionDef = TorannMagicDefOf.TM_ElementalFaction;
                        spawnThing.spawnCount = 1;
                        spawnThing.temporary  = false;

                        spawnThing.def     = TorannMagicDefOf.TM_Poppi;
                        spawnThing.kindDef = PawnKindDef.Named("TM_Poppi");

                        MoteMaker.ThrowSmoke(centerCell.ToVector3(), map, 1 + pwrVal);
                        SingleSpawnLoop(spawnThing, centerCell, map);
                    }
                    else
                    {
                        i--;
                    }
                }
            }
        }
コード例 #17
0
        protected override bool TryCastShot()
        {
            bool result = false;
            bool arg_40_0;

            Pawn pawn = this.CasterPawn;
            Map  map  = this.CasterPawn.Map;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_EnchantedBody.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_EnchantedBody_pwr");

            if (pawn != null && !pawn.Downed)
            {
                if (pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_EnchantedBodyHD))
                {
                    comp.MagicData.MagicPowersE.FirstOrDefault <MagicPower>((MagicPower x) => x.abilityDef == TorannMagicDefOf.TM_EnchantedBody).AutoCast = false;
                    pawn.health.RemoveHediff(pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_EnchantedBodyHD, false));
                    MoteMaker.ThrowHeatGlow(pawn.Position, pawn.Map, 1f);
                }

                if (pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_EnchantedAuraHD))
                {
                    comp.MagicData.MagicPowersStandalone.FirstOrDefault <MagicPower>((MagicPower x) => x.abilityDef == TorannMagicDefOf.TM_EnchantedAura).AutoCast = false;
                    pawn.health.RemoveHediff(pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_EnchantedAuraHD, false));
                    MoteMaker.ThrowHeatGlow(pawn.Position, pawn.Map, 1f);
                }
                else
                {
                    comp.MagicData.MagicPowersStandalone.FirstOrDefault <MagicPower>((MagicPower x) => x.abilityDef == TorannMagicDefOf.TM_EnchantedAura).AutoCast = true;
                    HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_EnchantedAuraHD, .5f + pwr.level);
                    for (int i = 0; i < 3; i++)
                    {
                        MoteMaker.ThrowSmoke(pawn.DrawPos, pawn.Map, Rand.Range(.6f, .8f));
                    }
                    MoteMaker.ThrowLightningGlow(pawn.DrawPos, pawn.Map, 1f);
                }
                arg_40_0 = true;
            }
            else
            {
                arg_40_0 = false;
            }
            bool flag = arg_40_0;

            if (flag)
            {
            }
            else
            {
                Log.Warning("failed to TryCastShot");
            }
            this.burstShotsLeft = 0;

            return(result);
        }
コード例 #18
0
        private void Initialize()
        {
            bool spawned = base.Pawn.Spawned;

            if (spawned)
            {
                MagicPowerSkill pwr = this.Pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Inspire.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Inspire_pwr");
                MagicPowerSkill ver = this.Pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Inspire.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Inspire_ver");
                this.pwrVal = pwr.level;
                this.verVal = ver.level;
            }
        }
コード例 #19
0
        public void Initialize(Map map)
        {
            pawn = this.launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();

            pwr      = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Blizzard.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Blizzard_pwr");
            ver      = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Blizzard.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Blizzard_ver");
            cellRect = CellRect.CenteredOn(base.Position, (int)(base.def.projectile.explosionRadius + (.75 * (ver.level + pwr.level))));
            cellRect.ClipInsideMap(map);
            duration    = duration + (90 * ver.level);
            initialized = true;
        }
コード例 #20
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);
                }
            }
        }
コード例 #21
0
        protected override bool TryCastShot()
        {
            bool flag = false;

            this.TargetsAoE.Clear();
            this.UpdateTargets();
            MagicPowerSkill pwr = base.CasterPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Lullaby.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Lullaby_pwr");
            MagicPowerSkill ver = base.CasterPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Lullaby.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Lullaby_ver");

            verVal = ver.level;
            pwrVal = pwr.level;
            if (base.CasterPawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = base.CasterPawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = base.CasterPawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            bool flag2 = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1;

            if (flag2)
            {
                this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1);
            }
            for (int i = 0; i < this.TargetsAoE.Count; i++)
            {
                Pawn newPawn = this.TargetsAoE[i].Thing as Pawn;
                if (newPawn.RaceProps.IsFlesh)
                {
                    if (Rand.Chance(.4f + (.1f * pwr.level) * TM_Calc.GetSpellSuccessChance(this.CasterPawn, newPawn, true)))
                    {
                        if (newPawn.InMentalState)
                        {
                            newPawn.mindState.mentalStateHandler.Reset();
                        }
                        //
                        //newPawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
                        Job job = new Job(TorannMagicDefOf.JobDriver_SleepNow);
                        newPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
                        TM_MoteMaker.ThrowNoteMote(newPawn.DrawPos, newPawn.Map, Rand.Range(.3f, .8f));
                        TM_MoteMaker.ThrowNoteMote(newPawn.DrawPos, newPawn.Map, Rand.Range(.3f, .8f));
                        TM_MoteMaker.ThrowNoteMote(newPawn.DrawPos, newPawn.Map, Rand.Range(.3f, .8f));
                    }
                    else
                    {
                        MoteMaker.ThrowText(newPawn.DrawPos, newPawn.Map, "TM_ResistedSpell".Translate(), -1);
                    }
                    HealthUtility.AdjustSeverity(newPawn, HediffDef.Named("TM_LullabyHD"), .95f + ver.level);
                }
            }
            this.PostCastShot(flag, out flag);
            return(flag);
        }
コード例 #22
0
        protected override bool TryCastShot()
        {
            bool flag = false;

            Map map = base.CasterPawn.Map;

            Pawn hitPawn = (Pawn)this.currentTarget;
            Pawn caster  = base.CasterPawn;

            MagicPowerSkill pwr = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Regenerate.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Regenerate_pwr");
            MagicPowerSkill ver = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Regenerate.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Regenerate_ver");

            verVal = ver.level;
            pwrVal = pwr.level;
            if (caster.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = caster.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = caster.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            if (hitPawn != null & !hitPawn.Dead)
            {
                if (pwrVal == 3)
                {
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Regeneration_III, Rand.Range(1f + verVal, 3f + (verVal * 3)));
                    TM_MoteMaker.ThrowRegenMote(hitPawn.Position.ToVector3(), map, 1f + (.2f * (verVal + pwrVal)));
                }
                else if (pwrVal == 2)
                {
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Regeneration_II, Rand.Range(1f + verVal, 3f + (verVal * 3)));
                    TM_MoteMaker.ThrowRegenMote(hitPawn.Position.ToVector3(), map, 1f + (.2f * (verVal + pwrVal)));
                }
                else if (pwrVal == 1)
                {
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Regeneration_I, Rand.Range(1f + verVal, 3f + (verVal * 3)));
                    TM_MoteMaker.ThrowRegenMote(hitPawn.Position.ToVector3(), map, 1f + (.2f * (verVal + pwrVal)));
                }
                else
                {
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Regeneration, Rand.Range(1f + verVal, 3f + (verVal * 3)));
                    TM_MoteMaker.ThrowRegenMote(hitPawn.Position.ToVector3(), map, 1f + (.2f * (verVal + pwrVal)));
                }
            }
            else
            {
                Messages.Message("TM_NothingToRegenerate".Translate(), MessageTypeDefOf.NeutralEvent);
            }
            this.PostCastShot(flag, out flag);
            return(flag);
        }
コード例 #23
0
ファイル: Verb_Rend.cs プロジェクト: bluba/TMagic
        protected override bool TryCastShot()
        {
            bool flag = false;

            this.TargetsAoE.Clear();
            //this.UpdateTargets();
            this.FindTargets();
            MagicPowerSkill ver = base.CasterPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Rend.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Rend_ver");

            this.arcaneDmg = base.CasterPawn.GetComp <CompAbilityUserMagic>().arcaneDmg;
            verVal         = ver.level;
            bool flag2 = this.UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && this.TargetsAoE.Count > 1;

            if (flag2)
            {
                this.TargetsAoE.RemoveRange(0, this.TargetsAoE.Count - 1);
            }
            for (int i = 0; i < this.TargetsAoE.Count; i++)
            {
                Pawn newPawn = this.TargetsAoE[i].Thing as Pawn;
                if (newPawn.RaceProps.IsFlesh)
                {
                    if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, newPawn, true)))
                    {
                        HealthUtility.AdjustSeverity(newPawn, HediffDef.Named("TM_RendHD"), (3f + (.6f * ver.level)) * this.arcaneDmg);
                        if (newPawn.Faction != null && !newPawn.Faction.HostileTo(base.CasterPawn.Faction))
                        {
                            newPawn.Faction.TryAffectGoodwillWith(base.CasterPawn.Faction, -20, true, false, null, null);
                        }
                        else if (newPawn.kindDef != null && newPawn.kindDef.RaceProps.Animal && newPawn.Faction == null)
                        {
                            newPawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter, null, true, false, null);
                        }
                        if (newPawn.IsColonist && !base.CasterPawn.IsColonist)
                        {
                            TM_Action.SpellAffectedPlayerWarning(newPawn);
                        }
                    }
                    else
                    {
                        MoteMaker.ThrowText(newPawn.DrawPos, newPawn.Map, "TM_ResistedSpell".Translate(), -1);
                    }
                }
                else
                {
                    TM_Action.DamageEntities(newPawn, null, (4f), DamageDefOf.Cut, this.CasterPawn);
                }
            }
            this.PostCastShot(flag, out flag);
            return(flag);
        }
コード例 #24
0
        public void Launch(Thing launcher, Vector3 origin, LocalTargetInfo targ, Thing flyingThing, DamageInfo?newDamageInfo = null)
        {
            bool spawned = flyingThing.Spawned;

            pawn = launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();

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

            this.arcaneDmg = comp.arcaneDmg;
            MagicPowerSkill pwr = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_ShadowBolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_ShadowBolt_pwr");
            MagicPowerSkill ver = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_ShadowBolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_ShadowBolt_ver");

            verVal = ver.level;
            pwrVal = pwr.level;

            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }
            if (spawned)
            {
                flyingThing.DeSpawn();
            }
            this.origin              = origin;
            this.impactDamage        = newDamageInfo;
            this.speed               = this.def.projectile.speed;
            this.proximityRadius    += (.4f * verVal);
            this.proximityFrequency -= verVal;
            this.flyingThing         = flyingThing;
            bool flag = targ.Thing != null;

            if (flag)
            {
                this.assignedTarget = targ.Thing;
            }
            float distanceAccuracyModifier = (targ.Cell.ToVector3Shifted() - this.pawn.Position.ToVector3Shifted()).MagnitudeHorizontal() * .1f;

            this.destination   = targ.Cell.ToVector3Shifted();
            this.ticksToImpact = this.StartingTicksToImpact;
            this.Initialize();
        }
コード例 #25
0
        public void Launch(Thing launcher, Vector3 origin, LocalTargetInfo targ, Thing flyingThing, DamageInfo?newDamageInfo = null)
        {
            Hediff invul = new Hediff();

            invul.def      = TorannMagicDefOf.TM_HediffInvulnerable;
            invul.Severity = 5;
            bool spawned = flyingThing.Spawned;

            pawn = launcher as Pawn;
            pawn.health.AddHediff(invul, null, null);
            comp = pawn.GetComp <CompAbilityUserMagic>();
            pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_ValiantCharge.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_ValiantCharge_pwr");
            ver  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_ValiantCharge.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_ValiantCharge_ver");
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            pwrVal = pwr.level;
            verVal = ver.level;
            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }
            if (spawned)
            {
                flyingThing.DeSpawn();
            }
            //
            ModOptions.Constants.SetPawnInFlight(true);
            //
            this.launcher     = launcher;
            this.origin       = origin;
            this.impactDamage = newDamageInfo;
            this.flyingThing  = flyingThing;
            bool flag = targ.Thing != null;

            if (flag)
            {
                this.assignedTarget = targ.Thing;
            }
            this.destination   = targ.Cell.ToVector3Shifted() + new Vector3(Rand.Range(-0.3f, 0.3f), 0f, Rand.Range(-0.3f, 0.3f));
            this.ticksToImpact = this.StartingTicksToImpact;
            this.Initialize();
        }
コード例 #26
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;
            //base.Impact(hitThing);
            ThingDef def = this.def;

            Pawn hitPawn = hitThing as Pawn;
            Pawn caster  = this.launcher as Pawn;
            CompAbilityUserMagic compHitPawn = hitPawn.GetComp <CompAbilityUserMagic>();
            CompAbilityUserMagic compCaster  = caster.GetComp <CompAbilityUserMagic>();

            if (hitPawn != null && compHitPawn != null)
            {
                if (compHitPawn.IsMagicUser && compHitPawn.MagicData != null && compHitPawn.Mana != null)
                {
                    MagicPowerSkill regen = hitPawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_global_regen.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_global_regen_pwr");
                    compHitPawn.Mana.CurLevel += (.2f + (.01f * regen.level)) * compCaster.arcaneDmg;
                    TM_MoteMaker.ThrowManaPuff(hitPawn.DrawPos, hitPawn.Map, 1f);
                    TM_MoteMaker.ThrowManaPuff(hitPawn.DrawPos, hitPawn.Map, 1f);
                    if (compCaster.MagicData != null && compCaster.MagicData.MagicPowerSkill_Cantrips.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Cantrips_pwr").level >= 6)
                    {
                        float sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Manipulation, sev);
                        sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Movement, sev);
                        sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Breathing, sev);
                        sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Sight, sev);
                        TM_MoteMaker.ThrowManaPuff(hitPawn.Position.ToVector3(), hitPawn.Map, 1f);
                        TM_MoteMaker.ThrowManaPuff(hitPawn.Position.ToVector3(), hitPawn.Map, 1f);
                    }
                }
                else
                {
                    float sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Manipulation, sev);
                    sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Movement, sev);
                    sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Breathing, sev);
                    sev = Rand.Range(0, 10) * compCaster.arcaneDmg;
                    HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_Sight, sev);
                    TM_MoteMaker.ThrowManaPuff(hitPawn.DrawPos, hitPawn.Map, 1f);
                    TM_MoteMaker.ThrowManaPuff(hitPawn.DrawPos, hitPawn.Map, 1f);
                }
            }
            Destroy();
        }
コード例 #27
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            Pawn hitPawn = hitThing as Pawn;
            Pawn caster  = this.launcher as Pawn;
            CompAbilityUserMagic compHitPawn = hitPawn.GetComp <CompAbilityUserMagic>();
            CompAbilityUserMagic compCaster  = caster.GetComp <CompAbilityUserMagic>();

            if (hitPawn != null && !hitPawn.Dead && !caster.Dead && !caster.Downed && caster != null)
            {
                if (Rand.Chance(TM_Calc.GetSpellSuccessChance(caster, hitPawn, true)))
                {
                    if (compHitPawn.IsMagicUser)
                    {
                        MagicPowerSkill regen       = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_global_regen.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_global_regen_pwr");
                        float           manaDrained = compHitPawn.Mana.CurLevel;
                        if (manaDrained > .5f)
                        {
                            manaDrained = .5f;
                        }
                        compHitPawn.Mana.CurLevel -= manaDrained;
                        compCaster.Mana.CurLevel  += (manaDrained * .6f) * (1 + regen.level * .05f);
                        TM_MoteMaker.ThrowSiphonMote(hitPawn.Position.ToVector3(), hitPawn.Map, 1f);
                        TM_MoteMaker.ThrowManaPuff(caster.Position.ToVector3(), caster.Map, 1f);
                    }
                    else
                    {
                        float sev = Rand.Range(0, 10);
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_AntiManipulation, sev);
                        sev = Rand.Range(0, 10);
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_AntiMovement, sev);
                        sev = Rand.Range(0, 10);
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_AntiBreathing, sev);
                        sev = Rand.Range(0, 10);
                        HealthUtility.AdjustSeverity(hitPawn, TorannMagicDefOf.TM_AntiSight, sev);
                        TM_MoteMaker.ThrowSiphonMote(hitPawn.Position.ToVector3(), hitPawn.Map, 1f);
                        TM_MoteMaker.ThrowSiphonMote(hitPawn.Position.ToVector3(), hitPawn.Map, 1f);
                    }
                }
                else
                {
                    MoteMaker.ThrowText(hitPawn.DrawPos, hitPawn.Map, "TM_ResistedSpell".Translate(), -1);
                }
            }
        }
コード例 #28
0
        public static List <MagicPowerSkill> GetAssociatedMagicPowerSkill(CompAbilityUserMagic comp, MagicPower power)
        {
            string str = power.TMabilityDefs.FirstOrDefault().defName.ToString() + "_";
            List <MagicPowerSkill> skills = new List <MagicPowerSkill>();

            for (int i = 0; i < comp.MagicData.AllMagicPowerSkills.Count; i++)
            {
                MagicPowerSkill mps = comp.MagicData.AllMagicPowerSkills[i];
                if (mps.label.Contains(str))
                {
                    skills.Add(mps);
                }
            }
            return(skills);
        }
コード例 #29
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            Pawn pawn = this.launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      ver  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_TechnoWeapon.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_TechnoWeapon_ver");

            verVal = ver.level;

            GenExplosion.DoExplosion(base.Position, map, 1f + (verVal * .05f), DamageDefOf.Burn, this.launcher, Mathf.RoundToInt(this.def.projectile.GetDamageAmount(1, null) * comp.arcaneDmg * (1f + (.02f * verVal))), 0, this.def.projectile.soundExplode, def, this.equipmentDef, this.intendedTarget.Thing, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
        }
コード例 #30
0
 public static MagicPowerSkill GetMagicPowerSkillFromLabel(CompAbilityUserMagic comp, string label)
 {
     if (comp != null && comp.MagicData != null && comp.MagicData.AllMagicPowerSkills.Count > 0)
     {
         for (int i = 0; i < comp.MagicData.AllMagicPowerSkills.Count; i++)
         {
             MagicPowerSkill mps = comp.MagicData.AllMagicPowerSkills[i];
             if (mps.label == label)
             {
                 return(mps);
             }
         }
     }
     return(null);
 }