Exemplo n.º 1
0
 static void Postfix(InteractionWorker_RecruitAttempt __instance, Pawn recruiter, Pawn recruitee, float recruitChance, bool useAudiovisualEffects)
 {
     if (GameComponent.ListAllySpawned.Contains(recruitee.GetUniqueLoadID()))
     {
         GameComponent.TryScheduleNextEvent(true);
     }
 }
Exemplo n.º 2
0
 public override void Tick()
 {
     base.Tick();
     Log.Message(this.CurStageIndex.ToString(), true);
     if (this.CurStageIndex == 1)
     {
         InteractionWorker_RecruitAttempt.DoRecruit(null, this.pawn, 1f, true);
     }
 }
 private void JoinColonyBecauseRescuedBy(Pawn by)
 {
     this.WillJoinColonyIfRescued = false;
     InteractionWorker_RecruitAttempt.DoRecruit(by, this.pawn, 1f, false);
     if (this.pawn.needs != null && this.pawn.needs.mood != null)
     {
         this.pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.Rescued, null);
     }
     Find.LetterStack.ReceiveLetter("LetterLabelRescueQuestFinished".Translate(), "LetterRescueQuestFinished".Translate().AdjustedFor(this.pawn, "PAWN").CapitalizeFirst(), LetterDefOf.PositiveEvent, this.pawn, null, null);
 }
Exemplo n.º 4
0
        /*
         * Affectionate Cat
         *
         * A single cat joins the colony.
         *
         */
        public void AffectionateCat(IncidentParms parms, out string flavorDesc, out GlobalTargetInfo target)
        {
            Settings.DebugString("Affectionate Cat");
            RCellFinder.TryFindRandomPawnEntryCell(out var loc, (Map)parms.target, CellFinder.EdgeRoadChance_Animal);
            var newThing = PawnGenerator.GeneratePawn(HPLDefOf.HPLovecraft_CatKind_Black);
            var cat      = GenSpawn.Spawn(newThing, loc, (Map)parms.target);

            InteractionWorker_RecruitAttempt.DoRecruit(cat.Map.mapPawns.FreeColonists.FirstOrDefault(), (Pawn)cat);
            flavorDesc = "ROM_OmenCatDesc4".Translate();
            target     = new GlobalTargetInfo(cat);
        }
Exemplo n.º 5
0
        protected override void Impact(Thing hitThing)
        {
            this.Destroy(DestroyMode.Vanish);

            if (CanOverpowerMind(this.Caster, hitThing))
            {
                Pawn victim = hitThing as Pawn;
                InteractionWorker_RecruitAttempt.DoRecruit(this.Caster, victim, 1f, true);
            }

        }
        public override void CompPostMake()
        {
            base.CompPostMake();
            this.PawnFactionOri = this.Pawn.Faction;
            this.Pawn.jobs.EndCurrentJob(Verse.AI.JobCondition.InterruptForced);

            if (this.Pawn.Faction != Faction.OfPlayer)
            {
                InteractionWorker_RecruitAttempt.DoRecruit(Find.MapPawns.FreeColonists.RandomElement <Pawn>(), this.Pawn, 1f, false);
            }
        }
Exemplo n.º 7
0
 public void JoinColonyBecauseRescuedBy(Pawn by)
 {
     WillJoinColonyIfRescued = false;
     if (!AnythingPreventsJoiningColonyIfRescued)
     {
         InteractionWorker_RecruitAttempt.DoRecruit(by, pawn, 1f, useAudiovisualEffects: false);
         if (pawn.needs != null && pawn.needs.mood != null)
         {
             pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.Rescued);
         }
         Find.LetterStack.ReceiveLetter("LetterLabelRescueQuestFinished".Translate(), "LetterRescueQuestFinished".Translate(pawn.Named("PAWN")).AdjustedFor(pawn).CapitalizeFirst(), LetterDefOf.PositiveEvent, pawn);
     }
 }
        /*
         * Affectionate Cat
         *
         * A single cat joins the colony.
         *
         */
        public void AffectionateCat(IncidentParms parms, out string flavorDesc, out GlobalTargetInfo target)
        {
            //Log.Message("Affectionate Cat");
            //Affectionate cat
            IntVec3 loc;

            RCellFinder.TryFindRandomPawnEntryCell(out loc, (Map)parms.target, CellFinder.EdgeRoadChance_Animal, null);
            Pawn  newThing = PawnGenerator.GeneratePawn(HPLDefOf.HPLovecraft_CatKind_Black, null);
            Thing cat      = GenSpawn.Spawn(newThing, loc, (Map)parms.target);

            InteractionWorker_RecruitAttempt.DoRecruit(cat.Map.mapPawns.FreeColonists.FirstOrDefault <Pawn>(), (Pawn)cat, 1f, true);
            flavorDesc = "ROM_OmenCatDesc4".Translate();
            target     = new RimWorld.Planet.GlobalTargetInfo(cat);
        }
