示例#1
0
 // Token: 0x06000B8D RID: 2957 RVA: 0x0002D630 File Offset: 0x0002B830
 protected virtual global::LifeStatus Hurt(ref global::DamageEvent damage)
 {
     if (this.dead)
     {
         damage.status = global::LifeStatus.IsDead;
     }
     else if (this.health > damage.amount)
     {
         damage.status = global::LifeStatus.IsAlive;
     }
     else
     {
         damage.status = global::LifeStatus.WasKilled;
     }
     this.ProcessDamageEvent(ref damage);
     if (this.ShouldRelayDamageEvent(ref damage))
     {
         base.SendMessage("OnHurt", damage, 1);
     }
     if (damage.status == global::LifeStatus.WasKilled)
     {
         base.SendMessage("OnKilled", damage, 1);
     }
     return(damage.status);
 }
示例#2
0
 // Token: 0x06000B8C RID: 2956 RVA: 0x0002D5D4 File Offset: 0x0002B7D4
 protected virtual void ApplyDamageTypeList(ref global::DamageEvent damage, global::DamageTypeList damageTypes)
 {
     for (int i = 0; i < 6; i++)
     {
         if (!Mathf.Approximately(damageTypes[i], 0f))
         {
             damage.damageTypes |= (global::DamageTypeFlags)(1 << i);
             damage.amount      += damageTypes[i];
         }
     }
 }
示例#3
0
 // Token: 0x06002D5C RID: 11612 RVA: 0x000AB28C File Offset: 0x000A948C
 protected sealed override void ApplyDamageTypeList(ref global::DamageEvent damage, global::DamageTypeList damageTypes)
 {
     for (int i = 0; i < 6; i++)
     {
         if (this._armorValues[i] > 0f && damageTypes[i] > 0f)
         {
             int   index2;
             int   index = index2 = i;
             float num   = damageTypes[index2];
             damageTypes[index] = num * Mathf.Clamp01(1f - this._armorValues[i] / 200f);
         }
     }
     base.ApplyDamageTypeList(ref damage, damageTypes);
 }
示例#4
0
    // Token: 0x06000B8F RID: 2959 RVA: 0x0002D72C File Offset: 0x0002B92C
    protected bool ShouldRelayDamageEvent(ref global::DamageEvent damage)
    {
        switch (damage.status)
        {
        case global::LifeStatus.IsAlive:
            return(this.sendMessageWhenAlive);

        case global::LifeStatus.WasKilled:
            return(this.sendMessageWhenKilled);

        case global::LifeStatus.IsDead:
            return(this.sendMessageWhenDead);

        default:
            Debug.LogWarning("Unhandled LifeStatus " + damage.status, this);
            return(false);
        }
    }
    // Token: 0x06002D25 RID: 11557 RVA: 0x000A8C94 File Offset: 0x000A6E94
    protected override global::LifeStatus Hurt(ref global::DamageEvent damage)
    {
        global::LifeStatus lifeStatus = base.Hurt(ref damage);
        bool flag = (damage.damageTypes & (global::DamageTypeFlags.damage_bullet | global::DamageTypeFlags.damage_melee | global::DamageTypeFlags.damage_explosion)) != (global::DamageTypeFlags)0;

        if (flag)
        {
            this._healOverTime = 0f;
        }
        if (lifeStatus == global::LifeStatus.WasKilled)
        {
            base.CancelInvoke("DoBleed");
        }
        else if (lifeStatus == global::LifeStatus.IsAlive && base.healthLossFraction > 0.2f)
        {
            float num = damage.amount / base.maxHealth;
            if ((damage.damageTypes & (global::DamageTypeFlags.damage_bullet | global::DamageTypeFlags.damage_melee)) != (global::DamageTypeFlags)0 && damage.amount > base.maxHealth * 0.05f)
            {
                int num2 = 0;
                if (num >= 0.25f)
                {
                    num2 = 1;
                }
                else if (num >= 0.15f)
                {
                    num2 = 2;
                }
                else if (num >= 0.05f)
                {
                    num2 = 3;
                }
                bool flag2 = Random.Range(0, num2) == 1 || num2 == 1;
                if (flag2)
                {
                    this.AddBleedingLevel(Mathf.Clamp(damage.amount * 0.15f, 1f, base.maxHealth));
                    this.bleedAttacker = damage.attacker.id;
                    this.bleedingID    = damage.victim.id;
                }
            }
        }
        return(lifeStatus);
    }
