public void UpdateSeverity()
        {
            float sev    = this.parent.Severity;
            Pawn  caster = this.Pawn;
            CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();

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

            if (comp != null)
            {
                pwrVal = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Prediction.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Prediction_pwr").level;
                if (sev <= 0)
                {
                    this.removeNow = true;
                }
                else if (!this.Pawn.IsColonist && settingsRef.AIHardMode)
                {
                    this.parent.Severity = 5;
                }
                else if (sev != pwrVal + .5f)
                {
                    this.parent.Severity = pwrVal + .5f;
                }
            }
            else
            {
                this.removeNow = true;
            }
        }
Exemple #2
0
        protected override bool TryCastShot()
        {
            Map  map  = base.CasterPawn.Map;
            Pawn pawn = base.CasterPawn;
            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();
            MightPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_BowTraining.FirstOrDefault((MightPowerSkill x) => x.label == "TM_BowTraining_pwr");

            if (pawn != null && !pawn.Dead)
            {
                if (comp.IsMightUser)
                {
                    HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_BowTrainingHD, -5f);
                    HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_BowTrainingHD, (.5f) + pwr.level);
                    ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                    if (!pawn.IsColonistPlayerControlled && settingsRef.AIHardMode)
                    {
                        HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_BowTrainingHD, 4);
                    }

                    MoteMaker.ThrowHeatGlow(pawn.Position, map, 1.5f);
                    MoteMaker.ThrowAirPuffUp(pawn.Position.ToVector3(), map);
                }
                else
                {
                    Log.Message("Pawn not detected as might user.");
                }
            }

            this.burstShotsLeft = 0;
            return(false);
        }
Exemple #3
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;
        }
Exemple #4
0
        protected override bool TryCastShot()
        {
            Pawn caster = base.CasterPawn;
            Pawn pawn   = this.currentTarget.Thing as Pawn;

            comp   = caster.GetComp <CompAbilityUserMagic>();
            pwrVal = comp.MagicData.MagicPowerSkill_TechnoShield.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_TechnoShield_pwr").level;
            verVal = comp.MagicData.MagicPowerSkill_TechnoShield.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_TechnoShield_ver").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;
                verVal = caster.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver").level;
            }
            if (settingsRef.AIHardMode && !caster.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }

            if (pawn != null)
            {
                ApplyTechnoShield(pawn);
            }
            return(true);
        }
Exemple #5
0
 public override void Tick()
 {
     base.Tick();
     if (Find.TickManager.TicksGame % 2 == 0 && daggerCount > 0 && this.launcher != null && this.launcher is Pawn)
     {
         Pawn caster = this.launcher as Pawn;
         CompAbilityUserMight comp = caster.TryGetComp <CompAbilityUserMight>();
         if (comp != null)
         {
             ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
             if ((comp.MightData.MightPowerSkill_FieldTraining.FirstOrDefault((MightPowerSkill x) => x.label == "TM_FieldTraining_pwr").level >= 12) || (!caster.IsColonist && settingsRef.AIHardMode))
             {
                 Projectile_Spinning newProjectile = (Projectile_Spinning)ThingMaker.MakeThing(this.def, null);
                 newProjectile.daggerCount = 0;
                 TM_CopyAndLaunchProjectile.CopyAndLaunchProjectile(newProjectile, caster, this.intendedTarget, this.intendedTarget, ProjectileHitFlags.All, null);
                 this.daggerCount--;
             }
             else
             {
                 daggerCount = 0;
             }
         }
         else
         {
             daggerCount = 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);
        }
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            try
            {
                Pawn victim = hitThing as Pawn;
                if (!initialized)
                {
                    Initialize(map);
                }

                int dmg = GetWeaponDmg(this.launcher as Pawn);
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                if (!pawn.IsColonist && settingsRef.AIHardMode)
                {
                    dmg += 12;
                }

                if (victim != null && Rand.Chance(GetWeaponAccuracy(pawn)))
                {
                    damageEntities(victim, null, dmg, DamageDefOf.Arrow);
                    TM_MoteMaker.ThrowBloodSquirt(victim.DrawPos, victim.Map, 1f);
                }
            }
            catch (NullReferenceException ex)
            {
                //
            }
        }
Exemple #8
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 #9
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);
        }
