public void showPersonInfo(Person p)
        {
            uiPerson.setTo(p);

            //I'm sure there was a reason why this info assignment done in two separate classes
            //And I'm sure the reason is 'I was too lazy to do a full migration and left it till later'
            //As I am doing now

            prestigeText.text = "Prestige: " + (int)(p.prestige) + "\nPrestige Moving towards: " + (int)(p.getTargetPrestige(null));
            personShadowAndEvidenceVals.text = (int)(p.shadow * 100) + "%\n" + (int)(p.evidence * 100) + "%";


            personAwarenss.text = (int)(p.awareness * 100) + "%";
            if (p.action == null)
            {
                actionText.text = "Not Taking Action";
                actionDesc.text = "Characters can take actions if they become aware and world panic is sufficiently high.";
                actionDesc.text = "\n\nThis character is not taking an action.";
            }
            else
            {
                actionText.text = p.action.getShort();
                actionDesc.text = "Characters can take actions if they become aware and world panic is sufficiently high.";
                actionDesc.text = "\n\n" + p.action.getLong();
            }

            string bodyText = "";
            //if (p.getDirectSuperiorIfAny() != null)
            //{
            //    bodyText += "\nDirect Superior: " + p.getDirectSuperiorIfAny().getFullName();
            //}
            //else
            //{
            //    bodyText += "\nDirect Superior: None";
            //}
            //bodyText += "\n";
            //bodyText += "\n";
            ThreatItem threat = p.getGreatestThreat();

            if (threat != null)
            {
                bodyText += "\nBelieved Greatest Threat: " + threat.getTitle();
                bodyText += "\nFear of threat: " + (int)threat.threat;
                if (threat.threat > World.staticMap.param.person_fearLevel_terrified)
                {
                    bodyText += "\n[Terrified]";
                }
                else if (threat.threat > World.staticMap.param.person_fearLevel_afraid)
                {
                    bodyText += "\n[Afraid]";
                }
                else
                {
                    bodyText += "\n[Moderate Concern]";
                }
            }
            else
            {
                bodyText += "\nNot feeling threatened.";
            }

            personBody.text = bodyText;


            insanityText.text  = "Sanity state: " + p.madness.name;
            insanityText.text += "\nSanity: " + ((int)p.sanity) + " Maximum: " + p.maxSanity;

            insanityDescText.text = p.madness.desc + "\n\n" +
                                    "Characters have a sanity score. If this value drops to zero, they become insane, and begin to act in an erratic and dangerous manner. "
                                    + "Characters will dislike insane characters to a moderate degree, and insane characters will occasionally lash out, further reducing their relationships."
                                    + "\nYou can cause reduce sanity using certain abilities.";

            personAwarenssDesc.text = "A person's awareness is how much they have realised about the threat their world faces.\nIt allows them to take actions against the darkenss directly." +
                                      "\nSome nobles gain awareness each time you expend power, they can also gain awareness by gaining suspicion as they seen evidence, and can be warned by their fellow nobles, especially neighbours."
                                      + "\nAwareness gain can be increased by being in a place of learning, or increased or decreased by traits."
                                      + "\n\nThis noble has an awareness rate of " + (int)(100 * p.getAwarenessMult()) + "%";

            prestigeDescText.text = "";
            List <string> prestigeReasons = new List <string>();

            p.getTargetPrestige(prestigeReasons);
            foreach (string s in prestigeReasons)
            {
                prestigeDescText.text += "*" + s + "\n";
            }

            for (int i = 0; i < traits.Length; i++)
            {
                traits[i].SetActive(false);
                traitDescBoxes[i].SetActive(false);
            }
            for (int i = 0; i < p.traits.Count; i++)
            {
                traits[i].SetActive(true);
                traitNames[i].text = p.traits[i].name;
                traitDescs[i].text = p.traits[i].desc;
            }
        }
        public override void turnTick(Person person)
        {
            if (person.title_land == null)
            {
                person.action = null; return;
            }

            turns += 1;
            if (turns >= World.staticMap.param.action_letterWritingTurns)
            {
                int    c            = 0;
                Person chosenTarget = null;
                foreach (Location loc in person.getLocation().getNeighbours())
                {
                    if (loc.person() != null)
                    {
                        RelObj rel = person.getRelation(loc.person());
                        if (rel.getLiking() < 10 && loc.person().awareness < person.awareness)
                        {
                            c += 1;
                            if (Eleven.random.Next(c) == 0)
                            {
                                chosenTarget = loc.person();
                            }
                        }
                    }
                }
                if (chosenTarget != null)
                {
                    double delta = person.map.param.awareness_letterWritingAwarenessGain * chosenTarget.getAwarenessMult() * person.map.param.awareness_master_speed;
                    delta = Math.Min(delta, 1 - chosenTarget.awareness);
                    delta = Math.Min(delta, person.awareness - chosenTarget.awareness);//Can't exceed your own awareness
                    chosenTarget.awareness += delta;
                    person.map.addMessage(person.getFullName() + " writes to " + chosenTarget.getFullName() + " to warn them. " + (int)(delta * 100) + " awareness gained", MsgEvent.LEVEL_ORANGE, false);
                }
                person.action = null;
            }
        }
