Пример #1
0
        public virtual void implement(VoteOption option)
        {
            bool   positive = true;
            int    priority = (society.hasEnthralled()) ? 1 : 3;
            string msg      = society.getName() + ": chose " + option.info(this) + " for " + this.ToString();

            World.staticMap.addMessage(msg, priority, positive, society.getCapitalHex());

            bool proposerPassed = false;

            foreach (Person p in option.votesFor)
            {
                if (option.votesFor.Contains(p))
                {
                    proposerPassed = true;
                }
            }
            if (proposerPassed)
            {
                proposer.prestige += World.staticMap.param.society_prestigeFromVotingSuccess;
            }
            else
            {
                proposer.prestige += World.staticMap.param.society_prestigeFromVotingFailure;
                if (proposer.prestige < 0)
                {
                    proposer.prestige = 0;
                }
            }
        }
        public virtual void implement(VoteOption option)
        {
            bool   positive = true;
            int    priority = (society.hasEnthralled()) ? 1 : 3;
            string msg      = society.getName() + ": chose " + option.info(this) + " for " + this.ToString();

            World.staticMap.addMessage(msg, priority, positive);
        }
 public void populate(Society society)
 {
     title.text = society.getName() + " has begun the Lightbringer Ritual. If this Ritual is successful, they will drive the Darkness back, causing you to suffer a defeat in this age.";
     body.text  = "They will be employing " + society.map.overmind.lightbringerLocations.Count() + " locations which they believe hold the secret to driving back the dark. If they hold at least half of these " +
                  " when the ritual ends, you will be defeated in this age, and humanity will survive. If you can remove enough them for the society's control (by destroying them or having them invaded) " +
                  "or if you can corrupt them (placing a broken, enthralled or high-shadow noble in the location), the ritual will fail."
                  + "\n\nThese locations are marked by flashing signs above them on the map";
     locations.text = "They currently hold " + society.map.overmind.computeLightbringerHeldLocations() + "/" + society.map.overmind.lightbringerLocations.Count + " locations.";
     this.society   = society;
 }
        public override void castInner(Map map, Person person)
        {
            Society soc = person.society;

            int    nAffected = 0;
            double totalV    = 0;

            foreach (Person p in soc.people)
            {
                bool       affected = false;
                ThreatItem t        = p.getGreatestThreat();
                foreach (Person p2 in soc.people)
                {
                    if (p2 == p)
                    {
                        continue;
                    }
                    if (p2.state == Person.personState.enthralled)
                    {
                        continue;
                    }
                    foreach (ThreatItem t2 in p2.threatEvaluations)
                    {
                        if (t2.isSame(t))
                        {
                            double delta = t.threat - t2.threat;
                            if (delta > 0)
                            {
                                affected = true;
                                delta   *= map.param.ability_polariseByFearMult;
                                p.getRelation(p2).addLiking(-delta, "Polarised by fear of " + t.getTitle(), map.turn);
                                totalV += delta;
                            }
                            break;
                        }
                    }
                }
                if (affected)
                {
                    nAffected += 1;
                }
            }

            double avrg = 0;

            if (nAffected > 0)
            {
                avrg = totalV / nAffected;
            }
            map.world.prefabStore.popImgMsg(
                "You turn the people of " + soc.getName() + " against each other, causing nobles to hate those who do not share their fears.\n" +
                nAffected + " nobles are affected, with an average liking change of of " + (int)(-avrg),
                map.world.wordStore.lookup("ABILITY_POLARISE_BY_FEAR"));
        }
        public override void cast(Map map, Hex hex)
        {
            base.cast(map, hex);

            Society soc = (Society)hex.location.soc;

            soc.voteSession.timeRemaining += map.param.ability_delayVoteTurnsAdded;

            map.world.prefabStore.popImgMsg(
                "You delay the voting process of " + soc.getName() + ". The motion will go on for longer, slowing their ability to respond and giving you more time to alter the voting intentions of the nobles.",
                map.world.wordStore.lookup("ABILITY_DELAY_VOTE"));
        }
        public override void cast(Map map, Hex hex)
        {
            base.cast(map, hex);

            Society soc = (Society)hex.location.soc;

            soc.voteSession = null;

            map.world.prefabStore.popImgMsg(
                "You cancel the voting session of " + soc.getName() + ". This current session is cancelled, and no result will occur, nor will nobles likings for each other change."
                + " Of course the next vote proposer may still simply re-table the same motion",
                map.world.wordStore.lookup("ABILITY_CANCEL_VOTE"));
        }
        public override void cast(Map map, Hex hex)
        {
            base.cast(map, hex);

            Society soc = (Society)hex.location.soc;

            soc.temporaryThreat += soc.permanentThreat;
            soc.permanentThreat  = 0;

            map.world.prefabStore.popImgMsg(
                "You change " + soc.getName() + "'s permanent threat into temporary. Temporary threat will decay over time, but a portion will be converted to permanent threat.",
                map.world.wordStore.lookup("ABILITY_SHORT_MEMORIES"));
        }
        public void movePerson(Person lord, Society receiving)
        {
            if (lord.society.people.Contains(lord) == false)
            {
                throw new Exception("Person attempting to leave society they were not a part of");
            }
            if (receiving.people.Contains(lord))
            {
                throw new Exception("Lord already in group they are attempting to join");
            }

            lord.society.people.Remove(lord);
            receiving.people.Add(lord);
            lord.society = receiving;
            World.log(lord.getFullName() + " now under the rule of " + receiving.getName());
        }
 public void populate(Society soc, Person agent)
 {
     this.agent               = agent;
     societyName.text         = soc.getName();
     textVotingIssue.text     = soc.voteSession.issue.ToString();
     textVotingIssueDesc.text = soc.voteSession.issue.getLargeDesc();
     textProposer.text        = "Proposed by: " + soc.voteSession.issue.proposer.getFullName();
     textProposerVote.text    = "Voting For: " + soc.voteSession.issue.proposer.getVote(soc.voteSession).info(soc.voteSession.issue);
     proposerBack.sprite      = soc.voteSession.issue.proposer.getImageBack();
     proposerMid.sprite       = soc.voteSession.issue.proposer.getImageMid();
     proposerFore.sprite      = soc.voteSession.issue.proposer.getImageFore();
     proposerBorder.sprite    = soc.voteSession.issue.proposer.getImageBorder();
     foreach (Person p in soc.people)
     {
         PopVoterBar bar = world.prefabStore.getVoterBar(p);
         //bar.gameObject.transform.parent = this.gameObject.transform;
         voterBars.Add(bar);
     }
     foreach (VoteOption opt in soc.voteSession.issue.options)
     {
         PopOptBar bar = world.prefabStore.getVoteOptBar(opt, soc.voteSession);
         //bar.gameObject.transform.parent = this.gameObject.transform;
         voteOptBars.Add(bar);
     }
     if (agent != null)
     {
         textAgentName.text = "Interacting with:\n" + agent.getFullName();
         agentBack.sprite   = agent.getImageBack();
         agentBorder.sprite = agent.getImageBorder();
         agentFore.sprite   = agent.getImageFore();
         agentMid.sprite    = agent.getImageMid();
         textAgentDesc.text = "You may use the voter's liking for " + agent.getFullName() + " to sway their votes one way or another, spending this liking as political capital.";
     }
     else
     {
         agentBack.sprite   = world.textureStore.icon_mask;
         agentMid.sprite    = world.textureStore.icon_mask;
         agentBorder.sprite = world.textureStore.slotCount;
         agentFore.sprite   = world.textureStore.icon_mask;
         textAgentName.text = "Interacting without character";
         textAgentDesc.text = "If you interact with a society with an enthralled noble, or use an agent, you can spend the liking the voters have towards them to sway their votes.";
     }
     sess = soc.voteSession;
     checkData();
 }
        public override void castInner(Map map, Person person)
        {
            Society soc = person.society;

            int nAffected = 0;

            foreach (Person p in soc.people)
            {
                bool       affected = false;
                ThreatItem t        = p.getGreatestThreat();
                if (t.threat >= map.param.person_fearLevel_terrified)
                {
                    foreach (Person p2 in soc.people)
                    {
                        if (p2 == p)
                        {
                            continue;
                        }
                        if (p2.state == Person.personState.enthralled)
                        {
                            continue;
                        }
                        if (p2.getMilitarism() < 0)
                        {
                            p.getRelation(p2).addLiking(map.param.ability_denouncePacisfistsLiking, "Pacifists expose us to danger", map.turn);
                        }
                    }
                    if (affected)
                    {
                        nAffected += 1;
                    }
                }
            }

            map.world.prefabStore.popImgMsg(
                "You call on the nobles of " + soc.getName() + " to reject the pacifists in their midst, explaining that these people are exposing you all to danger by refusing to take up arms against your many foes.\n" +
                nAffected + " nobles are affected.",
                map.world.wordStore.lookup("ABILITY_DENOUNCE_PACIFISTS"));
        }
