Esempio n. 1
0
 public static void FinalizeAndAddInjuryPostfix(DamageWorker_AddInjury __instance, Pawn pawn, Hediff_Injury injury, DamageInfo dinfo, DamageWorker.DamageResult result)
 {
     if (pawn != null)
     {
         if (injury != null)
         {
             Comp_NecronOG _Necron = pawn.TryGetCompFast <Comp_NecronOG>();
             if (_Necron != null)
             {
                 DamageInfo dInfo     = dinfo;
                 DamageDef  damageDef = dinfo.Def;
                 float      AP        = dinfo.ArmorPenetrationInt;
                 float      AV        = (pawn.kindDef.race.statBases.GetStatValueFromList(dinfo.Def.armorCategory.armorRatingStat, 0f));
                 bool       healable  = AP < AV;
                 if (healable)
                 {
                     _Necron.healableHediffs.Add(injury);
                 }
                 else
                 {
                     _Necron.unhealableHediffs.Add(injury);
                 }
                 //    Log.Message(string.Format("{1} got a {2} AP: {7} on its {3} AV:{6}, healable: {0}, total Healable: {5}, Unhealable: {4}", healable, pawn.Label, injury.Label, injury.Part, _Necron.unhealableHediffs.Count, _Necron.healableHediffs.Count, AV, AP));
             }
         }
     }
 }
        // Token: 0x0600403D RID: 16445 RVA: 0x001E1AD3 File Offset: 0x001DFED3
        public override void PawnDied(Corpse corpse)
        {
            Comp_NecronOG _Necron = corpse.InnerPawn.TryGetCompFast <Comp_NecronOG>();

            if (_Necron == null)
            {
                return;
            }
            if (_Necron.originalWeapon != null)
            {
                if (_Necron.originalWeapon.Spawned)
                {
                    _Necron.originalWeapon.DeSpawn();
                }
                corpse.InnerPawn.inventory.innerContainer.TryAddOrTransfer(_Necron.originalWeapon);
            }
            if (_Necron.secondryWeapon != null)
            {
                if (_Necron.secondryWeapon.Spawned)
                {
                    _Necron.secondryWeapon.DeSpawn();
                }
                corpse.InnerPawn.inventory.innerContainer.TryAddOrTransfer(_Necron.secondryWeapon);
            }
            int delay = 500;

            foreach (Hediff item in _Necron.healableHediffs)
            {
                delay += (int)(10 * item.Severity);
            }
            _Necron.reviveIntervalTicks = Math.Min(delay, maxtime.SecondsToTicks());
            //    Log.Message(string.Format("{0} tries revive in {1} seconds ({2} ticks)",corpse.InnerPawn.Label, _Necron.reviveIntervalTicks.TicksToSeconds(), _Necron.reviveIntervalTicks));
        }