Skip to content

Commit

Permalink
Fix weapon/item balance validation checking. Fixes #31.
Browse files Browse the repository at this point in the history
  • Loading branch information
gibbed committed Jun 24, 2019
1 parent 50e3741 commit 444d39c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
17 changes: 6 additions & 11 deletions projects/Gibbed.BorderlandsOz.GameInfo/ItemBalanceDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public bool IsSuitableFor(ItemDefinition item)
var current = this;
do
{
if (current.Item != null && current.Item == item)
if (current.Item != null || current.Items?.Count > 0)
{
return true;
}
if (current.Item == item || current.Items?.Contains(item) == true)
{
return true;
}

if (current.Items != null && current.Items.Contains(item) == true)
{
return true;
return false;
}

current = current.Base;
Expand Down Expand Up @@ -139,11 +139,6 @@ List<string> getList(IEnumerable<string> enumerable)
}
}

if (result.Item != item && result.Items.Contains(item) == false)
{
throw new ResourceNotFoundException($"item type '{item.ResourcePath}' is not valid for '{this.ResourcePath}'");
}

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ public WeaponBalanceDefinition Create(WeaponTypeDefinition weaponType)
AddPartList(balance.Parts.MaterialParts, balance.Parts.Mode, result.Parts.MaterialParts);
}

if (result.WeaponType != weaponType)
{
throw new ResourceNotFoundException($"weapon type '{weaponType.ResourcePath}' is not valid for '{this.ResourcePath}'");
}

return result;
}

Expand Down

0 comments on commit 444d39c

Please sign in to comment.