Attack configs determine whether an attack can sever limbs (instead of the amount of damage), new blood particles

This commit is contained in:
Joonas Rikkonen
2017-06-14 19:24:49 +03:00
parent f6425a7229
commit 242da11e3f
17 changed files with 116 additions and 96 deletions
+9 -15
View File
@@ -333,7 +333,7 @@ namespace Barotrauma
bool hitArmor = false;
float totalArmorValue = 0.0f;
if (armorValue>0.0f && SectorHit(armorSector, position))
if (armorValue > 0.0f && SectorHit(armorSector, position))
{
hitArmor = true;
totalArmorValue += armorValue;
@@ -347,8 +347,7 @@ namespace Barotrauma
hitArmor = true;
totalArmorValue += wearable.WearableComponent.ArmorValue;
}
}
}
if (hitArmor)
{
@@ -364,24 +363,19 @@ namespace Barotrauma
SoundPlayer.PlayDamageSound(damageSoundType, amount, position);
}
float bloodAmount = hitArmor || bleedingAmount <= 0.0f ? 0 : (int)Math.Min((int)(amount * 2.0f), 20);
float bloodParticleAmount = hitArmor || bleedingAmount <= 0.0f ? 0 : (int)Math.Min(amount / 5, 10);
float bloodParticleSize = MathHelper.Clamp(amount / 50.0f, 0.1f, 1.0f);
for (int i = 0; i < bloodAmount; i++)
for (int i = 0; i < bloodParticleAmount; i++)
{
Vector2 particleVel = WorldPosition - position;
if (particleVel != Vector2.Zero) particleVel = Vector2.Normalize(particleVel);
GameMain.ParticleManager.CreateParticle("blood",
WorldPosition,
particleVel * Rand.Range(100.0f, 300.0f), 0.0f, character.AnimController.CurrentHull);
if (i < bloodAmount / 5)
var blood = GameMain.ParticleManager.CreateParticle(inWater ? "waterblood" : "blood", WorldPosition, Vector2.Zero, 0.0f, character.AnimController.CurrentHull);
if (blood != null)
{
GameMain.ParticleManager.CreateParticle("waterblood", WorldPosition, Rand.Vector(10), 0.0f, character.AnimController.CurrentHull);
blood.Size *= bloodParticleSize;
}
}
damage += Math.Max(amount,bleedingAmount) / character.MaxHealth * 100.0f;
damage += Math.Max(amount, bleedingAmount) / character.MaxHealth * 100.0f;
return new AttackResult(amount, bleedingAmount, hitArmor);
}