DND_Monster.Ability.WebSpellcasterBoilerplate C# (CSharp) Method

WebSpellcasterBoilerplate() public method

public WebSpellcasterBoilerplate ( string name, bool unique ) : string
name string
unique bool
return string
        public string WebSpellcasterBoilerplate(string name, bool unique)
        {
            if (!isSpell) return "";
            if (String.IsNullOrEmpty(name) || String.IsNullOrWhiteSpace(name))
            {
                name = "Creature";
            }
            else
            {
                if (!name.Contains('*') && !unique) { name = name.ToLower(); }
            }
            string spellcastingstat = Description.Split('|')[1];
            int modifier = 0;

            switch (spellcastingstat.ToLower().Substring(0, 3))
            {
                case "str":
                    modifier = (int)Math.Floor((double)(Convert.ToInt32(Monster.STR) - 10) / 2);
                    break;
                case "int":
                    modifier = (int)Math.Floor((double)(Convert.ToInt32(Monster.INT) - 10) / 2);
                    break;
                case "wis":
                    modifier = (int)Math.Floor((double)(Convert.ToInt32(Monster.WIS) - 10) / 2);
                    break;
                case "cha":
                    modifier = (int)Math.Floor((double)(Convert.ToInt32(Monster.CHA) - 10) / 2);
                    break;
                case "con":
                    modifier = (int)Math.Floor((double)(Convert.ToInt32(Monster.CON) - 10) / 2);
                    break;
                case "dex":
                    modifier = (int)Math.Floor((double)(Convert.ToInt32(Monster.DEX) - 10) / 2);
                    break;
            }

            string levelSuffix = "th";
            if (Description.Split('|')[2].Trim() == "1")
            {
                levelSuffix = "st";
            }
            if (Description.Split('|')[2].Trim() == "2")
            {
                levelSuffix = "nd";
            }
            if (Description.Split('|')[2].Trim() == "3")
            {
                levelSuffix = "rd";
            }

            string returnstring = "";

            if (!Description.Contains("NotInnate"))
            {
                returnstring += (unique ? name : "The " + name) + "'s spellcasting ability is " + spellcastingstat + " (spell save DC " + (8 + Monster.CR.profBonus + modifier) + "). ";
                returnstring += (unique ? name : "The " + name) + " can innately cast the following spells, requiring no material components: ";
            }
            else
            {
                returnstring += (unique ? name : "The " + name) + " is a " + Description.Split('|')[2] + levelSuffix + "-level spellcaster. ";
                returnstring += "Its spellcasting ability is " + spellcastingstat + " (spell save DC " + (8 + Monster.CR.profBonus + modifier) + ", +" + (modifier + Monster.CR.profBonus) + " to hit with spell attacks). ";
                returnstring += (unique ? name : "The " + name) + " has the following " + Description.Split('|')[0] + " spells prepared:";
            }

            return "<h4>" + (Description.Contains("NotInnate") ? "" : "Innate ") + "Spellcasting. </h4><p>" + returnstring + "</p></br>";
        }