public override void Notify_DoBillStarted() { if (!this.GiverPawn.Dead && this.recipe.anesthesize) { HealthUtility.TryAnesthesize(this.GiverPawn); } }
private static void ApplyCriticalDamageToTarget(Verb_MeleeAttack vMA, Pawn attacker, LocalTargetInfo target) { Pawn tpawn = target.Thing as Pawn; var DamageInfosToApply = Traverse.Create(vMA).Method("DamageInfosToApply", new Type[] { typeof(LocalTargetInfo) }); MRpawntoken token = MainController.GetPawnToken(attacker); switch (token.amode.solver) { case 0: // Kill // Double damage on all applied damage foreach (DamageInfo current in (DamageInfosToApply.GetValue <IEnumerable <DamageInfo> >(target))) { if (target.ThingDestroyed) { break; } current.SetAmount(Mathf.Max(1, Mathf.RoundToInt(current.Amount * 2f))); target.Thing.TakeDamage(current); } break; case 1: // Capture // We replace all damage by an anesthesize effect if (target.Thing.def.category == ThingCategory.Pawn) { HealthUtility.TryAnesthesize(tpawn); } break; case 2: // Stun // We replace ALL damage by a short stun effect instead target.Thing.TakeDamage(new DamageInfo(DamageDefOf.Stun, 20)); break; case 3: // Disarm // We replace ALL damage by removing currently equiped weapon if (tpawn.equipment != null && tpawn.equipment.Primary != null) { ThingWithComps thingwithcomps = new ThingWithComps(); tpawn.equipment.TryDropEquipment(tpawn.equipment.Primary, out thingwithcomps, tpawn.Position); } break; default: Log.Warning(string.Concat(new object[] { "Melee Rebalance: Critical Special effect not registered for ", attacker })); break; } }