Пример #11
0
        public void populate(Society soc, Person agent)
        {
            this.agent               = agent;
            societyName.text         = soc.getName();
            textVotingIssue.text     = soc.voteSession.issue.ToString();
            textVotingIssueDesc.text = soc.voteSession.issue.getLargeDesc();
            textProposer.text        = "Proposed by: " + soc.voteSession.issue.proposer.getFullName();
            if (soc.voteSession.issue.proposer != null)
            {
                World.log("Proposer: " + soc.voteSession.issue.proposer.getFullName());
                World.log("Text " + textProposerVote);
                textProposerVote.text = "Voting For: " + soc.voteSession.issue.proposer.getVote(soc.voteSession).info(soc.voteSession.issue);
                proposerBack.sprite   = soc.voteSession.issue.proposer.getImageBack();
                proposerMid.sprite    = soc.voteSession.issue.proposer.getImageMid();
                proposerFore.sprite   = soc.voteSession.issue.proposer.getImageFore();
                proposerBorder.sprite = soc.voteSession.issue.proposer.getImageBorder();
            }
            else
            {
                Person arbitrary = soc.getSovereign();
                if (arbitrary == null)
                {
                    arbitrary = soc.people[0];
                }
                if (arbitrary != null)
                {
                    textProposerVote.text = "";
                    proposerBack.sprite   = arbitrary.getImageBack();
                    proposerMid.sprite    = arbitrary.getImageMid();
                    proposerFore.sprite   = arbitrary.getImageFore();
                    proposerBorder.sprite = arbitrary.getImageBorder();
                }
            }
            foreach (Person p in soc.people)
            {
                PopVoterBar bar = world.prefabStore.getVoterBar(p);
                //bar.gameObject.transform.parent = this.gameObject.transform;
                voterBars.Add(bar);
            }
            foreach (VoteOption opt in soc.voteSession.issue.options)
            {
                PopOptBar bar = world.prefabStore.getVoteOptBar(opt, soc.voteSession);
                //bar.gameObject.transform.parent = this.gameObject.transform;
                voteOptBars.Add(bar);
            }
            viewSelf.gameObject.SetActive(false);
            if (agent != null)
            {
                textAgentName.text = "Interacting with:\n" + agent.getFullName();
                agentBack.sprite   = agent.getImageBack();
                agentBorder.sprite = agent.getImageBorder();
                agentFore.sprite   = agent.getImageFore();
                agentMid.sprite    = agent.getImageMid();
                textAgentDesc.text = "You may use the voter's liking for " + agent.getFullName() + " to sway their votes one way or another, spending this liking as political capital.";
            }
            else
            {
                agentBack.sprite   = world.textureStore.icon_mask;
                agentMid.sprite    = world.textureStore.icon_mask;
                agentBorder.sprite = world.textureStore.slotCount;
                agentFore.sprite   = world.textureStore.icon_mask;
                textAgentName.text = "Interacting without character";
                textAgentDesc.text = "If you interact with a society with an enthralled noble, or use an agent, you can spend the liking the voters have towards them to sway their votes.";
            }


            if (World.staticMap.param.option_useAdvancedGraphics == 1 && agent != null)
            {
                Person p = agent;
                if (p.isMale)
                {
                    agentMid.sprite   = p.map.world.textureStore.cultures[p.culture.graphicsIndex].m_faces[p.imgAdvFace];
                    agentEyes.sprite  = p.map.world.textureStore.cultures[p.culture.graphicsIndex].m_eyes[p.imgAdvEyes];
                    agentMouth.sprite = p.map.world.textureStore.cultures[p.culture.graphicsIndex].m_mouths[p.imgAdvMouth];
                    agentHair.sprite  = p.map.world.textureStore.cultures[p.culture.graphicsIndex].m_hair[p.imgAdvHair];
                    agentJewel.sprite = p.map.world.textureStore.cultures[p.culture.graphicsIndex].m_jewels[p.imgAdvJewel];
                }
                else
                {
                    agentMid.sprite   = p.map.world.textureStore.cultures[p.culture.graphicsIndex].f_faces[p.imgAdvFace];
                    agentEyes.sprite  = p.map.world.textureStore.cultures[p.culture.graphicsIndex].f_eyes[p.imgAdvEyes];
                    agentMouth.sprite = p.map.world.textureStore.cultures[p.culture.graphicsIndex].f_mouths[p.imgAdvMouth];
                    agentHair.sprite  = p.map.world.textureStore.cultures[p.culture.graphicsIndex].f_hair[p.imgAdvHair];
                    agentJewel.sprite = p.map.world.textureStore.cultures[p.culture.graphicsIndex].f_jewels[p.imgAdvJewel];
                }
                agentFore.sprite = p.getImageFore();
            }
            else
            {
                agentEyes.sprite  = World.self.textureStore.person_advClear;
                agentMouth.sprite = World.self.textureStore.person_advClear;
                agentHair.sprite  = World.self.textureStore.person_advClear;
                agentJewel.sprite = World.self.textureStore.person_advClear;
            }
            lastPos = World.self.ui.uiInputs.scrollwheelTracking;

            sess = soc.voteSession;
            checkData();

            if (agent != null && agent == soc.map.overmind.enthralled)
            {
                bGoToSelf();
                viewSelf.gameObject.SetActive(true);
            }
        }
