예제 #1
0
        public override void implement(VoteOption option)
        {
            base.implement(option);
            society.crisisWitchHunt = false;
            KillOrder order = new KillOrder(option.person, "Judged guilty of conspiracy with dark forces");

            order.votedByNobles = true;
            society.killOrders.Add(order);
            bool isGood = (option.person.state != Person.personState.enthralled) && (option.person.state != Person.personState.broken) && (option.person.shadow < 0.5);

            society.map.turnMessages.Add(new MsgEvent(society.getName() + " has voted to execute " + option.person.getFullName() + ", having judged them guilty of conspiracy with dark forces", MsgEvent.LEVEL_RED, isGood));

            World.log("EXECUTION ORDER GONE THROUGH FOR SUSPICION OF DARKNESS " + society.getName() + " " + option.person.getFullName() + " true shadow (" + option.person.shadow + ")");
        }
        public void triggerCivilWar(List <Person> rebelsTotal)
        {
            World.log(this.getName() + " falls into civil war as " + rebelsTotal.Count + " out of " + people.Count + " nobles declare rebellion against " + getSovreign().getFullName());

            int  level     = MsgEvent.LEVEL_ORANGE;
            bool goodThing = true;

            if (this.hasEnthralled())
            {
                goodThing = false;
                level     = MsgEvent.LEVEL_RED;
            }
            map.addMessage(this.getName() + " falls into civil war! Provinces declare war on the sovreign's loyal forces.",
                           level, goodThing);

            List <Province>       seenProvinces    = new List <Province>();
            List <List <Person> > rebelsByProvince = new List <List <Person> >();
            List <Person>         unmappedRebels   = new List <Person>();

            foreach (Person p in rebelsTotal)
            {
                if (p.title_land == null)
                {
                    unmappedRebels.Add(p); continue;
                }
                if (seenProvinces.Contains(p.title_land.settlement.location.province))
                {
                    int ind = seenProvinces.IndexOf(p.title_land.settlement.location.province);
                    rebelsByProvince[ind].Add(p);
                }
                else
                {
                    seenProvinces.Add(p.title_land.settlement.location.province);
                    rebelsByProvince.Add(new List <Person>());
                    rebelsByProvince[rebelsByProvince.Count - 1].Add(p);
                }
            }

            if (rebelsByProvince.Count == 0)
            {
                World.log("No rebels had any territory. Rebellion called off");
                return;
            }

            rebelsByProvince[0].AddRange(unmappedRebels);

            World.log("Rebellion has " + seenProvinces.Count + " provinces");

            for (int k = 0; k < seenProvinces.Count; k++)
            {
                List <Person> rebels    = rebelsByProvince[k];
                Society       rebellion = new Society(map);
                map.socialGroups.Add(rebellion);
                rebellion.setName(seenProvinces[k].name + " rebellion");
                rebellion.isRebellion = true;
                if (Eleven.random.Next(2) == 0)
                {
                    rebellion.posture = militaryPosture.defensive;
                }
                foreach (Person p in rebels)
                {
                    if (p.title_land != null)
                    {
                        p.title_land.settlement.location.soc = rebellion;
                    }
                    this.people.Remove(p);
                    rebellion.people.Add(p);
                    p.society = rebellion;
                }

                double proportionalStrength = 0;
                rebellion.computeMilitaryCap();
                this.computeMilitaryCap();

                if (this.maxMilitary > 0 || rebellion.maxMilitary > 0)
                {
                    proportionalStrength      = this.maxMilitary / (this.maxMilitary + rebellion.maxMilitary);
                    rebellion.currentMilitary = this.currentMilitary * (1 - proportionalStrength);
                    this.currentMilitary      = this.currentMilitary * proportionalStrength;
                }

                if (getSovreign() != null)
                {
                    KillOrder killSovreign = new KillOrder(getSovreign(), "Rebellion against tyranny");
                    rebellion.killOrders.Add(killSovreign);
                }

                foreach (Person p in rebels)
                {
                    KillOrder killRebel = new KillOrder(p, "Rebelled against sovreign");
                    this.killOrders.Add(killRebel);
                }
                this.map.declareWar(rebellion, this);
            }
        }