Modifications to the damage/armor system:

- Armor values aren't reduced from the damage taken, but instead multiply the damage (e.g. an item reduces damage by 10% instead of 10 hp). Now armor doesn't make characters invulnerable to small amounts of damage.
- Armoring isn't defined as a single "armor value", but instead there are "damage modifiers" which can be added to items and limbs. The modifiers can only affect specific types of damage and have separate multipliers for the damage amount and bleeding amount.
- Having a fire proof item on a limb doesn't make that limb invulnerable to burn damage. Item's that protect against fire now have a damage modifier for the Burn damage type.
This commit is contained in:
Joonas Rikkonen
2017-12-02 15:42:13 +02:00
parent 1d4327b690
commit 04bcc6b9b1
17 changed files with 209 additions and 148 deletions

View File

@@ -1356,6 +1356,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\Character.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\CharacterInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\CharacterNetworking.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\DamageModifier.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\DelayedEffect.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\HuskInfection.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\Jobs\Job.cs" />

View File

@@ -24,12 +24,15 @@
<collider radius ="230"/>
<!-- head -->
<limb id = "0" width="300" height="673" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<limb id = "0" width="300" height="673" type="Head" steerforce="1.0" flip="true"">
<sprite texture="Content/Characters/Carrier/carrier.png" sourcerect="0,0,393,778" depth="0.02" origin ="0.5,0.45"/>
<lightsource range="400.0" color="0.7,0.8,1.0,1.0">
<lighttexture texture="Content/Characters/Carrier/carrier.png" sourcerect="392,0,307,778" origin="0.5, 0.45"/>
</lightsource>
<damagemodifier armorsector="0.0,180.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="SctructureBlunt" deflectprojectiles="true"/>
<damagemodifier armorsector="0.0,360.0" damagesound="SctructureBlunt" deflectprojectiles="true"/>
<attack range="400" damagerange="250" duration="0.08" damage="100" stun="5" force="20" damagetype="blunt" targetforce="100"/>
</limb>

View File

@@ -30,17 +30,20 @@
<collider width="45" radius="22"/>
<!-- head -->
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armorvalue="30.0" mouthpos="17,35">
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" mouthpos="17,35">
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="0,0,51,121" depth="0.02" origin="0.45,0.63"/>
</limb>
<!-- middle part -->
<limb id = "1" radius="22" height="40" flip="true" armorsector="0.0,180.0" armorvalue="20.0">0
<limb id = "1" radius="22" height="40" flip="true" >
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="57,7,59,57" depth="0.021" origin="0.3,0.65"/>
</limb>
<!-- tail -->
<limb id = "2" radius="22" height="45" type="Tail" flip="true" armorsector="0.0,180.0" armorvalue="20.0">
<limb id = "2" radius="22" height="45" type="Tail" flip="true">
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="6,141,60,95" depth="0.022" origin="0.37,0.43"/>
</limb>

View File

@@ -33,25 +33,28 @@
<collider radius="60"/>
<!-- head -->
<limb id = "0" radius="30" height="86" mass = "6" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armor="10.0" mouthpos="30,65">
<limb id = "0" radius="30" height="86" mass = "6" type="Head" flip="true" steerforce="1.0" mouthpos="30,65">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="0,0,101,168" depth="0.02" origin="0.4,0.53"/>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.5" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<!-- middle part -->
<limb id = "1" width="42" height="61" mass = "6" flip="true" armorsector="0.0,180.0" armor="10.0">
<limb id = "1" width="42" height="61" mass = "6" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="3,168,59,64" depth="0.021" origin="0.3,0.65"/>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<!-- middle part -->
<limb id = "2" width="35" height="52" mass = "6" flip="true" armorsector="0.0,180.0" armor="10.0">
<limb id = "2" width="35" height="52" mass = "6" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="66,180,65,70" depth="0.022" origin="0.3,0.65"/>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.5" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<!-- tail -->
<limb id = "3" radius="20" mass = "6" type="Tail" flip="true" armorsector="0.0,180.0" armor="10.0">
<limb id = "3" radius="20" mass = "6" type="Tail" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="133,158,46,93" depth="0.023" origin="0.37,0.3"/>
</limb>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.5" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<limb id = "4" width="15" height="63" mass = "4" refjoint="3" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="232,153,20,63" depth="0.012" origin="0.5,0.5"/>

View File

