Exemplo n.º 1
0
        static Thing CanAttack(Zombie zombie)
        {
            var mode = ZombieSettings.Values.attackMode;

            var targets = GetAdjacted <Pawn>(zombie).ToList();

            foreach (var target in targets)
            {
                if (target.Dead || target.Downed)
                {
                    continue;
                }

                // if (TouchPathEndModeUtility.IsAdjacentOrInsideAndAllowedToTouch(zombie.Position, target.Position, zombie.Map) == false)
                var distance = (target.DrawPos - zombie.DrawPos).MagnitudeHorizontalSquared();
                if (distance > Constants.MIN_ATTACKDISTANCE_SQUARED)
                {
                    continue;
                }

                if (Tools.HasInfectionState(target, InfectionState.Infecting))
                {
                    continue;
                }

                if (mode == AttackMode.Everything)
                {
                    return(target);
                }

                if (target.MentalState != null)
                {
                    var msDef = target.MentalState.def;
                    if (msDef == MentalStateDefOf.Manhunter || msDef == MentalStateDefOf.ManhunterPermanent)
                    {
                        return(target);
                    }
                }

                if (mode == AttackMode.OnlyHumans && target.RaceProps.Humanlike)
                {
                    return(target);
                }

                if (mode == AttackMode.OnlyColonists && target.IsColonist)
                {
                    return(target);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
 public override bool ColonistSelector(Pawn pawn)
 {
     return(Tools.HasInfectionState(pawn, InfectionState.Infecting, InfectionState.Infected));
 }
Exemplo n.º 3
0
 public override bool ColonistSelector(Pawn pawn)
 {
     return(Tools.HasInfectionState(pawn, InfectionState.BittenInfectable));
 }