Skip to content

Commit

Permalink
Fixed dropping of ancient items without bonus options
Browse files Browse the repository at this point in the history
Not all ancients have a bonus option, e.g. Gywen Pendant of Ability.
  • Loading branch information
sven-n committed Sep 7, 2024
1 parent a133ee8 commit 02b3ea9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/GameLogic/DefaultDropGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,13 @@ private void ApplyRandomAncientOption(Item item)

var itemOfSet = ancientSet.Items.First(i => object.Equals(i.ItemDefinition, item.Definition));
item.ItemSetGroups.Add(itemOfSet);
var bonusOption = itemOfSet.BonusOption ?? throw Error.NotInitializedProperty(itemOfSet, nameof(itemOfSet.BonusOption)); // for example: +5str or +10str
var bonusOptionLink = new ItemOptionLink();
bonusOptionLink.ItemOption = bonusOption;
bonusOptionLink.Level = bonusOption.LevelDependentOptions.Select(o => o.Level).SelectRandom();
item.ItemOptions.Add(bonusOptionLink);
if (itemOfSet.BonusOption is { } bonusOption) // for example: +5str or +10str
{
var bonusOptionLink = new ItemOptionLink();
bonusOptionLink.ItemOption = bonusOption;
bonusOptionLink.Level = bonusOption.LevelDependentOptions.Select(o => o.Level).SelectRandom();
item.ItemOptions.Add(bonusOptionLink);
}
}

private void AddRandomExcOptions(Item item)
Expand Down

0 comments on commit 02b3ea9

Please sign in to comment.