@@ -19,9 +19,10 @@
<collider radius ="230"/>
<!-- head -->
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true">
<sprite texture="Content/Characters/Moloch/moloch.png" sourcerect="0,0,628,1024" depth="0.02" origin ="0.4,0.5"/>
<attack range="700" damagerange="350" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
<damagemodifier damagetype="Any" armorsector="0.0,180.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<limb id = "1" width="50" height="440" flip="true">

View File

@@ -25,9 +25,10 @@
<collider radius="100"/>
<!-- head -->
<limb id = "0" type="Head" width="350" height="320" steerforce="1.0" flip="true" armorsector="0.0,360.0" armorvalue="100.0">
<limb id = "0" type="Head" width="350" height="320" steerforce="1.0" flip="true">
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="0,0,369,348" depth="0.02" origin ="0.5,0.6"/>
<attack range="250" damagerange="170" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
<damagemodifier damagetype="Any" armorsector="0.0,360.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<limb id = "1" radius="50" height="120" flip="true">

View File

@@ -63,8 +63,7 @@
<Item
name="Diving Suit"
category="Equipment"
tags="diving"
tags="diving"
price="200"
fireproof="true"
description="An atmospheric diving suit capable of withstanding the immense pressure under Europa's crust.">
@@ -73,7 +72,7 @@
<Body width="37" height="113" density="15"/>
<Wearable slots="Head+Torso+Legs" armorvalue="10.0">
<Wearable slots="Head+Torso+Legs">
<sprite texture="DivingSuit.png" limb="Head" sourcerect="0,0,1,1" origin="0.5,0.5" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="Torso" sourcerect="42,0,42,97" origin="0.5,0.55" depthlimb="Head" hidelimb="true"/>
@@ -142,7 +141,6 @@
</LightComponent>
</Propulsion>
<ItemContainer capacity="1" hideitems="true">
<Containable name="Battery Cell"/>
<Containable name="Fulgurium Battery Cell"/>

View File

@@ -1,8 +1,7 @@
<Items>
<Item
name="Orange Jumpsuit"
category="Equipment"
category="Equipment"
tags="smallitem"
fireproof="true"
description="The fire-resistant fabric offers some protection against fires. Plenty of pockets for carrying any extra gear an engineer might need.">
@@ -19,7 +18,10 @@
<sprite texture="engigear.png" limb="LeftThigh" sourcerect="53,0,27,49" origin="0.5,0.5" depth="0.14" hidelimb="true"/>
<sprite texture="engigear.png" limb="RightLeg" sourcerect="33,0,20,51" origin="0.5,0.5" depth="0.11" hidelimb="true"/>
<sprite texture="engigear.png" limb="LeftLeg" sourcerect="33,0,20,51" origin="0.5,0.5" depth="0.15" hidelimb="true"/>
<sprite texture="engigear.png" limb="LeftLeg" sourcerect="33,0,20,51" origin="0.5,0.5" depth="0.15" hidelimb="true"/>
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.7"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.9" bleedingdamagemultiplier="0.9"/>
</Wearable>
<ItemContainer capacity="5">
@@ -48,6 +50,9 @@
<sprite texture="engigear.png" limb="RightLeg" sourcerect="33,77,20,51" origin="0.5,0.5" depth="0.11" hidelimb="true"/>
<sprite texture="engigear.png" limb="LeftLeg" sourcerect="33,77,20,51" origin="0.5,0.5" depth="0.15" hidelimb="true"/>
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.7"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.9" bleedingdamagemultiplier="0.9"/>
</Wearable>
<ItemContainer capacity="5">

View File

@@ -10,17 +10,18 @@
<Body width="52" height="17" density="40"/>
<Wearable slots="Any,Torso" armorvalue="10.0">
<Wearable slots="Any,Torso">
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.9"/>
<damagemodifier damagetype="Blunt" armorsector="0.0,360.0" damagemultiplier="0.3" bleedingmultiplier="0.3" damagesound="LimbArmor" deflectprojectiles="true"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="securitygear.png" limb="Torso" sourcerect="0,0,38,58" origin="0.52,0.48"/>
<sprite texture="securitygear.png" limb="RightArm" sourcerect="41,0,21,21" origin="0.5,1.1"/>
</Wearable>
</Item>
<Item
name="Ballistic Helmet"
category="Equipment"
category="Equipment"
tags="smallitem"
description="While the helmet won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board.">
@@ -34,6 +35,8 @@
<Body radius="12" density="50"/>
<Wearable slots="Any,Head" armorvalue="20.0">
<damagemodifier damagetype="Blunt" armorsector="0.0,360.0" damagemultiplier="0.2" bleedingmultiplier="0.2" damagesound="LimbArmor" deflectprojectiles="true"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="securitygear.png" limb="Head" sourcerect="39,31,29,22" origin="0.51,0.9"/>
</Wearable>
</Item>

