Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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;


                if (mightAbilityDef == TorannMagicDefOf.TM_Whirlwind)//mightAbilityDef == TorannMagicDefOf.)
                {
                    num = mightUser.ActualStaminaCost(mightAbilityDef) * 100;

                    num2  = FlyingObject_Whirlwind.GetWeaponDmg(mightUser.Pawn);
                    text2 = "TM_WhirlwindDamage".Translate(
                        num2.ToString()
                        );
                }
                else if (mightAbilityDef == TorannMagicDefOf.TM_Cleave)
                {
                    num = mightUser.ActualStaminaCost(mightAbilityDef) * 100;
                    if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon)
                    {
                        num2  = Mathf.Min((mightUser.Pawn.equipment.Primary.def.BaseMass * .4f) * 100f, 75f);
                        text2 = "TM_CleaveChance".Translate(
                            num2.ToString()
                            );
                    }
                    else
                    {
                        text2 = "TM_CleaveChance".Translate(
                            num2.ToString()
                            );
                    }
                }
                else if (mightUser.Pawn.equipment.Primary != null && mightUser.Pawn.equipment.Primary.def.IsRangedWeapon)
                {
                    num = mightUser.ActualStaminaCost(mightAbilityDef) * 100;
                    if (mightAbilityDef == TorannMagicDefOf.TM_Headshot)
                    {
                        num2  = Projectile_Headshot.GetWeaponDmg(mightUser.Pawn, ThingDef.Named("Projectile_Headshot"));
                        text2 = "TM_WeaponDamage".Translate(
                            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(
                            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(
                            mightAbilityDef.label,
                            num2.ToString(),
                            num3.ToString()
                            );
                    }
                }
                else if (mightUser.Pawn.equipment.Primary != null && !mightUser.Pawn.equipment.Primary.def.IsRangedWeapon)
                {
                    num = mightUser.ActualStaminaCost(mightAbilityDef) * 100;
                    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(
                            mightAbilityDef.label,
                            num2.ToString()
                            );
                    }
                    if (mightAbilityDef == TorannMagicDefOf.TM_BladeSpin)
                    {
                        num2  = Verb_BladeSpin.GetWeaponDmg(mightUser.Pawn);
                        text2 = "TM_WeaponDamage".Translate(
                            mightAbilityDef.label,
                            num2.ToString()
                            );
                    }
                    if (mightAbilityDef == TorannMagicDefOf.TM_SeismicSlash)
                    {
                        num2  = Verb_SeismicSlash.GetWeaponDmg(mightUser.Pawn);
                        text2 = "TM_WeaponDamage".Translate(
                            mightAbilityDef.label,
                            num2.ToString()
                            );
                    }
                }
                else if (mightUser.Pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false))
                {
                    num = mightUser.ActualStaminaCost(mightAbilityDef) * 100;
                    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 - (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))
                {
                    num   = mightUser.ActualStaminaCost(mightAbilityDef) * 100;
                    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
                }
                else
                {
                    num = mightUser.ActualStaminaCost(mightAbilityDef) * 100;
                }

                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);
        }
Exemplo n.º 3
0
        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);
        }