示例#1
0
 // Token: 0x06000097 RID: 151 RVA: 0x00005A01 File Offset: 0x00003C01
 public override void DoHWEffect(Pawn pawn)
 {
     if (HaywireUtility.Rnd100() < 50)
     {
         HaywireEffect.DoHWBreakDown(pawn);
     }
 }
        public static void PostFix(ref StunHandler __instance, ref int ___EMPAdaptedTicksLeft, DamageInfo dinfo)
        {
            var pawn = __instance.parent as Pawn;

            if (pawn != null && (pawn.Downed || pawn.Dead))
            {
                return;
            }

            var Haywire = DefDatabase <DamageDef> .GetNamed("GGHaywireEMP");

            if (dinfo.Def != Haywire || !EMPAffects(pawn))
            {
                return;
            }

            if (___EMPAdaptedTicksLeft <= 0 || HaywireUtility.Rnd100() < (int)Controller.Settings.HWChance)
            {
                __instance.StunFor(Mathf.RoundToInt(dinfo.Amount * 15f), dinfo.Instigator);
                if (pawn != null && pawn.RaceProps.IsMechanoid)
                {
                    ___EMPAdaptedTicksLeft = 2000;
                }

                HaywireUtility.DoHaywireEffect(pawn);
                return;
            }

            var position = __instance.parent.Position;

            MoteMaker.ThrowText(new Vector3(position.x + 1f, position.y, position.z + 1f), __instance.parent.Map,
                                "Adapted".Translate(), Color.white);
        }
 // Token: 0x0600009C RID: 156 RVA: 0x00005A41 File Offset: 0x00003C41
 public virtual void DoHWEffect(Pawn pawn)
 {
     if (HaywireUtility.Rnd100() < 40)
     {
         HaywireEffect.DoHWExplosion(pawn);
     }
 }
示例#4
0
        // Token: 0x0600006E RID: 110 RVA: 0x00004AB0 File Offset: 0x00002CB0
        public static void SetUpBDVars(Pawn Victim, Thing instigator, out BodyPartRecord candidate,
                                       out DamageDef DamDef, out float dmg)
        {
            DamDef = null;
            var Rnd = HaywireUtility.Rnd100();

            if (Rnd < 50)
            {
                DamDef = DamageDefOf.Cut;
            }
            else if (Rnd < 87)
            {
                DamDef = DamageDefOf.Blunt;
            }
            else
            {
                DamDef = DamageDefOf.EMP;
            }

            dmg = RndDmg(7f, 15f);
            if (Victim != null)
            {
                var bodyV = Victim.BodySize;
                if (bodyV > 0f)
                {
                    dmg *= bodyV;
                }
            }

            if (DamDef == DamageDefOf.EMP)
            {
                dmg *= 3f;
            }

            candidate = null;
            var  potentials = new List <BodyPartRecord>();
            var  raceProps  = Victim?.RaceProps;
            bool hasParts;

            if (raceProps == null)
            {
                hasParts = false;
            }
            else
            {
                var body = raceProps.body;
                hasParts = body?.AllParts != null;
            }

            if (hasParts)
            {
                potentials.AddRange(Victim.RaceProps.body.AllParts);
            }

            if (potentials.Count > 0)
            {
                candidate = GetCandidate(potentials);
            }
        }
示例#5
0
        // Token: 0x0600006D RID: 109 RVA: 0x00004984 File Offset: 0x00002B84
        public static void SetUpExpVars(Pawn pawn, out float radius, out DamageDef dmgdef, out int dmg,
                                        out ThingDef postTD, out float postChance, out int postNum, out ThingDef preTD, out float preChance,
                                        out int preNum, out float fireChance)
        {
            radius     = Mathf.Lerp(1.9f, 5.9f, Math.Min(pawn.BodySize, 5f) / 5f);
            dmgdef     = DamageDefOf.EMP;
            dmg        = 50;
            postTD     = null;
            postChance = 0f;
            postNum    = 0;
            preTD      = null;
            preChance  = 0f;
            preNum     = 0;
            fireChance = 0f;
            var rnd = HaywireUtility.Rnd100();

            if (rnd < 10)
            {
                dmgdef = DefDatabase <DamageDef> .GetNamed("GGHaywireEMP");

                return;
            }

            if (rnd < 50)
            {
                dmgdef     = DamageDefOf.Smoke;
                dmg        = 0;
                postTD     = ThingDefOf.Gas_Smoke;
                postChance = 1f;
                postNum    = 1;
                return;
            }

            if (rnd < 70)
            {
                dmgdef     = DamageDefOf.Flame;
                dmg        = 20;
                dmg        = (int)(dmg * pawn.BodySize);
                postTD     = ThingDefOf.Gas_Smoke;
                postChance = 1f;
                postNum    = 1;
                preTD      = ThingDefOf.Filth_Fuel;
                preChance  = 1f;
                preNum     = 1;
                fireChance = 0.95f;
                return;
            }

            if (rnd >= 85)
            {
                return;
            }

            dmgdef     = DamageDefOf.Bomb;
            dmg        = 25;
            dmg        = (int)(dmg * pawn.BodySize);
            postTD     = ThingDefOf.Gas_Smoke;
            postChance = 1f;
            postNum    = 1;
            fireChance = 0.5f;
        }