View File

@@ -72,8 +72,7 @@
<Item
name="Railgun Shell"
category="Misc"
category="Misc"
price="200">
<Deconstruct time="10">
@@ -103,8 +102,7 @@
<Item
name="Nuclear Shell"
category="Misc"
category="Misc"
price="500">
<Deconstruct time="10">

View File

@@ -11,24 +11,32 @@ namespace Barotrauma
Damage, Bloodloss, Pressure, Suffocation, Drowning, Burn, Husk, Disconnected
}
public enum DamageType { None, Blunt, Slash, Burn }
[Flags]
public enum DamageType
{
None = 0,
Blunt = 1,
Slash = 2,
Burn = 4,
Any = Blunt | Slash | Burn
}
struct AttackResult
{
public readonly float Damage;
public readonly float Bleeding;
public readonly bool HitArmor;
public AttackResult(float damage, float bleeding, bool hitArmor=false)
public readonly List<DamageModifier> AppliedDamageModifiers;
public AttackResult(float damage, float bleeding, List<DamageModifier> appliedDamageModifiers = null)
{
this.Damage = damage;
this.Bleeding = bleeding;
this.HitArmor = hitArmor;
this.AppliedDamageModifiers = appliedDamageModifiers;
}
}
partial class Attack
{
public readonly float Range;

View File

@@ -0,0 +1,66 @@
using Microsoft.Xna.Framework;
using System.Xml.Linq;
namespace Barotrauma
{
class DamageModifier
{
[Serialize(DamageType.None, false)]
public DamageType DamageType
{
get;
private set;
}
[Serialize(1.0f, false)]
public float DamageMultiplier
{
get;
private set;
}
[Serialize(1.0f, false)]
public float BleedingMultiplier
{
get;
private set;
}
[Serialize("0.0,360", false)]
public Vector2 ArmorSector
{
get;
private set;
}
[Serialize(true, false)]
public bool IsArmor
{
get;
private set;
}
[Serialize(true, false)]
public bool DeflectProjectiles
{
get;
private set;
}
#if CLIENT
[Serialize(DamageSoundType.None, false)]
public DamageSoundType DamageSoundType
{
get;
private set;
}
#endif
public DamageModifier(XElement element)
{
SerializableProperty.DeserializeProperties(this, element);
ArmorSector = new Vector2(MathHelper.ToRadians(ArmorSector.X), MathHelper.ToRadians(ArmorSector.Y));
}
}
}

View File

@@ -72,10 +72,7 @@ namespace Barotrauma
private bool isSevered;
private float severedFadeOutTimer;
private readonly Vector2 armorSector;
private readonly float armorValue;
public Vector2? MouthPos;
//a timer for delaying when a hitsound/attacksound can be played again
@@ -91,6 +88,8 @@ namespace Barotrauma
private Vector2 animTargetPos;
private float scale;
private List<DamageModifier> damageModifiers;
public float AttackTimer;
@@ -179,7 +178,7 @@ namespace Barotrauma
public float Burnt
{
get { return burnt; }
set { burnt = MathHelper.Clamp(value,0.0f,100.0f); }
protected set { burnt = MathHelper.Clamp(value, 0.0f, 100.0f); }
}
public List<WearableSprite> WearingItems
@@ -255,15 +254,7 @@ namespace Barotrauma
GameMain.World.AddJoint(pullJoint);
steerForce = element.GetAttributeFloat("steerforce", 0.0f);
//maxHealth = Math.Max(ToolBox.GetAttributeFloat(element, "health", 100.0f),1.0f);
armorSector = element.GetAttributeVector2("armorsector", Vector2.Zero);
armorSector.X = MathHelper.ToRadians(armorSector.X);
armorSector.Y = MathHelper.ToRadians(armorSector.Y);
armorValue = Math.Max(element.GetAttributeFloat("armor", 0.0f), 0.0f);
if (element.Attribute("mouthpos") != null)
{
MouthPos = ConvertUnits.ToSimUnits(element.GetAttributeVector2("mouthpos", Vector2.Zero));
@@ -272,6 +263,8 @@ namespace Barotrauma
body.BodyType = BodyType.Dynamic;
body.FarseerBody.AngularDamping = LimbAngularDamping;
damageModifiers = new List<DamageModifier>();
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
@@ -322,6 +315,9 @@ namespace Barotrauma
case "attack":
attack = new Attack(subElement);
break;
case "damagemodifier":
damageModifiers.Add(new DamageModifier(subElement));
break;
}
}
@@ -344,46 +340,51 @@ namespace Barotrauma
public AttackResult AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, bool playSound)
{
bool hitArmor = false;
float totalArmorValue = 0.0f;
List<DamageModifier> appliedDamageModifiers = new List<DamageModifier>();
if (armorValue > 0.0f && SectorHit(armorSector, position))
foreach (DamageModifier damageModifier in damageModifiers)
{
hitArmor = true;
totalArmorValue += armorValue;
if (damageModifier.DamageType.HasFlag(damageType) && SectorHit(damageModifier.ArmorSector, position))
{
appliedDamageModifiers.Add(damageModifier);
}
}
foreach (WearableSprite wearable in wearingItems)
{
if (wearable.WearableComponent.ArmorValue > 0.0f &&
SectorHit(wearable.WearableComponent.ArmorSectorLimits, position))
foreach (DamageModifier damageModifier in wearable.WearableComponent.DamageModifiers)
{
hitArmor = true;
totalArmorValue += wearable.WearableComponent.ArmorValue;
if (damageModifier.DamageType.HasFlag(damageType) && SectorHit(damageModifier.ArmorSector, position))
{
appliedDamageModifiers.Add(damageModifier);
}
}
}
}
if (hitArmor)
foreach (DamageModifier damageModifier in appliedDamageModifiers)
{
totalArmorValue = Math.Max(totalArmorValue, 0.0f);
amount = Math.Max(0.0f, amount - totalArmorValue);
bleedingAmount = Math.Max(0.0f, bleedingAmount - totalArmorValue);
amount *= damageModifier.DamageMultiplier;
bleedingAmount *= damageModifier.BleedingMultiplier;
}
#if CLIENT
if (playSound)
{
DamageSoundType damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.LimbBlunt : DamageSoundType.LimbSlash;
if (hitArmor)
{
damageSoundType = DamageSoundType.LimbArmor;
}
foreach (DamageModifier damageModifier in appliedDamageModifiers)
{
if (damageModifier.DamageSoundType != DamageSoundType.None)
{
damageSoundType = damageModifier.DamageSoundType;
break;
}
}
SoundPlayer.PlayDamageSound(damageSoundType, amount, position);
}
float bloodParticleAmount = hitArmor || bleedingAmount <= 0.0f ? 0 : (int)Math.Min(amount / 5, 10);
float bloodParticleAmount = 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 < bloodParticleAmount; i++)
@@ -402,9 +403,14 @@ namespace Barotrauma
#endif
if (damageType == DamageType.Burn)
{
Burnt += amount * 10.0f;
}
damage += Math.Max(amount,bleedingAmount) / character.MaxHealth * 100.0f;
return new AttackResult(amount, bleedingAmount, hitArmor);
return new AttackResult(amount, bleedingAmount, appliedDamageModifiers);
}
public bool SectorHit(Vector2 armorSector, Vector2 simPosition)

