public virtual void Effect() { LocalTargetInfo t = this.TargetsAoE[0]; bool flag = t.Cell != default(IntVec3); if (flag) { Pawn casterPawn = base.CasterPawn; this.Ability.PostAbilityAttempt(); LongEventHandler.QueueLongEvent(delegate { FlyingObject_Whirlwind flyingObject = (FlyingObject_Whirlwind)GenSpawn.Spawn(ThingDef.Named("FlyingObject_Whirlwind"), this.CasterPawn.Position, this.CasterPawn.Map); flyingObject.Launch(this.CasterPawn, t.Cell, this.CasterPawn); }, "LaunchingFlyer", false, null); } }
public static string PostAbilityDesc(TMAbilityDef mightAbilityDef, CompAbilityUserMight mightUser) { string result = ""; StringBuilder stringBuilder = new StringBuilder(); bool flag = mightAbilityDef != null; if (flag) { string text = ""; string text2 = ""; float num = 0; float num2 = 0; if (mightAbilityDef == TorannMagicDefOf.TM_Whirlwind)//mightAbilityDef == TorannMagicDefOf.) { num = mightUser.ActualStaminaCost(mightAbilityDef); num2 = FlyingObject_Whirlwind.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WhirlwindDamage".Translate(new object[] { num2.ToString() }); } else if (mightAbilityDef == TorannMagicDefOf.TM_Cleave) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num2 = Mathf.Min((mightUser.Pawn.equipment.Primary.def.BaseMass * .3f) * 100f, 65f); text2 = "TM_CleaveChance".Translate(new object[] { num2.ToString() }); } else { text2 = "TM_CleaveChance".Translate(new object[] { num2.ToString() }); } } else if (mightUser.Pawn.equipment.Primary != null && mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightAbilityDef == TorannMagicDefOf.TM_Headshot) { num2 = Projectile_Headshot.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_Headshot")); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_AntiArmor) { num2 = Projectile_AntiArmor.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_AntiArmor")); float num3 = Projectile_AntiArmor.GetWeaponDmgMech(mightUser.Pawn, Mathf.RoundToInt(num2)); text2 = "TM_AntiArmorDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString(), num3.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_I || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_II || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_III) { num2 = Projectile_ArrowStorm.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_ArrowStorm")); int num3 = Mathf.RoundToInt(Projectile_ArrowStorm.GetWeaponAccuracy(mightUser.Pawn) * 100f); text2 = "TM_ArrowStormDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString(), num3.ToString() }); } } else if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_I || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_II || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_III) { num2 = Verb_PhaseStrike.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_BladeSpin) { num = mightUser.ActualStaminaCost(mightAbilityDef); num2 = Verb_BladeSpin.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_SeismicSlash) { num = mightUser.ActualStaminaCost(mightAbilityDef); num2 = Verb_SeismicSlash.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } } else { num = mightUser.ActualStaminaCost(mightAbilityDef); } text = "TM_AbilityDescBaseStaminaCost".Translate(new object[] { mightAbilityDef.staminaCost.ToString("p1") }) + "\n" + "TM_AbilityDescAdjustedStaminaCost".Translate(new object[] { num.ToString("p1") }); bool flag2 = text != ""; if (flag2) { stringBuilder.AppendLine(text); } bool flag3 = text2 != ""; if (flag3) { stringBuilder.AppendLine(text2); } result = stringBuilder.ToString(); } return(result); }
public static string PostAbilityDesc(TMAbilityDef mightAbilityDef, CompAbilityUserMight mightUser, int maxCastingTicks) { string result = ""; StringBuilder stringBuilder = new StringBuilder(); bool flag = mightAbilityDef != null; if (flag) { string text = ""; string text2 = ""; string text3 = ""; float num = 0; float num2 = 0; num = mightUser.ActualStaminaCost(mightAbilityDef) * 100; if (mightAbilityDef == TorannMagicDefOf.TM_Whirlwind)//mightAbilityDef == TorannMagicDefOf.) { num2 = FlyingObject_Whirlwind.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WhirlwindDamage".Translate( num2.ToString() ); } else if (mightAbilityDef == TorannMagicDefOf.TM_Cleave) { if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num2 = Mathf.Min((mightUser.Pawn.equipment.Primary.def.BaseMass * .15f) * 100f, 75f); text2 = "TM_CleaveChance".Translate( num2.ToString() ); } else { text2 = "TM_CleaveChance".Translate( num2.ToString() ); } } else if (mightAbilityDef == TorannMagicDefOf.TM_ShadowStrike) { num2 = Projectile_ShadowStrike.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate( mightAbilityDef.label, num2.ToString() ); if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { text3 = "TM_CritChance".Translate( mightAbilityDef.label, mightUser.weaponCritChance.ToString("P0") ); } else { text3 = "TM_CritChance".Translate( mightAbilityDef.label, "0" ); } } else if (mightUser.Pawn.equipment.Primary != null && mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { if (mightAbilityDef == TorannMagicDefOf.TM_Headshot) { num2 = Projectile_Headshot.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate( mightAbilityDef.label, num2.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_AntiArmor) { num2 = Projectile_AntiArmor.GetWeaponDmg(mightUser.Pawn); float num3 = Projectile_AntiArmor.GetWeaponDmgMech(mightUser.Pawn, Mathf.RoundToInt(num2)); text2 = "TM_AntiArmorDamage".Translate( mightAbilityDef.label, num2.ToString(), num3.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_I || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_II || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_III) { num2 = Projectile_ArrowStorm.GetWeaponDmg(mightUser.Pawn); int num3 = Mathf.RoundToInt(Projectile_ArrowStorm.GetWeaponAccuracy(mightUser.Pawn) * 100f); text2 = "TM_ArrowStormDamage".Translate( mightAbilityDef.label, num2.ToString(), num3.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_TempestStrike) { num2 = Projectile_TempestStrike.GetWeaponDmg(mightUser.Pawn); int num3 = Mathf.RoundToInt(Verb_TempestStrike.HitChance(mightUser.Pawn) * 100); text2 = "TM_ArrowStormDamage".Translate( mightAbilityDef.label, (num2.ToString() + " per strike\n"), num3.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_SuppressingFire) { num2 = Verb_SuppressingFire.GetShotCount(mightUser.Pawn); text2 = "TM_SuppressingFireCount".Translate(num2).ToString(); } if (mightAbilityDef == TorannMagicDefOf.TM_Buckshot) { num2 = Verb_Buckshot.GetShotCount(mightUser.Pawn); text2 = "TM_BuckshotFireCount".Translate(num2).ToString(); } } else if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { if (mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_I || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_II || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_III) { num2 = Mathf.RoundToInt(mightUser.weaponDamage * mightAbilityDef.weaponDamageFactor); text2 = "TM_WeaponDamage".Translate( mightAbilityDef.label, num2.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_BladeSpin) { num2 = Mathf.RoundToInt(mightUser.weaponDamage * mightAbilityDef.weaponDamageFactor); text2 = "TM_WeaponDamage".Translate( mightAbilityDef.label, num2.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_SeismicSlash) { num2 = Mathf.RoundToInt(mightUser.weaponDamage * mightAbilityDef.weaponDamageFactor * (1f + (.1f * mightUser.MightData.GetSkill_Power(mightAbilityDef).level))); text2 = "TM_WeaponDamage".Translate( mightAbilityDef.label, num2.ToString() ); } if (mightAbilityDef == TorannMagicDefOf.TM_TempestStrike) { num2 = Projectile_TempestStrike.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate( mightAbilityDef.label, num2.ToString() ) + " per strike"; } } else if (mightUser.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false)) { if (mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast || mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast_I || mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast_II || mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast_III) { num2 = 4 - (mightUser.MightData.MightPowerSkill_PsionicBlast.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBlast_ver").level); text2 = "TM_PsionicInitialCost".Translate( 20 ) + "\n" + "TM_PsionicBlastAddCost".Translate( num2 ); } if (mightAbilityDef == TorannMagicDefOf.TM_PsionicDash) { num2 = 8 - (mightUser.MightData.MightPowerSkill_PsionicDash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicDash_eff").level); text2 = "TM_PsionicInitialCost".Translate( num2 ); } if (mightAbilityDef == TorannMagicDefOf.TM_PsionicBarrier) { num2 = 8 - (mightUser.MightData.MightPowerSkill_PsionicDash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicDash_eff").level); text2 = "TM_PsionicBarrierMaintenanceCost".Translate( 20 ) + "\n" + "TM_PsionicBarrierConversionRate".Translate( num2 ); } if (mightAbilityDef == TorannMagicDefOf.TM_PsionicStorm) { num2 = 65 - (5 * (mightUser.MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_eff").level)); text2 = "TM_PsionicInitialCost".Translate( num2 ); } } else if (TM_Calc.HasHateHediff(mightUser.Pawn) && (mightAbilityDef == TorannMagicDefOf.TM_Spite || mightAbilityDef == TorannMagicDefOf.TM_Spite_I || mightAbilityDef == TorannMagicDefOf.TM_Spite_II || mightAbilityDef == TorannMagicDefOf.TM_Spite_III)) { text2 = "TM_RequiresHateAmount".Translate( 20 ); } //else if (mightUser.Pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_ChiHD, false) && (mightAbilityDef == TorannMagicDefOf.TM_TigerStrike || mightAbilityDef == TorannMagicDefOf.TM_DragonStrike || mightAbilityDef == TorannMagicDefOf.TM_ThunderStrike)) //{ // //displays ability damage for active/passive attacks //} if (mightAbilityDef.chiCost != 0) { text = "TM_AbilityDescBaseChiCost".Translate( (mightAbilityDef.chiCost * 100).ToString("n1") ) + "\n" + "TM_AbilityDescAdjustedChiCost".Translate( (mightUser.ActualChiCost(mightAbilityDef) * 100).ToString("n1") ); } else { text = "TM_AbilityDescBaseStaminaCost".Translate( (mightAbilityDef.staminaCost * 100).ToString("n1") ) + "\n" + "TM_AbilityDescAdjustedStaminaCost".Translate( num.ToString("n1") ); } if (mightUser.coolDown != 1f && maxCastingTicks != 0) { text3 = "TM_AdjustedCooldown".Translate( ((maxCastingTicks * mightUser.coolDown) / 60).ToString("0.00") ); } bool flag2 = text != ""; if (flag2) { stringBuilder.AppendLine(text); } bool flag3 = text2 != ""; if (flag3) { stringBuilder.AppendLine(text2); } result = stringBuilder.ToString(); bool flag4 = text3 != ""; if (flag4) { stringBuilder.AppendLine(text3); } result = stringBuilder.ToString(); } return(result); }
public static string PostAbilityDesc(TMAbilityDef mightAbilityDef, CompAbilityUserMight mightUser) { string result = ""; StringBuilder stringBuilder = new StringBuilder(); bool flag = mightAbilityDef != null; if (flag) { string text = ""; string text2 = ""; float num = 0; float num2 = 0; if (mightAbilityDef == TorannMagicDefOf.TM_Whirlwind)//mightAbilityDef == TorannMagicDefOf.) { num = mightUser.ActualStaminaCost(mightAbilityDef); num2 = FlyingObject_Whirlwind.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WhirlwindDamage".Translate(new object[] { num2.ToString() }); } else if (mightAbilityDef == TorannMagicDefOf.TM_Cleave) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num2 = Mathf.Min((mightUser.Pawn.equipment.Primary.def.BaseMass * .3f) * 100f, 65f); text2 = "TM_CleaveChance".Translate(new object[] { num2.ToString() }); } else { text2 = "TM_CleaveChance".Translate(new object[] { num2.ToString() }); } } else if (mightUser.Pawn.equipment.Primary != null && mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightAbilityDef == TorannMagicDefOf.TM_Headshot) { num2 = Projectile_Headshot.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_Headshot")); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_AntiArmor) { num2 = Projectile_AntiArmor.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_AntiArmor")); float num3 = Projectile_AntiArmor.GetWeaponDmgMech(mightUser.Pawn, Mathf.RoundToInt(num2)); text2 = "TM_AntiArmorDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString(), num3.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_I || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_II || mightAbilityDef == TorannMagicDefOf.TM_ArrowStorm_III) { num2 = Projectile_ArrowStorm.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_ArrowStorm")); int num3 = Mathf.RoundToInt(Projectile_ArrowStorm.GetWeaponAccuracy(mightUser.Pawn) * 100f); text2 = "TM_ArrowStormDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString(), num3.ToString() }); } } else if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_I || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_II || mightAbilityDef == TorannMagicDefOf.TM_PhaseStrike_III) { num2 = Verb_PhaseStrike.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_BladeSpin) { num = mightUser.ActualStaminaCost(mightAbilityDef); num2 = Verb_BladeSpin.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } if (mightAbilityDef == TorannMagicDefOf.TM_SeismicSlash) { num = mightUser.ActualStaminaCost(mightAbilityDef); num2 = Verb_SeismicSlash.GetWeaponDmg(mightUser.Pawn); text2 = "TM_WeaponDamage".Translate(new object[] { mightAbilityDef.label, num2.ToString() }); } } else if (mightUser.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false)) { num = mightUser.ActualStaminaCost(mightAbilityDef); if (mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast || mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast_I || mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast_II || mightAbilityDef == TorannMagicDefOf.TM_PsionicBlast_III) { num2 = 4 - (mightUser.MightData.MightPowerSkill_PsionicBlast.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicBlast_ver").level); text2 = "TM_PsionicInitialCost".Translate(new object[] { 20 }) + "\n" + "TM_PsionicBlastAddCost".Translate(new object[] { num2 }); } if (mightAbilityDef == TorannMagicDefOf.TM_PsionicDash) { num2 = 8 - (mightUser.MightData.MightPowerSkill_PsionicDash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicDash_eff").level); text2 = "TM_PsionicInitialCost".Translate(new object[] { num2 }); } if (mightAbilityDef == TorannMagicDefOf.TM_PsionicBarrier) { num2 = 8 - (mightUser.MightData.MightPowerSkill_PsionicDash.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicDash_eff").level); text2 = "TM_PsionicBarrierMaintenanceCost".Translate(new object[] { 20 }) + "\n" + "TM_PsionicBarrierConversionRate".Translate(new object[] { num2 }); } if (mightAbilityDef == TorannMagicDefOf.TM_PsionicStorm) { num2 = 65 - (mightUser.MightData.MightPowerSkill_PsionicStorm.FirstOrDefault((MightPowerSkill x) => x.label == "TM_PsionicStorm_eff").level); text2 = "TM_PsionicInitialCost".Translate(new object[] { num2 }); } } else { num = mightUser.ActualStaminaCost(mightAbilityDef); } text = "TM_AbilityDescBaseStaminaCost".Translate(new object[] { mightAbilityDef.staminaCost.ToString("p1") }) + "\n" + "TM_AbilityDescAdjustedStaminaCost".Translate(new object[] { num.ToString("p1") }); bool flag2 = text != ""; if (flag2) { stringBuilder.AppendLine(text); } bool flag3 = text2 != ""; if (flag3) { stringBuilder.AppendLine(text2); } result = stringBuilder.ToString(); } return(result); }