public override void castInner(Map map, Person person)
        {
            base.castInner(map, person);

            map.world.prefabStore.popImgMsg(
                "You discard your worthless vessel, " + map.overmind.enthralled.getFullName() + ".",
                map.world.wordStore.lookup("ABILITY_APOPTOSIS"));
            person.die("Walked into the night and never returned");
        }
示例#2
0
        public void takeLocationFromOther(SocialGroup att, SocialGroup def, Location taken)
        {
            World.log(att.getName() + " takes " + taken.getName() + " from " + def.getName());
            int  priority = MsgEvent.LEVEL_YELLOW;
            bool benefit  = !def.hasEnthralled();

            if (att.hasEnthralled())
            {
                priority = MsgEvent.LEVEL_GREEN;
            }
            else if (def.hasEnthralled())
            {
                priority = MsgEvent.LEVEL_RED;
            }
            else
            {
                priority = MsgEvent.LEVEL_YELLOW;
            }


            addMessage(new MsgEvent(att.getName() + " takes " + taken.getName() + " from " + def.getName(), priority, benefit));

            if (taken.settlement != null)
            {
                if (taken.settlement.isHuman == false)
                {
                    taken.settlement = null;//Burn it down
                }
                else if (taken.settlement.title != null && taken.settlement.title.heldBy != null)
                {
                    Person lord = taken.settlement.title.heldBy;
                    if (att is Society)
                    {
                        Society socAtt = (Society)att;
                        lord.prestige *= param.combat_prestigeLossFromConquest;
                        foreach (Title t in lord.titles)
                        {
                            t.heldBy = null;
                        }
                        lord.titles.Clear();


                        movePerson(lord, socAtt);
                    }
                    else
                    {
                        lord.die("Killed by " + att.getName() + " when " + taken.getName() + " fell");
                    }
                }
            }

            taken.soc = att;
            att.takeLocationFromOther(def, taken);
        }
示例#3
0
        public void die(Map map, string v)
        {
            person.die(v);
            disband(map, null);
            bool positive = person == null || person.state != Person.personState.enthralledAgent;

            map.addMessage(this.getName() + " dies! " + v, MsgEvent.LEVEL_GREEN, positive);

            if (this.isEnthralled())
            {
                map.world.prefabStore.popMsg(this.getName() + " dies!\n" + v);
            }
        }