Exemple #10
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>();

            pwrVal = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_EnchantedBody.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_EnchantedBody_pwr").level;
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
            }
            if (pawn != null && !pawn.Downed)
            {
                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);
                }

                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);
                }
                else
                {
                    comp.MagicData.MagicPowersE.FirstOrDefault <MagicPower>((MagicPower x) => x.abilityDef == TorannMagicDefOf.TM_EnchantedBody).AutoCast = true;
                    HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_EnchantedBodyHD, .5f + pwrVal);
                    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);
        }
Exemple #11
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            Pawn victim = hitThing as Pawn;

            if (!initialized)
            {
                Initialize(map);
            }

            ThingWithComps arg_3C_0;
            int            value = 0;

            if (pawn == null)
            {
                arg_3C_0 = null;
            }
            else
            {
                Pawn_EquipmentTracker expr_eq = pawn.equipment;
                arg_3C_0 = ((expr_eq != null) ? expr_eq.Primary : null);
            }
            ThingWithComps thing;
            bool           flag31 = (thing = arg_3C_0) != null;

            if (flag31)
            {
                value = Mathf.RoundToInt(thing.GetStatValue(StatDefOf.MarketValue));
            }

            int dmg;

            if (value > 1000)
            {
                value -= 1000;
                dmg    = (this.def.projectile.damageAmountBase) + (int)((20 + (value / 120)) * (1 + (.1f * pwr.level) + (.05f * str.level)));
            }
            else
            {
                dmg = (this.def.projectile.damageAmountBase) + (int)((value / 50) * (1 + (.1f * pwr.level) + (.05f * str.level)));
            }
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (!pawn.IsColonistPlayerControlled && settingsRef.AIHardMode)
            {
                dmg += 12;
            }

            if (victim != null && Rand.Chance(pawn.equipment.Primary.GetStatValue(StatDefOf.AccuracyMedium, true)))
            {
                damageEntities(victim, null, dmg, DamageDefOf.Arrow);
                TM_MoteMaker.ThrowBloodSquirt(victim.DrawPos, victim.Map, 1f);
            }
        }
        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();
                        }
                    }
                }
            }
        }
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

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

            try
            {
                CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();
                //MightPowerSkill ver = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_DisablingShot.FirstOrDefault((MightPowerSkill x) => x.label == "TM_DisablingShot_ver");
                verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_DisablingShot, "TM_DisablingShot", "_ver", true);
                MightPowerSkill        str         = comp.MightData.MightPowerSkill_global_strength.FirstOrDefault((MightPowerSkill x) => x.label == "TM_global_strength_pwr");
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                //verVal = ver.level;
                //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
                //{
                //    MightPowerSkill mver = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                //    verVal = mver.level;
                //}
                //if (settingsRef.AICasting && !pawn.IsColonist)
                //{
                //    verVal = 3;
                //}
                if (victim != null && !victim.Dead && Rand.Chance(this.launcher.GetStatValue(StatDefOf.ShootingAccuracyPawn, true)))
                {
                    int dmg = (this.def.projectile.GetDamageAmount(1, null));
                    if (victim.RaceProps.IsFlesh)
                    {
                        System.Random rnd = new System.Random();
                        if (verVal > 0 && victim.needs.food != null)
                        {
                            int randomTranqSev = GenMath.RoundRandom(rnd.Next((int)(verVal * .5f * str.level), (int)((verVal + .5f * str.level) * 3)));
                            LegShot(victim, randomTranqSev, TMDamageDefOf.DamageDefOf.TM_Tranquilizer);
                        }
                        else
                        {
                            LegShot(victim, dmg, TMDamageDefOf.DamageDefOf.TM_DisablingShot);
                        }
                    }
                    else
                    {
                        damageEntities(victim, null, dmg, this.def.projectile.damageDef);
                    }
                }
                else
                {
                    Log.Message("No valid target for Disabling Shot");
                }
            }
            catch (NullReferenceException ex)
            {
            }
        }
        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--;
                    }
                }
            }
        }
Exemple #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);
            }
        }
