コード例 #1
0
        public override void turnTick(Location location)
        {
            if (location.settlement == null)
            {
                return;
            }
            if (location.soc == null || (location.soc is Society == false))
            {
                return;
            }

            SG_Fishmen target = null;

            foreach (SocialGroup sg in location.map.socialGroups)
            {
                if (sg is SG_Fishmen)
                {
                    target = (SG_Fishmen)sg;
                }
            }

            target.currentMilitary += location.map.param.ability_fishmanCultMilRegen;
            target.temporaryThreat += location.map.param.ability_fishmanCultTempThreat;

            if (location.person() != null)
            {
                foreach (ThreatItem item in location.person().threatEvaluations)
                {
                    if (item.group == target && item.temporaryDread < 100)
                    {
                        item.temporaryDread += location.map.param.ability_fishmanCultDread;
                    }
                }
            }
        }
コード例 #2
0
        public override void turnTick(Property p, Location location)
        {
            if (location.settlement == null)
            {
                return;
            }
            if (location.soc == null || (location.soc is Society == false))
            {
                return;
            }

            int  c      = 0;
            Unit target = null;

            foreach (Unit u in location.map.units)
            {
                if (u is Unit_Fishman)
                {
                    if (u.hp < u.maxHp)
                    {
                        c += 1;
                        if (Eleven.random.Next(c) == 0)
                        {
                            target = u;
                        }
                    }
                }
            }

            if (target != null)
            {
                target.hp += location.map.param.ability_fishmanCultMilRegen;
                if (target.hp > target.maxHp)
                {
                    target.hp = target.maxHp;
                }

                target.society.temporaryThreat += location.map.param.ability_fishmanCultTempThreat;
                if (location.person() != null)
                {
                    foreach (ThreatItem item in location.person().threatEvaluations)
                    {
                        if (item.group == target.society && item.temporaryDread < 100)
                        {
                            item.temporaryDread += location.map.param.ability_fishmanCultDread;
                        }
                    }
                }
            }

            location.settlement.infiltration += location.map.param.ability_fishmanInfiltrate;
            if (location.settlement.infiltration > 1)
            {
                location.settlement.infiltration = 1;
            }
        }
コード例 #3
0
        public override void takeLocationFromOther(SocialGroup def, Location taken)
        {
            base.takeLocationFromOther(def, taken);

            if (taken.settlement != null)
            {
                if (taken.person() != null)
                {
                    taken.person().die("Sacrificed by the Chtonians as they overran " + taken.getName(), true);
                }
                taken.settlement = new Set_EnslavedCity(taken);
                //taken.settlement.fallIntoRuin();
            }
        }
コード例 #4
0
        public override void takeLocationFromOther(SocialGroup def, Location taken)
        {
            base.takeLocationFromOther(def, taken);

            if (taken.settlement != null)
            {
                if (taken.person() != null)
                {
                    taken.person().die("Devoured by the Unholy Flesh as it overran " + taken.getName(), true);
                }
                //taken.settlement = new Set_UnholyFlesh_Ganglion(taken);
                taken.settlement.fallIntoRuin();
            }
        }
コード例 #5
0
        public override void turnTick(Property p, Location location)
        {
            base.turnTick(p, location);

            bool maintained = false;

            if (location.person() == null)
            {
                maintained = false;
            }
            else
            {
                if (location.person().state == Person.personState.enthralled)
                {
                    maintained = true;
                }
                if (location.person().state == Person.personState.broken)
                {
                    maintained = true;
                }
                if (location.person().shadow >= 0.5)
                {
                    maintained = true;
                }
            }

            if (!maintained)
            {
                p.charge = 0;
            }

            foreach (Hex h in location.territory)
            {
                if (h.cloud == null)
                {
                    h.cloud = new Cloud_Fog();
                }
                else if (h.cloud is Cloud_Fog)
                {
                    ((Cloud_Fog)h.cloud).age = 0;
                }
            }
        }
コード例 #6
0
 public override void turnTick(Property p, Location location)
 {
     if (location.settlement == null)
     {
         return;
     }
     if (location.person() == null)
     {
         return;
     }
     if (location.person().sanity == 0)
     {
         return;
     }
     if (Eleven.random.Next(2) == 0)
     {
         location.person().sanity -= 1;
     }
     if (location.person().sanity < 0)
     {
         location.person().sanity = 0;
     }
 }
コード例 #7
0
 public override void turnTick(Property p, Location location)
 {
     if (location.settlement == null)
     {
         return;
     }
     if (location.person() == null)
     {
         return;
     }
     if (location.person().state != Person.personState.normal)
     {
         return;
     }
     if (location.person().sanity != 0)
     {
         return;
     }
     location.person().shadow += location.map.param.ability_fishmanHauntingAbyssalSirensShadowPerTurn;
     if (location.person().shadow > 1)
     {
         location.person().shadow = 1;
     }
 }