Exemplo n.º 9
0
 private void PrisonerRescued(Pawn by)
 {
     this.willJoinColonyIfRescued = false;
     InteractionWorker_RecruitAttempt.DoRecruit(by, this.pawn, 1f, false);
     Messages.Message("MessagePrisonerRescued".Translate().AdjustedFor(this.pawn).CapitalizeFirst(), this.pawn, MessageTypeDefOf.PositiveEvent);
 }
Exemplo n.º 10
0
        // Token: 0x0600002F RID: 47 RVA: 0x00002870 File Offset: 0x00000A70
        public static void DoTend(Pawn doctor, Pawn patient, Cloakgen medkit)
        {
            bool flag = patient.health.HasHediffsNeedingTend(false);

            if (flag)
            {
                bool flag2 = medkit != null && medkit.Destroyed;
                if (flag2)
                {
                    Log.Warning("Tried to use destroyed medkit.", false);
                    medkit = null;
                }
                float num = HealthShardTendUtility.CalculateBaseTendQuality(doctor, patient, medkit.kitComp.Props.medicine ?? null);
                HealthShardTendUtility.GetOptimalHediffsToTendWithSingleTreatment(patient, medkit.kitComp.Props.medicine != null, HealthShardTendUtility.tmpHediffsToTend, null);
                for (int i = 0; i < HealthShardTendUtility.tmpHediffsToTend.Count; i++)
                {
                    HealthShardTendUtility.tmpHediffsToTend[i].Tended(num, i);
                }
                bool flag3 = doctor != null && doctor.Faction == Faction.OfPlayer && patient.Faction != doctor.Faction && !patient.IsPrisoner && patient.Faction != null;
                if (flag3)
                {
                    patient.mindState.timesGuestTendedToByPlayer++;
                }
                bool flag4 = doctor != null && doctor.IsColonistPlayerControlled;
                if (flag4)
                {
                    patient.records.AccumulateStoryEvent(StoryEventDefOf.TendedByPlayer);
                }
                bool flag5 = doctor != null && doctor.RaceProps.Humanlike && patient.RaceProps.Animal;
                if (flag5)
                {
                    bool flag6 = RelationsUtility.TryDevelopBondRelation(doctor, patient, 0.004f);
                    if (flag6)
                    {
                        bool flag7 = doctor.Faction != null && doctor.Faction != patient.Faction;
                        if (flag7)
                        {
                            InteractionWorker_RecruitAttempt.DoRecruit(doctor, patient, 1f, false);
                        }
                    }
                }
                patient.records.Increment(RecordDefOf.TimesTendedTo);
                bool flag8 = doctor != null;
                if (flag8)
                {
                    doctor.records.Increment(RecordDefOf.TimesTendedOther);
                }
                bool flag9 = doctor == patient && !doctor.Dead;
                if (flag9)
                {
                    doctor.mindState.Notify_SelfTended();
                }
                bool flag10 = medkit.kitComp.Props.medicine != null;
                if (flag10)
                {
                    bool flag11 = patient.Spawned || (doctor != null && doctor.Spawned);
                    if (flag11)
                    {
                        bool flag12 = medkit.kitComp.Props.medicine != null && StatExtension.GetStatValueAbstract(medkit.kitComp.Props.medicine, StatDefOf.MedicalPotency, null) > StatExtension.GetStatValueAbstract(ThingDefOf.MedicineIndustrial, StatDefOf.MedicalPotency, null);
                        if (flag12)
                        {
                            SoundStarter.PlayOneShot(SoundDefOf.TechMedicineUsed, new TargetInfo(patient.Position, patient.Map, false));
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
        public static void DoTend(Pawn doctor, Pawn patient, Thing medicine)
        {
            if (patient.health.HasHediffsNeedingTend(false))
            {
                if (medicine != null && medicine.Destroyed)
                {
                    Log.Warning("Tried to use destroyed repair kit.", false);
                    medicine = null;
                }

                //float quality = 1f; //CalculateBaseTendQuality
                GetOptimalHediffsToTendWithSingleTreatment(patient, medicine != null, tmpHediffsToTend, null);

                for (int i = 0; i < tmpHediffsToTend.Count; i++)
                {
                    //tmpHediffsToTend[i].Tended(quality, i);
                    if (medicine == null)
                    {
                        tmpHediffsToTend[i].Tended(0.1f, i);
                    }
                    else
                    {
                        patient.health.RemoveHediff(tmpHediffsToTend[i]);
                    }
                }
                if (doctor != null && doctor.Faction == Faction.OfPlayer && patient.Faction != doctor.Faction && !patient.IsPrisoner && patient.Faction != null)
                {
                    patient.mindState.timesGuestTendedToByPlayer++;
                }
                if (doctor != null && doctor.IsColonistPlayerControlled)
                {
                    patient.records.AccumulateStoryEvent(StoryEventDefOf.TendedByPlayer);
                }
                if (doctor != null && doctor.RaceProps.Humanlike && patient.RaceProps.Animal)
                {
                    if (RelationsUtility.TryDevelopBondRelation(doctor, patient, 0.004f))
                    {
                        if (doctor.Faction != null && doctor.Faction != patient.Faction)
                        {
                            InteractionWorker_RecruitAttempt.DoRecruit(doctor, patient, 1f, false);
                        }
                    }
                }
                patient.records.Increment(RecordDefOf.TimesTendedTo);
                if (doctor != null)
                {
                    doctor.records.Increment(RecordDefOf.TimesTendedOther);
                }
                if (doctor == patient && !doctor.Dead)
                {
                    doctor.mindState.Notify_SelfTended();
                }
                if (medicine != null)
                {
                    if (patient.Spawned || (doctor != null && doctor.Spawned))
                    {
                        //if (medicine != null && medicine.GetStatValue(StatDefOf.MedicalPotency, true) > RimWorld.ThingDefOf.MedicineIndustrial.GetStatValueAbstract(StatDefOf.MedicalPotency, null))
                        {
                            SoundDefOf.Building_Complete.PlayOneShot(new TargetInfo(patient.Position, patient.Map, false));
                        }
                    }
                    if (medicine.stackCount > 1)
                    {
                        medicine.stackCount--;
                    }
                    else if (!medicine.Destroyed)
                    {
                        medicine.Destroy(DestroyMode.Vanish);
                    }
                }
            }
        }
Exemplo n.º 12
0
        internal static void _DoTend(Pawn doctor, Pawn patient, Medicine medicine)
        {
            if (!patient.health.HasHediffsNeedingTend(false))
            {
                return;
            }
            if (medicine != null && medicine.Destroyed)
            {
                Log.Warning("Tried to use destroyed medicine.");
                medicine = (Medicine)null;
            }
            float num1    = medicine == null ? 0.0f : medicine.def.GetStatValueAbstract(StatDefOf.MedicalPotency, (ThingDef)null);
            float quality = medicine == null ? 0.5f : num1;

            if (doctor != null)
            {
                quality *= doctor.GetStatValue(StatDefOf.BaseHealingQuality, true);
            }
            if (patient.InBed())
            {
                quality *= patient.CurrentBed().GetStatValue(StatDefOf.MedicalTreatmentQualityFactor, true);
            }
            if (patient.health.hediffSet.GetInjuriesTendable().Any <Hediff_Injury>())
            {
                float num2          = 0.0f;
                int   batchPosition = 0;
                foreach (Hediff_Injury hediffInjury in (IEnumerable <Hediff_Injury>)patient.health.hediffSet.GetInjuriesTendable().OrderByDescending <Hediff_Injury, float>((Func <Hediff_Injury, float>)(x => x.Severity)))
                {
                    float num3 = Mathf.Min(hediffInjury.Severity, 20f);
                    if ((double)num2 + (double)num3 <= 20.0)
                    {
                        num2 += num3;
                        hediffInjury.Tended(quality, batchPosition);
                        if (medicine != null)
                        {
                            ++batchPosition;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else
            {
                bleedingStumps.Clear();
                List <Hediff_MissingPart> partsCommonAncestors = patient.health.hediffSet.GetMissingPartsCommonAncestors();
                for (int index = 0; index < partsCommonAncestors.Count; ++index)
                {
                    if (partsCommonAncestors[index].IsFresh)
                    {
                        bleedingStumps.Add(partsCommonAncestors[index]);
                    }
                }
                if (bleedingStumps.Count > 0)
                {
                    bleedingStumps.RandomElement <Hediff_MissingPart>().IsFresh = false;
                    bleedingStumps.Clear();
                }
                else
                {
                    otherHediffs.Clear();
                    otherHediffs.AddRange(patient.health.hediffSet.GetTendableNonInjuryNonMissingPartHediffs());
                    Hediff result;
                    if (otherHediffs.TryRandomElement <Hediff>(out result))
                    {
                        HediffCompProperties hediffCompProperties = result.def.CompPropsFor(typeof(HediffComp_Tendable));
                        if (hediffCompProperties != null && hediffCompProperties.tendAllAtOnce)
                        {
                            int batchPosition = 0;
                            for (int index = 0; index < otherHediffs.Count; ++index)
                            {
                                if (otherHediffs[index].def == result.def)
                                {
                                    otherHediffs[index].Tended(quality, batchPosition);
                                    ++batchPosition;
                                }
                            }
                        }
                        else
                        {
                            result.Tended(quality, 0);
                        }
                    }
                    otherHediffs.Clear();
                }
            }
            if (doctor != null && patient.HostFaction == null && (patient.Faction != null && patient.Faction != doctor.Faction))
            {
                patient.Faction.AffectGoodwillWith(doctor.Faction, 0.3f);
            }
            if (doctor != null && doctor.RaceProps.Humanlike && (patient.RaceProps.Animal && RelationsUtility.TryDevelopBondRelation(doctor, patient, 0.01f)) && (doctor.Faction != null && doctor.Faction != patient.Faction))
            {
                InteractionWorker_RecruitAttempt.DoRecruit(doctor, patient, 1f, false);
            }
            patient.records.Increment(RecordDefOf.TimesTendedTo);
            if (doctor != null)
            {
                doctor.records.Increment(RecordDefOf.TimesTendedOther);
                doctor.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOfPsychology.DoctorBleedingHeart, patient);
            }
            if (medicine == null)
            {
                return;
            }
            if ((patient.Spawned || doctor != null && doctor.Spawned) && (double)num1 > 0.899999976158142)
            {
                SoundDef.Named("TechMedicineUsed").PlayOneShot((SoundInfo)patient.Position);
            }
            if (medicine.stackCount > 1)
            {
                --medicine.stackCount;
            }
            else
            {
                if (medicine.Destroyed)
                {
                    return;
                }
                medicine.Destroy(DestroyMode.Vanish);
            }
        }
Exemplo n.º 13
0
        internal static void _DoTend(Pawn doctor, Pawn patient, Medicine medicine)
        {
            if (!patient.health.HasHediffsNeedingTend(false))
            {
                return;
            }
            if (medicine != null && medicine.Destroyed)
            {
                Log.Warning("Tried to use destroyed medicine.");
                medicine = null;
            }
            float        num          = (medicine == null) ? 0.2f : medicine.def.GetStatValueAbstract(StatDefOf.MedicalPotency, null);
            float        num2         = num;
            Building_Bed building_Bed = patient.CurrentBed();

            if (building_Bed != null)
            {
                num2 += building_Bed.GetStatValue(StatDefOf.MedicalTendQualityOffset, true);
            }
            if (doctor != null)
            {
                num2 *= doctor.GetStatValue(StatDefOf.HealingQuality, true);
            }
            num2 = Mathf.Clamp01(num2);
            if (patient.health.hediffSet.GetInjuriesTendable().Any <Hediff_Injury>())
            {
                float num3 = 0f;
                int   num4 = 0;
                foreach (Hediff_Injury current in from x in patient.health.hediffSet.GetInjuriesTendable()
                         orderby x.Severity descending
                         select x)
                {
                    float num5 = Mathf.Min(current.Severity, 20f);
                    if (num3 + num5 > 20f)
                    {
                        break;
                    }
                    num3 += num5;
                    current.Tended(num2, num4);
                    if (medicine == null)
                    {
                        break;
                    }
                    num4++;
                }
            }
            else
            {
                bleedingStumps.Clear();
                List <Hediff_MissingPart> missingPartsCommonAncestors = patient.health.hediffSet.GetMissingPartsCommonAncestors();
                for (int i = 0; i < missingPartsCommonAncestors.Count; i++)
                {
                    if (missingPartsCommonAncestors[i].IsFresh)
                    {
                        bleedingStumps.Add(missingPartsCommonAncestors[i]);
                    }
                }
                if (bleedingStumps.Count > 0)
                {
                    bleedingStumps.RandomElement <Hediff_MissingPart>().IsFresh = false;
                    bleedingStumps.Clear();
                }
                else
                {
                    otherHediffs.Clear();
                    otherHediffs.AddRange(patient.health.hediffSet.GetTendableNonInjuryNonMissingPartHediffs());
                    Hediff hediff;
                    if (otherHediffs.TryRandomElement(out hediff))
                    {
                        HediffCompProperties_TendDuration hediffCompProperties_TendDuration = hediff.def.CompProps <HediffCompProperties_TendDuration>();
                        if (hediffCompProperties_TendDuration != null && hediffCompProperties_TendDuration.tendAllAtOnce)
                        {
                            int num6 = 0;
                            for (int j = 0; j < otherHediffs.Count; j++)
                            {
                                if (otherHediffs[j].def == hediff.def)
                                {
                                    otherHediffs[j].Tended(num2, num6);
                                    num6++;
                                }
                            }
                        }
                        else
                        {
                            hediff.Tended(num2, 0);
                        }
                    }
                    otherHediffs.Clear();
                }
            }
            if (doctor != null && patient.HostFaction == null && patient.Faction != null && patient.Faction != doctor.Faction)
            {
                patient.Faction.AffectGoodwillWith(doctor.Faction, 0.3f);
            }
            if (doctor != null && doctor.RaceProps.Humanlike && patient.RaceProps.Animal && RelationsUtility.TryDevelopBondRelation(doctor, patient, 0.004f) && doctor.Faction != null && doctor.Faction != patient.Faction)
            {
                InteractionWorker_RecruitAttempt.DoRecruit(doctor, patient, 1f, false);
            }
            patient.records.Increment(RecordDefOf.TimesTendedTo);
            if (doctor != null)
            {
                doctor.records.Increment(RecordDefOf.TimesTendedOther);
                doctor.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOfPsychology.DoctorBleedingHeart, patient);
            }
            if (medicine != null)
            {
                if ((patient.Spawned || (doctor != null && doctor.Spawned)) && num > 1f)
                {
                    SoundDef.Named("TechMedicineUsed").PlayOneShot(new TargetInfo(patient.Position, patient.Map, false));
                }
                if (medicine.stackCount > 1)
                {
                    medicine.stackCount--;
                }
                else if (!medicine.Destroyed)
                {
                    medicine.Destroy(DestroyMode.Vanish);
                }
            }
        }
Exemplo n.º 14
0
        public static void DoTend(Pawn doctor, Pawn patient, Medicine medicine)
        {
            if (!patient.health.HasHediffsNeedingTend(false))
            {
                return;
            }
            if (medicine != null && medicine.Destroyed)
            {
                Log.Warning("Tried to use destroyed medicine.");
                medicine = null;
            }
            float        num          = (medicine == null) ? 0.2f : medicine.def.GetStatValueAbstract(StatDefOf.MedicalPotency, null);
            float        quality      = num;
            Building_Bed building_Bed = patient.CurrentBed();

            if (building_Bed != null)
            {
                quality += building_Bed.GetStatValue(StatDefOf.MedicalTendQualityOffset, true);
            }
            if (doctor != null)
            {
                quality *= doctor.GetStatValue(StatDefOf.HealingQuality, true);
            }
            quality = Mathf.Clamp01(quality);
            if (patient.health.hediffSet.GetInjuriesTendable().Any <Hediff_Injury>())
            {
                float maxSeverity   = 0f;
                int   batchPosition = 0;

                // added prio by bleeding, everything else vanilla
                foreach (Hediff_Injury current in from x in patient.health.hediffSet.GetInjuriesTendable().Where(x => x.BleedRate > 0)
                         orderby x.BleedRate descending
                         select x)
                {
                    float severity = Mathf.Min(current.Severity, 20f);
                    if (maxSeverity + severity > 20f)
                    {
                        break;
                    }
                    maxSeverity += severity;
                    current.Tended(quality, batchPosition);
                    if (medicine == null)
                    {
                        break;
                    }
                    batchPosition++;
                }

                foreach (Hediff_Injury current in from x in patient.health.hediffSet.GetInjuriesTendable()
                         orderby x.Severity descending
                         select x)
                {
                    float severity = Mathf.Min(current.Severity, 20f);
                    if (maxSeverity + severity > 20f)
                    {
                        break;
                    }
                    maxSeverity += severity;
                    current.Tended(quality, batchPosition);
                    if (medicine == null)
                    {
                        break;
                    }
                    batchPosition++;
                }
            }
            else
            {
                _TendUtility.bleedingStumps.Clear();
                List <Hediff_MissingPart> missingPartsCommonAncestors = patient.health.hediffSet.GetMissingPartsCommonAncestors();
                for (int i = 0; i < missingPartsCommonAncestors.Count; i++)
                {
                    if (missingPartsCommonAncestors[i].IsFresh)
                    {
                        _TendUtility.bleedingStumps.Add(missingPartsCommonAncestors[i]);
                    }
                }
                if (_TendUtility.bleedingStumps.Count > 0)
                {
                    _TendUtility.bleedingStumps.RandomElement <Hediff_MissingPart>().IsFresh = false;
                    _TendUtility.bleedingStumps.Clear();
                }
                else
                {
                    _TendUtility.otherHediffs.Clear();
                    _TendUtility.otherHediffs.AddRange(patient.health.hediffSet.GetTendableNonInjuryNonMissingPartHediffs());
                    Hediff hediff;
                    if (_TendUtility.otherHediffs.TryRandomElement(out hediff))
                    {
                        HediffCompProperties_TendDuration hediffCompProperties_TendDuration = hediff.def.CompProps <HediffCompProperties_TendDuration>();
                        if (hediffCompProperties_TendDuration != null && hediffCompProperties_TendDuration.tendAllAtOnce)
                        {
                            int num6 = 0;
                            for (int j = 0; j < _TendUtility.otherHediffs.Count; j++)
                            {
                                if (_TendUtility.otherHediffs[j].def == hediff.def)
                                {
                                    _TendUtility.otherHediffs[j].Tended(quality, num6);
                                    num6++;
                                }
                            }
                        }
                        else
                        {
                            hediff.Tended(quality, 0);
                        }
                    }
                    _TendUtility.otherHediffs.Clear();
                }
            }
            if (doctor != null && patient.HostFaction == null && patient.Faction != null && patient.Faction != doctor.Faction)
            {
                patient.Faction.AffectGoodwillWith(doctor.Faction, 0.3f);
            }
            if (doctor != null && doctor.RaceProps.Humanlike && patient.RaceProps.Animal && RelationsUtility.TryDevelopBondRelation(doctor, patient, ChanceToDevelopBondRelationOnTended) && doctor.Faction != null && doctor.Faction != patient.Faction)
            {
                InteractionWorker_RecruitAttempt.DoRecruit(doctor, patient, 1f, false);
            }
            patient.records.Increment(RecordDefOf.TimesTendedTo);
            if (doctor != null)
            {
                doctor.records.Increment(RecordDefOf.TimesTendedOther);
            }
            if (medicine != null)
            {
                if ((patient.Spawned || (doctor != null && doctor.Spawned)) && num > 1f)
                {
                    SoundDef.Named("TechMedicineUsed").PlayOneShot(new TargetInfo(patient.Position, patient.Map, false));
                }
                if (medicine.stackCount > 1)
                {
                    medicine.stackCount--;
                }
                else if (!medicine.Destroyed)
                {
                    medicine.Destroy(DestroyMode.Vanish);
                }
            }
        }