Пример #12
0
 public LogBox(Society p)
 {
     path = "logging" + World.separator + "societies" + World.separator + p.getName() + ".log";
     System.IO.File.WriteAllLines(path, new string[] { "Log for " + p.getName() });
 }
        public override void implement(VoteOption option)
        {
            base.implement(option);
            if (option.group != null)
            {
                Society         receiver     = (Society)option.group;
                bool            canVassalise = false;
                List <Location> trans        = new List <Location>();
                foreach (Location loc in society.map.locations)
                {
                    if (loc.soc == society)
                    {
                        trans.Add(loc);
                    }
                    if (loc.soc == receiver && loc.settlement != null)
                    {
                        canVassalise = true;
                    }
                }
                if (canVassalise)
                {
                    World.log(society.getName() + " ALLIES UNDER " + receiver.getName());
                    society.map.turnMessages.Add(new MsgEvent(society.getName() + " forms alliance under " + receiver.getName() + ", transferring all lands and landed nobles.", MsgEvent.LEVEL_RED, true, receiver.getCapitalHex()));

                    foreach (Location loc in trans)
                    {
                        receiver.map.takeLocationFromOther(receiver, society, loc);
                    }

                    string message = society.getName() + " is allying itself under " + receiver.getName() + ", in response to their fears of the rising darkness. This alliance is made of nations "
                                     + " believed to be safe from the shadow";
                    if (receiver.allianceName == null)
                    {
                        if (receiver.getCapital() != null)
                        {
                            string name = "";
                            int    q    = Eleven.random.Next(7);
                            if (q == 0)
                            {
                                name = receiver.getCapital().shortName + " Alliance";
                            }
                            if (q == 1)
                            {
                                name = receiver.getCapital().shortName + " Concord";
                            }
                            if (q == 2)
                            {
                                name = receiver.getCapital().shortName + " Guardians";
                            }
                            if (q == 3)
                            {
                                name = "Alliance of " + receiver.getCapital().shortName;
                            }
                            if (q == 4)
                            {
                                name = receiver.getCapital().shortName + " Entente";
                            }
                            if (q == 5)
                            {
                                name = "The " + receiver.getCapital().shortName + " League";
                            }
                            if (q == 6)
                            {
                                name = "The " + receiver.getCapital().shortName + " Compact";
                            }

                            message += "\nThis alliance will now go by the name of " + name;
                            receiver.allianceName = name;
                        }
                    }
                    society.map.world.prefabStore.popImgMsg(message, "The sheep naturally flock together in times of threat, seeking safety in number. But is the wolf already in their midst?");
                }
            }
        }