コード例 #8
0
        public void AI_WeakReleased(Map map)
        {
            if (this.movesTaken != 0)
            {
                return;
            }
            if (this.task is Task_GoToLocation)
            {
                return;
            }                                              //Already moving or fleeing

            if (this is Unit_Vampire vamp)
            {
                if (vamp.blood < vamp.maxBlood * 0.3 && location.person() != null)
                {
                    //Drink
                    vamp.blood = vamp.maxBlood;

                    double   amount = map.param.unit_minorEvidence;
                    Evidence e2     = new Evidence(map.turn);
                    e2.pointsTo = vamp;
                    e2.weight   = amount;
                    vamp.location.evidence.Add(e2);
                    return;
                }
            }


            bool shouldFlee = false;

            if (this.location.soc != null && this.location.soc.hostileTo(this))
            {
                shouldFlee = true;
            }
            if (!shouldFlee)
            {
                foreach (Unit u in location.units)
                {
                    if (u.hostileTo(this))
                    {
                        shouldFlee = true; break;
                    }
                }
            }
            if (!shouldFlee)
            {
                foreach (Location l2 in location.getNeighbours())
                {
                    if (shouldFlee)
                    {
                        break;
                    }
                    foreach (Unit u in l2.units)
                    {
                        if (u.hostileTo(this))
                        {
                            shouldFlee = true; break;
                        }
                    }
                }
            }
            if (shouldFlee)
            {
                flee(map);
            }
            if (this.task != null)
            {
                return;
            }


            this.movesTaken += 1;
            if (this.location.person() != null)
            {
                if (this.location.settlement.infiltration < World.staticMap.param.ability_unit_spreadShadowInfiltrationReq)
                {
                    bool lockedDown = false;
                    foreach (Property p in location.properties)
                    {
                        if (p.proto is Pr_Lockdown)
                        {
                            lockedDown = true;
                            break;
                        }
                    }
                    if (location.settlement.security >= 5)
                    {
                        lockedDown = true;
                    }
                    if (!lockedDown)
                    {
                        this.task = new Task_Infiltrate_Weak();
                        return;
                    }
                }
                else if (this.location.person().shadow < 1)
                {
                    this.task = new Task_SpreadShadow_Weak();
                    return;
                }
            }

            //We're not starting a new task, so this location is bad. Onwards to greener pastures
            Location target     = null;
            double   bestDist   = -1;
            int      c          = 0;
            Location safeHarbor = null;

            foreach (Location loc in map.locations)
            {
                if (loc == this.location)
                {
                    continue;
                }
                if (loc.soc == null)
                {
                    continue;
                }
                if (loc.soc.hostileTo(this))
                {
                    continue;
                }
                if (loc.person() != null && loc.soc is Society && loc.person().shadow < 1)
                {
                    bool good = true;
                    foreach (Unit u in loc.units)
                    {
                        if (u.hostileTo(this))
                        {
                            good = false; break;
                        }
                    }
                    if (loc.settlement.security >= 5)
                    {
                        good = false;
                    }
                    if (good)
                    {
                        foreach (Property pr in loc.properties)
                        {
                            if (pr.proto is Pr_Lockdown)
                            {
                                good = false; break;
                            }
                            if (pr.proto is Pr_MajorSecurityBoost)
                            {
                                good = false; break;
                            }
                        }
                    }

                    if (good)
                    {
                        double dist = Math.Abs(loc.hex.x - this.location.hex.x) + Math.Abs(loc.hex.y - this.location.hex.y);
                        //dist *= Eleven.random.NextDouble();
                        double score = (loc.person().prestige + 5) / (dist + 1);

                        if (loc.map.overmind.lightbringerLocations.Contains(loc))
                        {
                            score *= 25;
                        }
                        //score *= Eleven.random.NextDouble() * Eleven.random.NextDouble();
                        //if (dist < bestDist || bestDist == -1)
                        //{
                        //    bestDist = dist;
                        //    target = loc;
                        //}
                        if (score > bestDist || bestDist == -1)
                        {
                            bestDist = score;
                            target   = loc;
                        }
                    }
                }

                if (loc.soc is Society)
                {
                    c += 1;
                    if (Eleven.random.Next(c) == 0)
                    {
                        safeHarbor = loc;
                    }
                }
            }
            if (target != null)
            {
                task = new Task_GoToLocation(target);
            }
            else
            {
                //We're unable to find anywhere to infiltrate. Probably banned from everywhere else. Do we have safe harbor? Can we change our name?
                if (location.soc is Society && location.soc.hostileTo(this) == false)
                {
                    //In a safe harbor, swap out now
                    task = new Task_ChangeIdentity();
                }
                else if (safeHarbor != null)
                {
                    task = new Task_GoToLocation(safeHarbor);
                }
                else
                {
                    die(map, "Was no further use");;
                }
            }
        }