Exemple #16
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 #17
0
        public static int GetWeaponDmg(Pawn pawn, ThingDef projectileDef)
        {
            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();
            MightPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Headshot.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Headshot_pwr");
            MightPowerSkill      str  = comp.MightData.MightPowerSkill_global_strength.FirstOrDefault((MightPowerSkill x) => x.label == "TM_global_strength_pwr");

            pwrVal = pwr.level;
            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                pwrVal = mpwr.level;
            }
            ThingWithComps arg_3C_0;
            int            value = 0;

            if (pawn == null)
            {
                arg_3C_0 = null;
            }
            else
            {
                Pawn_EquipmentTracker expr_eq = pawn.equipment;
                arg_3C_0 = ((expr_eq != null) ? expr_eq.Primary : null);
            }
            ThingWithComps thing;
            bool           flag31 = (thing = arg_3C_0) != null;

            if (flag31)
            {
                value = Mathf.RoundToInt(thing.GetStatValue(StatDefOf.MarketValue));
            }

            int dmg;

            if (value > 1000)
            {
                value -= 1000;
                dmg    = (projectileDef.projectile.GetDamageAmount(1, null)) + (int)((20 + (value / 120)) * (1 + (.1f * pwrVal)));
            }
            else
            {
                dmg = (projectileDef.projectile.GetDamageAmount(1, null)) + (int)((value / 50) * (1 + (.1f * pwrVal)));
            }
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (!pawn.IsColonist && settingsRef.AIHardMode)
            {
                dmg += 8;
            }

            return(Mathf.RoundToInt(dmg * comp.mightPwr));
        }
        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();
        }
        public void Launch(Thing launcher, Vector3 origin, LocalTargetInfo targ, Thing flyingThing, DamageInfo?newDamageInfo = null)
        {
            bool spawned = flyingThing.Spawned;

            pawn = launcher as Pawn;

            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            this.arcaneDmg = comp.mightPwr;
            MightPowerSkill pwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_pwr");
            MightPowerSkill ver = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_ver");

            verVal = ver.level;
            pwrVal = pwr.level;
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }
            if (spawned)
            {
                flyingThing.DeSpawn();
            }
            //determine true center, calculate strike radius
            //determine pawn position relative to true center, if pawn is to the right set orb top right of strike radius (multiple of a vector shift ~30deg offset of north and in the direction of the pawn)
            //this position is the orb position, set orb exact position to this (make sure to check if out of bounds, if so, put the orb on the other side, if too high, put orb below)
            //tick checks for pawn status (exists, alive, not downed, performing job)
            //maintains a 'strike interval' that slowly decreases as the spell remains active (to a minimum point mathf.max(minimum interval, strike interval (which changes)
            //if strike time - pick two spots within the strike radius, one is origin, one is destination, get a vector from origin to dest
            //with a small strike delay (1-3 ticks), continue to generate a new lighting strike from the origin to the dest until the position is the same as the destination
            //might need to set an array to handle the lightning bolts, if you want more than 1 at a time
            //if the caster runs out of stamina or psi to sustain the ability, then it ends the job and the psi storm should fade
            //psi storm job does nothing but stand there and subtract energy
            //might use tm_thunderstrike sound to reduce volume of the strike, play thunder offmap each iteration, generate a "cloud" of motes around the orb
            //might need to pull the mesh maker functionality from wizardry

            this.centerLoc    = targ.Cell;
            this.impactDamage = newDamageInfo;
            this.speed        = 0f;
            this.flyingThing  = flyingThing;
            bool flag = targ.Thing != null;

            if (flag)
            {
                this.assignedTarget = targ.Thing;
            }
            this.Initialize();
            GetOrbOffset();
        }
Exemple #20
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();
        }
        public static int GetWeaponDmg(Pawn pawn)
        {
            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();
            int   pwrVal = comp.MightData.MightPowerSkill_ShadowStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_ShadowStrike_pwr").level;
            float dmg    = comp.weaponDamage;

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (!pawn.IsColonist && settingsRef.AIHardMode)
            {
                dmg += 5;
            }

            dmg = Mathf.RoundToInt(dmg * TorannMagicDefOf.TM_ShadowStrike.weaponDamageFactor * (1f + (.05f * pwrVal)));
            return((int)Mathf.Clamp(dmg, 0, 30));
        }
        public static int GetWeaponDmg(Pawn pawn)
        {
            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();

            float dmg = comp.weaponDamage;

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (!pawn.IsColonist && settingsRef.AIHardMode)
            {
                dmg += 8;
            }

            dmg = Mathf.RoundToInt(dmg * TorannMagicDefOf.TM_AntiArmor.weaponDamageFactor);
            return((int)Mathf.Clamp(dmg, 0, 60));
        }
Exemple #23
0
        public override void PostAbilityAttempt()
        {
            base.PostAbilityAttempt();
            bool flag = this.mightDef != null;

            if (flag)
            {
                bool flag3 = this.MightUser.Stamina != null;
                if (flag3)
                {
                    ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                    this.MightUser.Stamina.UseMightPower(this.MightUser.ActualStaminaCost(mightDef));
                    this.MightUser.MightUserXP += (int)((mightDef.staminaCost * 120) * settingsRef.xpMultiplier);
                }
            }
        }