Exemplo n.º 3
0
        public void increasePanicFromPower(int cost, Ability ability)
        {
            if (cost == 0)
            {
                return;
            }

            panicFromPowerUse += cost * map.param.panic_panicPerPower;
            if (panicFromPowerUse > 1)
            {
                panicFromPowerUse = 1;
            }

            List <Person> allPeople = new List <Person>();

            foreach (SocialGroup sg in map.socialGroups)
            {
                if (sg is Society)
                {
                    allPeople.AddRange(((Society)sg).people);
                }
            }
            double sumWeighting = 0;

            foreach (Person p in allPeople)
            {
                double pv = p.getAwarenessMult();
                if (p.title_land == null)
                {
                    continue;
                }
                if (p.awareness >= 1)
                {
                    pv = 0;
                }
                if (p.awareness > 0)
                {
                    pv *= map.param.awarenessInvestigationDetectMult;
                }
                pv           *= pv;
                sumWeighting += pv;
            }
            Person detector = null;
            double roll     = Eleven.random.NextDouble() * sumWeighting;

            foreach (Person p in allPeople)
            {
                double pv = p.getAwarenessMult();
                if (p.title_land == null)
                {
                    continue;
                }
                if (p.awareness >= 1)
                {
                    pv = 0;
                }
                if (p.awareness > 0)
                {
                    pv *= map.param.awarenessInvestigationDetectMult;
                }
                pv   *= pv;
                roll -= pv;
                if (roll <= 0)
                {
                    detector = p;
                    break;
                }
            }

            if (detector != null)
            {
                double gain = cost * map.param.awareness_increasePerCost * map.param.awareness_master_speed;
                gain *= detector.getAwarenessMult();
                detector.awareness += gain;
                if (detector.awareness > 1)
                {
                    detector.awareness = 1;
                }
                map.turnMessages.Add(new MsgEvent(detector.getFullName() + " has noticed a sign of dark power. Gains " + (int)(100 * gain) + " awareness", MsgEvent.LEVEL_RED, false));
            }

            map.worldPanic = this.computeWorldPanic(new List <ReasonMsg>());
        }
        public void showPersonInfo(Person p)
        {
            profileBack.enabled   = true;
            profileMid.enabled    = true;
            profileFore.enabled   = true;
            profileBorder.enabled = true;
            //Done to unfuck the distortion of images which periodically occurs
            profileBack.sprite   = null;
            profileMid.sprite    = null;
            profileFore.sprite   = null;
            profileBorder.sprite = null;
            profileBack.sprite   = p.getImageBack();
            profileMid.sprite    = p.getImageMid();
            profileFore.sprite   = p.getImageFore();
            if (p.society.getSovreign() == p)
            {
                profileBorder.sprite = p.map.world.textureStore.slotKing;
            }
            else if (p.titles.Count > 0)
            {
                profileBorder.sprite = p.map.world.textureStore.slotDuke;
            }
            else
            {
                profileBorder.sprite = p.map.world.textureStore.slotCount;
            }

            personTitle.text = p.getFullName();
            TitleLanded title = p.title_land;

            if (title == null)
            {
                locText.text = "No Landed Title";
            }
            else
            {
                locText.text = "of " + title.settlement.name;
            }
            string bodyText = "";

            if (p.getDirectSuperiorIfAny() != null)
            {
                bodyText += "\nDirect Superior: " + p.getDirectSuperiorIfAny().getFullName();
            }
            else
            {
                bodyText += "\nDirect Superior: None";
            }
            prestigeText.text = "Prestige: " + (int)(p.prestige) + "\nPrestige Moving towards: " + (int)(p.getTargetPrestige(null));
            bodyText         += "\nShadow: " + (int)(p.shadow * 100) + "%";
            bodyText         += "\nEvidence: " + (int)(p.evidence * 100) + "%";
            bodyText         += "\nMilitarism: " + (int)(p.politics_militarism * 100) + "%";
            bodyText         += " (" + p.getMilitarismInfo() + ")";

            bodyText += "\n";

            personAwarenss.text = (int)(p.awareness * 100) + "%";
            if (p.action == null)
            {
                actionText.text = "Not Taking Action";
                actionDesc.text = "Characters can take actions if they become aware and world panic is sufficiently high.";
                actionDesc.text = "\n\nThis character is not taking an action.";
            }
            else
            {
                actionText.text = p.action.getShort();
                actionDesc.text = "Characters can take actions if they become aware and world panic is sufficiently high.";
                actionDesc.text = "\n\n" + p.action.getLong();
            }

            Society     soc  = getSociety(GraphicalMap.selectedHex);
            VoteSession vote = (soc != null) ? soc.voteSession : null;

            if (vote != null)
            {
                bodyText += "\nVoting on: " + vote.issue.ToString();

                VoteOption vo = p.getVote(vote);
                bodyText += "\n\tto " + vo.info(vote.issue);
            }
            else
            {
                bodyText += "\nNot voting.";
            }

            bodyText += "\n";

            ThreatItem threat = p.getGreatestThreat();

            if (threat != null)
            {
                bodyText += "\nBelieved Greatest Threat: " + threat.getTitle();
                bodyText += "\nFear of threat: " + (int)threat.threat;
                if (threat.threat > World.staticMap.param.person_fearLevel_terrified)
                {
                    bodyText += "\n[Terrified]";
                }
                else if (threat.threat > World.staticMap.param.person_fearLevel_afraid)
                {
                    bodyText += "\n[Afraid]";
                }
                else
                {
                    bodyText += "\n[Moderate Concern]";
                }
            }
            else
            {
                bodyText += "\nNot feeling threatened.";
            }

            personBody.text = bodyText;


            insanityText.text  = "Sanity state: " + p.madness.name;
            insanityText.text += "\nSanity: " + ((int)p.sanity) + " Maximum: " + p.maxSanity;

            insanityDescText.text = p.madness.desc + "\n\n" +
                                    "Characters have a sanity score. If this value drops to zero, they become insane, and begin to act in an erratic and dangerous manner. "
                                    + "Characters will dislike insane characters to a moderate degree, and insane characters will occasionally lash out, further reducing their relationships."
                                    + "\nYou can cause reduce sanity using certain abilities.";

            personAwarenssDesc.text = "A person's awareness is how much they have realised about the threat their world faces.\nIt allows them to take actions against the darkenss directly." +
                                      "\nSome nobles gain awareness each time you expend power, they can also gain awareness by gaining suspicion as they seen evidence, and can be warned by their fellow nobles, especially neighbours."
                                      + "\nAwareness gain can be increased by being in a place of learning, or increased or decreased by traits."
                                      + "\n\nThis noble has an awareness rate of " + (int)(100 * p.getAwarenessMult()) + "%";

            prestigeDescText.text = "";
            List <string> prestigeReasons = new List <string>();

            p.getTargetPrestige(prestigeReasons);
            foreach (string s in prestigeReasons)
            {
                prestigeDescText.text += "*" + s + "\n";
            }

            for (int i = 0; i < traits.Length; i++)
            {
                traits[i].SetActive(false);
                traitDescBoxes[i].SetActive(false);
            }
            for (int i = 0; i < p.traits.Count; i++)
            {
                traits[i].SetActive(true);
                traitNames[i].text = p.traits[i].name;
                traitDescs[i].text = p.traits[i].desc;
            }
        }