public static void PushEffect(Thing Caster, Thing target, int distance, bool damageOnCollision = false) { if (target is Building) { return; } LongEventHandler.QueueLongEvent(delegate() { Pawn pawn; if (target != null && (pawn = (target as Pawn)) != null && pawn.Spawned && !pawn.Downed && !pawn.Dead && (pawn?.MapHeld) != null) { bool drafted = pawn.Drafted; Vector3 vector = HarmonyPatches.PushResult(Caster, target, distance, out bool flag2); RRY_FlyingObject flyingObject = (RRY_FlyingObject)GenSpawn.Spawn(ThingDef.Named("JT_FlyingObject"), pawn.PositionHeld, pawn.MapHeld, 0); bool flag3 = flag2 & damageOnCollision; if (flag3) { flyingObject.Launch(Caster, new LocalTargetInfo(IntVec3Utility.ToIntVec3(vector)), target, new DamageInfo?(new DamageInfo(DamageDefOf.Blunt, (float)Rand.Range(8, 10), 0f, -1f, null, null, null, 0, null))); } else { flyingObject.Launch(Caster, new LocalTargetInfo(IntVec3Utility.ToIntVec3(vector)), target); } } }, "PushingCharacter", false, null); }
public static bool Patch_CheckCreateVerbProperties(ref Pawn_NativeVerbs __instance) { bool flag = HarmonyPatches._cachedVerbProperties.GetValue(__instance) != null; bool result; if (flag) { result = true; } else { bool flag2 = XenomorphUtil.IsXenomorph(HarmonyPatches.pawnPawnNativeVerbs(__instance)); if (flag2) { HarmonyPatches._cachedVerbProperties.SetValue(__instance, new List <VerbProperties>()); HarmonyPatches.cachedVerbProperties(__instance).Add(NativeVerbPropertiesDatabase.VerbWithCategory((VerbCategory)1)); result = false; } else { result = true; } } return(result); }
public static bool Pre_DrawEquipment_Cloak(PawnRenderer __instance) { Pawn pawn = HarmonyPatches.PawnRenderer_GetPawn(__instance); bool flag = pawn.health.hediffSet.HasHediff(YautjaDefOf.RRY_Hediff_Cloaked, false); if (flag) { return(false); } return(true); }
// Token: 0x0600000C RID: 12 RVA: 0x0000283C File Offset: 0x00000A3C public static void Patch_PawnRenderer_RenderPawnAt(PawnRenderer __instance, ref Vector3 drawLoc, ref RotDrawMode bodyDrawType, ref bool headStump) { Pawn pawn = HarmonyPatches.PawnRenderer_GetPawn(__instance); foreach (var hd in pawn.health.hediffSet.hediffs) { HediffComp_DrawImplant comp = hd.TryGetComp <HediffComp_DrawImplant>(); if (comp != null) { comp.DrawImplant(); } } }
public static bool Patch_Pawn_HealthTracker_DropBloodFilth(Pawn_HealthTracker __instance) { Pawn pawn = HarmonyPatches.Pawn_HealthTracker_GetPawn(__instance); bool flag = (pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Cocooned)); bool result; if (flag) { result = false; } else { result = true; } return(result); }
// Token: 0x060039E1 RID: 14817 RVA: 0x001B83B8 File Offset: 0x001B67B8 private IEnumerable <DamageInfo> DamageInfosToApply(LocalTargetInfo target) { float damAmount = this.verbProps.AdjustedMeleeDamageAmount(this, base.CasterPawn); float armorPenetration = this.verbProps.AdjustedArmorPenetration(this, base.CasterPawn); DamageDef damDef = this.verbProps.meleeDamageDef; BodyPartGroupDef bodyPartGroupDef = null; HediffDef hediffDef = null; damAmount = Rand.Range(damAmount * 0.8f, damAmount * 1.2f); if (base.CasterIsPawn) { bodyPartGroupDef = this.verbProps.AdjustedLinkedBodyPartsGroup(this.tool); if (damAmount >= 1f) { if (base.HediffCompSource != null) { hediffDef = base.HediffCompSource.Def; } } else { damAmount = 1f; damDef = DamageDefOf.Blunt; } } ThingDef source; if (base.EquipmentSource != null) { source = base.EquipmentSource.def; } else { source = base.CasterPawn.def; } Vector3 direction = (target.Thing.Position - base.CasterPawn.Position).ToVector3(); DamageDef def = damDef; float num = damAmount; float num2 = armorPenetration; Thing caster = this.caster; DamageInfo mainDinfo = new DamageInfo(def, num, num2, -1f, caster, null, source, DamageInfo.SourceCategory.ThingOrUnknown, null); mainDinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); mainDinfo.SetWeaponBodyPartGroup(bodyPartGroupDef); mainDinfo.SetWeaponHediff(hediffDef); mainDinfo.SetAngle(direction); yield return(mainDinfo); if (this.surpriseAttack && ((this.verbProps.surpriseAttack != null && !this.verbProps.surpriseAttack.extraMeleeDamages.NullOrEmpty <ExtraMeleeDamage>()) || (this.tool != null && this.tool.surpriseAttack != null && !this.tool.surpriseAttack.extraMeleeDamages.NullOrEmpty <ExtraMeleeDamage>()))) { IEnumerable <ExtraMeleeDamage> extraDamages = Enumerable.Empty <ExtraMeleeDamage>(); if (this.verbProps.surpriseAttack != null && this.verbProps.surpriseAttack.extraMeleeDamages != null) { extraDamages = extraDamages.Concat(this.verbProps.surpriseAttack.extraMeleeDamages); } if (this.tool != null && this.tool.surpriseAttack != null && !this.tool.surpriseAttack.extraMeleeDamages.NullOrEmpty <ExtraMeleeDamage>()) { extraDamages = extraDamages.Concat(this.tool.surpriseAttack.extraMeleeDamages); } foreach (ExtraMeleeDamage extraDamage in extraDamages) { int extraDamageAmount = GenMath.RoundRandom(extraDamage.AdjustedDamageAmount(this, base.CasterPawn)); float extraDamageArmorPenetration = extraDamage.AdjustedArmorPenetration(this, base.CasterPawn); def = extraDamage.def; num2 = (float)extraDamageAmount; num = extraDamageArmorPenetration; caster = this.caster; DamageInfo extraDinfo = new DamageInfo(def, num2, num, -1f, caster, null, source, DamageInfo.SourceCategory.ThingOrUnknown, null); extraDinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); extraDinfo.SetWeaponBodyPartGroup(bodyPartGroupDef); extraDinfo.SetWeaponHediff(hediffDef); extraDinfo.SetAngle(direction); yield return(extraDinfo); } } if (target.GetType() == typeof(Pawn)) { Pawn hitPawn = (Pawn)target; HarmonyPatches.PushEffect(CasterPawn, hitPawn, (int)((Rand.Range(2, 3) + CasterPawn.BodySize) - hitPawn.BodySize), true); } yield break; }