Beispiel #1
0
        public override void cast(Map map, Hex hex)
        {
            base.cast(map, hex);
            if (!castable(map, hex))
            {
                return;
            }


            SG_UnholyFlesh soc = null;

            foreach (SocialGroup sg in map.socialGroups)
            {
                if (sg is SG_UnholyFlesh)
                {
                    soc = (SG_UnholyFlesh)sg;
                }
            }
            if (soc == null)
            {
                map.socialGroups.Add(new SG_UnholyFlesh(map, hex.location));
            }
            else
            {
                hex.location.soc = soc;
            }

            hex.location.settlement = new Set_UnholyFlesh_Seed(hex.location);

            map.world.prefabStore.popImgMsg(
                "You begin a growth of Unholy Flesh. This swarm of fleshy protrustions is a reasonable combattant, but excells at instilling fear in nobles, aiding political goals."
                + "\nYou may continue to grow and control this social group with further actions",
                map.world.wordStore.lookup("UNHOLY_FLESH_SEED"));
        }
Beispiel #2
0
        public override void turnTick()
        {
            base.turnTick();

            foreach (Hex h in location.territory)
            {
                h.flora = null;
            }

            if (location.soc is SG_UnholyFlesh)
            {
                SG_UnholyFlesh parent = (SG_UnholyFlesh)location.soc;
                if (parent.warState == SG_UnholyFlesh.warStates.DEFEND)
                {
                    defensiveStrengthMax = location.map.param.ability_fleshWithdrawBonus;
                }
            }

            if (location.map.automatic)
            {
                foreach (Location loc in location.getNeighbours())
                {
                    if (loc.settlement == null && loc.isOcean == false && Eleven.random.NextDouble() < 0.05)
                    {
                        loc.settlement = new Set_UnholyFlesh_Ganglion(loc);
                        loc.soc        = this.location.soc;
                    }
                    if (loc.soc != this.location.soc && loc.soc != null && loc.soc.currentMilitary * 1.3 < location.soc.currentMilitary && (location.soc.isAtWar() == false))
                    {
                        location.map.declareWar(location.soc, loc.soc);
                    }
                }
            }
        }
Beispiel #3
0
 public Unit_Flesh(Location loc, SG_UnholyFlesh soc) : base(loc, soc)
 {
     hp         = 1;
     home       = loc;
     isMilitary = true;
     parentSG   = soc;
 }
Beispiel #4
0
        public override void cast(Map map, Hex hex)
        {
            base.cast(map, hex);
            if (!castable(map, hex))
            {
                return;
            }

            if (hex.location.soc != null && (hex.location.soc is SG_UnholyFlesh))
            {
                SG_UnholyFlesh flesh = (SG_UnholyFlesh)hex.location.soc;
                flesh.warState = SG_UnholyFlesh.warStates.DEFEND;

                map.world.prefabStore.popImgMsg(
                    "The flesh beings its retreat, defending where it can, protecting its vulnerable ganglia",
                    map.world.wordStore.lookup("UNHOLY_FLESH_WITHDRAW"));

                foreach (Unit u in map.units)
                {
                    if (u is Unit_Flesh)
                    {
                        //Reset your tasks so you immediately retreat
                        if (u.task is Task_GoToLocationAgressively)
                        {
                            u.task = null;
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public override void cast(Map map, Hex hex)
        {
            base.cast(map, hex);
            if (!castable(map, hex))
            {
                return;
            }

            foreach (Location l in hex.location.getNeighbours())
            {
                if (l.soc != null && (l.soc is SG_UnholyFlesh))
                {
                    if (l.soc.getRel(hex.location.soc).state == DipRel.dipState.war)
                    {
                        continue;
                    }
                    map.declareWar(l.soc, hex.location.soc);

                    SG_UnholyFlesh flesh = (SG_UnholyFlesh)l.soc;
                    flesh.warState = SG_UnholyFlesh.warStates.ATTACK;

                    map.world.prefabStore.popImgMsg(
                        "The unholy flesh suddenly turns hostile, and begins its attack on " + hex.location.soc.getName(),
                        map.world.wordStore.lookup("UNHOLY_FLESH_ATTACK"));
                }
            }
        }
Beispiel #6
0
        public void ai_testFlesh()
        {
            if (overmind.power <= 0)
            {
                return;
            }

            int      c            = 0;
            int      c2           = 0;
            Location expandLoc    = null;
            Location growLoc      = null;
            Location parentExpand = null;

            foreach (Location loc in overmind.map.locations)
            {
                if (loc.soc is SG_UnholyFlesh)
                {
                    foreach (Location l2 in loc.getNeighbours())
                    {
                        if (l2.isOcean == false && l2.soc == null && l2.settlement == null)
                        {
                            c += 1;
                            if (Eleven.random.Next(c) == 0)
                            {
                                expandLoc    = l2;
                                parentExpand = loc;
                            }
                        }
                        else if (l2.soc is Society && l2.soc.currentMilitary < loc.soc.currentMilitary)
                        {
                            if (loc.soc.isAtWar() == false)
                            {
                                overmind.map.declareWar(loc.soc, l2.soc);
                            }
                        }
                    }
                }
                else if (loc.isOcean == false && loc.settlement == null && loc.soc == null)
                {
                    c2 += 1;
                    if (Eleven.random.Next(c2) == 0)
                    {
                        growLoc = loc;
                    }
                }
            }
            if (expandLoc != null)
            {
                expandLoc.soc                  = parentExpand.soc;
                expandLoc.settlement           = new Set_UnholyFlesh_Ganglion(expandLoc);
                expandLoc.soc.temporaryThreat += overmind.map.param.ability_growFleshThreatAdd;
                overmind.power                -= map.param.ability_fleshGrowCost;
            }
            else if (growLoc != null)
            {
                SG_UnholyFlesh soc = null;
                foreach (SocialGroup sg in map.socialGroups)
                {
                    if (sg is SG_UnholyFlesh)
                    {
                        soc = (SG_UnholyFlesh)sg;
                    }
                }
                if (soc == null)
                {
                    map.socialGroups.Add(new SG_UnholyFlesh(map, growLoc));
                }
                else
                {
                    growLoc.soc = soc;
                }

                growLoc.settlement = new Set_UnholyFlesh_Seed(growLoc);
                overmind.power    -= map.param.ability_fleshSeedCost;
            }
        }