public static void Impact_CanHit_Postfix(ref Projectile __instance, Thing thing, LocalTargetInfo ___intendedTarget, ref bool __result) { if (phaseHediffs == null) { // if (AMAMod.Dev) Log.Message("Projectile_CanHit_PhaseShifter_Patch phaseHediffs is null, Populating"); phaseHediffs = DefDatabase <HediffDef> .AllDefsListForReading.FindAll(x => x.HasComp(typeof(HediffComp_PhaseShifter))); // if (AMAMod.Dev) Log.Message("Projectile_CanHit_PhaseShifter_Patch phaseHediffs Populated: " + phaseHediffs.Count); } if (thing != null) { Pawn hitPawn = thing as Pawn; if (hitPawn != null) { for (int i = 0; i < phaseHediffs.Count; i++) { HediffWithComps item = hitPawn.health.hediffSet.GetFirstHediffOfDef(phaseHediffs[i]) as HediffWithComps; if (item != null) { List <Hediff> list = hitPawn.health.hediffSet.hediffs.FindAll(x => phaseHediffs.Contains(x.def)); foreach (Hediff hediff in list) { HediffComp_PhaseShifter _Shifter = hediff.TryGetCompFast <HediffComp_PhaseShifter>(); if (_Shifter != null) { if (_Shifter.phasedfor.Contains(__instance)) { __result = false; } else { if (!_Shifter.isPhasedIn) { _Shifter.phasedfor.Add(__instance); if (_Shifter.phasedNotifcationTick == 0) { MoteMaker.ThrowText(hitPawn.Position.ToVector3(), hitPawn.Map, "AdeptusMechanicus.Phased_Out".Translate(__instance.LabelCap, hitPawn.LabelShortCap), 3f); _Shifter.phasedNotifcationTick = _Shifter.Props.minPhasedNotifcation.SecondsToTicks(); } __result = false; } } } } } } } } }
// Token: 0x060011D5 RID: 4565 RVA: 0x000EC6D0 File Offset: 0x000EA8D0 public static bool Prefix(Pawn __instance, ref DamageInfo dinfo, out bool absorbed) { Traverse traverse = Traverse.Create(__instance); Pawn pawn = (Pawn)AM_PreApplyDamage_HediffComp_Shield_Patch.pawn.GetValue(__instance); bool flag = dinfo.Def != null && pawn != null && !pawn.Downed; if (flag) { if (pawn.health.hediffSet.hediffs.Any(x => x.TryGetComp <HediffComp_Shield>() != null)) { List <Hediff> list = pawn.health.hediffSet.hediffs.FindAll(x => x.TryGetComp <HediffComp_Shield>() != null); foreach (Hediff item in list) { HediffComp_Shield _Shield = item.TryGetComp <HediffComp_Shield>(); if (_Shield != null) { absorbed = _Shield.CheckPreAbsorbDamage(dinfo); return(false); } } } if (pawn.health.hediffSet.hediffs.Any(x => x.TryGetComp <HediffComp_PhaseShifter>() != null)) { List <Hediff> list = pawn.health.hediffSet.hediffs.FindAll(x => x.TryGetComp <HediffComp_PhaseShifter>() != null); foreach (Hediff item in list) { HediffComp_PhaseShifter _Shifter = item.TryGetComp <HediffComp_PhaseShifter>(); if (_Shifter != null) { if (dinfo.Def.isExplosive) { absorbed = !_Shifter.isPhasedIn; return(_Shifter.isPhasedIn); } } } } } absorbed = false; return(true); }
public static bool Prefix(ref ProjectileCE __instance, Thing thing) { if (thing != null) { Pawn hitPawn = thing as Pawn; if (hitPawn != null) { if (hitPawn.health.hediffSet.hediffs.Any(x => x.TryGetCompFast <HediffComp_PhaseShifter>() != null)) { List <Hediff> list = hitPawn.health.hediffSet.hediffs.FindAll(x => x.TryGetCompFast <HediffComp_PhaseShifter>() != null); foreach (Hediff item in list) { HediffComp_PhaseShifter _Shifter = item.TryGetCompFast <HediffComp_PhaseShifter>(); if (_Shifter != null) { if (_Shifter.phasedfor.Contains(__instance)) { return(false); } else { if (!_Shifter.isPhasedIn) { _Shifter.phasedfor.Add(__instance); if (_Shifter.phasedNotifcationTick == 0) { MoteMaker.ThrowText(hitPawn.Position.ToVector3(), hitPawn.Map, "AdeptusMechanicus.Phased_Out".Translate(__instance.LabelCap, hitPawn.LabelShortCap), 3f); _Shifter.phasedNotifcationTick = _Shifter.Props.minPhasedNotifcation.SecondsToTicks(); } return(false); } } } } } } } return(true); }
public static void Impact_CanHit_Postfix(ref Projectile __instance, Thing thing, LocalTargetInfo ___intendedTarget, ref bool __result) { if (thing != null) { Pawn hitPawn = thing as Pawn; if (hitPawn != null) { if (hitPawn.health.hediffSet.hediffs.Any(x => x.TryGetComp <HediffComp_PhaseShifter>() != null)) { List <Hediff> list = hitPawn.health.hediffSet.hediffs.FindAll(x => x.TryGetComp <HediffComp_PhaseShifter>() != null); foreach (Hediff item in list) { HediffComp_PhaseShifter _Shifter = item.TryGetComp <HediffComp_PhaseShifter>(); if (_Shifter != null) { if (_Shifter.phasedfor.Contains(__instance)) { __result = false; } else { if (!_Shifter.isPhasedIn) { _Shifter.phasedfor.Add(__instance); if (_Shifter.phasedNotifcationTick == 0) { MoteMaker.ThrowText(hitPawn.Position.ToVector3(), hitPawn.Map, "AMA_Phased_Out".Translate(__instance.LabelCap, hitPawn.LabelShortCap), 3f); _Shifter.phasedNotifcationTick = _Shifter.Props.minPhasedNotifcation.SecondsToTicks(); } __result = false; } } } } } } } }