View File

@@ -5,6 +5,7 @@ using FarseerPhysics.Dynamics.Joints;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
@@ -255,7 +256,8 @@ namespace Barotrauma.Items.Components
target.Body.ApplyLinearImpulse(item.body.LinearVelocity * item.body.Mass);
if (attackResult.HitArmor)
if (attackResult.AppliedDamageModifiers != null &&
attackResult.AppliedDamageModifiers.Any(dm => dm.DeflectProjectiles))
{
item.body.LinearVelocity *= 0.1f;
}

View File

@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
@@ -27,79 +28,62 @@ namespace Barotrauma.Items.Components
class Wearable : Pickable
{
WearableSprite[] wearableSprites;
LimbType[] limbType;
Limb[] limb;
private WearableSprite[] wearableSprites;
private LimbType[] limbType;
private Limb[] limb;
private float armorValue;
private List<DamageModifier> damageModifiers;
private Vector2 armorSector;
[Serialize(0.0f, false)]
public float ArmorValue
public List<DamageModifier> DamageModifiers
{
get { return armorValue; }
set { armorValue = MathHelper.Clamp(value, 0.0f, 100.0f); }
get { return damageModifiers; }
}
[Serialize("0.0,360.0", false)]
public Vector2 ArmorSector
{
get { return armorSector; }
set
{
armorSector.X = MathHelper.ToRadians(value.X);
armorSector.Y = MathHelper.ToRadians(value.Y);
}
}
public Vector2 ArmorSectorLimits
{
get { return armorSector; }
}
public Wearable (Item item, XElement element)
: base(item, element)
{
this.item = item;
var sprites = element.Elements().Where(x => x.Name.ToString() == "sprite").ToList();
int spriteCount = sprites.Count;
damageModifiers = new List<DamageModifier>();
int spriteCount = element.Elements().Count(x => x.Name.ToString() == "sprite");
wearableSprites = new WearableSprite[spriteCount];
limbType = new LimbType[spriteCount];
limb = new Limb[spriteCount];
int i = 0;
foreach (XElement subElement in sprites)
foreach (XElement subElement in element.Elements())
{
//Rectangle sourceRect = new Rectangle(
// ToolBox.GetAttributeInt(subElement, "sourcex", 1),
// ToolBox.GetAttributeInt(subElement, "sourcey", 1),
// ToolBox.GetAttributeInt(subElement, "sourcewidth", 1),
// ToolBox.GetAttributeInt(subElement, "sourceheight", 1));
if (subElement.Attribute("texture") == null)
switch (subElement.Name.ToString().ToLower())
{
DebugConsole.ThrowError("Item \"" + item.Name + "\" doesn't have a texture specified!");
return;
case "sprite":
if (subElement.Attribute("texture") == null)
{
DebugConsole.ThrowError("Item \"" + item.Name + "\" doesn't have a texture specified!");
return;
}
string spritePath = subElement.Attribute("texture").Value;
spritePath = Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" + spritePath;
var sprite = new Sprite(subElement, "", spritePath);
wearableSprites[i] = new WearableSprite(this, sprite,
subElement.GetAttributeBool("hidelimb", false),
subElement.GetAttributeBool("inheritlimbdepth", true),
(LimbType)Enum.Parse(typeof(LimbType), subElement.GetAttributeString("depthlimb", "None"), true));
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
subElement.GetAttributeString("limb", "Head"), true);
i++;
break;
case "damagemodifier":
damageModifiers.Add(new DamageModifier(subElement));
break;
}
string spritePath = subElement.Attribute("texture").Value;
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
var sprite = new Sprite(subElement, "", spritePath);
wearableSprites[i] = new WearableSprite(this, sprite,
subElement.GetAttributeBool("hidelimb", false),
subElement.GetAttributeBool("inheritlimbdepth", true),
(LimbType)Enum.Parse(typeof(LimbType), subElement.GetAttributeString("depthlimb", "None"), true));
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
subElement.GetAttributeString("limb", "Head"), true);
i++;
}
}
public override void Equip(Character character)
{
picker = character;
@@ -107,15 +91,7 @@ namespace Barotrauma.Items.Components
{
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
if (equipLimb == null) continue;
//something is already on the limb -> unequip it
//if (equipLimb.WearingItem != null && equipLimb.WearingItem != this)
//{
// equipLimb.WearingItem.Unequip(character);
//}
//sprite[i].Depth = equipLimb.sprite.Depth - 0.001f;
item.body.Enabled = false;
IsActive = true;
@@ -143,20 +119,9 @@ namespace Barotrauma.Items.Components
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
if (equipLimb == null) continue;
//foreach (WearableSprite wearable in equipLimb.WearingItems)
//{
// if (wearable != wearableSprites[i]) continue;
equipLimb.WearingItems.RemoveAll(w => w != null && w == wearableSprites[i]);
// equipLimb.WearingItems.Remove(wearableSprites[i]);
//}
equipLimb.WearingItems.RemoveAll(w=> w!=null && w==wearableSprites[i]);
//if (equipLimb.WearingItem != this) continue;
limb[i] = null;
//equipLimb.WearingItem = null;
//equipLimb.WearingItemSprite = null;
}
IsActive = false;

View File

@@ -761,7 +761,7 @@ namespace Barotrauma
float damageAmount = attack.GetStructureDamage(deltaTime);
Condition -= damageAmount;
return new AttackResult(damageAmount, 0.0f, false);
return new AttackResult(damageAmount, 0.0f, null);
}
private bool IsInWater()

View File

@@ -205,8 +205,6 @@ namespace Barotrauma
float dmg = (float)Math.Sqrt(size.X) * deltaTime / c.AnimController.Limbs.Length;
foreach (Limb limb in c.AnimController.Limbs)
{
if (limb.WearingItems.Find(w => w != null && w.WearableComponent.Item.FireProof) != null) continue;
limb.Burnt += dmg * 10.0f;
c.AddDamage(limb.SimPosition, DamageType.Burn, dmg, 0, 0, false);
}
}