protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); ThingDef def = this.def; Pawn pawn = this.launcher as Pawn; if (!pawn.Spawned) { //pwrVal = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_pwr").level; pwrVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicStorm, "TM_PsionicStorm", "_pwr", true); arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr; } else { //MightPowerSkill pwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBlast_pwr"); pwrVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast, "TM_PsionicBlast", "_pwr", true); //pwrVal = pwr.level; arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr; } //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // MightPowerSkill mpwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr"); // pwrVal = mpwr.level; //} TM_MoteMaker.MakePowerBeamMotePsionic(base.Position, map, this.def.projectile.explosionRadius * 6f, 2f, .7f, .1f, .6f); GenExplosion.DoExplosion(base.Position, map, this.def.projectile.explosionRadius, TMDamageDefOf.DamageDefOf.TM_PsionicInjury, this.launcher, Mathf.RoundToInt(this.def.projectile.GetDamageAmount(1, null) * pawn.GetStatValue(StatDefOf.PsychicSensitivity, false) * (1 + (0.15f * pwrVal)) * this.arcaneDmg), 0, this.def.projectile.soundExplode, def, this.equipmentDef, this.intendedTarget.Thing, null, 0f, 1, false, null, 0f, 1, 0.0f, false); }
public void Launch(Thing launcher, Vector3 origin, LocalTargetInfo targ, Thing flyingThing, DamageInfo?newDamageInfo = null) { bool spawned = flyingThing.Spawned; pawn = launcher as Pawn; drafted = pawn.Drafted; comp = pawn.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_DragonStrike, "TM_DragonStrike", "_ver", true); //this.verVal = comp.MightData.MightPowerSkill_DragonStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_DragonStrike_ver").level; //if (comp.Pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // MightPowerSkill mver = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver"); // verVal = mver.level; //} if (spawned) { flyingThing.DeSpawn(); } // ModOptions.Constants.SetPawnInFlight(true); // this.origin = origin; this.impactDamage = newDamageInfo; this.flyingThing = flyingThing; this.distanceToTarget = (targ.Cell - origin.ToIntVec3()).LengthHorizontal; bool flag = targ.Thing != null; if (flag) { this.assignedTarget = targ.Thing; } this.destination = targ.Cell.ToVector3(); this.ticksToImpact = this.StartingTicksToImpact; this.Initialize(); }
protected override void Impact(Thing hitThing) { if (!this.initialized && !hitThing.DestroyedOrNull()) { this.initialized = true; this.caster = this.launcher as Pawn; CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_ShadowStrike, "TM_ShadowStrike", "_ver", true); this.startPos = caster.Position; this.age = 0; this.weaponDamage = GetWeaponDmg(caster); this.critChance = comp.weaponCritChance; GenClamor.DoClamor(caster, 2f, ClamorDefOf.Ability); if (DoMove(hitThing)) { DoStrike(hitThing); } } if (age >= 0) { age++; } Destroy(DestroyMode.Vanish); }
public static int GetWeaponDmg(Pawn pawn) { CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_SeismicSlash, "TM_SeismicSlash", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_SeismicSlash, "TM_SeismicSlash", "_pwr", true); //MightPowerSkill pwr = comp.MightData.MightPowerSkill_SeismicSlash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_SeismicSlash_pwr"); //MightPowerSkill ver = comp.MightData.MightPowerSkill_SeismicSlash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_SeismicSlash_ver"); MightPowerSkill str = comp.MightData.MightPowerSkill_global_strength.FirstOrDefault((MightPowerSkill x) => x.label == "TM_global_strength_pwr"); //verVal = ver.level; //pwrVal = pwr.level; //if (pawn.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; //} int dmgNum = 0; ThingWithComps weaponComp = pawn.equipment.Primary; float weaponDPS = weaponComp.GetStatValue(StatDefOf.MeleeWeapon_AverageDPS, false) * .7f; float dmgMultiplier = weaponComp.GetStatValue(StatDefOf.MeleeWeapon_DamageMultiplier, false); float pawnDPS = pawn.GetStatValue(StatDefOf.MeleeDPS, false); float skillMultiplier = (.7f + (.07f * pwrVal)); return(dmgNum = Mathf.RoundToInt(skillMultiplier * dmgMultiplier * (pawnDPS + weaponDPS) * comp.mightPwr)); }
protected override bool TryCastShot() { Pawn caster = base.CasterPawn; bool flag = caster != null && !caster.Dead; if (flag) { CompAbilityUserMight comp = caster.TryGetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_ShadowSlayer, "TM_ShadowSlayer", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_ShadowSlayer, "TM_ShadowSlayer", "_pwr", true); float sev = 40 + (comp.mightPwr * (3 * verVal)); HealthUtility.AdjustSeverity(caster, TorannMagicDefOf.TM_ShadowSlayerCloakHD, sev); HediffComp_Disappears hdComp = caster.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_ShadowSlayerCloakHD).TryGetComp <HediffComp_Disappears>(); if (hdComp != null) { hdComp.ticksToDisappear = Mathf.RoundToInt(60 * sev); } for (int i = 0; i < 3; i++) { Vector3 rndPos = caster.DrawPos; rndPos.x += Rand.Range(-.5f, .5f); rndPos.z += Rand.Range(-.5f, .5f); MoteMaker.ThrowSmoke(rndPos, caster.Map, Rand.Range(.6f, 1.2f)); } } return(true); }
protected override bool TryCastShot() { Pawn caster = base.CasterPawn; bool flag = caster != null && !caster.Dead; if (flag) { CompAbilityUserMight comp = caster.TryGetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_VeilOfShadows, "TM_VeilOfShadows", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_VeilOfShadows, "TM_VeilOfShadows", "_pwr", true); HealthUtility.AdjustSeverity(caster, TorannMagicDefOf.TM_ShadowCloakHD, .2f + (comp.mightPwr * verVal)); HediffComp_Disappears hdComp = caster.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_ShadowCloakHD).TryGetComp <HediffComp_Disappears>(); if (hdComp != null) { hdComp.ticksToDisappear = 600 + (60 * pwrVal); } ThingDef fog = TorannMagicDefOf.Fog_Shadows; fog.gas.expireSeconds.min = 10 + pwrVal; fog.gas.expireSeconds.max = 11 + pwrVal; GenExplosion.DoExplosion(caster.Position, caster.Map, 3f + (.3f * verVal), TMDamageDefOf.DamageDefOf.TM_Toxin, caster, 0, 0, TMDamageDefOf.DamageDefOf.TM_Toxin.soundExplosion, null, null, null, fog, 1f, 1, false, null, 0f, 0, 0.0f, false); for (int i = 0; i < 6; i++) { Vector3 rndPos = caster.DrawPos; rndPos.x += Rand.Range(-1.5f, 1.5f); rndPos.z += Rand.Range(-1.5f, 1.5f); TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_ShadowCloud, rndPos, caster.Map, Rand.Range(1f, 1.8f), .6f, .05f, Rand.Range(.6f, .8f), Rand.Range(-40, 40), Rand.Range(2, 3f), Rand.Range(0, 360), Rand.Range(0, 360)); } } return(true); }
private void Initialize(IntVec3 target, Pawn pawn) { if (target != null && pawn != null) { verVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_ThunderStrike, "TM_ThunderStrike", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_ThunderStrike, "TM_ThunderStrike", "_pwr", true); //this.verVal = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_ThunderStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_ThunderStrike_ver").level; //this.pwrVal = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_ThunderStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_ThunderStrike_pwr").level; //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // MightPowerSkill mver = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver"); // MightPowerSkill mpwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr"); // verVal = mver.level; // pwrVal = mpwr.level; //} this.arcaneDmg = pawn.GetComp <CompAbilityUserMight>().mightPwr; this.origin = pawn.Position.ToVector3Shifted(); this.destination = target.ToVector3Shifted(); this.direction = TM_Calc.GetVector(this.origin, this.destination); this.directionOffsetRight = Quaternion.AngleAxis(30, Vector3.up) * direction; this.directionOffsetLeft = Quaternion.AngleAxis(-30, Vector3.up) * direction; //Log.Message("origin: " + this.origin + " destination: " + this.destination + " direction: " + this.direction + " directionRight: " + this.directionOffsetRight); this.maxIteration = this.maxIteration + verVal; initialized = true; HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_HediffInvulnerable, .05f); } else { Log.Warning("Failed to initialize " + this.def.defName); this.iteration = this.maxIteration; } }
protected override bool TryCastShot() { Pawn caster = base.CasterPawn; Pawn pawn = this.currentTarget.Thing as Pawn; bool flag = pawn != null && !pawn.Dead; if (flag) { CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); int verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_Custom, "TM_Taunt", "_ver", true); int pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_Custom, "TM_Taunt", "_pwr", true); radius += (2f * verVal); tauntChance += (pwrVal * .05f); targetsMax += pwrVal; SoundInfo info = SoundInfo.InMap(new TargetInfo(caster.Position, caster.Map, false), MaintenanceType.None); if (this.CasterPawn.gender == Gender.Female) { info.pitchFactor = Rand.Range(1.1f, 1.3f); } else { info.pitchFactor = Rand.Range(.7f, .9f); } TorannMagicDefOf.TM_Roar.PlayOneShot(info); Effecter RageWave = TorannMagicDefOf.TM_RageWaveED.Spawn(); RageWave.Trigger(new TargetInfo(caster.Position, caster.Map, false), new TargetInfo(caster.Position, caster.Map, false)); RageWave.Cleanup(); TM_Action.SearchAndTaunt(caster, this.radius, targetsMax, tauntChance); } return(true); }
//public override bool CanHitTargetFrom(IntVec3 root, LocalTargetInfo targ) //{ // if (targ.Thing != null && targ.Thing == this.caster) // { // return this.verbProps.targetParams.canTargetSelf; // } // 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) // { // ShootLine shootLine; // validTarg = this.TryFindShootLineFromTo(root, targ, out shootLine); // } // else // { // validTarg = false; // } // } // else // { // validTarg = false; // } // return validTarg; //} protected override bool TryCastShot() { Pawn pawn = this.CasterPawn; verVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast, "TM_PsionicBlast", "_ver", true); //this.verVal = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_PsionicBlast.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBlast_ver").level; //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // this.verVal = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver").level; //} IntVec3 targetVariation = this.currentTarget.Cell; targetVariation.x += Mathf.RoundToInt((Rand.Range(-.1f, .1f) * Vector3.Distance(pawn.DrawPos, this.currentTarget.CenterVector3)) + Rand.Range(-1f, 1f)); targetVariation.z += Mathf.RoundToInt((Rand.Range(-.1f, .1f) * Vector3.Distance(pawn.DrawPos, this.currentTarget.CenterVector3)) + Rand.Range(-1f, 1f)); float angle = (Quaternion.AngleAxis(90, Vector3.up) * GetVector(pawn.Position, targetVariation)).ToAngleFlat(); Vector3 drawPos = pawn.DrawPos + (GetVector(pawn.Position, targetVariation) * .5f); TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_PsiBlastStart"), drawPos, pawn.Map, Rand.Range(.4f, .6f), Rand.Range(.0f, .05f), .1f, .2f, 0, 0, 0, angle); //throw psi blast start TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_PsiBlastEnd"), drawPos, pawn.Map, Rand.Range(.4f, .8f), Rand.Range(.0f, .1f), .2f, .3f, 0, Rand.Range(1f, 1.5f), angle, angle); //throw psi blast end this.TryLaunchProjectile(this.verbProps.defaultProjectile, targetVariation); float psiEnergy = 0; if (pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false)) { psiEnergy = this.CasterPawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).Severity; HealthUtility.AdjustSeverity(pawn, HediffDef.Named("TM_PsionicHD"), -(4 - this.verVal)); } bool result = Rand.Chance(((verVal * 4) + psiEnergy) / 100); return(result); }
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; this.strikePos = base.Position; CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_RifleSpec, "TM_RifleSpec", "_ver", true); this.radius = this.def.projectile.explosionRadius; this.initialized = true; } GenExplosion.DoExplosion(this.strikePos, map, this.def.projectile.explosionRadius, this.def.projectile.damageDef, this.launcher as Pawn, Mathf.RoundToInt((this.def.projectile.GetDamageAmount(1f) + (1.5f * verVal)) * mightPwr), 3, this.def.projectile.soundExplode, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, true); strikePos.x += Mathf.RoundToInt(Rand.Range(-radius, radius)); strikePos.z += Mathf.RoundToInt(Rand.Range(-radius, radius)); GenExplosion.DoExplosion(this.strikePos, map, this.def.projectile.explosionRadius / 2f, this.def.projectile.damageDef, this.launcher as Pawn, Mathf.RoundToInt(((this.def.projectile.GetDamageAmount(1f) / 2f) + (1f * verVal)) * mightPwr), 0, this.def.projectile.soundExplode, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, true); strikePos = base.Position; strikePos.x += Mathf.RoundToInt(Rand.Range(-radius, radius)); strikePos.z += Mathf.RoundToInt(Rand.Range(-radius, radius)); GenExplosion.DoExplosion(this.strikePos, map, this.def.projectile.explosionRadius / 2f, this.def.projectile.damageDef, this.launcher as Pawn, Mathf.RoundToInt(((this.def.projectile.GetDamageAmount(1f) / 2f) + (1f * verVal)) * mightPwr), 0, this.def.projectile.soundExplode, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, true); }
public static int GetWeaponDmgMech(Pawn pawn, int dmg) { //MightPowerSkill pwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_AntiArmor.FirstOrDefault((MightPowerSkill x) => x.label == "TM_AntiArmor_pwr"); int pwrVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_AntiArmor, "TM_AntiArmor", "_pwr", true); int mechDmg = dmg + Mathf.RoundToInt(dmg * (1 + (.5f * pwrVal))); return(mechDmg); }
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) { } }
public static float GetWeaponAccuracy(Pawn pawn) { float weaponAccuracy = pawn.equipment.Primary.GetStatValue(StatDefOf.AccuracyMedium, true); verVal = TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_ArrowStorm, "TM_ArrowStorm", "_ver", true); //MightPowerSkill ver = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_ArrowStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_ArrowStorm_ver"); //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; //} weaponAccuracy = Mathf.Min(1f, (.8f * weaponAccuracy) + (.05f * verVal)); return(weaponAccuracy); }
protected override bool TryCastShot() { Pawn caster = base.CasterPawn; CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_FirstAid, "TM_FirstAid", "_pwr", true); verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_FirstAid, "TM_FirstAid", "_ver", true); bool flag = caster != null; if (flag) { using (IEnumerator <BodyPartRecord> enumerator = caster.health.hediffSet.GetInjuredParts().GetEnumerator()) { int num = 2 + pwrVal; while (enumerator.MoveNext()) { BodyPartRecord rec = enumerator.Current; IEnumerable <Hediff_Injury> arg_BB_0 = caster.health.hediffSet.GetHediffs <Hediff_Injury>(); Func <Hediff_Injury, bool> arg_BB_1; arg_BB_1 = (Hediff_Injury injury) => injury.Part == rec; if (num > 0) { int num2 = 2 + pwrVal; foreach (Hediff_Injury current in arg_BB_0.Where(arg_BB_1)) { if (num2 > 0) { bool flag5 = current.CanHealNaturally() && !current.IsPermanent() && current.TendableNow(); if (flag5) { current.Tended(Rand.Range(0, 0.4f) + (.1f * verVal)); num--; num2--; } } } } } } } return(false); }
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); }
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)); }
public static int GetWeaponDmg(Pawn caster) { CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); //MightPowerSkill pwr = comp.MightData.MightPowerSkill_Whirlwind.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Whirlwind_pwr"); pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_Whirlwind, "TM_Whirlwind", "_pwr", true); float dmgNum = comp.weaponDamage; if (caster.equipment.Primary != null && caster.equipment.Primary.def.IsRangedWeapon) { dmgNum = Mathf.RoundToInt(dmgNum * TorannMagicDefOf.TM_Whirlwind.weaponDamageFactor); } dmgNum = Mathf.RoundToInt(dmgNum * (1 + (.08f * pwrVal))); return((int)Mathf.Max(5, dmgNum)); }
public void ApplyWhirlwindDamage(DamageInfo dinfo) { bool flag = !dinfo.InstantPermanentInjury; if (flag) { bool flag2 = dinfo.Instigator != null; if (flag2) { int num2 = Mathf.RoundToInt(dinfo.Amount); bool flag3 = pawn != null && base.Position != default(IntVec3); if (flag3) { for (int i = 0; i < 8; i++) { IntVec3 intVec = base.Position + GenAdj.AdjacentCells[i]; Pawn cleaveVictim = new Pawn(); cleaveVictim = intVec.GetFirstPawn(base.Map); if (cleaveVictim != null && cleaveVictim.Faction != pawn.Faction) { cleaveVictim.TakeDamage(dinfo); MoteMaker.ThrowMicroSparks(cleaveVictim.Position.ToVector3(), base.Map); CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_Whirlwind, "TM_Whirlwind", "_ver", true); //MightPowerSkill ver = comp.MightData.MightPowerSkill_Whirlwind.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Whirlwind_ver"); //verVal = ver.level; //if(pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // MightPowerSkill mver = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver"); // verVal = mver.level; //} DamageInfo dinfo2 = new DamageInfo(TMDamageDefOf.DamageDefOf.TM_Whirlwind, weaponDmg, 0, (float)-1, pawn, null, null, DamageInfo.SourceCategory.ThingOrUnknown); System.Random random = new System.Random(); int rnd = GenMath.RoundRandom(random.Next(0, 100)); if (rnd < (verVal * 5)) { cleaveVictim.TakeDamage(dinfo2); MoteMaker.ThrowMicroSparks(cleaveVictim.Position.ToVector3(), base.Map); } } } } } } }
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)); CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_PsionicDash, "TM_PsionicDash", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_PsionicDash, "TM_PsionicDash", "_pwr", true); //this.pwrVal = comp.MightData.MightPowerSkill_PsionicDash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicDash_pwr").level; //this.verVal = comp.MightData.MightPowerSkill_PsionicDash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicDash_ver").level; this.arcaneDmg = comp.mightPwr; //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // this.pwrVal = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr").level; // this.verVal = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver").level; //} } //flyingThing.ThingID += Rand.Range(0, 2147).ToString(); }
protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); ThingDef def = this.def; pawn = this.launcher as Pawn; Pawn victim = hitThing as Pawn; try { CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_Headshot, "TM_Headshot", "_ver", true); //MightPowerSkill ver = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_Headshot.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Headshot_ver"); //verVal = ver.level; //if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // MightPowerSkill mver = comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver"); // verVal = mver.level; //} CellRect cellRect = CellRect.CenteredOn(base.Position, 1); cellRect.ClipInsideMap(map); int dmg = GetWeaponDmg(pawn); armorPen = pawn.equipment.Primary.def.Verbs.FirstOrDefault().defaultProjectile.projectile.GetArmorPenetration(1f); if (victim != null && Rand.Chance(this.launcher.GetStatValue(StatDefOf.ShootingAccuracyPawn, true))) { this.PenetratingShot(victim, dmg, this.def.projectile.damageDef); if (victim.Dead) { comp.Stamina.CurLevel += (.1f * verVal); } } } catch (NullReferenceException ex) { //Log.Message("null error " + ex); } }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); ThingDef def = this.def; if (!this.initialized) { caster = this.launcher as Pawn; CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_ShotgunSpec, "TM_ShotgunSpec", "_ver", true); this.explosionCount = 5; if (verVal >= 3) { this.explosionCount++; } this.initialized = true; } landed = true; ticksToDetonation = def.projectile.explosionDelay; GenExplosion.NotifyNearbyPawnsOfDangerousExplosive(this, def.projectile.damageDef, launcher.Faction); }
public int GetAttackDmg(Pawn pawn) { CompAbilityUserMight comp = pawn.GetComp <CompAbilityUserMight>(); //MightPowerSkill pwr = comp.MightData.MightPowerSkill_TigerStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_TigerStrike_pwr"); //MightPowerSkill ver = comp.MightData.MightPowerSkill_TigerStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_TigerStrike_ver"); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_TigerStrike, "TM_TigerStrike", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_TigerStrike, "TM_TigerStrike", "_pwr", true); MightPowerSkill str = comp.MightData.MightPowerSkill_global_strength.FirstOrDefault((MightPowerSkill x) => x.label == "TM_global_strength_pwr"); //this.verVal = ver.level; //this.pwrVal = pwr.level; //if (pawn.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; //} int dmgNum = 0; float pawnDPS = pawn.GetStatValue(StatDefOf.MeleeDPS, false); float skillMultiplier = .8f + (.08f * pwrVal); return(dmgNum = Mathf.RoundToInt(skillMultiplier * pawnDPS * comp.mightPwr * Rand.Range(.75f, 1.25f))); }
protected override bool TryCastShot() { CompAbilityUserMight comp = this.CasterPawn.GetComp <CompAbilityUserMight>(); MightPowerSkill ver = comp.MightData.MightPowerSkill_SeismicSlash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_SeismicSlash_ver"); pwrVal = TM_Calc.GetMightSkillLevel(this.CasterPawn, comp.MightData.MightPowerSkill_SeismicSlash, "TM_SeismicSlash", "_pwr", true); CellRect cellRect = CellRect.CenteredOn(base.CasterPawn.Position, 1); Map map = base.CasterPawn.Map; cellRect.ClipInsideMap(map); IntVec3 centerCell = cellRect.CenterCell; this.origin = base.CasterPawn.Position.ToVector3(); this.destination = this.currentTarget.Cell.ToVector3Shifted(); this.ticksToImpact = Mathf.RoundToInt((this.origin - this.destination).magnitude); if (this.CasterPawn.equipment.Primary != null && !this.CasterPawn.equipment.Primary.def.IsRangedWeapon) { TMAbilityDef ad = (TMAbilityDef)this.Ability.Def; int dmgNum = Mathf.RoundToInt(comp.weaponDamage * ad.weaponDamageFactor * (1 + (.1f * pwrVal))); ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); if (!this.CasterPawn.IsColonist && settingsRef.AIHardMode) { dmgNum += 10; } Vector3 strikeVec = this.origin; DrawBlade(strikeVec, 0); for (int i = 0; i < this.StartingTicksToImpact; i++) { strikeVec = this.ExactPosition; Pawn victim = strikeVec.ToIntVec3().GetFirstPawn(map); if (victim != null && victim.Faction != base.CasterPawn.Faction) { DrawStrike(strikeVec.ToIntVec3(), strikeVec, map); damageEntities(victim, null, dmgNum, DamageDefOf.Cut); } float angle = (Quaternion.AngleAxis(90, Vector3.up) * TM_Calc.GetVector(this.CasterPawn.DrawPos, this.currentTarget.CenterVector3)).ToAngleFlat(); TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_DirectionalDirt"), strikeVec, this.CasterPawn.Map, .3f + (.08f * i), .05f, .15f, .38f, 0, 5f - (.2f * i), angle, angle); if (i == 2) { TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Cleave"), strikeVec, this.CasterPawn.Map, .6f + (.05f * i), .05f, .04f + (.03f * i), .15f, -10000, 30, angle, angle); } //MoteMaker.ThrowTornadoDustPuff(strikeVec, map, .6f, Color.white); for (int j = 0; j < 2 + (2 * verVal); j++) { IntVec3 searchCell = strikeVec.ToIntVec3() + GenAdj.AdjacentCells8WayRandomized()[j]; TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_DirectionalDirt"), searchCell.ToVector3Shifted(), this.CasterPawn.Map, .1f + (.04f * i), .05f, .04f, .28f, 0, 4f - (.2f * i), angle, angle); //MoteMaker.ThrowTornadoDustPuff(searchCell.ToVector3(), map, .4f, Color.gray); victim = searchCell.GetFirstPawn(map); if (victim != null && victim.Faction != base.CasterPawn.Faction) { DrawStrike(searchCell, searchCell.ToVector3(), map); damageEntities(victim, null, dmgNum, DamageDefOf.Cut); } } this.ticksToImpact--; } } else { Messages.Message("MustHaveMeleeWeapon".Translate( this.CasterPawn.LabelCap ), MessageTypeDefOf.RejectInput); return(false); } this.burstShotsLeft = 0; this.PostCastShot(flag10, out flag10); return(flag10); }
public static int GetShotCount(Pawn pawn) { int shots = 0; float weaponDamage = pawn.equipment.Primary.def.Verbs.FirstOrDefault().defaultProjectile.projectile.GetDamageAmount(pawn.equipment.Primary, null); float burstShots = pawn.equipment.Primary.def.Verbs.FirstOrDefault().burstShotCount; shots = Mathf.RoundToInt(((50f / weaponDamage) + (2 * burstShots)) * (1.2f + .15f * TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_RifleSpec, "TM_RifleSpec", "_eff", true)) * pawn.GetComp <CompAbilityUserMight>().mightPwr); return(shots); }
protected override IEnumerable <Toil> MakeNewToils() { CompAbilityUserMight comp = this.pawn.GetComp <CompAbilityUserMight>(); float radius = 2f; radius = 2 + (.5f * TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_PsionicBarrier, "TM_PsionicBarrier", "_ver", true)); //if (this.pawn.story.traits.HasTrait(TorannMagicDefOf.TM_Psionic)) //{ // radius = 2 + (.5f * comp.MightData.MightPowerSkill_PsionicBarrier.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBarrier_ver").level); //} //else if(this.pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) //{ // radius = 2 + (.5f * comp.MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver").level); //} this.psiFlag = this.pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false); Toil psionicBarrier = new Toil(); psionicBarrier.initAction = delegate { if (age > duration) { this.EndJobWith(JobCondition.Succeeded); } Map map = this.pawn.Map; this.barrierCells = new List <IntVec3>(); this.barrierCells.Clear(); this.GetCellList(radius); ticksLeftThisToil = 10; }; psionicBarrier.tickAction = delegate { DrawBarrier(radius); if (Find.TickManager.TicksGame % this.barrierSearchFrequency == 0) { if (psiFlag) { if (Rand.Chance(.15f * comp.MightData.MightPowerSkill_PsionicBarrier.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBarrier_pwr").level)) { RepelProjectiles(false); } else { RepelProjectiles(psiFlag); } if (this.pawn.IsColonist) { HealthUtility.AdjustSeverity(this.pawn, HediffDef.Named("TM_PsionicHD"), -.005f); } else { HealthUtility.AdjustSeverity(this.pawn, HediffDef.Named("TM_PsionicHD"), -.05f); } psiEnergy = this.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).Severity; if (psiEnergy < 1) { this.EndJobWith(JobCondition.Succeeded); } if (this.psiFlag) { ticksLeftThisToil = (int)psiEnergy; } } else { RepelProjectiles(false); comp.Stamina.CurLevel -= .0004f; } } age++; if (!psiFlag) { ticksLeftThisToil = Mathf.RoundToInt(((float)(duration - age) / (float)duration) * 100f); if (age > duration) { this.EndJobWith(JobCondition.Succeeded); } if (comp.Stamina.CurLevel < .01f) { this.EndJobWith(JobCondition.Succeeded); } } }; psionicBarrier.defaultCompleteMode = ToilCompleteMode.Delay; psionicBarrier.defaultDuration = this.duration; psionicBarrier.WithProgressBar(TargetIndex.A, delegate { if (this.pawn.DestroyedOrNull() || this.pawn.Dead || this.pawn.Downed) { return(1f); } return(1f - (float)psionicBarrier.actor.jobs.curDriver.ticksLeftThisToil / 100); }, false, 0f); psionicBarrier.AddFinishAction(delegate { if (this.pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) { CompAbilityUserMight mightComp = this.pawn.GetComp <CompAbilityUserMight>(); if (mightComp.mimicAbility != null) { mightComp.RemovePawnAbility(mightComp.mimicAbility); } } //do soemthing? }); yield return(psionicBarrier); }
public static int GetShotCount(Pawn pawn) { return(Mathf.RoundToInt((5 + TM_Calc.GetMightSkillLevel(pawn, pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_ShotgunSpec, "TM_ShotgunSpec", "_eff", true)) * pawn.GetComp <CompAbilityUserMight>().mightPwr)); }
protected override bool TryCastShot() { bool flag = false; Pawn caster = base.CasterPawn; this.TargetsAoE.Clear(); //this.UpdateTargets(); FindTargets(); CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); if (this.Ability.Def == TorannMagicDefOf.TM_StayAlert || this.Ability.Def == TorannMagicDefOf.TM_StayAlert_I || this.Ability.Def == TorannMagicDefOf.TM_StayAlert_II || this.Ability.Def == TorannMagicDefOf.TM_StayAlert_III) { pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_StayAlert, "TM_StayAlert", "_pwr", true); flagSA = true; } if (this.Ability.Def == TorannMagicDefOf.TM_MoveOut || this.Ability.Def == TorannMagicDefOf.TM_MoveOut_I || this.Ability.Def == TorannMagicDefOf.TM_MoveOut_II || this.Ability.Def == TorannMagicDefOf.TM_MoveOut_III) { pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_MoveOut, "TM_MoveOut", "_pwr", true); flagMO = true; } if (this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine || this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine_I || this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine_II || this.Ability.Def == TorannMagicDefOf.TM_HoldTheLine_III) { pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_HoldTheLine, "TM_HoldTheLine", "_pwr", true); flagHTL = true; } Effecter OrderED = TorannMagicDefOf.TM_CommanderOrderED.Spawn(); OrderED.Trigger(new TargetInfo(caster.Position, caster.Map, false), new TargetInfo(caster.Position, caster.Map, false)); OrderED.Cleanup(); for (int i = 0; i < this.TargetsAoE.Count; i++) { Pawn newPawn = this.TargetsAoE[i].Thing as Pawn; if (newPawn.RaceProps.Humanlike && newPawn != caster) { float socialChance = (float)(caster.skills.GetSkill(SkillDefOf.Social).Level / 20f); float rChance = Mathf.Clamp(socialChance * 2f, .1f, 1f); if (!caster.IsColonist) { rChance = Mathf.Clamp(socialChance * 3f, .5f, 1f); ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); if (settingsRef.AIHardMode) { socialChance = 1f; } } if (Rand.Chance(rChance)) { float targetCountFactor = Mathf.Clamp(5f / (float)this.TargetsAoE.Count, .1f, 1f); if (flagSA) { if (newPawn.needs != null && newPawn.needs.rest != null) { newPawn.needs.rest.CurLevel += ((0.5f * targetCountFactor) + .05f * pwrVal); } if (newPawn.health != null && newPawn.health.hediffSet != null) { HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_StayAlertHD, (.7f * targetCountFactor) + (.1f * pwrVal)); } TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_PowerWave, newPawn.DrawPos, newPawn.Map, .8f, .2f, .1f, .1f, 0, 1f, 0, Rand.Chance(.5f) ? 0 : 180); } else if (flagMO) { if (newPawn.health != null && newPawn.health.hediffSet != null) { HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_MoveOutHD, Mathf.Clamp(.6f * targetCountFactor, .25f, .6f) + (.13f * pwrVal)); } TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_PowerWave, newPawn.DrawPos, newPawn.Map, .8f, .2f, .1f, .1f, 0, 1f, 0, Rand.Chance(.5f) ? 0 : 180); } else if (flagHTL) { if (newPawn.health != null && newPawn.health.hediffSet != null) { HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_HTLShieldHD, Mathf.Clamp(35f * targetCountFactor, 10f, 35f) + (5f * pwrVal)); HealthUtility.AdjustSeverity(newPawn, TorannMagicDefOf.TM_HoldTheLineHD, Mathf.Clamp(.7f * targetCountFactor, .3f, .7f) + (.1f * pwrVal)); Effecter HTLShieldED = TorannMagicDefOf.TM_HTL_EffecterED.Spawn(); HTLShieldED.Trigger(new TargetInfo(newPawn.Position, newPawn.Map, false), new TargetInfo(newPawn.Position, newPawn.Map, false)); OrderED.Cleanup(); } } if (newPawn.needs != null && newPawn.needs.mood != null && newPawn.needs.mood.thoughts != null) { if (Rand.Chance(1f - (.2f * socialChance))) { float moodChance = Mathf.Clamp(TM_Calc.GetRelationsFactor(caster, newPawn), .1f, .9f); if (Rand.Chance(moodChance)) { newPawn.needs.mood.thoughts.memories.TryGainMemory(TorannMagicDefOf.TM_TakingOrdersTD, null); } } } TM_FleckMaker.ThrowGenericFleck(FleckDefOf.LightningGlow, newPawn.DrawPos, newPawn.Map, .4f, .3f, .1f, .1f, 0, 0f, 0f, 0f); TM_FleckMaker.ThrowGenericFleck(FleckDefOf.LightningGlow, newPawn.DrawPos, newPawn.Map, .7f, .2f, .1f, .1f, 0, 0f, 0f, 0f); TM_FleckMaker.ThrowGenericFleck(FleckDefOf.LightningGlow, newPawn.DrawPos, newPawn.Map, 1.1f, .1f, .1f, .1f, 0, 0f, 0f, 0f); TM_FleckMaker.ThrowGenericFleck(FleckDefOf.ShotFlash, newPawn.DrawPos, newPawn.Map, .4f, .3f, .1f, .1f, 0, 0f, 0f, 0f); } else { if (newPawn.IsColonist) { MoteMaker.ThrowText(newPawn.DrawPos, newPawn.Map, "TM_IgnoredOrder".Translate(), -1); } } } } this.PostCastShot(flag, out flag); return(flag); }
protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); ThingDef def = this.def; this.caster = this.launcher as Pawn; if (!this.initialized) { CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>(); //pwrVal = caster.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_WaveOfFear.FirstOrDefault((MightPowerSkill x) => x.label == "TM_WaveOfFear_pwr").level; //verVal = caster.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_WaveOfFear.FirstOrDefault((MightPowerSkill x) => x.label == "TM_WaveOfFear_ver").level; verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_WaveOfFear, "TM_WaveOfFear", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_WaveOfFear, "TM_WaveOfFear", "_pwr", true); effVal = caster.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_WaveOfFear.FirstOrDefault((MightPowerSkill x) => x.label == "TM_WaveOfFear_eff").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; //} this.arcaneDmg = comp.mightPwr; ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); //if (!caster.IsColonist && settingsRef.AIHardMode) //{ // pwrVal = 3; // verVal = 3; //} for (int h = 0; h < caster.health.hediffSet.hediffs.Count; h++) { if (caster.health.hediffSet.hediffs[h].def.defName.Contains("TM_HateHD")) { hediff = caster.health.hediffSet.hediffs[h]; } } if (hediff != null) { this.radius = 4 + (.8f * verVal) + (.07f * hediff.Severity); HealthUtility.AdjustSeverity(caster, hediff.def, -(25f * (1 - .1f * this.effVal))); } else { this.radius = 4 + (.8f * verVal); } this.duration = Mathf.RoundToInt(this.radius * 10); this.affectedPawns = new List <Pawn>(); this.affectedPawns.Clear(); SoundInfo info = SoundInfo.InMap(new TargetInfo(base.Position, this.Map, false), MaintenanceType.None); TorannMagicDefOf.TM_GaspingAir.PlayOneShot(info); Effecter FearWave = TorannMagicDefOf.TM_FearWave.Spawn(); FearWave.Trigger(new TargetInfo(caster.Position, caster.Map, false), new TargetInfo(base.Position, this.Map, false)); FearWave.Cleanup(); SearchAndFear(); this.initialized = true; } if (Find.TickManager.TicksGame % this.waveDelay == 0) { SearchAndFear(); this.waveRange++; } }
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 pwr = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_AntiArmor.FirstOrDefault((MightPowerSkill x) => x.label == "TM_AntiArmor_pwr"); verVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_AntiArmor, "TM_AntiArmor", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(pawn, comp.MightData.MightPowerSkill_AntiArmor, "TM_AntiArmor", "_pwr", true); //MightPowerSkill ver = pawn.GetComp<CompAbilityUserMight>().MightData.MightPowerSkill_AntiArmor.FirstOrDefault((MightPowerSkill x) => x.label == "TM_AntiArmor_ver"); MightPowerSkill str = comp.MightData.MightPowerSkill_global_strength.FirstOrDefault((MightPowerSkill x) => x.label == "TM_global_strength_pwr"); //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; //} this.Initialize(base.Position, pawn); if (victim != null && !victim.Dead && Rand.Chance(this.launcher.GetStatValue(StatDefOf.ShootingAccuracyPawn, true))) { int dmg = GetWeaponDmg(pawn); bool flagFleshType = victim.RaceProps.FleshType != FleshTypeDefOf.Normal; float num = TM_Calc.GetOverallArmor(victim, StatDefOf.ArmorRating_Sharp); bool flagArmorAmount = num > 1f; if (flagArmorAmount || flagFleshType) { MoteMaker.ThrowMicroSparks(victim.Position.ToVector3(), map); TM_Action.DamageEntities(victim, null, dmg, 1.5f, this.def.projectile.damageDef, pawn); MoteMaker.MakeStaticMote(victim.Position, pawn.Map, ThingDefOf.Mote_ExplosionFlash, 4f); TM_Action.DamageEntities(victim, null, GetWeaponDmgMech(pawn, dmg), 1.5f, this.def.projectile.damageDef, pawn); MoteMaker.ThrowMicroSparks(victim.Position.ToVector3(), map); for (int i = 0; i < 1 + verVal; i++) { GenExplosion.DoExplosion(newPos, map, Rand.Range(.1f * (1 + verVal), .3f * (1 + verVal)), DamageDefOf.Bomb, this.launcher, this.def.projectile.GetDamageAmount(1, null) / 4 * (1 + verVal), .4f, SoundDefOf.MetalHitImportant, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, true); GenExplosion.DoExplosion(newPos, map, Rand.Range(.2f * (1 + verVal), .4f * (1 + verVal)), DamageDefOf.Stun, this.launcher, this.def.projectile.GetDamageAmount(1, null) / 2 * (1 + verVal), .4f, SoundDefOf.MetalHitImportant, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, true); newPos = GetNewPos(newPos, pawn.Position.x <= victim.Position.x, pawn.Position.z <= victim.Position.z, false, 0, 0, xProb, 1 - xProb); MoteMaker.ThrowMicroSparks(victim.Position.ToVector3(), base.Map); MoteMaker.ThrowDustPuff(newPos, map, Rand.Range(1.2f, 2.4f)); } DestroyArmor(victim, 4, 100); } else { TM_Action.DamageEntities(victim, null, dmg, 1.5f, this.def.projectile.damageDef, pawn); } } else { Log.Message("No valid target for anti armor shot or missed"); } } catch (NullReferenceException) { // } }
protected override bool TryCastShot() { bool result = false; bool arg_40_0; CompAbilityUserMight comp = this.CasterPawn.GetComp <CompAbilityUserMight>(); verVal = TM_Calc.GetMightSkillLevel(this.CasterPawn, comp.MightData.MightPowerSkill_PhaseStrike, "TM_PhaseStrike", "_ver", true); pwrVal = TM_Calc.GetMightSkillLevel(this.CasterPawn, comp.MightData.MightPowerSkill_PhaseStrike, "TM_PhaseStrike", "_pwr", true); //pwr = comp.MightData.MightPowerSkill_PhaseStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PhaseStrike_pwr"); //ver = comp.MightData.MightPowerSkill_PhaseStrike.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PhaseStrike_ver"); //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; //} if (this.CasterPawn.equipment.Primary != null && !this.CasterPawn.equipment.Primary.def.IsRangedWeapon) { TMAbilityDef ad = (TMAbilityDef)this.Ability.Def; this.dmgNum = Mathf.RoundToInt(comp.weaponDamage * ad.weaponDamageFactor); ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); if (!this.CasterPawn.IsColonist && settingsRef.AIHardMode) { this.dmgNum += 10; } if (this.currentTarget != null && base.CasterPawn != null) { arg_29_0 = this.currentTarget.Cell; Vector3 vector = this.currentTarget.CenterVector3; arg_40_0 = this.currentTarget.Cell.IsValid; arg_41_0 = vector.InBounds(base.CasterPawn.Map); arg_42_0 = true; // vector.ToIntVec3().Standable(base.CasterPawn.Map); } else { arg_40_0 = false; } bool flag = arg_40_0; bool flag2 = arg_41_0; bool flag3 = arg_42_0; if (flag) { if (flag2 & flag3) { Pawn p = this.CasterPawn; Map map = this.CasterPawn.Map; IntVec3 pLoc = this.CasterPawn.Position; bool drafted = p.Drafted; if (p.IsColonist) { try { ThingSelectionUtility.SelectNextColonist(); this.CasterPawn.DeSpawn(); //p.SetPositionDirect(this.currentTarget.Cell); SearchForTargets(arg_29_0, (2f + (float)(.5f * verVal)), map, p); GenSpawn.Spawn(p, this.currentTarget.Cell, map); DrawBlade(p.Position.ToVector3Shifted(), 4f + (float)(verVal)); p.drafter.Drafted = drafted; CameraJumper.TryJumpAndSelect(p); TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_BladeSweep"), this.CasterPawn.DrawPos, this.CasterPawn.Map, 1.4f + .4f * ver.level, .04f, 0f, .18f, 1000, 0, 0, Rand.Range(0, 360)); } catch { if (!CasterPawn.Spawned) { GenSpawn.Spawn(p, pLoc, map); p.drafter.Drafted = true; Log.Message("Phase strike threw exception - despawned pawn has been recovered at casting location"); } } } else { this.CasterPawn.DeSpawn(); SearchForTargets(arg_29_0, (2f + (float)(.5f * verVal)), map, p); GenSpawn.Spawn(p, this.currentTarget.Cell, map); DrawBlade(p.Position.ToVector3Shifted(), 4f + (float)(verVal)); } //this.CasterPawn.SetPositionDirect(this.currentTarget.Cell); //base.CasterPawn.SetPositionDirect(this.currentTarget.Cell); //this.CasterPawn.pather.ResetToCurrentPosition(); result = true; } else { Messages.Message("InvalidTargetLocation".Translate(), MessageTypeDefOf.RejectInput); } } } else { Messages.Message("MustHaveMeleeWeapon".Translate( this.CasterPawn.LabelCap ), MessageTypeDefOf.RejectInput); return(false); } this.burstShotsLeft = 0; //this.ability.TicksUntilCasting = (int)base.UseAbilityProps.SecondsToRecharge * 60; return(result); }