Exemplo n.º 1
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            var map = (Map)parms.target;

            if (map.mapTemperature.OutdoorTemp <= -10 || map.mapTemperature.OutdoorTemp >= 50)
            {
                return(false);
            }

            if (map.mapPawns.FreeColonistsCount < 6)
            {
                return(false);
            }

            if (map.mapPawns
                .FreeHumanlikesOfFaction(Faction.OfPlayer)
                .Count(p => p.kindDef?.race?.defName == "Ant_AntiniumRace") <
                3)
            {
                return(false);
            }

            if (HiveQueenUtility.QueenExists())
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        private void SetQueenHediffSeverity(Pawn pawn)
        {
            float severity = 0f;

            int score = -1;

            score = HiveQueenUtility.GetPawnHQScore(pawn);

            if (score < 0)
            {
                score *= 2;
            }

            score += QueenStrength;

            if (score > 0)
            {
                severity = score * .1f;
                severity = Math.Min(severity, 1f);
            }
            else
            {
                severity = 0f;
            }

            // do hediff
            Hediff olddiff = pawn.health.hediffSet.GetFirstHediffOfDef(AntHQDefOf.Ant_HiveQueenInspHediff, false);

            if (olddiff != null)
            {
                pawn.health.RemoveHediff(olddiff);
            }

            if (severity > 0f)
            {
                Hediff hediff = HediffMaker.MakeHediff(AntHQDefOf.Ant_HiveQueenInspHediff, pawn, null);
                hediff.Severity = severity;
                pawn.health.AddHediff(hediff, null, null, null);
            }
        }