public bool CheckPreAbsorbDamage(DamageInfo dinfo)
 {
     if (ShieldState == ShieldState.Active && (dinfo.Instigator != null || dinfo.Def.isExplosive))
     {
         if (dinfo.Instigator != null)
         {
             AttachableThing attachableThing = dinfo.Instigator as AttachableThing;
             if (attachableThing != null && attachableThing.parent == Pawn)
             {
                 return(false);
             }
         }
         energy -= (float)dinfo.Amount * EnergyLossPerDamage;
         //if (dinfo.Def == DamageDefOf.EMP)
         //{
         //    this.energy = -1f;
         //}
         if (energy < 0f)
         {
             Break();
         }
         else
         {
             AbsorbedDamage(dinfo);
         }
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public override bool CheckPreAbsorbDamage(DamageInfo dinfo)
 {
     if (this.ShieldState == ShieldState.Active && ((dinfo.Instigator != null && !dinfo.Instigator.Position.AdjacentTo8WayOrInside(base.Wearer.Position)) || dinfo.Def.isExplosive))
     {
         if (dinfo.Instigator != null)
         {
             AttachableThing attachableThing = dinfo.Instigator as AttachableThing;
             if (attachableThing != null && attachableThing.parent == base.Wearer)
             {
                 return(false);
             }
         }
         this.energy -= dinfo.Amount * this.EnergyLossPerDamage;
         if (dinfo.Def == DamageDefOf.EMP)
         {
             this.energy = -1f;
         }
         if (this.energy < 0f)
         {
             this.Break();
         }
         else
         {
             this.AbsorbedDamage(dinfo);
         }
         return(true);
     }
     return(false);
 }