public static Thing SpawnBloodFromExtraction(Pawn extractee, bool isBloodPack = false)
        {
            BloodType type   = BloodTypeUtility.BloodType(extractee);
            Thing     result = null;

            switch (type)
            {
            case BloodType.Animal:
                result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_Animal : null);
                break;

            case BloodType.LowBlood:
                result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_LowBlood : VampDefOf.BloodVial_LowBlood);
                break;

            case BloodType.AverageBlood:
                result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_AverageBlood : VampDefOf.BloodPack_AverageBlood);
                break;

            case BloodType.HighBlood:
                result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_HighBlood : VampDefOf.BloodVial_HighBlood);
                break;

            case BloodType.Special:
                result = (Thing)ThingMaker.MakeThing(isBloodPack ? null : VampDefOf.BloodVial_Special);
                break;
            }
            if (result != null)
            {
                result.stackCount = 1;
                GenPlace.TryPlaceThing(result, extractee.PositionHeld, extractee.Map, ThingPlaceMode.Near);
                extractee.BloodNeed().AdjustBlood(isBloodPack ? -AMT_BLOODPACK : -AMT_BLOODVIAL);
            }
            return(result);
        }
Exemplo n.º 2
0
        public static BloodType BloodType(Pawn pawn)
        {
            if (!pawn?.Dead ?? false)
            {
                if (pawn?.RaceProps?.Animal ?? false)
                {
                    return(Vampire.BloodType.Animal);
                }
                if (pawn?.RaceProps?.Humanlike ?? false)
                {
                    bool lowBlood  = (BloodTypeUtility.IsLowblood(pawn));
                    bool highBlood = (BloodTypeUtility.IsHighblood(pawn));

                    if (BloodTypeUtility.IsHighblood(pawn) && BloodTypeUtility.IsLowblood(pawn))
                    {
                        return(Vampire.BloodType.AverageBlood);
                    }
                    if (highBlood)
                    {
                        return(Vampire.BloodType.HighBlood);
                    }
                    if (lowBlood)
                    {
                        return(Vampire.BloodType.LowBlood);
                    }

                    return(Vampire.BloodType.AverageBlood);
                }
            }
            return(Vampire.BloodType.None);
        }
Exemplo n.º 3
0
        public static bool IsAcceptableVictimFor(Pawn vampire, Pawn victim, bool desperate)
        {
            if (victim == null || vampire == null)
            {
                return(false);
            }
            if (victim.Dead || vampire.Dead)
            {
                return(false);
            }
            if (!victim.Spawned || !vampire.Spawned)
            {
                return(false);
            }
            if (victim?.BloodNeed() is Need_Blood targetBlood)
            {
                if (vampire?.BloodNeed() is Need_Blood eaterBlood)
                {
                    if (VampireUtility.IsDaylight(victim) && !victim.PositionHeld.Roofed(victim.Map))
                    {
                        return(false);
                    }

                    if (victim.IsVampire())
                    {
                        return(false);
                    }

                    if (!vampire.CanReserve(victim))
                    {
                        return(false);
                    }

                    if (victim.RaceProps.Animal)
                    {
                        if (eaterBlood.preferredFeedMode > PreferredFeedMode.AnimalLethal)
                        {
                            return(false);
                        }
                        if (eaterBlood.preferredFeedMode == PreferredFeedMode.AnimalNonLethal &&
                            targetBlood.CurBloodPoints == 1)
                        {
                            return(false);
                        }
                    }

                    if (victim.RaceProps.Humanlike)
                    {
                        if (eaterBlood.preferredFeedMode < PreferredFeedMode.HumanoidNonLethal)
                        {
                            return(false);
                        }
                        if (eaterBlood.preferredFeedMode == PreferredFeedMode.HumanoidNonLethal &&
                            targetBlood.CurBloodPoints <= 2)
                        {
                            return(false);
                        }
                    }

                    if (!desperate && (int)BloodTypeUtility.BloodType(victim) < (int)vampire.VampComp().Bloodline.minBloodPref)
                    {
                        return(false);
                    }
                    else if ((int)BloodTypeUtility.BloodType(victim) < (int)vampire.VampComp().Bloodline.desperateBloodPref)
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
 public override string GetLabelWhenUsedOn(Pawn pawn, BodyPartRecord part)
 {
     return(recipe.LabelCap + " (" + BloodTypeUtility.BloodType(pawn).GetLabel() + ")" + ((BloodItemUtility.ExtractionWillKill(pawn, BloodExtractType.Vial)) ? " (" + ("ROMV_DeadlyOperationShort".Translate()).RawText + ")"  : ""));
 }
Exemplo n.º 5
0
        public static Thing SpawnBloodFromExtraction(Pawn extractee, BloodExtractType bloodExtractType)
        {
            BloodType type   = BloodTypeUtility.BloodType(extractee);
            Thing     result = null;

            switch (type)
            {
            case BloodType.Animal:
                switch (bloodExtractType)
                {
                case BloodExtractType.Vial:
                case BloodExtractType.Pack:
                case BloodExtractType.Wine:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodPack_Animal);
                    break;
                }
                break;

            case BloodType.LowBlood:
                switch (bloodExtractType)
                {
                case BloodExtractType.Vial:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodVial_LowBlood);
                    break;

                case BloodExtractType.Pack:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodPack_LowBlood);
                    break;

                case BloodExtractType.Wine:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodWine_LowBlood);
                    break;
                }
                break;

            case BloodType.AverageBlood:
                switch (bloodExtractType)
                {
                case BloodExtractType.Vial:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodVial_AverageBlood);
                    break;

                case BloodExtractType.Pack:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodPack_AverageBlood);
                    break;

                case BloodExtractType.Wine:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodWine_AverageBlood);
                    break;
                }
                break;

            case BloodType.HighBlood:
                switch (bloodExtractType)
                {
                case BloodExtractType.Vial:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodVial_HighBlood);
                    break;

                case BloodExtractType.Pack:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodPack_HighBlood);
                    break;

                case BloodExtractType.Wine:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodWine_HighBlood);
                    break;
                }
                break;

            case BloodType.Special:
                switch (bloodExtractType)
                {
                case BloodExtractType.Vial:
                case BloodExtractType.Pack:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodVial_Special);
                    break;

                case BloodExtractType.Wine:
                    result = (Thing)ThingMaker.MakeThing(VampDefOf.BloodWine_Special);
                    break;
                }
                break;
            }
            if (result != null)
            {
                result.stackCount = 1;
                GenPlace.TryPlaceThing(result, extractee.PositionHeld, extractee.Map, ThingPlaceMode.Near);

                int bloodAdjustAmount = 0;
                switch (bloodExtractType)
                {
                case BloodExtractType.Vial:
                    bloodAdjustAmount = -AMT_BLOODVIAL;
                    break;

                case BloodExtractType.Wine:
                    bloodAdjustAmount = -AMT_BLOODWINE;
                    break;

                case BloodExtractType.Pack:
                    bloodAdjustAmount = -AMT_BLOODPACK;
                    break;
                }

                extractee.BloodNeed().AdjustBlood(bloodAdjustAmount);
            }
            return(result);
        }
Exemplo n.º 6
0
 public override string GetLabelWhenUsedOn(Pawn pawn, BodyPartRecord part)
 {
     return(this.recipe.LabelCap + " (" + BloodTypeUtility.BloodType(pawn).GetLabel() + ")");
 }