Ejemplo n.º 1
0
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            if (!recipe.products[0].thingDef.HasComp(typeof(CompUseEffect_GiveBlood)))
            {
                Log.Error("Blood Bank - Give blood operation failed (products[0] has no CompBlood)");
                return;
            }

            bool isBadIdea   = BloodBankUtilities.MakeBloodPack(pawn, recipe.products[0].thingDef);
            bool isViolation = IsViolationOnPawn(pawn, null, billDoer.Faction);

            BloodBankUtilities.GiveThoughtsForTakeBlood(pawn, isViolation, isBadIdea);
            if (pawn.Dead)
            {
                BloodBankUtilities.GiveThoughtsForKilledForBlood(pawn);
            }

            if (!isViolation)
            {
                return;
            }

            int    goodwillChange = -5;//minor effect for taking blood from non-allied or prisoner pawn
            string reason         = "GoodwillChangedReason_RemovedBodyPart".Translate("blood");

            pawn.Faction.TryAffectGoodwillWith(billDoer.Faction, goodwillChange, true, true, reason, pawn);
        }
Ejemplo n.º 2
0
 public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill)
 {
     CompBloodProduct compBloodProduct = ingredients[0].TryGetComp<CompBloodProduct>();
     if (compBloodProduct != null)
         BloodBankUtilities.AdministerBooster(pawn, compBloodProduct);
     else
         Log.Error($"Blood Bank - Give booster operation failed (ingredients[0] ({ingredients[0].def.defName}) has no CompBloodProduct)");
 }
Ejemplo n.º 3
0
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            if (!(ingredients[0] is ThingWithComps) || !ingredients[0].def.HasComp(typeof(CompUseEffect_GiveBlood)))
            {
                Log.Error("Blood Bank - Give blood operation failed (ingredients[0] has no BloodPackComp)");
                return;
            }

            BloodBankUtilities.ApplyBloodPack(pawn, ingredients[0].def);
        }
        public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
        {
            CompBlood compBlood = ingredients[0].TryGetComp <CompBlood>();

            if (compBlood != null)
            {
                BloodBankUtilities.AdministerTransfusion(pawn, compBlood);
            }
            else
            {
                Log.Error($"Blood Bank - Give blood operation failed (ingredients[0] ({ingredients[0].def.defName}) has no CompBlood)");
            }
        }
        private static RecipeDef GenerateRacialSurgery(ThingDef pawn, RecipeDef original)
        {
            RecipeDef newDef = new RecipeDef();

            newDef.label           = original.label;
            newDef.description     = original.description;
            newDef.workerClass     = original.workerClass;
            newDef.jobString       = original.jobString;
            newDef.anesthetize     = original.anesthetize;
            newDef.workAmount      = original.workAmount;
            newDef.isViolation     = original.isViolation;
            newDef.targetsBodyPart = original.targetsBodyPart;

            newDef.skillRequirements = original.skillRequirements;

            newDef.surgerySuccessChanceFactor     = original.surgerySuccessChanceFactor;
            newDef.dontShowIfAnyIngredientMissing = original.dontShowIfAnyIngredientMissing;
            newDef.defName              = original.defName + "_" + pawn.defName;
            newDef.modContentPack       = original.modContentPack; //does this matter?
            newDef.researchPrerequisite = original.researchPrerequisite;
            //set up ingredients and products
            ThingDef bloodDef = BloodBankUtilities.GetBloodDefForPawn(pawn);

            if (original.defName == "TakeBlood")
            {
                newDef.products = new List <ThingDefCountClass>
                {
                    new ThingDefCountClass(bloodDef, 1)
                };
            }
            else if (original.defName == "GiveBlood")
            {
                IngredientCount ingredientCount = new IngredientCount();
                ingredientCount.SetBaseCount(1);
                ingredientCount.filter.SetAllow(bloodDef, true);
                newDef.ingredients.Add(ingredientCount);
                newDef.fixedIngredientFilter.SetAllow(bloodDef, true);
            }

            //newDef.recipeUsers.Add(pawn);
            pawn.recipes.Add(newDef);

            return(newDef);
        }
 public override void DoEffect(Pawn pawn)
 {
     BloodBankUtilities.ApplyBloodPack(pawn, parent.def);
     base.DoEffect(pawn);
 }
 public override void DoEffect(Pawn pawn)
 {
     BloodBankUtilities.AdministerTransfusion(pawn, parent.GetComp <CompBlood>());
     base.DoEffect(pawn);
 }
 public override void DoEffect(Pawn pawn)
 {
     BloodBankUtilities.AdministerBooster(pawn, parent.GetComp <CompBloodProduct>());
     base.DoEffect(pawn);
 }