示例#6
0
    // Token: 0x06000B8E RID: 2958 RVA: 0x0002D6CC File Offset: 0x0002B8CC
    protected void ProcessDamageEvent(ref global::DamageEvent damage)
    {
        if (this.takenodamage)
        {
            return;
        }
        global::LifeStatus status = damage.status;

        if (status != global::LifeStatus.IsAlive)
        {
            if (status == global::LifeStatus.WasKilled)
            {
                this._health = 0f;
            }
        }
        else
        {
            this._health -= damage.amount;
        }
    }
 // Token: 0x06002D54 RID: 11604 RVA: 0x000AB09C File Offset: 0x000A929C
 public void OnHurt(global::DamageEvent damage)
 {
     this.MarkDamageTime();
 }
示例#8
0
 // Token: 0x06000B8A RID: 2954 RVA: 0x0002D494 File Offset: 0x0002B694
 private static global::LifeStatus HurtShared(IDBase attacker, IDBase victim, global::TakeDamage.Quantity damageQuantity, out global::DamageEvent damage, object extraData = null)
 {
     if (victim)
     {
         IDMain idMain = victim.idMain;
         if (idMain)
         {
             global::TakeDamage takeDamage;
             if (idMain is global::Character)
             {
                 takeDamage = ((global::Character)idMain).takeDamage;
             }
             else
             {
                 takeDamage = idMain.GetLocal <global::TakeDamage>();
             }
             if (takeDamage && !takeDamage.takenodamage)
             {
                 takeDamage.MarkDamageTime();
                 damage.victim.id   = victim;
                 damage.attacker.id = attacker;
                 damage.amount      = damageQuantity.value;
                 damage.sender      = takeDamage;
                 damage.status      = ((!takeDamage.dead) ? global::LifeStatus.IsAlive : global::LifeStatus.IsDead);
                 damage.damageTypes = (global::DamageTypeFlags)0;
                 damage.extraData   = extraData;
                 if ((int)damageQuantity.Unit == -1)
                 {
                     takeDamage.ApplyDamageTypeList(ref damage, damageQuantity.list);
                 }
                 takeDamage.Hurt(ref damage);
                 return(damage.status);
             }
         }
     }
     damage.victim.id   = null;
     damage.attacker.id = null;
     damage.amount      = 0f;
     damage.sender      = null;
     damage.damageTypes = (global::DamageTypeFlags)0;
     damage.status      = global::LifeStatus.Failed;
     damage.extraData   = extraData;
     return(global::LifeStatus.Failed);
 }
示例#9
0
 // Token: 0x06000B89 RID: 2953 RVA: 0x0002D484 File Offset: 0x0002B684
 public static global::LifeStatus KillSelf(IDBase victim, out global::DamageEvent damage, object extraData = null)
 {
     return(global::TakeDamage.HurtShared(victim, victim, global::TakeDamage.Quantity.AllHealth, out damage, extraData));
 }
示例#10
0
 // Token: 0x06000B82 RID: 2946 RVA: 0x0002D420 File Offset: 0x0002B620
 public static global::LifeStatus Hurt(IDBase attacker, IDBase victim, global::TakeDamage.Quantity damageQuantity, out global::DamageEvent damage, object extraData = null)
 {
     return(global::TakeDamage.HurtShared(attacker, victim, damageQuantity, out damage, extraData));
 }
 // Token: 0x06003D5C RID: 15708 RVA: 0x000DB9AC File Offset: 0x000D9BAC
 public void OnHurt(global::DamageEvent damage)
 {
 }
 // Token: 0x06002D68 RID: 11624 RVA: 0x000AB4F8 File Offset: 0x000A96F8
 protected override global::LifeStatus Hurt(ref global::DamageEvent damage)
 {
     return(base.Hurt(ref damage));
 }