Пример #1
0
 public override string Format()
 {
     if (Count > 1)
     {
         return(Count.ToString() + " " + HtmlCompiler.GetPlural(Translation.Translate(Structure)));
     }
     return(Translation.Translate(Structure));
 }
Пример #2
0
        public override string Format()
        {
            string output = "";

            if (Count > 1)
            {
                output += Count.ToString() + " ";
                output += HtmlCompiler.GetPlural(Translation.Translate(OwnName));
            }
            else
            {
                output = Translation.Translate(OwnName);
            }
            return(output);
        }
Пример #3
0
        public string GetTarget(string prep)
        {
            // SQUAD
            if (Parent is SquadInfo)
            {
                if (ApplicationType == ApplicationTypes.ApplyToSquad)
                {
                    return(" " + prep + " the squad");
                }
            }
            // UNIT
            else if (Parent is UnitInfo)
            {
                switch (ApplicationType)
                {
                case ApplicationTypes.ApplyToSquad:
                    return(" " + prep + " the squad");

                case ApplicationTypes.ApplyToEntityType:
                    if (Target != "")
                    {
                        return(prep + " " + HtmlCompiler.GetPlural(TargetName));
                    }
                    break;

                case ApplicationTypes.ApplyToEntity:
                    if (Target != "")
                    {
                        return(prep + " " + Translation.Translate(((UnitInfo)Parent).Name));
                    }
                    break;
                }
            }
            // Abilities
            else if (Parent is SkillInfo)
            {
                SkillInfo sk       = Parent as SkillInfo;
                bool      aoe      = (sk.Radius > 0);
                bool      isTarget = (sk.ActivationType == "tp_ability_activation_targeted");

                if (isTarget)
                {
                    if (aoe)
                    {
                        return(prep + " each target in the area of effect");
                    }
                    else
                    {
                        switch (ApplicationType)
                        {
                        case ApplicationTypes.ApplyToSquad:
                            return(prep + " targeted squad");

                        case ApplicationTypes.ApplyToEntity:
                            return(prep + " the target ");
                        }
                    }
                }
                else
                {
                    switch (ApplicationType)
                    {
                    case ApplicationTypes.ApplyToEntity:
                    {
                        if (aoe)
                        {
                            return(prep + " each target in the area of effect");
                        }
                        break;
                    }

                    case ApplicationTypes.ApplyToWeaponType:
                        if (Target != "")
                        {
                            return(prep + " " + TargetName);
                        }
                        break;

                    case ApplicationTypes.ApplyToSquadType:
                        if (Target != "")
                        {
                            return(prep + " " + TargetName);
                        }
                        break;

                    case ApplicationTypes.ApplyToEntityType:
                        if (Target != "")
                        {
                            return(prep + " " + TargetName);
                        }
                        break;
                    }
                }
            }
            else if (Target != "")      // research and others
            {
                return(prep + " " + TargetName);
            }

            return("");
        }
Пример #4
0
        public override string Compile()
        {
            if (Parent != null)
            {
                string target  = "";
                string action  = "Increases ";
                bool   further = false;
                string amount  = "";
                bool   stacks  = !DoNotStacks;

                switch (UsageType)
                {
                case UsageTypes.Add:
                    if (Amount < 0)
                    {
                        action = "Decreases";
                    }
                    break;

                case UsageTypes.Multiply:
                    if (Amount < 1)
                    {
                        action = "Decreases";
                    }
                    break;
                }

                double mul = 1.0;

                if (Parent is SquadInfo || Parent is UnitInfo)
                {
                    SquadInfo squad   = Parent is UnitInfo ? (SquadInfo)((UnitInfo)Parent).Parent : (SquadInfo)Parent;
                    bool      isSquad = squad.MaxSquadSize > 1;

                    if (TargetName == squad.Unit.Name)
                    {
                        further = true;
                    }

                    if (isSquad)
                    {
                        target = TargetName + " squads";
                        mul    = squad.StartingSquadSize;
                    }
                    else
                    {
                        target = HtmlCompiler.GetPlural(TargetName);
                    }
                }
                else if (Parent is ResearchInfo)
                {
                    target = TargetName;
                }
                else if (Parent is BuildingInfo)
                {
                    if (TargetName == ((BuildingInfo)Parent).Name)
                    {
                        further = true;
                    }
                    target = HtmlCompiler.GetPlural(TargetName);
                }
                else
                {
                    target = HtmlCompiler.GetPlural(TargetName);
                }

                if (this.UsageType == UsageTypes.Add)
                {
                    amount = ((double)Math.Abs((mul * Amount))).ToString();
                }
                else
                {
                    amount = ((double)(mul * Math.Abs((this.Amount - 1) * 100))).ToString() + "%";
                }

                return(action + " the " + this.ModifierTranslation + " of " + (further ? "further " : "") + target + " by " + amount + (ModifierTranslation == "build time" ? " seconds" : "") + (stacks ? "" : "(do not stacks)"));
            }
            return(base.Compile());
        }