Пример #14
0
        public override void castInner(Map map, Unit u)
        {
            Society soc = (Society)u.location.soc;

            SocialGroup enemy = null;

            foreach (SocialGroup sg in map.socialGroups)
            {
                if (sg.getRel(u.location.soc).state == DipRel.dipState.war)
                {
                    bool controlled = false;
                    if (sg is Society)
                    {
                        Society sgSoc = (Society)sg;
                        if (sgSoc.isDarkEmpire)
                        {
                            controlled = true;
                        }
                    }
                    else
                    {
                        controlled = sg.isDark();
                    }
                    if (controlled && sg.currentMilitary > u.location.soc.currentMilitary)
                    {
                        enemy = sg;
                    }
                }
            }
            if (enemy == null)
            {
                map.world.prefabStore.popMsg(soc.getName() + " is not at war with a superior military you control."); return;
            }

            HashSet <Person> targets = new HashSet <Person>();

            foreach (Person p in soc.people)
            {
                targets.Add(p);
            }
            int nSaved = 0;

            foreach (Location loc in map.locations)
            {
                if (loc.soc == soc)
                {
                    foreach (Location l2 in loc.getNeighbours())
                    {
                        if (l2.soc != soc)
                        {
                            if (l2.person() != null)
                            {
                                targets.Add(l2.person());
                            }
                        }
                    }
                    nSaved += 1;
                }
            }
            if (nSaved >= 10)
            {
                AchievementManager.unlockAchievement(SteamManager.achievement_key.SAVIOUR);
            }

            foreach (Person p in targets)
            {
                double boost = 100;
                //Let's not overcomplicate this one
                //foreach (ThreatItem item in p.threatEvaluations)
                //{
                //    if (item.group == enemy)
                //    {
                //        boost = item.threat;
                //    }
                //}
                //if (boost > 150) { boost = 150; }
                //if (boost < 25) { boost = 25; }
                p.getRelation(u.person).addLiking(boost, "Our Saviour!", map.turn, RelObj.STACK_REPLACE, true);
            }

            DipRel rel = soc.getRel(enemy);

            if (rel.war != null)
            {
                rel.war.startTurn = map.turn;
            }
            List <Unit> rems = new List <Unit>();

            foreach (Unit u2 in map.units)
            {
                if (u2.society == enemy && u2.isMilitary)
                {
                    rems.Add(u2);
                }
                else if (u2.society == soc && u2 is Unit_Army)
                {
                    u2.task = null;//Retask, to drop the 'defend the homeland' defensive task and go on the offensive
                }
            }
            foreach (Unit u2 in rems)
            {
                u2.die(map, "Killed by The Saviour");
            }
            soc.posture = Society.militaryPosture.offensive;//Flip to assault mode to ruin the dark forces

            Evidence e2 = new Evidence(map.turn);

            e2.pointsTo = u;
            e2.weight   = u.location.map.param.unit_majorEvidence;
            u.location.evidence.Add(e2);

            u.location.map.world.prefabStore.popImgMsg(u.getName() + " saves " + soc.getName() + " from invasion by " + enemy.getName() + "."
                                                       + "\nNobles within the nation, and those adjacent to it gain liking for " + soc.getName() + ". " + targets.Count + " nobles affected. " + rems.Count + " units killed."
                                                       + soc.getName() + " will now wage this war with renewed vigour, driving back their dark enemy",
                                                       u.location.map.world.wordStore.lookup("ABILITY_SAVIOUR_INVASION"), 7);
        }
