// Token: 0x06003953 RID: 14675 RVA: 0x001A8E8C File Offset: 0x001A728C
 public override void simulate(uint simulation, bool inputSteady)
 {
     if (this.isUsing && this.isUseable)
     {
         base.player.equipment.isBusy = false;
         this.isUsing = false;
         ItemConsumeableAsset itemConsumeableAsset = (ItemConsumeableAsset)base.player.equipment.asset;
         if (this.consumeMode == EConsumeMode.AID)
         {
             if (Provider.isServer)
             {
                 if (itemConsumeableAsset != null && this.enemy != null)
                 {
                     byte health     = this.enemy.life.health;
                     byte virus      = this.enemy.life.virus;
                     bool isBleeding = this.enemy.life.isBleeding;
                     bool isBroken   = this.enemy.life.isBroken;
                     this.enemy.life.askHeal((byte)((float)itemConsumeableAsset.health * (1f + base.player.skills.mastery(2, 0) * 0.5f)), itemConsumeableAsset.hasBleeding, itemConsumeableAsset.hasBroken);
                     byte food = this.enemy.life.food;
                     this.enemy.life.askEat((byte)((float)itemConsumeableAsset.food * ((float)base.player.equipment.quality / 100f)));
                     byte food2 = this.enemy.life.food;
                     byte b     = (byte)((float)itemConsumeableAsset.water * ((float)base.player.equipment.quality / 100f));
                     if (itemConsumeableAsset.foodConstrainsWater)
                     {
                         b = (byte)Mathf.Min((int)b, (int)(food2 - food));
                     }
                     this.enemy.life.askDrink(b);
                     this.enemy.life.askInfect((byte)((float)itemConsumeableAsset.virus * (1f - this.enemy.skills.mastery(1, 2) * 0.5f)));
                     this.enemy.life.askDisinfect((byte)((float)itemConsumeableAsset.disinfectant * (1f + this.enemy.skills.mastery(2, 0) * 0.5f)));
                     if (base.player.equipment.quality < 50)
                     {
                         this.enemy.life.askInfect((byte)((float)(itemConsumeableAsset.food + itemConsumeableAsset.water) * 0.5f * (1f - (float)base.player.equipment.quality / 50f) * (1f - this.enemy.skills.mastery(1, 2) * 0.5f)));
                     }
                     byte health2     = this.enemy.life.health;
                     byte virus2      = this.enemy.life.virus;
                     bool isBleeding2 = this.enemy.life.isBleeding;
                     bool isBroken2   = this.enemy.life.isBroken;
                     uint num         = 0u;
                     int  num2        = 0;
                     if (health2 > health)
                     {
                         num += (uint)Mathf.RoundToInt((float)(health2 - health) / 2f);
                         num2++;
                     }
                     if (virus2 > virus)
                     {
                         num += (uint)Mathf.RoundToInt((float)(virus2 - virus) / 2f);
                         num2++;
                     }
                     if (isBleeding && !isBleeding2)
                     {
                         num += 15u;
                         num2++;
                     }
                     if (isBroken && !isBroken2)
                     {
                         num += 15u;
                         num2++;
                     }
                     if (num > 0u)
                     {
                         base.player.skills.askPay(num);
                     }
                     if (num2 > 0)
                     {
                         base.player.skills.askRep(num2);
                     }
                 }
                 base.player.equipment.use();
             }
         }
         else
         {
             if (itemConsumeableAsset != null)
             {
                 base.player.life.askRest(itemConsumeableAsset.energy);
                 base.player.life.askView((byte)((float)itemConsumeableAsset.vision * (1f - base.player.skills.mastery(1, 2))));
                 base.player.life.askWarm(itemConsumeableAsset.warmth);
                 bool flag;
                 if (base.channel.isOwner && itemConsumeableAsset.vision > 0 && Provider.provider.achievementsService.getAchievement("Berries", out flag) && !flag)
                 {
                     Provider.provider.achievementsService.setAchievement("Berries");
                 }
             }
             if (Provider.isServer)
             {
                 Vector3 point = base.transform.position + Vector3.up;
                 if (itemConsumeableAsset != null)
                 {
                     base.player.life.askHeal((byte)((float)itemConsumeableAsset.health * (1f + base.player.skills.mastery(2, 0) * 0.5f)), itemConsumeableAsset.hasBleeding, itemConsumeableAsset.hasBroken);
                     byte food3 = base.player.life.food;
                     base.player.life.askEat((byte)((float)itemConsumeableAsset.food * ((float)base.player.equipment.quality / 100f)));
                     byte food4 = base.player.life.food;
                     byte b2    = (byte)((float)itemConsumeableAsset.water * ((float)base.player.equipment.quality / 100f));
                     if (itemConsumeableAsset.foodConstrainsWater)
                     {
                         b2 = (byte)Mathf.Min((int)b2, (int)(food4 - food3));
                     }
                     base.player.life.askDrink(b2);
                     base.player.life.askInfect((byte)((float)itemConsumeableAsset.virus * (1f - base.player.skills.mastery(1, 2) * 0.5f)));
                     base.player.life.askDisinfect((byte)((float)itemConsumeableAsset.disinfectant * (1f + base.player.skills.mastery(2, 0) * 0.5f)));
                     base.player.life.askWarm(itemConsumeableAsset.warmth);
                     if (base.player.equipment.quality < 50)
                     {
                         base.player.life.askInfect((byte)((float)(itemConsumeableAsset.food + itemConsumeableAsset.water) * 0.5f * (1f - (float)base.player.equipment.quality / 50f) * (1f - base.player.skills.mastery(1, 2) * 0.5f)));
                     }
                 }
                 base.player.equipment.use();
                 if (itemConsumeableAsset != null && itemConsumeableAsset.explosion > 0)
                 {
                     EffectManager.sendEffect(itemConsumeableAsset.explosion, EffectManager.LARGE, point);
                     List <EPlayerKill> list;
                     DamageTool.explode(point, itemConsumeableAsset.range, EDeathCause.CHARGE, base.channel.owner.playerID.steamID, itemConsumeableAsset.playerDamageMultiplier.damage, itemConsumeableAsset.zombieDamageMultiplier.damage, itemConsumeableAsset.animalDamageMultiplier.damage, itemConsumeableAsset.barricadeDamage, itemConsumeableAsset.structureDamage, itemConsumeableAsset.vehicleDamage, itemConsumeableAsset.resourceDamage, itemConsumeableAsset.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false);
                     if (itemConsumeableAsset.playerDamageMultiplier.damage > 0.5f)
                     {
                         EPlayerKill eplayerKill;
                         base.player.life.askDamage(101, Vector3.up, EDeathCause.CHARGE, ELimb.SPINE, base.channel.owner.playerID.steamID, out eplayerKill);
                     }
                 }
             }
         }
     }
 }
