예제 #1
0
        public virtual string GetAoEDesc()
        {
            string result = "";
            VerbProperties_Ability def = this.MainVerb;

            if (def != null)
            {
                if (def.TargetAoEProperties != null)
                {
                    StringBuilder s = new StringBuilder();
                    s.AppendLine(StringsToTranslate.AU_AoEProperties);
                    if (def.TargetAoEProperties.targetClass == typeof(Pawn))
                    {
                        s.AppendLine("\t" + StringsToTranslate.AU_TargetClass + StringsToTranslate.AU_TargetClass);
                    }
                    else
                    {
                        s.AppendLine("\t" + StringsToTranslate.AU_TargetClass + def.TargetAoEProperties.targetClass.ToString().CapitalizeFirst());
                    }
                    s.AppendLine("\t" + "Range".Translate() + ": " + def.TargetAoEProperties.range.ToString());
                    s.AppendLine("\t" + StringsToTranslate.AU_TargetClass + def.TargetAoEProperties.friendlyFire.ToString());
                    s.AppendLine("\t" + StringsToTranslate.AU_AoEMaxTargets + def.TargetAoEProperties.maxTargets.ToString());
                    if (def.TargetAoEProperties.startsFromCaster)
                    {
                        s.AppendLine("\t" + StringsToTranslate.AU_AoEStartsFromCaster);
                    }
                    result = s.ToString();
                }
            }
            return(result);
        }
예제 #2
0
 public virtual string PostAbilityVerbCompDesc(VerbProperties_Ability verbDef)
 {
     return("");
 }
예제 #3
0
 public virtual string PostAbilityVerbCompDesc(VerbProperties_Ability verbDef) => "";
예제 #4
0
        public string GetBasics()
        {
            string result = "";
            VerbProperties_Ability def = this.MainVerb;

            if (def != null)
            {
                StringBuilder s = new StringBuilder();
                s.AppendLine(StringsToTranslate.AU_Cooldown + def.SecondsToRecharge.ToString("N0") + " " + "SecondsLower".Translate());
                switch (def.AbilityTargetCategory)
                {
                case AbilityTargetCategory.TargetAoE:
                    s.AppendLine(StringsToTranslate.AU_Type + StringsToTranslate.AU_TargetAoE);
                    break;

                case AbilityTargetCategory.TargetSelf:
                    s.AppendLine(StringsToTranslate.AU_Type + StringsToTranslate.AU_TargetSelf);
                    break;

                case AbilityTargetCategory.TargetThing:
                    s.AppendLine(StringsToTranslate.AU_Type + StringsToTranslate.AU_TargetThing);
                    break;

                case AbilityTargetCategory.TargetLocation:
                    s.AppendLine(StringsToTranslate.AU_Type + StringsToTranslate.AU_TargetLocation);
                    break;
                }
                if (def.tooltipShowProjectileDamage)
                {
                    if (def.defaultProjectile != null)
                    {
                        if (def.defaultProjectile.projectile != null)
                        {
                            if (def.defaultProjectile.projectile.damageAmountBase > 0)
                            {
                                s.AppendLine("Damage".Translate() + ": " + def.defaultProjectile.projectile.damageAmountBase);
                                s.AppendLine("Damage".Translate() + " " + StringsToTranslate.AU_Type + def.defaultProjectile.projectile.damageDef.LabelCap);
                            }
                        }
                    }
                }
                if (def.tooltipShowExtraDamages)
                {
                    if (def.extraDamages != null && def.extraDamages.Count > 0)
                    {
                        if (def.extraDamages.Count == 1)
                        {
                            s.AppendLine(StringsToTranslate.AU_Extra + " " + "Damage".Translate() + ": " + def.extraDamages[0].damage);
                            s.AppendLine(StringsToTranslate.AU_Extra + " " + "Damage".Translate() + " " + StringsToTranslate.AU_Type + def.extraDamages[0].damageDef.LabelCap);
                        }
                        else
                        {
                            s.AppendLine(StringsToTranslate.AU_Extra + " " + "Damage".Translate() + ": ");
                            foreach (ExtraDamage extraDam in def.extraDamages)
                            {
                                s.AppendLine("\t" + StringsToTranslate.AU_Extra + " " + "Damage".Translate() + " " + StringsToTranslate.AU_Type + extraDam.damageDef.LabelCap);
                                s.AppendLine("\t" + StringsToTranslate.AU_Extra + " " + "Damage".Translate() + ": " + extraDam.damage);
                            }
                        }
                    }
                }
                if (def.tooltipShowMentalStatesToApply)
                {
                    if (def.mentalStatesToApply != null && def.mentalStatesToApply.Count > 0)
                    {
                        if (def.mentalStatesToApply.Count == 1)
                        {
                            s.AppendLine(StringsToTranslate.AU_MentalStateChance + ": " + def.mentalStatesToApply[0].mentalStateDef.LabelCap + " " + def.mentalStatesToApply[0].applyChance.ToStringPercent());
                        }
                        else
                        {
                            s.AppendLine(StringsToTranslate.AU_MentalStateChance);
                            foreach (ApplyMentalStates mentalState in def.mentalStatesToApply)
                            {
                                s.AppendLine("\t" + mentalState.mentalStateDef.LabelCap + " " + mentalState.applyChance.ToStringPercent());
                            }
                        }
                    }
                }
                if (def.tooltipShowHediffsToApply)
                {
                    if (def.hediffsToApply != null && def.hediffsToApply.Count > 0)
                    {
                        if (def.hediffsToApply.Count == 1)
                        {
                            s.AppendLine(StringsToTranslate.AU_EffectChance + def.hediffsToApply[0].hediffDef.LabelCap + " " + def.hediffsToApply[0].applyChance.ToStringPercent());
                        }
                        else
                        {
                            s.AppendLine(StringsToTranslate.AU_EffectChance);
                            foreach (ApplyHediffs hediff in def.hediffsToApply)
                            {
                                float duration = 0;
                                if (hediff.hediffDef.comps != null)
                                {
                                    if (hediff.hediffDef.HasComp(typeof(HediffComp_Disappears)))
                                    {
                                        int intDuration = ((HediffCompProperties_Disappears)hediff.hediffDef.CompPropsFor(typeof(HediffComp_Disappears))).disappearsAfterTicks.max;
                                        duration = GenTicks.TicksToSeconds(intDuration);
                                    }
                                }
                                if (duration == 0)
                                {
                                    s.AppendLine("\t" + hediff.hediffDef.LabelCap + " " + hediff.applyChance.ToStringPercent());
                                }
                                else
                                {
                                    s.AppendLine("\t" + hediff.hediffDef.LabelCap + " " + hediff.applyChance.ToStringPercent() + " " + duration + " " + "SecondsToLower".Translate());
                                }
                            }
                        }
                    }
                    if (def.burstShotCount > 1)
                    {
                        s.AppendLine(StringsToTranslate.AU_BurstShotCount + " " + def.burstShotCount.ToString());
                    }
                }

                result = s.ToString();
            }
            return(result);
        }