Пример #15
0
        public override void turnTick(Unit unit)
        {
            dur += 1;
            if (dur >= unit.location.map.param.unit_shareSuspicionTime)
            {
                if (unit.person != null && unit.location.person() != null && unit.location.person().state != Person.personState.broken)
                {
                    foreach (RelObj rel in unit.person.relations.Values)
                    {
                        double them = unit.location.person().getRelation(rel.them).suspicion;
                        double me   = rel.suspicion;
                        double gain = (me - them) * 1;

                        RelObj toInv     = unit.location.person().getRelation(unit.person);
                        double relLiking = toInv.getLiking();
                        relLiking += 50;
                        if (relLiking < 0)
                        {
                            relLiking = 0;
                        }
                        relLiking /= 100;
                        if (relLiking > 1)
                        {
                            relLiking = 1;
                        }                                    //0 to 1

                        gain *= relLiking;

                        if (me > them)
                        {
                            Person themP = World.staticMap.persons[rel.them];
                            unit.location.map.addMessage(unit.getName() + " warns " + unit.location.person().getFullName() + " about " + themP.getFullName(), MsgEvent.LEVEL_ORANGE, false, unit.location.hex);
                            unit.location.person().getRelation(rel.them).suspicion += gain;
                        }
                    }
                }


                if (unit is Unit_Investigator && unit.location.soc != null && unit.location.soc is Society)
                {
                    Unit_Investigator inv = (Unit_Investigator)unit;
                    Society           soc = (Society)inv.location.soc;
                    bool submitted        = false;
                    foreach (Evidence ev in inv.evidenceCarried)
                    {
                        if (soc.evidenceSubmitted.Contains(ev) == false)
                        {
                            submitted = true;
                            soc.evidenceSubmitted.Add(ev);
                            soc.lastEvidenceSubmission = unit.location.map.turn;
                            ev.turnSubmitted           = unit.location.map.turn;

                            unit.location.addAgentDreadAroundThisLocation();
                            //double deltaFear = World.staticMap.param.threat_evidencePresented;
                            //if (soc.isDarkEmpire == false)
                            //{
                            //    soc.dread_agents_evidenceFound += deltaFear;
                            //}
                        }
                    }
                    if (submitted)
                    {
                        unit.location.map.addMessage(unit.getName() + " presents evidence to " + soc.getName(), MsgEvent.LEVEL_ORANGE, false, unit.location.hex);
                    }
                }
                unit.task = null;
            }
        }