Exemple #2
0
 public override void simulate(uint simulation, bool inputSteady)
 {
     if (this.isUsing && this.isUseable)
     {
         base.player.equipment.isBusy = false;
         this.isUsing = false;
         ItemConsumeableAsset itemConsumeableAsset = (ItemConsumeableAsset)base.player.equipment.asset;
         if (this.consumeMode == EConsumeMode.AID)
         {
             if (Provider.isServer)
             {
                 if (itemConsumeableAsset != null && this.enemy != null)
                 {
                     byte health     = this.enemy.life.health;
                     byte virus      = this.enemy.life.virus;
                     bool isBleeding = this.enemy.life.isBleeding;
                     bool isBroken   = this.enemy.life.isBroken;
                     this.enemy.life.askHeal((byte)((float)itemConsumeableAsset.health * (1f + base.player.skills.mastery(2, 0) * 0.5f)), itemConsumeableAsset.hasBleeding, itemConsumeableAsset.hasBroken);
                     byte food = this.enemy.life.food;
                     this.enemy.life.askEat((byte)((float)itemConsumeableAsset.food * ((float)base.player.equipment.quality / 100f)));
                     byte food2 = this.enemy.life.food;
                     byte b     = (byte)((float)itemConsumeableAsset.water * ((float)base.player.equipment.quality / 100f));
                     if (itemConsumeableAsset.foodConstrainsWater)
                     {
                         b = (byte)Mathf.Min((int)b, (int)(food2 - food));
                     }
                     this.enemy.life.askDrink(b);
                     this.enemy.life.askInfect((byte)((float)itemConsumeableAsset.virus * (1f - this.enemy.skills.mastery(1, 2) * 0.5f)));
                     this.enemy.life.askDisinfect((byte)((float)itemConsumeableAsset.disinfectant * (1f + this.enemy.skills.mastery(2, 0) * 0.5f)));
                     if (base.player.equipment.quality < 50)
                     {
                         this.enemy.life.askInfect((byte)((float)(itemConsumeableAsset.food + itemConsumeableAsset.water) * 0.5f * (1f - (float)base.player.equipment.quality / 50f) * (1f - this.enemy.skills.mastery(1, 2) * 0.5f)));
                     }
                     byte health2     = this.enemy.life.health;
                     byte virus2      = this.enemy.life.virus;
                     bool isBleeding2 = this.enemy.life.isBleeding;
                     bool isBroken2   = this.enemy.life.isBroken;
                     uint num         = 0u;
                     int  num2        = 0;
                     if (health2 > health)
                     {
                         num += (uint)Mathf.RoundToInt((float)(health2 - health) / 2f);
                         num2++;
                     }
                     if (virus2 > virus)
                     {
                         num += (uint)Mathf.RoundToInt((float)(virus2 - virus) / 2f);
                         num2++;
                     }
                     if (isBleeding && !isBleeding2)
                     {
                         num += 15u;
                         num2++;
                     }
                     if (isBroken && !isBroken2)
                     {
                         num += 15u;
                         num2++;
                     }
                     if (num > 0u)
                     {
                         base.player.skills.askPay(num);
                     }
                     if (num2 > 0)
                     {
                         base.player.skills.askRep(num2);
                     }
                 }
                 base.player.equipment.use();
             }
         }
         else
         {
             if (itemConsumeableAsset != null)
             {
                 base.player.life.askRest(itemConsumeableAsset.energy);
                 base.player.life.askView((byte)((float)itemConsumeableAsset.vision * (1f - base.player.skills.mastery(1, 2))));
                 base.player.life.askWarm(itemConsumeableAsset.warmth);
                 bool flag;
                 if (base.channel.isOwner && itemConsumeableAsset.vision > 0 && Provider.provider.achievementsService.getAchievement("Berries", out flag) && !flag)
                 {
                     Provider.provider.achievementsService.setAchievement("Berries");
                 }
             }
             if (Provider.isServer)
             {
                 if (itemConsumeableAsset != null)
                 {
                     base.player.life.askHeal((byte)((float)itemConsumeableAsset.health * (1f + base.player.skills.mastery(2, 0) * 0.5f)), itemConsumeableAsset.hasBleeding, itemConsumeableAsset.hasBroken);
                     byte food3 = base.player.life.food;
                     base.player.life.askEat((byte)((float)itemConsumeableAsset.food * ((float)base.player.equipment.quality / 100f)));
                     byte food4 = base.player.life.food;
                     byte b2    = (byte)((float)itemConsumeableAsset.water * ((float)base.player.equipment.quality / 100f));
                     if (itemConsumeableAsset.foodConstrainsWater)
                     {
                         b2 = (byte)Mathf.Min((int)b2, (int)(food4 - food3));
                     }
                     base.player.life.askDrink(b2);
                     base.player.life.askInfect((byte)((float)itemConsumeableAsset.virus * (1f - base.player.skills.mastery(1, 2) * 0.5f)));
                     base.player.life.askDisinfect((byte)((float)itemConsumeableAsset.disinfectant * (1f + base.player.skills.mastery(2, 0) * 0.5f)));
                     base.player.life.askWarm(itemConsumeableAsset.warmth);
                     if (base.player.equipment.quality < 50)
                     {
                         base.player.life.askInfect((byte)((float)(itemConsumeableAsset.food + itemConsumeableAsset.water) * 0.5f * (1f - (float)base.player.equipment.quality / 50f) * (1f - base.player.skills.mastery(1, 2) * 0.5f)));
                     }
                 }
                 base.player.equipment.use();
             }
         }
     }
 }