public virtual void takeLocationFromOther(SocialGroup def, Location taken)
        {
            this.temporaryThreat += map.param.threat_takeLocation;

            addHistory("#GRN_We have taken " + taken.getName() + " from " + def.getName());
            def.addHistory("#RED_We have lost " + taken.getName() + " to " + this.getName());
        }
Esempio n. 2
0
        private void declarePeace(DipRel rel)
        {
            World.log("Peace breaks out between " + rel.nameA + " and " + rel.nameB);

            turnMessages.Add(new MsgEvent("The war between " + rel.war.att.getName() + " and " + rel.war.def.getName() + " winds down", MsgEvent.LEVEL_YELLOW, false));

            rel.war   = null;
            rel.state = DipRel.dipState.none;

            SocialGroup a = rel.getA();
            SocialGroup b = rel.getB();

            if (a != null)
            {
                a.addHistory("Now at peace with " + rel.nameB);
            }
            if (b != null)
            {
                b.addHistory("Now at peace with " + rel.nameA);
            }
        }
Esempio n. 3
0
        public void declareWar(SocialGroup att, SocialGroup def)
        {
            World.log(att.getName() + " declares war on " + def.getName());
            int  priority = MsgEvent.LEVEL_ORANGE;
            bool good     = false;

            if (att.hasEnthralled())
            {
                good = true; priority = MsgEvent.LEVEL_GREEN;
            }
            if (def.hasEnthralled())
            {
                priority = MsgEvent.LEVEL_RED;
            }
            Location attLoc = null;

            foreach (Location loc in locations)
            {
                if (loc.soc == att)
                {
                    attLoc = loc;
                }
            }
            Hex focusHex = null;

            if (attLoc != null)
            {
                focusHex = attLoc.hex;
            }
            turnMessages.Add(new MsgEvent(att.getName() + " launches an offensive against " + def.getName(), priority, good, focusHex));

            att.getRel(def).state = DipRel.dipState.war;
            att.getRel(def).war   = new War(this, att, def);

            if (def.getRel(att).state != DipRel.dipState.war)
            {
                throw new Exception("Asymmetric war");
            }

            foreach (Location loc in locations)
            {
                if (loc.soc == att || loc.soc == def)
                {
                    if (loc.settlement != null && loc.settlement.embeddedUnit != null)
                    {
                        loc.units.Add(loc.settlement.embeddedUnit);
                        units.Add(loc.settlement.embeddedUnit);
                        loc.settlement.embeddedUnit = null;
                    }
                }
            }

            if (att is Society)
            {
                Society sAtt = (Society)att;
                sAtt.crisisWarLong  = "We are at war, attacking " + def.getName() + ". We can discuss how to deploy our forces.";
                sAtt.crisisWarShort = "Crisis: At War";
                //Get the agents moving early, or they'll stick around doing whatever nonsense they previously were
                foreach (Unit u in units)
                {
                    if (u.society == def &&
                        u is Unit_Investigator &&
                        (((Unit_Investigator)u).state == Unit_Investigator.unitState.basic || ((Unit_Investigator)u).state == Unit_Investigator.unitState.knight) &&
                        (u.task is Task_Disrupted == false))
                    {
                        u.task = new Task_DefendHomeland();
                    }
                }
            }
            att.addHistory("We declared war on " + def.getName());
            if (def is Society)
            {
                Society sDef = (Society)def;
                sDef.crisisWarLong  = att.getName() + " has attacked us, and we are at war. We must respond to this crisis.";
                sDef.crisisWarShort = "Crisis: At War";
                //Get the agents moving early, or they'll stick around doing whatever nonsense they previously were
                foreach (Unit u in units)
                {
                    if (u.society == def &&
                        u is Unit_Investigator &&
                        (((Unit_Investigator)u).state == Unit_Investigator.unitState.basic || ((Unit_Investigator)u).state == Unit_Investigator.unitState.knight) &&
                        (u.task is Task_Disrupted == false))
                    {
                        u.task = new Task_DefendHomeland();
                    }
                }
            }
            def.addHistory(att.getName() + " declared war on us");
        }