示例#4
0
        public void progressToNextAge()
        {
            map.automatic             = false;
            map.world.displayMessages = false;
            map.burnInComplete        = false;
            panicFromCluesDiscovered  = 0;
            panicFromPowerUse         = 0;
            List <Location> monsters = new List <Location>();

            foreach (Location loc in map.locations)
            {
                if (loc.soc != null && loc.soc.isDark() && (loc.soc is Society == false))
                {
                    monsters.Add(loc);
                }
            }
            lightbringerCasters = null;
            lightRitualProgress = 0;
            lightbringerLocations.Clear();
            while (monsters.Count > 3)
            {
                int      q   = Eleven.random.Next(monsters.Count);
                Location loc = monsters[q];
                loc.soc = null;
                if (loc.settlement != null)
                {
                    loc.settlement = null;
                }
                monsters.RemoveAt(q);
            }
            int lastIndexPerson = 0;

            foreach (SocialGroup sg in map.socialGroups)
            {
                if (sg is Society)
                {
                    Society soc = (Society)sg;
                    foreach (Person p in soc.people)
                    {
                        lastIndexPerson = Math.Max(p.index, lastIndexPerson);
                    }
                    soc.isDarkEmpire = false;
                }
            }
            if (enthralled != null)
            {
                enthralled.die("Died as the age changed", false);
            }

            int burnTurns = 300;

            for (int i = 0; i < burnTurns; i++)
            {
                map.turnTick();

                if (i % 25 == 0)
                {
                    bool hasHumanity = false;
                    foreach (Location loc in map.locations)
                    {
                        if (loc.isOcean)
                        {
                            continue;
                        }
                        if (loc.soc is Society && loc.settlement is SettlementHuman)
                        {
                            hasHumanity = true;
                        }
                    }
                    if (!hasHumanity)
                    {
                        foreach (Location loc in map.locations)
                        {
                            if (loc.isOcean)
                            {
                                continue;
                            }
                            if (loc.hex.getHabilitability() > map.param.mapGen_minHabitabilityForHumans && loc.isMajor)
                            {
                                loc.settlement = new Set_City(loc);

                                Society soc = new Society(map, loc);
                                soc.setName(loc.shortName);
                                loc.soc = soc;
                                map.socialGroups.Add(soc);
                            }
                        }
                    }

                    if (map.data_avrgEnshadowment > 0.1)
                    {
                        foreach (SocialGroup sg in map.socialGroups)
                        {
                            if (sg is Society)
                            {
                                Society       soc  = (Society)sg;
                                List <Person> dead = new List <Person>();
                                foreach (Person p in soc.people)
                                {
                                    if (p.state == Person.personState.broken && Eleven.random.Next(2) == 0)
                                    {
                                        dead.Add(p);
                                    }
                                    else if (p.shadow > 0 && Eleven.random.Next(2) == 0)
                                    {
                                        p.shadow = 0;
                                    }
                                }
                                foreach (Person p in dead)
                                {
                                    p.die("Died of old age", false);
                                }
                            }
                        }
                    }
                }
                foreach (SocialGroup sg in map.socialGroups)
                {
                    if (sg is Society)
                    {
                        Society       soc  = (Society)sg;
                        List <Person> dead = new List <Person>();
                        foreach (Person p in soc.people)
                        {
                            if (p.index <= lastIndexPerson)
                            {
                                if (p.index % 100 == i)
                                {
                                    dead.Add(p);
                                }
                            }
                        }
                        foreach (Person p in dead)
                        {
                            p.die("Died of old age", false);
                        }
                    }
                }

                if (i == burnTurns / 2)
                {
                    List <Unit> units = new List <Unit>();
                    units.AddRange(map.units);
                    foreach (Unit u in units)
                    {
                        u.die(map, "Old age");
                    }
                }
            }

            foreach (Person p in map.persons)
            {
                if (p == null)
                {
                    continue;
                }
                for (int i = 0; i < map.persons.Count; i++)
                {
                    if ((map.persons[i] == null || map.persons[i].isDead) && p.relations.ContainsKey(i))
                    {
                        p.relations.Remove(i);
                    }
                }
            }
            map.burnInComplete        = true;
            map.world.displayMessages = true;
            startedComplete();
            endOfGameAchieved   = false;
            map.firstPlayerTurn = map.turn;
        }
        public void takeLocationFromOther(SocialGroup att, SocialGroup def, Location taken)
        {
            World.log(att.getName() + " takes " + taken.getName() + " from " + def.getName());
            int  priority = MsgEvent.LEVEL_YELLOW;
            bool benefit  = !def.hasEnthralled();

            if (att.hasEnthralled())
            {
                priority = MsgEvent.LEVEL_GREEN;
            }
            else if (def.hasEnthralled())
            {
                priority = MsgEvent.LEVEL_RED;
            }
            else
            {
                priority = MsgEvent.LEVEL_YELLOW;
            }


            turnMessages.Add(new MsgEvent(att.getName() + " takes " + taken.getName() + " from " + def.getName(), priority, benefit));

            if (taken.settlement != null)
            {
                if (taken.settlement.isHuman == false)
                {
                    taken.settlement = null;//Burn it down
                }
                else if (taken.settlement.title != null && taken.settlement.title.heldBy != null)
                {
                    Person lord = taken.settlement.title.heldBy;
                    if (att is Society)
                    {
                        Society socAtt = (Society)att;
                        lord.prestige *= param.combat_prestigeLossFromConquest;
                        if (socAtt.getSovreign() != null)
                        {
                            lord.getRelation(socAtt.getSovreign()).addLiking(param.person_likingFromBeingInvaded, "Their nation invaded mine", turn);
                        }
                        foreach (Title t in lord.titles)
                        {
                            t.heldBy = null;
                        }
                        lord.titles.Clear();


                        movePerson(lord, socAtt);
                    }
                    else
                    {
                        lord.die("Killed by " + att.getName() + " when " + taken.getName() + " fell");
                    }
                }
            }

            taken.soc = att;
            att.takeLocationFromOther(def, taken);

            bool hasRemainingTerritory = false;

            foreach (Location loc in locations)
            {
                if (loc.soc == def)
                {
                    hasRemainingTerritory = true;
                    break;
                }
            }
            if (!hasRemainingTerritory)
            {
                World.log("Last territory taken");
                addMessage(def.getName() + " has lost its last holdings to " + att.getName());

                /*
                 * if (att is Society && def is Society)
                 * {
                 *  Society sAtt = (Society)att;
                 *  Society sDef = (Society)def;
                 *  List<Person> toMove = new List<Person>();
                 *  foreach (Person p in sDef.people)
                 *  {
                 *      if (p.title_land == null)
                 *      {
                 *          toMove.Add(p);
                 *      }
                 *  }
                 *  foreach (Person p in toMove)
                 *  {
                 *      movePerson(p, sAtt);
                 *      addMessage(p.getFullName() + " is now part of the court of " + att.getName(), MsgEvent.LEVEL_GRAY, false);
                 *  }
                 * }
                 */
            }
        }