Exemple #24
0
 private void Initialize()
 {
     if (pawn != null)
     {
         MoteMaker.MakeStaticMote(pawn.TrueCenter(), pawn.Map, ThingDefOf.Mote_ExplosionFlash, 12f);
         SoundDefOf.Ambient_AltitudeWind.sustainFadeoutTime.Equals(30.0f);
         MoteMaker.ThrowDustPuff(pawn.Position, pawn.Map, Rand.Range(1.2f, 1.8f));
         weaponDmg = GetWeaponDmg(pawn);
         ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
         if (!pawn.IsColonist && settingsRef.AIHardMode)
         {
             weaponDmg += 10;
         }
     }
     //flyingThing.ThingID += Rand.Range(0, 214).ToString();
 }
Exemple #25
0
        //bool validTarg;

        //public override bool CanHitTargetFrom(IntVec3 root, LocalTargetInfo targ)
        //{
        //    if (targ.IsValid && targ.CenterVector3.InBounds(base.CasterPawn.Map) && !targ.Cell.Fogged(base.CasterPawn.Map) && targ.Cell.Walkable(base.CasterPawn.Map))
        //    {
        //        if ((root - targ.Cell).LengthHorizontal < this.verbProps.range)
        //        {
        //            //out of range
        //            validTarg = true;
        //        }
        //        else
        //        {
        //            validTarg = false;
        //        }
        //    }
        //    else
        //    {
        //        validTarg = false;
        //    }
        //    return validTarg;
        //}

        protected override bool TryCastShot()
        {
            bool result = false;
            Pawn p      = this.CasterPawn;
            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            if (this.currentTarget != null && base.CasterPawn != null)
            {
                Map map = this.CasterPawn.Map;
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                if (this.currentTarget.Thing != null && this.currentTarget.Thing == base.CasterPawn)
                {
                    if (comp.mageLightActive == true)
                    {
                        comp.mageLightActive = false;
                        if (comp.mageLightThing != null)
                        {
                            comp.mageLightThing.Destroy(DestroyMode.Vanish);
                            comp.mageLightThing = null;
                        }
                        comp.mageLightSet = false;
                        Hediff hediff = base.CasterPawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_MageLightHD);
                        if (hediff != null)
                        {
                            base.CasterPawn.health.RemoveHediff(hediff);
                        }
                    }
                    else
                    {
                        comp.mageLightActive = true;
                        comp.mageLightSet    = false;
                        HealthUtility.AdjustSeverity(base.CasterPawn, TorannMagicDefOf.TM_MageLightHD, .5f);
                    }
                }
                else
                {
                    Messages.Message("InvalidSummon".Translate(), MessageTypeDefOf.RejectInput);
                    comp.Mana.GainNeed(comp.ActualManaCost(TorannMagicDefOf.TM_MageLight));
                }

                result = true;
            }

            this.burstShotsLeft = 0;
            //this.ability.TicksUntilCasting = (int)base.UseAbilityProps.SecondsToRecharge * 60;
            return(result);
        }
Exemple #26
0
        public static int GetWeaponDmg(Pawn pawn)
        {
            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();

            pwrVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_Headshot, "TM_Headshot", "_pwr", true);

            float dmg = comp.weaponDamage;

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            if (!pawn.IsColonist && settingsRef.AIHardMode)
            {
                dmg += 8;
            }

            dmg = Mathf.RoundToInt(dmg * (1f + (.1f * pwrVal)) * TorannMagicDefOf.TM_Headshot.weaponDamageFactor);
            return((int)Mathf.Clamp(dmg, 0, 100));
        }
Exemple #27
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, Mathf.RoundToInt(Rand.Range(this.def.projectile.GetDamageAmount(1, null) / 2, this.def.projectile.GetDamageAmount(1, null)) * this.arcaneDmg), 0, TorannMagicDefOf.TM_SoftExplosion, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0.1f, true);
            CellRect cellRect = CellRect.CenteredOn(base.Position, 5);

            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 (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;
            }
            for (int i = 0; i < (pwrVal * 3); i++)
            {
                IntVec3 randomCell = cellRect.RandomCell;
                if (randomCell.IsValid && randomCell.InBounds(map) && !randomCell.Fogged(map))
                {
                    this.FireExplosion(randomCell, map, 2.2f, ver);
                }
                else
                {
                    i--;
                }
            }
        }
