public override void implement(VoteOption option)
        {
            base.implement(option);

            society.lastEvidenceResponse = society.map.turn;
            foreach (Evidence ev in foundEvidence)
            {
                society.handledEvidence.Add(ev);
            }

            if (option.index == DEFEND_PROVINCE)
            {
                World.log(society.getName() + " implements crisis legislation, increasing security to " + society.map.provinces[option.province].name);
                foreach (Location loc in society.map.locations)
                {
                    if (loc.province.index == option.province && loc.soc == society)
                    {
                        Property.addProperty(society.map, loc, "Major Security Boost");
                    }
                }
                society.map.addMessage(society.getName() + " raises " + society.map.provinces[option.province].name + " security level", MsgEvent.LEVEL_ORANGE, false, society.map.provinces[option.province].coreHex);
            }
            if (option.index == NATIONWIDE_SECURITY)
            {
                World.log(society.getName() + " implements crisis legislation, increasing security nationwide");
                foreach (Location loc in society.map.locations)
                {
                    if (loc.province.index == option.province && loc.soc == society)
                    {
                        Property.addProperty(society.map, loc, "Minor Security Boost");
                    }
                }
                society.map.addMessage(society.getName() + " raises its security level nationwide", MsgEvent.LEVEL_ORANGE, false, society.getCapitalHex());
            }
            if (option.index == NO_RESPONSE)
            {
                World.log(society.getName() + " implements crisis legislation, does nothing");
            }
            if (option.index == EXPELL_ALL_FOREIGN_AGENTS)
            {
                bool agentsExpelled = false;
                foreach (Unit u in society.map.units)
                {
                    if (u.society != society && society.enemies.Contains(u) == false)
                    {
                        society.enemies.Add(u);
                        if (u.isEnthralled())
                        {
                            agentsExpelled = true;
                        }
                    }
                }
                if (agentsExpelled)
                {
                    society.map.world.prefabStore.popMsg(society.getName() + " expells all foreign agents, in response to evidence discovered." +
                                                         " All your existing agents will now be attacked on sight if they enter or are in its lands. New agents will still be acceptable.");
                }
                World.log(society.getName() + " implements crisis legislation, expelling all foreign agents");
                society.map.addMessage(society.getName() + " outlaws all foreign agents", MsgEvent.LEVEL_RED, false, society.getCapitalHex());
            }
            if (option.index == INVESTIGATOR_HOSTILITY)
            {
                foreach (Evidence ev in foundEvidence)
                {
                    if (ev.discoveredBy.society == society && ev.discoveredBy != null && ev.pointsTo != null && (ev.discoveredBy.hostileTo(ev.pointsTo) == false))
                    {
                        ev.discoveredBy.hostility.Add(ev.pointsTo);
                        society.map.addMessage(ev.discoveredBy.getName() + " permitted to attack " + ev.pointsTo.getName(), MsgEvent.LEVEL_RED, !ev.pointsTo.isEnthralled());
                        if (ev.pointsTo.isEnthralled())
                        {
                            society.map.world.prefabStore.popMsg("The nobles of " + society.getName() + " have given permission their agent, " + ev.discoveredBy.getName()
                                                                 + " to attack " + ev.pointsTo.getName() + " on sight, if they encounter them during investigations.");
                        }
                    }
                }
            }
            if (option.index == LOCKDOWN_PROVINCE)
            {
                World.log(society.getName() + " implements crisis legislation, fully locking down " + society.map.provinces[option.province].name);
                Unit enthralledVic = null;
                foreach (Location loc in society.map.locations)
                {
                    if (loc.province.index == option.province && loc.soc == society)
                    {
                        Property.addProperty(society.map, loc, "Lockdown");
                        foreach (Unit u in loc.units)
                        {
                            if (u.isEnthralled())
                            {
                                enthralledVic = u;
                            }
                        }
                    }
                }
                society.map.addMessage(society.getName() + " locks down " + society.map.provinces[option.province].name, MsgEvent.LEVEL_ORANGE, false, society.map.provinces[option.province].coreHex);
                if (enthralledVic != null)
                {
                    society.map.world.prefabStore.popMsg(society.getName() + " has imposed a complete lockdown in the province " + society.map.provinces[option.province].name +
                                                         " which impacts your agent " + enthralledVic.getName() + "'s ability to operate until the lockdown is over.");
                }
            }

            if (option.index == AGENT_TO_INVESTIGATOR)
            {
                Unit_Investigator inv = (Unit_Investigator)option.unit;
                inv.changeState(Unit_Investigator.unitState.investigator);
                World.self.prefabStore.popMsgAgent(option.unit, option.unit, option.unit.getName() + " has been assigned the role of Investigator, by the nobles of " + option.unit.society.getName() +
                                                   " in response to external threats. Investigators are experts at combatting your agents. They can recognise evidence and spot your agents if they are in the same location.");
            }
            if (option.index == AGENT_TO_BASIC)
            {
                Unit_Investigator inv = (Unit_Investigator)option.unit;
                inv.changeState(Unit_Investigator.unitState.basic);
                if (inv.person.isWatched())
                {
                    World.self.prefabStore.popMsgAgent(option.unit, option.unit, option.unit.getName() + " has been assigned the role of Agent, by the nobles of " + option.unit.society.getName() +
                                                       " in response to external threats. Standard agents are general-purpose units. They can investigate your agents' evidence, and can assist in wars. They can be promoted "
                                                       + " to specalists by vote.");
                }
            }
        }
예제 #2
0
        public static void addForgottenSecrets(Map map)
        {
            int             nSecrets  = 0;
            int             nReq      = map.param.unit_seeker_nCreatedSecrets;
            List <Location> available = new List <Location>();

            foreach (Location loc in map.locations)
            {
                if (loc.settlement != null && (loc.settlement is Set_University || loc.settlement is Set_Abbey))
                {
                    available.Add(loc);
                }
            }

            //From these, pick at most nReq
            //Gonna do it badly, because I don't have a random.shuffle(list) implementation at hand
            while (available.Count > 0 && nSecrets < nReq)
            {
                int      q      = Eleven.random.Next(available.Count);
                Location chosen = available[q];
                available.RemoveAt(q);
                nSecrets += 1;
                Property.addProperty(map, chosen, "Forgotten Secret");
            }

            if (nSecrets < nReq)
            {
                available = new List <Location>();
                foreach (Location loc in map.locations)
                {
                    if (loc.settlement == null && (loc.isOcean == false))
                    {
                        available.Add(loc);
                    }
                }
                while (available.Count > 0 && nSecrets < nReq)
                {
                    int      q      = Eleven.random.Next(available.Count);
                    Location chosen = available[q];
                    available.RemoveAt(q);
                    nSecrets += 1;
                    Property.addProperty(map, chosen, "Forgotten Secret");
                }
            }

            //Emergency fallback, make everywhere acceptable
            if (nSecrets < nReq)
            {
                available = new List <Location>();
                foreach (Location loc in map.locations)
                {
                    available.Add(loc);
                }
                while (available.Count > 0 && nSecrets < nReq)
                {
                    int      q      = Eleven.random.Next(available.Count);
                    Location chosen = available[q];
                    available.RemoveAt(q);
                    nSecrets += 1;
                    Property.addProperty(map, chosen, "Forgotten Secret");
                }
            }
        }