public static void ResurrectWithSideEffects(Pawn pawn) { Corpse corpse = pawn.Corpse; float x2 = (corpse == null) ? 0f : (corpse.GetComp <CompRottable>().RotProgress / 60000f); Resurrect(pawn); BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); Hediff hediff = HediffMaker.MakeHediff(HediffDefOf.ResurrectionSickness, pawn); if (!pawn.health.WouldDieAfterAddingHediff(hediff)) { pawn.health.AddHediff(hediff); } if (Rand.Chance(DementiaChancePerRotDaysCurve.Evaluate(x2)) && brain != null) { Hediff hediff2 = HediffMaker.MakeHediff(HediffDefOf.Dementia, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff2)) { pawn.health.AddHediff(hediff2); } } if (Rand.Chance(BlindnessChancePerRotDaysCurve.Evaluate(x2))) { foreach (BodyPartRecord item in from x in pawn.health.hediffSet.GetNotMissingParts() where x.def == BodyPartDefOf.Eye select x) { if (!pawn.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(item)) { Hediff hediff3 = HediffMaker.MakeHediff(HediffDefOf.Blindness, pawn, item); pawn.health.AddHediff(hediff3); } } } if (brain != null && Rand.Chance(ResurrectionPsychosisChancePerRotDaysCurve.Evaluate(x2))) { Hediff hediff4 = HediffMaker.MakeHediff(HediffDefOf.ResurrectionPsychosis, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff4)) { pawn.health.AddHediff(hediff4); } } if (pawn.Dead) { Log.Error("The pawn has died while being resurrected."); Resurrect(pawn); } }
public static float would_fuck(Pawn f****r, Corpse f****d, bool invert_opinion = false, bool ignore_bleeding = false, bool ignore_gender = false) { CompRottable comp = f****d.GetComp <CompRottable>(); //--Log.Message("rotFactor:" + rotFactor); // Things that don't rot, such as mechanoids and weird mod-added stuff such as Rimworld of Magic's elementals. if (comp == null) { // Trying to necro the weird mod-added stuff causes an error, so skipping those for now. return(0.0f); } float maxRot = ((CompProperties_Rottable)comp.props).TicksToDessicated; float rotFactor = (maxRot - comp.RotProgress) / maxRot; //--Log.Message("rotFactor:" + rotFactor); return(would_fuck(f****r, f****d.InnerPawn, invert_opinion, ignore_bleeding, ignore_gender) * rotFactor); }
protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); ThingDef def = this.def; int raisedPawns = 0; Pawn pawn = this.launcher as Pawn; Pawn victim = hitThing as Pawn; CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>(); pwr = comp.MagicData.MagicPowerSkill_RaiseUndead.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_RaiseUndead_pwr"); ver = comp.MagicData.MagicPowerSkill_RaiseUndead.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_RaiseUndead_ver"); Thing corpseThing = null; IntVec3 curCell; IEnumerable <IntVec3> targets = GenRadial.RadialCellsAround(base.Position, this.def.projectile.explosionRadius, true); for (int i = 0; i < targets.Count(); i++) { curCell = targets.ToArray <IntVec3>()[i]; TM_MoteMaker.ThrowPoisonMote(curCell.ToVector3Shifted(), map, .3f); if (curCell.InBounds(map)) { Corpse corpse = null; List <Thing> thingList; thingList = curCell.GetThingList(map); int z = 0; while (z < thingList.Count) { corpseThing = thingList[z]; if (corpseThing != null) { bool validator = corpseThing is Corpse; if (validator) { corpse = corpseThing as Corpse; Pawn undeadPawn = corpse.InnerPawn; CompRottable compRottable = corpse.GetComp <CompRottable>(); float rotStage = 0; if (compRottable != null && compRottable.Stage == RotStage.Dessicated) { rotStage = 1f; } if (compRottable != null) { rotStage += compRottable.RotProgressPct; } bool flag_SL = false; if (undeadPawn.def.defName == "SL_Runner" || undeadPawn.def.defName == "SL_Peon" || undeadPawn.def.defName == "SL_Archer" || undeadPawn.def.defName == "SL_Hero") { PawnGenerationRequest pgr = new PawnGenerationRequest(PawnKindDef.Named("Tribesperson"), pawn.Faction, PawnGenerationContext.NonPlayer, -1, true, false, false, false, false, true, 0, false, false, false, false, false, false, false, false, 0, null, 0); Pawn newUndeadPawn = PawnGenerator.GeneratePawn(pgr); GenSpawn.Spawn(newUndeadPawn, corpse.Position, corpse.Map, WipeMode.Vanish); corpse.Strip(); corpse.Destroy(DestroyMode.Vanish); rotStage = 1f; flag_SL = true; undeadPawn = newUndeadPawn; } if (!undeadPawn.def.defName.Contains("ROM_") && undeadPawn.RaceProps.IsFlesh && (undeadPawn.Dead || flag_SL) && undeadPawn.def.thingClass.FullName != "TorannMagic.TMPawnSummoned") { bool wasVampire = false; IEnumerable <ThingDef> enumerable = from hd in DefDatabase <HediffDef> .AllDefs where (def.defName == "ROM_Vampirism") select def; if (enumerable.Count() > 0) { bool hasVampHediff = undeadPawn.health.hediffSet.HasHediff(HediffDef.Named("ROM_Vampirism")) || undeadPawn.health.hediffSet.HasHediff(HediffDef.Named("ROM_GhoulHediff")); if (hasVampHediff) { wasVampire = true; } } if (!wasVampire) { undeadPawn.SetFaction(pawn.Faction); if (undeadPawn.Dead) { ResurrectionUtility.Resurrect(undeadPawn); } raisedPawns++; comp.supportedUndead.Add(undeadPawn); if (undeadPawn.kindDef != null && undeadPawn.kindDef.RaceProps != null && undeadPawn.kindDef.RaceProps.Animal) { RemoveHediffsAddictionsAndPermanentInjuries(undeadPawn); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadAnimalHD, -4f); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadAnimalHD, .5f + ver.level); undeadPawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_UndeadAnimalHD).TryGetComp <HediffComp_Undead>().linkedPawn = pawn; HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), -2f); HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), rotStage); if (undeadPawn.training.CanAssignToTrain(TrainableDefOf.Tameness).Accepted) { while (!undeadPawn.training.HasLearned(TrainableDefOf.Tameness)) { undeadPawn.training.Train(TrainableDefOf.Tameness, pawn); } } if (undeadPawn.training.CanAssignToTrain(TrainableDefOf.Obedience).Accepted) { while (!undeadPawn.training.HasLearned(TrainableDefOf.Obedience)) { undeadPawn.training.Train(TrainableDefOf.Obedience, pawn); } } if (undeadPawn.training.CanAssignToTrain(TrainableDefOf.Release).Accepted) { while (!undeadPawn.training.HasLearned(TrainableDefOf.Release)) { undeadPawn.training.Train(TrainableDefOf.Release, pawn); } } if (undeadPawn.training.CanAssignToTrain(TorannMagicDefOf.Haul).Accepted) { while (!undeadPawn.training.HasLearned(TorannMagicDefOf.Haul)) { undeadPawn.training.Train(TorannMagicDefOf.Haul, pawn); } } if (undeadPawn.training.CanAssignToTrain(TorannMagicDefOf.Rescue).Accepted) { while (!undeadPawn.training.HasLearned(TorannMagicDefOf.Rescue)) { undeadPawn.training.Train(TorannMagicDefOf.Rescue, pawn); } } undeadPawn.playerSettings.medCare = MedicalCareCategory.NoMeds; undeadPawn.def.tradeability = Tradeability.None; } else if (undeadPawn.story != null && undeadPawn.story.traits != null && undeadPawn.needs != null && undeadPawn.playerSettings != null) { CompAbilityUserMagic compMagic = undeadPawn.GetComp <CompAbilityUserMagic>(); if (compMagic != null && TM_Calc.IsMagicUser(undeadPawn)) //(compMagic.IsMagicUser && !undeadPawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) || { compMagic.Initialize(); compMagic.RemovePowers(true); } CompAbilityUserMight compMight = undeadPawn.GetComp <CompAbilityUserMight>(); if (compMight != null && TM_Calc.IsMightUser(undeadPawn)) //compMight.IsMightUser || { compMight.Initialize(); compMight.RemovePowers(true); } RemoveHediffsAddictionsAndPermanentInjuries(undeadPawn); RemovePsylinkAbilities(undeadPawn); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadHD, -4f); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadHD, .5f + ver.level); undeadPawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_UndeadHD).TryGetComp <HediffComp_Undead>().linkedPawn = pawn; HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), -2f); HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), rotStage); RedoSkills(undeadPawn, pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_LichHD"))); if (undeadPawn.story.traits.HasTrait(TorannMagicDefOf.ChaosMage)) { compMagic.RemovePawnAbility(TorannMagicDefOf.TM_ChaosTradition); } RemoveTraits(undeadPawn, undeadPawn.story.traits.allTraits); undeadPawn.story.traits.GainTrait(new Trait(TraitDef.Named("Undead"), 0, false)); undeadPawn.story.traits.GainTrait(new Trait(TraitDef.Named("Psychopath"), 0, false)); undeadPawn.needs.AddOrRemoveNeedsAsAppropriate(); RemoveClassHediff(undeadPawn); if (undeadPawn.health.hediffSet.HasHediff(HediffDef.Named("DeathAcidifier"))) { Hediff hd = undeadPawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("DeathAcidifier")); undeadPawn.health.RemoveHediff(hd); } //Color undeadColor = new Color(.2f, .4f, 0); //undeadPawn.story.hairColor = undeadColor; //CompAbilityUserMagic undeadComp = undeadPawn.GetComp<CompAbilityUserMagic>(); //if (undeadComp.IsMagicUser) //{ // undeadComp.ClearPowers(); //} List <SkillRecord> skills = undeadPawn.skills.skills; for (int j = 0; j < skills.Count; j++) { skills[j].passion = Passion.None; } undeadPawn.playerSettings.hostilityResponse = HostilityResponseMode.Attack; undeadPawn.playerSettings.medCare = MedicalCareCategory.NoMeds; for (int h = 0; h < 24; h++) { undeadPawn.timetable.SetAssignment(h, TimeAssignmentDefOf.Work); } } } else { Messages.Message("Vampiric powers have prevented undead reanimation of " + undeadPawn.LabelShort, MessageTypeDefOf.RejectInput); } } } else if (corpseThing is Pawn) { Pawn undeadPawn = corpseThing as Pawn; if (undeadPawn != pawn && !TM_Calc.IsNecromancer(undeadPawn) && TM_Calc.IsUndead(corpseThing as Pawn)) { RemoveHediffsAddictionsAndPermanentInjuries(undeadPawn); TM_MoteMaker.ThrowPoisonMote(curCell.ToVector3Shifted(), map, .6f); } } } z++; } } if (raisedPawns > pwr.level + 1) { i = targets.Count(); } } }
public static void ResurrectWithSideEffects(Pawn pawn) { Corpse corpse = pawn.Corpse; float num; bool flag; if (corpse != null) { CompRottable comp = corpse.GetComp <CompRottable>(); num = (float)(comp.RotProgress / 60000.0); flag = (comp.Stage == RotStage.Fresh); } else { num = 0f; flag = true; } ResurrectionUtility.Resurrect(pawn); BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); float chance = Mathf.Max((float)(0.20000000298023224 * num), 0.08f); if (Rand.Chance(chance) && brain != null) { int a = Rand.RangeInclusive(1, 5); int b = Mathf.FloorToInt(pawn.health.hediffSet.GetPartHealth(brain)) - 1; a = Mathf.Min(a, b); if (a > 0 && !pawn.health.WouldDieAfterAddingHediff(HediffDefOf.Burn, brain, (float)a)) { DamageDef burn = DamageDefOf.Burn; int amount = a; BodyPartRecord hitPart = brain; pawn.TakeDamage(new DamageInfo(burn, amount, -1f, null, hitPart, null, DamageInfo.SourceCategory.ThingOrUnknown)); } } float chance2 = Mathf.Max((float)(0.11999999731779099 * num), 0.04f); if (Rand.Chance(chance2)) { IEnumerable <BodyPartRecord> enumerable = from x in pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined) where x.def == BodyPartDefOf.LeftEye || x.def == BodyPartDefOf.RightEye select x; foreach (BodyPartRecord item in enumerable) { Hediff hediff = HediffMaker.MakeHediff(HediffDefOf.Blindness, pawn, item); pawn.health.AddHediff(hediff, null, null); } } Hediff hediff2 = HediffMaker.MakeHediff(HediffDefOf.ResurrectionSickness, pawn, null); if (!pawn.health.WouldDieAfterAddingHediff(hediff2)) { pawn.health.AddHediff(hediff2, null, null); } if ((!flag || Rand.Chance(0.3f)) && brain != null) { Hediff hediff3 = HediffMaker.MakeHediff(HediffDefOf.ResurrectionPsychosis, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff3)) { pawn.health.AddHediff(hediff3, null, null); } } if (pawn.Dead) { Log.Error("The pawn has died while being resurrected."); ResurrectionUtility.Resurrect(pawn); } }
public static void ResurrectWithSideEffects(Pawn pawn) { Corpse corpse = pawn.Corpse; float x2; if (corpse != null) { CompRottable comp = corpse.GetComp <CompRottable>(); x2 = comp.RotProgress / 60000f; } else { x2 = 0f; } ResurrectionUtility.Resurrect(pawn); BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); Hediff hediff = HediffMaker.MakeHediff(HediffDefOf.ResurrectionSickness, pawn, null); if (!pawn.health.WouldDieAfterAddingHediff(hediff)) { pawn.health.AddHediff(hediff, null, null, null); } float chance = ResurrectionUtility.DementiaChancePerRotDaysCurve.Evaluate(x2); if (Rand.Chance(chance) && brain != null) { Hediff hediff2 = HediffMaker.MakeHediff(HediffDefOf.Dementia, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff2)) { pawn.health.AddHediff(hediff2, null, null, null); } } float chance2 = ResurrectionUtility.BlindnessChancePerRotDaysCurve.Evaluate(x2); if (Rand.Chance(chance2)) { IEnumerable <BodyPartRecord> enumerable = from x in pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null) where x.def == BodyPartDefOf.Eye select x; foreach (BodyPartRecord current in enumerable) { Hediff hediff3 = HediffMaker.MakeHediff(HediffDefOf.Blindness, pawn, current); pawn.health.AddHediff(hediff3, null, null, null); } } if (brain != null) { float chance3 = ResurrectionUtility.ResurrectionPsychosisChancePerRotDaysCurve.Evaluate(x2); if (Rand.Chance(chance3)) { Hediff hediff4 = HediffMaker.MakeHediff(HediffDefOf.ResurrectionPsychosis, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff4)) { pawn.health.AddHediff(hediff4, null, null, null); } } } if (pawn.Dead) { Log.Error("The pawn has died while being resurrected.", false); ResurrectionUtility.Resurrect(pawn); } }
protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); ThingDef def = this.def; if (!this.initialized) { if (this.launcher is Pawn) { caster = this.launcher as Pawn; CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>(); MagicPowerSkill ver = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Resurrection.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Resurrection_ver"); MagicPowerSkill pwr = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Resurrection.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Resurrection_eff"); verVal = ver.level; pwrVal = pwr.level; } this.angle = Rand.Range(-12f, 12f); IntVec3 curCell = base.Position; this.CheckSpawnSustainer(); if (curCell.InBounds(map)) { Corpse corpse = null; List <Thing> thingList; thingList = curCell.GetThingList(map); int z = 0; while (z < thingList.Count) { corpseThing = thingList[z]; if (corpseThing != null) { bool validator = corpseThing is Corpse; if (validator) { corpse = corpseThing as Corpse; CompRottable compRot = corpse.GetComp <CompRottable>(); deadPawn = corpse.InnerPawn; deadPawnPosition = corpse.Position; if (deadPawn.RaceProps.IsFlesh && !TM_Calc.IsUndead(deadPawn) && compRot != null) { if (!corpse.IsNotFresh()) { z = thingList.Count; this.validTarget = true; corpse.SetForbidden(true); } else { Messages.Message("TM_ResurrectionTargetExpired".Translate(), MessageTypeDefOf.RejectInput); } } if (TM_Calc.IsUndead(deadPawn)) { z = thingList.Count; this.validTarget = true; } } } z++; } } this.initialized = true; } if (corpseThing.Position != this.deadPawnPosition || corpseThing.Map == null) { Log.Message("Corpse was moved or destroyed during resurrection process."); this.age = this.timeToRaise; } if (this.validTarget) { if (this.sustainer != null) { this.sustainer.info.volumeFactor = this.age / this.timeToRaise; this.sustainer.Maintain(); if (this.TicksLeft <= 0) { this.sustainer.End(); this.sustainer = null; } } if (this.age + 1 == this.timeToRaise) { TM_MoteMaker.MakePowerBeamMoteColor(base.Position, base.Map, this.radius * 3f, 2f, 2f, .1f, 1.5f, colorInt.ToColor); if (this.deadPawn == null) { if (corpseThing != null) { Corpse corpse = corpseThing as Corpse; if (corpse != null) { this.deadPawn = corpse.InnerPawn; } } } if (deadPawn != null) { if (TM_Calc.IsUndead(deadPawn)) { if (deadPawn.RaceProps.Humanlike) { GenExplosion.DoExplosion(base.Position, this.Map, Rand.Range(10, 16), TMDamageDefOf.DamageDefOf.TM_Holy, this.launcher, Mathf.RoundToInt(Rand.Range(20, 32)), 6, TMDamageDefOf.DamageDefOf.TM_Holy.soundExplosion); } else { GenExplosion.DoExplosion(base.Position, this.Map, Rand.Range(10, 16), TMDamageDefOf.DamageDefOf.TM_Holy, this.launcher, Mathf.RoundToInt(Rand.Range(16, 24)), 3, TMDamageDefOf.DamageDefOf.TM_Holy.soundExplosion); } } else { if (!deadPawn.kindDef.RaceProps.Animal && deadPawn.kindDef.RaceProps.Humanlike) { ResurrectionUtility.ResurrectWithSideEffects(deadPawn); SoundDef.Named("Thunder_OffMap").PlayOneShot(null); SoundDef.Named("Thunder_OffMap").PlayOneShot(null); using (IEnumerator <Hediff> enumerator = deadPawn.health.hediffSet.GetHediffs <Hediff>().GetEnumerator()) { while (enumerator.MoveNext()) { Hediff rec = enumerator.Current; if (rec.def.defName == "ResurrectionPsychosis") { if (Rand.Chance(verVal * .33f)) { deadPawn.health.RemoveHediff(rec); } } } } HealthUtility.AdjustSeverity(deadPawn, HediffDef.Named("TM_ResurrectionHD"), 1f); ReduceSkillsOfPawn(deadPawn, (.35f - .035f * pwrVal)); ApplyHealthDefects(deadPawn, .6f - (.06f * verVal), .3f - .03f * verVal); } if (deadPawn.kindDef.RaceProps.Animal) { ResurrectionUtility.Resurrect(deadPawn); HealthUtility.AdjustSeverity(deadPawn, HediffDef.Named("TM_ResurrectionHD"), 1f); } } } } } else { Messages.Message("TM_InvalidResurrection".Translate( caster.LabelShort ), MessageTypeDefOf.RejectInput); this.age = this.timeToRaise; } }
protected override void Impact(Thing hitThing) { if (hitThing != null) { Pawn p = hitThing as Pawn; if (p != null) { int harmType = canBeHarm(p); if (harmType == 0) { BattleLogEntry_RangedImpact entry = new BattleLogEntry_RangedImpact(base.launcher, hitThing, this.intendedTarget.Thing, base.equipmentDef, base.def, base.targetCoverDef); Find.BattleLog.Add(entry); int damageAmountBase = 60; DamageDef damageDef = base.def.projectile.damageDef; float y = this.ExactRotation.eulerAngles.y; Thing launcher = base.launcher; ThingDef equipmentDef = base.equipmentDef; DamageInfo dinfo = new DamageInfo(damageDef, damageAmountBase, base.ArmorPenetration, y, launcher, null, equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing); /* * HediffSet bodypart = p.health.hediffSet; * IEnumerable<BodyPartRecord> blist = bodypart.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined); * if(blist!=null) * foreach (BodyPartRecord record in blist) * { * if (record.def.tags.Contains(BodyPartTagDefOf.BloodPumpingSource)) * { * * * dinfo.SetHitPart(record); * break; * } * } * */ hitThing.TakeDamage(dinfo).AssociateWithLog(entry); // ((Pawn)hitThing).health.hediffSet.AddDirect(HediffMaker.MakeHediff(HediffDefOf.ToxicBuildup,(Pawn)hitThing)); // hitThing.Kill(dinfo); if ((hitThing as Pawn).Dead) { if (((Pawn)hitThing).Spawned) { hitThing.DeSpawn(DestroyMode.Vanish); } Pawn news = hitThing as Pawn; Corpse cp = (Corpse)ThingMaker.MakeThing(((Pawn)hitThing).RaceProps.corpseDef, null); // hitThing.Destroy(DestroyMode.Vanish); hitThing.holdingOwner = null; cp.InnerPawn = news; Corpse.PostCorpseDestroy(news); //cp.InnerPawn.health.hediffSet.part CompRottable comp = cp.GetComp <CompRottable>(); //comp.RotImmediately(); // Log.Warning(comp.RotProgress+" int"); comp.RotProgress += 6000000000f; } } else if (harmType == 2) { BattleLogEntry_RangedImpact entry = new BattleLogEntry_RangedImpact(base.launcher, hitThing, this.intendedTarget.Thing, base.equipmentDef, base.def, base.targetCoverDef); Find.BattleLog.Add(entry); int damageAmountBase = 100; DamageDef damageDef = base.def.projectile.damageDef; float y = this.ExactRotation.eulerAngles.y; Thing launcher = base.launcher; ThingDef equipmentDef = base.equipmentDef; DamageInfo dinfo = new DamageInfo(damageDef, damageAmountBase, base.ArmorPenetration, y, launcher, null, equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing); hitThing.TakeDamage(dinfo).AssociateWithLog(entry); } else { } } } base.Impact(hitThing); }
public float DetermineBloodRemaining(Thing newOccupant, out float difference) { difference = 0.0f; float result = 0.0f; if (newOccupant != null) { //Live if (newOccupant is Pawn) { Pawn pawn = newOccupant as Pawn; if (pawn.Dead) { this.EjectContents(); return(result); } if (pawn.health != null) { Hediff bloodLossSickness = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Uvhash_BloodLossSickness")); if (bloodLossSickness == null) { Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.BloodLoss); if (firstHediffOfDef == null) { Hediff bloodLossHediff = HediffMaker.MakeHediff(HediffDefOf.BloodLoss, pawn, null); bloodLossHediff.Severity = 0.01f; pawn.health.AddHediff(bloodLossHediff, null, new DamageInfo(DamageDefOf.Stab, Rand.Range(1, 3), -1, this)); firstHediffOfDef = bloodLossHediff; } firstHediffOfDef.Severity += 0.01f; result = bloodTurnoverPoint - (bloodLossFatalVolume * firstHediffOfDef.Severity); if (result < 4.0f && warningMessage == false) { warningMessage = true; Messages.Message("BloodLossWarning".Translate(new object[] { newOccupant.LabelShort }), MessageTypeDefOf.NegativeEvent); } } else { Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.BloodLoss); if (firstHediffOfDef == null) { Hediff bloodLossHediff = HediffMaker.MakeHediff(HediffDefOf.BloodLoss, pawn, null); bloodLossHediff.Severity = 0.01f; if (bloodLossSickness.Severity > 0.0f) { bloodLossHediff.Severity = bloodLossSickness.Severity; } pawn.health.AddHediff(bloodLossHediff, null, new DamageInfo(DamageDefOf.Stab, Rand.Range(1, 3), -1, this)); firstHediffOfDef = bloodLossHediff; } if (bloodLossSickness.Severity > 0.0f) { firstHediffOfDef.Severity = bloodLossSickness.Severity; } pawn.health.RemoveHediff(bloodLossSickness); firstHediffOfDef.Severity += 0.01f; result = bloodTurnoverPoint - (bloodLossFatalVolume * firstHediffOfDef.Severity); } } } //Dead else if (newOccupant is Corpse) { Corpse corpse = newOccupant as Corpse; corpse.HitPoints -= 1; if (corpse.HitPoints <= 1 || bloodLoaded <= 0.0f) { this.EjectContents(); } CompRottable compRottable = corpse.GetComp <CompRottable>(); if (compRottable != null) { compRottable.RotProgress = compRottable.RotProgress + 3000f; } result = bloodLoaded - (bloodTurnoverPoint * 0.01f); } else { result = bloodLoaded - (bloodTurnoverPoint * 0.01f); } } difference = bloodLoaded - result; return(result); }