Exemple #28
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 (settingsRef.AIHardMode && !pawn.IsColonistPlayerControlled)
            {
                pwrVal = 3;
                verVal = 3;
            }

            duration = 600 + (verVal * 200);
            CellRect cellRect = CellRect.CenteredOn(base.Position, 8 + (verVal * 2));

            cellRect.ClipInsideMap(map);

            if (this.primed == true)
            {
                if (((this.boltDelay + this.lastStrike) < this.age))
                {
                    IntVec3 randomCell = cellRect.RandomCell;
                    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(10 - (pwrVal * 2), 50 - (pwrVal * 7));

                    bool flag1 = this.age <= duration;
                    if (!flag1)
                    {
                        this.primed = false;
                        map.weatherDecider.DisableRainFor(0);
                        map.weatherDecider.StartNextWeather();
                    }
                }
            }
        }
        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;
            CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>();
            MightPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Spite.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Spite_pwr");
            MightPowerSkill      ver  = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Spite.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Spite_ver");

            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.mightPwr;
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }

            if (victim == null && this.intendedTarget != null && this.intendedTarget.Thing != null && this.intendedTarget.Thing is Pawn)
            {
                victim = this.intendedTarget.Thing as Pawn;
            }

            if (victim != null)
            {
                TM_Action.DamageEntities(victim, null, this.def.projectile.GetDamageAmount(1, null) * (1 + .1f * pwrVal) * this.arcaneDmg, this.def.projectile.damageDef, this.launcher);
                if (Rand.Chance(.15f * verVal))
                {
                    int dmg = Mathf.RoundToInt(((this.def.projectile.GetDamageAmount(1, null) / 3)) * this.arcaneDmg);  //projectile = 15
                    TM_Action.DamageEntities(victim, null, dmg, DamageDefOf.Stun, this.launcher);
                }
            }
        }
Exemple #30
0
        protected override bool TryCastShot()
        {
            if (this.CasterPawn.equipment.Primary != null && !this.CasterPawn.equipment.Primary.def.IsRangedWeapon)
            {
                CompAbilityUserMight comp = this.CasterPawn.GetComp <CompAbilityUserMight>();
                //MightPowerSkill ver = comp.MightData.MightPowerSkill_SeismicSlash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_SeismicSlash_ver");
                //MightPowerSkill pwr = comp.MightData.MightPowerSkill_SeismicSlash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_SeismicSlash_pwr");
                verVal = TM_Calc.GetMightSkillLevel(this.CasterPawn, comp.MightData.MightPowerSkill_BladeSpin, "TM_BladeSpin", "_ver", true);
                pwrVal = TM_Calc.GetMightSkillLevel(this.CasterPawn, comp.MightData.MightPowerSkill_BladeSpin, "TM_BladeSpin", "_pwr", true);
                //verVal = ver.level;
                //pwrVal = pwr.level;
                //if (base.CasterPawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
                //{
                //    MightPowerSkill mver = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                //    MightPowerSkill mpwr = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                //    verVal = mver.level;
                //    pwrVal = mpwr.level;
                //}
                CellRect cellRect = CellRect.CenteredOn(base.CasterPawn.Position, 1);
                Map      map      = base.CasterPawn.Map;
                cellRect.ClipInsideMap(map);

                IntVec3                centerCell  = cellRect.CenterCell;
                TMAbilityDef           ad          = (TMAbilityDef)this.Ability.Def;
                int                    dmgNum      = Mathf.RoundToInt(comp.weaponDamage * ad.weaponDamageFactor);
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                if (!this.CasterPawn.IsColonist && settingsRef.AIHardMode)
                {
                    dmgNum += 10;
                }

                SearchForTargets(base.CasterPawn.Position, (2f + (float)(.5f * verVal)), map);
                TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_BladeSweep"), this.CasterPawn.DrawPos, this.CasterPawn.Map, 1.6f + .4f * verVal, .04f, 0f, .18f, 1000, 0, 0, Rand.Range(0, 360));
            }
            else
            {
                Messages.Message("MustHaveMeleeWeapon".Translate(
                                     this.CasterPawn.LabelCap
                                     ), MessageTypeDefOf.RejectInput);
                return(false);
            }

            this.burstShotsLeft = 0;
            this.PostCastShot(flag10, out flag10);
            return(flag10);
        }