Пример #16
0
        public void setToSocFromSocScreen()
        {
            Society soc = GraphicalSociety.activeSociety;

            screenSociety.SetActive(true);
            flag1.color   = soc.color;
            flag2.color   = soc.color2;
            socTitle.text = soc.getName();
            title.text    = soc.getName();
            locText.text  = "";
            string bodyText = "";

            bodyText         += "\nSocial group: " + soc.getName();
            socTypeTitle.text = soc.getTypeName();
            socTypeDesc.text  = soc.getTypeDesc();

            if (soc.voteSession != null)
            {
                bodyText += "\nVoting on: " + soc.voteSession.issue.ToString();
                bodyText += "\nTurns Remaining: " + soc.voteSession.timeRemaining;
            }

            string econEffects = "";

            foreach (EconEffect effect in soc.econEffects)
            {
                econEffects += "Econ from " + effect.from.name + " to " + effect.to.name + "\n";
            }
            socEcon.text = econEffects;


            bodyText += "\nMILITARY POSTURE: " + soc.posture;
            if (soc.offensiveTarget != null)
            {
                bodyText += "\nOffensive: " + soc.offensiveTarget.getName();
            }
            else
            {
                bodyText += "\nOffensive: None";
            }
            if (soc.defensiveTarget != null)
            {
                bodyText += "\nDefensive: " + soc.defensiveTarget.getName();
            }
            else
            {
                bodyText += "\nDefensive: None";
            }
            bodyText += "\nRebel cap " + soc.data_rebelLordsCap;
            bodyText += "\nLoyal cap " + soc.data_loyalLordsCap;
            bodyText += "\nStability: " + (int)(soc.data_societalStability * 100) + "%";
            if (soc.instabilityTurns > 0)
            {
                bodyText += "\nTURNS TILL CIVIL WAR: " + (soc.map.param.society_instablityTillRebellion - soc.instabilityTurns);
            }
            body.text = bodyText;

            string           strThreat = "";
            List <ReasonMsg> msgs      = new List <ReasonMsg>();
            double           threat    = soc.getThreat(msgs);

            strThreat += "Threat: " + (int)threat;
            foreach (ReasonMsg msg in msgs)
            {
                strThreat += "\n   " + msg.msg + " " + (int)msg.value;
            }
            socThreat.text = strThreat;
        }