예제 #5
0
        public IEnumerable <Command_PawnAbility> GetPawnAbilityVerbs()
        {
            //Log.ErrorOnce("GetPawnAbilityVerbs Called", 912912);
            List <Verb_UseAbility> temp = new List <Verb_UseAbility>();

            temp.AddRange(this.AbilityVerbs);
            for (int i = 0; i < this.allPowers.Count; i++)
            {
                int                    j            = i;
                Verb_UseAbility        newVerb      = temp[j];
                VerbProperties_Ability newVerbProps = newVerb.UseAbilityProps;
                newVerb.caster    = this.AbilityUser;
                newVerb.verbProps = temp[j].verbProps;

                Command_PawnAbility command_CastPower = new Command_PawnAbility(this, this.allPowers[i])
                {
                    verb         = newVerb,
                    defaultLabel = this.allPowers[j].powerdef.LabelCap
                };


                //GetDesc
                StringBuilder s = new StringBuilder();
                s.AppendLine(this.allPowers[j].powerdef.GetDescription());
                s.AppendLine(PostAbilityVerbCompDesc(newVerb.UseAbilityProps));
                command_CastPower.defaultDesc = s.ToString();
                s = null;


                command_CastPower.targetingParams = this.allPowers[j].powerdef.MainVerb.targetParams;
                //command_CastPower.targetingParams = TargetingParameters.ForAttackAny();

                //if (newVerb.useAbilityProps.AbilityTargetCategory == AbilityTargetCategory.TargetSelf)
                //{
                //    command_CastPower.targetingParams = TargetingParameters.ForSelf(this.abilityUser);
                //}
                //else
                //{
                //    command_CastPower.targetingParams = TargetingParameters.
                //}
                command_CastPower.icon = this.allPowers[j].powerdef.uiIcon;
                //string str;
                //if (FloatMenuUtility.GetAttackAction(this.abilityUser, LocalTargetInfo.Invalid, out str) == null)
                //{
                //    command_CastPower.Disable(str.CapitalizeFirst() + ".");
                //}
                command_CastPower.action = delegate(Thing target)
                {
                    Action attackAction = CompAbilityUser.TryCastAbility(this.AbilityUser, target, this, newVerb, this.allPowers[j].powerdef as AbilityDef);
                    if (attackAction != null)
                    {
                        if (CanOverpowerTarget(this.AbilityUser, target, this.allPowers[j].powerdef as AbilityDef))
                        {
                            attackAction();
                        }
                    }
                };
                if (newVerb.caster.Faction != Faction.OfPlayer)
                {
                    command_CastPower.Disable("CannotOrderNonControlled".Translate());
                }
                string reason = "";
                if (newVerb.CasterIsPawn)
                {
                    if (newVerb.CasterPawn.story.WorkTagIsDisabled(WorkTags.Violent) && this.allPowers[j].powerdef.MainVerb.isViolent)
                    {
                        command_CastPower.Disable("IsIncapableOfViolence".Translate(new object[]
                        {
                            newVerb.CasterPawn.NameStringShort
                        }));
                    }
                    else if (!newVerb.CasterPawn.drafter.Drafted)
                    {
                        command_CastPower.Disable("IsNotDrafted".Translate(new object[]
                        {
                            newVerb.CasterPawn.NameStringShort
                        }));
                    }
                    else if (!newVerb.ability.CanFire)
                    {
                        command_CastPower.Disable("AU_PawnAbilityRecharging".Translate(new object[]
                        {
                            newVerb.CasterPawn.NameStringShort
                        }));
                    }
                    //This is a hook for modders.
                    else if (!CanCastPowerCheck(newVerb, out reason))
                    {
                        command_CastPower.Disable(reason.Translate(new object[]
                        {
                            newVerb.CasterPawn.NameStringShort
                        }));
                    }
                }
                yield return(command_CastPower);
            }
            temp = null;
            yield break;
        }