public static void Effect_DecreasePreference(Polity polity, string preferenceId, float minPercentChange, float maxPercentChange, int rngOffset)
    {
        float charismaFactor = polity.CurrentLeader.Charisma / 10f;
        float wisdomFactor   = polity.CurrentLeader.Wisdom / 15f;

        float attributesFactor = Mathf.Max(charismaFactor, wisdomFactor);

        attributesFactor = Mathf.Clamp(attributesFactor, 0.5f, 2f);

        float randomFactor            = polity.GetNextLocalRandomFloat(rngOffset++);
        float preferencePercentChange = (maxPercentChange - minPercentChange) * randomFactor + minPercentChange;

        preferencePercentChange /= attributesFactor;

        Faction dominantFaction = polity.DominantFaction;

        dominantFaction.DecreasePreferenceValue(preferenceId, preferencePercentChange);
    }
    protected static void Effect_DecreaseRelationship(Polity sourcePolity, Polity targetPolity, float minPercentChange, float maxPercentChange, int rngOffset)
    {
        float charismaFactor = sourcePolity.CurrentLeader.Charisma / 10f;
        float wisdomFactor   = sourcePolity.CurrentLeader.Wisdom / 15f;

        float attributesFactor = Mathf.Max(charismaFactor, wisdomFactor);

        attributesFactor = Mathf.Clamp(attributesFactor, 0.5f, 2f);

        float randomFactor = sourcePolity.GetNextLocalRandomFloat(rngOffset);
        float relationshipPercentChange = (maxPercentChange - minPercentChange) * randomFactor + minPercentChange;

        relationshipPercentChange /= attributesFactor;

        Faction sourceDominantFaction = sourcePolity.DominantFaction;
        Faction targetdominantFaction = targetPolity.DominantFaction;

        float newValue = MathUtility.DecreaseByPercent(sourceDominantFaction.GetRelationshipValue(targetdominantFaction), relationshipPercentChange);

        Faction.SetRelationship(sourceDominantFaction, targetdominantFaction, newValue);

        Manager.AddUpdatedCells(sourcePolity, CellUpdateType.Territory, CellUpdateSubType.Relationship);
        Manager.AddUpdatedCells(targetPolity, CellUpdateType.Territory, CellUpdateSubType.Relationship);
    }
    protected override void GenerateName(Faction parentFaction)
    {
        int rngOffset = RngOffsets.CLAN_GENERATE_NAME + unchecked ((int)Polity.Id);

        if (parentFaction != null)
        {
            rngOffset += unchecked ((int)parentFaction.Id);
        }

        GetRandomIntDelegate   getRandomInt   = (int maxValue) => Polity.GetNextLocalRandomInt(rngOffset++, maxValue);
        GetRandomFloatDelegate getRandomFloat = () => Polity.GetNextLocalRandomFloat(rngOffset++);

        Language language = Polity.Culture.Language;
        Region   region   = CoreGroup.Cell.Region;

        string untranslatedName = "";

        if (region.Elements.Count <= 0)
        {
            throw new System.Exception("No elements to choose name from");
        }

        List <string> possibleAdjectives = null;

        List <Element.Instance> remainingElements = new List <Element.Instance>(region.Elements);

        bool addMoreWords = true;

        bool  isPrimaryNoun   = true;
        float extraWordChance = 0.2f;

        List <Element.Instance> usedElements = new List <Element.Instance>();

        while (addMoreWords)
        {
            addMoreWords = false;

            bool hasRemainingElements = remainingElements.Count > 0;

            if ((!hasRemainingElements) && (usedElements.Count <= 0))
            {
                throw new System.Exception("No elements to use for name");
            }

            Element.Instance element = null;

            if (hasRemainingElements)
            {
                element = remainingElements.RandomSelectAndRemove(getRandomInt);

                usedElements.Add(element);
            }
            else
            {
                element = usedElements.RandomSelect(getRandomInt);
            }

            if (isPrimaryNoun)
            {
                untranslatedName = element.SingularName;
                isPrimaryNoun    = false;

                possibleAdjectives = element.Adjectives;
            }
            else
            {
                bool first = true;
                foreach (Element.Instance usedElement in usedElements)
                {
                    if (first)
                    {
                        untranslatedName = usedElement.SingularName;
                        first            = false;
                    }
                    else
                    {
                        untranslatedName = usedElement.SingularName + ":" + untranslatedName;
                    }
                }
            }

            string adjective = possibleAdjectives.RandomSelect(getRandomInt, 2 * usedElements.Count);

            if (!string.IsNullOrEmpty(adjective))
            {
                untranslatedName = "[adj]" + adjective + " " + untranslatedName;
            }

            addMoreWords = extraWordChance > getRandomFloat();

            if (!addMoreWords)
            {
                foreach (Faction faction in Polity.GetFactions())
                {
                    if (Language.ClearConstructCharacters(untranslatedName) == faction.Name.Meaning)
                    {
                        addMoreWords = true;
                        break;
                    }
                }
            }

            extraWordChance /= 2f;
        }

        untranslatedName = "[Proper][NP](" + untranslatedName + ")";

        Info.Name = new Name(untranslatedName, language, World);

        //		#if DEBUG
        //		Debug.Log ("Clan #" + Id + " name: " + Name);
        //		#endif
    }