Пример #17
0
        public List <MsgEvent> getThreats()
        {
            List <MsgEvent> reply = new List <MsgEvent>();

            List <Unit> agents = new List <Unit>();

            foreach (Unit u in map.units)
            {
                if (u.isEnthralled() && (!u.automated))
                {
                    agents.Add(u);
                }
                else
                {
                    if (u.task is Task_Investigate)
                    {
                        reply.Add(new MsgEvent(u.getName() + " is investigating evidence at " + u.location.getName(), MsgEvent.LEVEL_ORANGE, false, u.location.hex));
                    }
                    else if (u.task is Task_ShareSuspicions)
                    {
                        reply.Add(new MsgEvent(u.getName() + " is warning the noble at " + u.location.getName(), MsgEvent.LEVEL_ORANGE, false, u.location.hex));
                    }
                    else if (u.task is Task_InvestigateNoble)
                    {
                        if (u.location.person() != null)
                        {
                            int level = MsgEvent.LEVEL_ORANGE;
                            if (u.location.person().state == Person.personState.enthralled)
                            {
                                level = MsgEvent.LEVEL_RED;
                            }
                            reply.Add(new MsgEvent(u.getName() + " is investigating the noble at " + u.location.getName(), level, false, u.location.hex));
                        }
                    }
                    else if (u.task is Task_InvestigateNobleBasic)
                    {
                        if (u.location.person() != null)
                        {
                            int level = MsgEvent.LEVEL_YELLOW;
                            if (u.location.person().state == Person.personState.enthralled)
                            {
                                level = MsgEvent.LEVEL_ORANGE;
                            }
                            reply.Add(new MsgEvent(u.getName() + " is investigating the noble at " + u.location.getName(), level, false, u.location.hex));
                        }
                    }
                }
            }
            int[] suspicions = new int[agents.Count];

            foreach (SocialGroup sg in map.socialGroups)
            {
                bool relevant = false;
                if (sg.hasEnthralled())
                {
                    relevant = true;
                }
                if (sg is Society)
                {
                    Society soc = (Society)sg;
                    if (soc.isDarkEmpire)
                    {
                        relevant = true;
                    }

                    foreach (Person p in soc.people)
                    {
                        if (p.state == Person.personState.enthralled || p.state == Person.personState.broken)
                        {
                            continue;
                        }

                        for (int i = 0; i < agents.Count; i++)
                        {
                            Unit u = agents[i];
                            if (u.person != null)
                            {
                                if (p.getRelation(u.person).suspicion > 0)
                                {
                                    suspicions[i] += 1;
                                }
                            }
                        }
                    }

                    if (soc.voteSession != null)
                    {
                        if (soc.voteSession.issue is VoteIssue_CondemnAgent)
                        {
                            VoteIssue_CondemnAgent issue = (VoteIssue_CondemnAgent)soc.voteSession.issue;
                            if (issue.target.isEnthralled())
                            {
                                reply.Add(new MsgEvent(soc.getName() + " is voting to condemn " + issue.target.getName(), MsgEvent.LEVEL_RED, false, issue.target.location.hex));
                            }
                        }
                    }
                }
                else
                {
                    if (sg.isDark())
                    {
                        relevant = true;
                    }
                }

                if (relevant)
                {
                    foreach (SocialGroup s2 in map.socialGroups)
                    {
                        if (s2 == sg)
                        {
                            continue;
                        }
                        if (s2 is Society)
                        {
                            Society soc = (Society)s2;
                            Hex     hex = null;
                            if (soc.capital != null)
                            {
                                hex = soc.capital.hex;
                            }
                            if (soc.offensiveTarget == sg)
                            {
                                if (soc.posture == Society.militaryPosture.offensive)
                                {
                                    int level = MsgEvent.LEVEL_RED;
                                    if (soc.currentMilitary < sg.currentMilitary * 0.75)
                                    {
                                        level = MsgEvent.LEVEL_ORANGE;
                                    }
                                    if (soc.currentMilitary < sg.currentMilitary * 0.25)
                                    {
                                        level = MsgEvent.LEVEL_YELLOW;
                                    }
                                    reply.Add(new MsgEvent(soc.getName() + " is offensive and targetting " + sg.getName(), MsgEvent.LEVEL_RED, false, hex));
                                    if (soc.voteSession != null && soc.voteSession.issue is VoteIssue_DeclareWar)
                                    {
                                        reply.Add(new MsgEvent(soc.getName() + " is voting to declare war on " + sg.getName(), MsgEvent.LEVEL_RED, false, hex));
                                    }
                                }
                                else
                                {
                                    reply.Add(new MsgEvent(soc.getName() + " is targetting " + sg.getName(), MsgEvent.LEVEL_ORANGE, false, hex));
                                }
                            }
                            else
                            {
                                int nThreat = 0;
                                foreach (Person p in soc.people)
                                {
                                    ThreatItem t = p.getGreatestThreat();
                                    if (t != null && t.group == sg)
                                    {
                                        nThreat += 1;
                                    }
                                }
                                if (nThreat > 0)
                                {
                                    reply.Add(new MsgEvent(nThreat + " nobles from " + soc.getName() + " consider " + sg.getName() + " their greatest threat", MsgEvent.LEVEL_YELLOW, false, hex));
                                }
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < agents.Count; i++)
            {
                if (suspicions[i] > 0)
                {
                    reply.Add(new MsgEvent(suspicions[i] + " nobles are suspicious of " + agents[i].getName(), MsgEvent.LEVEL_YELLOW, false));
                }
            }

            return(reply);
        }
Пример #18
0
 public void computeLightbringer()
 {
     if (lightbringerCasters != null && lightbringerCasters.isGone())
     {
         map.world.prefabStore.popMsg("The Lightbringer Ritual is interrupted and ruined, as the society which was casting it, " + lightbringerCasters.getName() + " is gone. You are safe for now.");
         lightRitualProgress = 0;
         lightbringerCasters = null;
         lightbringerLocations.Clear();
         return;
     }
     if (lightbringerCasters != null)
     {
         lightRitualProgress += 1;
         if (lightRitualProgress >= map.param.awareness_turnsForLightRitual)
         {
             //We're done
             int nHeld = this.computeLightbringerHeldLocations();
             if (nHeld >= lightbringerLocations.Count / 2d)
             {
                 lightRitualProgress = 0;
                 lightbringerCasters = null;
                 lightbringerLocations.Clear();
                 defeat();
             }
             else
             {
                 map.world.prefabStore.popMsg("You have averted the effects of this Lightbringer Ritual, as the society known as " + lightbringerCasters.getName() + " does not hold sufficient "
                                              + "ritual locations when casting ended.");
                 lightRitualProgress = 0;
                 lightbringerCasters = null;
                 lightbringerLocations.Clear();
             }
         }
     }
 }