Skip to content

Commit

Permalink
Merge pull request #498 from ze-dom/bugfix/exc_item_drop
Browse files Browse the repository at this point in the history
Fixed exc options being added to non-exc dropped items and item drops durability
  • Loading branch information
sven-n authored Oct 2, 2024
2 parents 935ec7d + 5eb419c commit bad3dbb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/GameLogic/DefaultDropGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public DefaultDropGenerator(GameConfiguration config, IRandomizer randomizer)
}

item.Level = GetItemLevelByMonsterLevel(item.Definition!, monsterLvl);
item.Durability = item.GetMaximumDurabilityOfOnePiece();
return item;
}

Expand All @@ -159,8 +160,9 @@ public DefaultDropGenerator(GameConfiguration config, IRandomizer randomizer)
/// <param name="item">The item.</param>
protected void ApplyRandomOptions(Item item)
{
item.Durability = item.GetMaximumDurabilityOfOnePiece();
foreach (var option in item.Definition!.PossibleItemOptions.Where(o => o.AddsRandomly))
foreach (var option in item.Definition!.PossibleItemOptions.Where(o =>
o.AddsRandomly &&
!o.PossibleOptions.Any(po => object.Equals(po.OptionType, ItemOptionTypes.Excellent))))
{
this.ApplyOption(item, option);
}
Expand Down Expand Up @@ -198,6 +200,7 @@ protected void ApplyRandomOptions(Item item)
item.HasSkill = item.CanHaveSkill(); // every excellent item got skill

this.AddRandomExcOptions(item);
item.Durability = item.GetMaximumDurabilityOfOnePiece();
return item;
}

Expand All @@ -216,6 +219,7 @@ protected void ApplyRandomOptions(Item item)
item.HasSkill = item.CanHaveSkill(); // every ancient item got skill

this.ApplyRandomAncientOption(item);
item.Durability = item.GetMaximumDurabilityOfOnePiece();
return item;
}

Expand Down Expand Up @@ -295,6 +299,7 @@ private static bool IsGroupRelevant(MonsterDefinition monsterDefinition, DropIte
this.AddRandomExcOptions(item);
}

item.Durability = item.GetMaximumDurabilityOfOnePiece();
return item;
}

Expand All @@ -314,7 +319,7 @@ private void ApplyOption(Item item, ItemOptionDefinition option)
var itemOptionLink = new ItemOptionLink
{
ItemOption = newOption,
Level = newOption?.LevelDependentOptions.Select(l => l.Level).SelectRandom() ?? 0
Level = newOption?.LevelDependentOptions.Select(l => l.Level).SelectRandom() ?? 0,
};
item.ItemOptions.Add(itemOptionLink);
}
Expand Down

0 comments on commit bad3dbb

Please sign in to comment.