-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #543 from ze-dom/bugfix/item_level_upgrade_chaos_mix
Bugfix/item level upgrade chaos mix
- Loading branch information
Showing
53 changed files
with
6,854 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/GameLogic/PlayerActions/Craftings/ChaosWeaponAndFirstWingsCrafting.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// <copyright file="ChaosWeaponAndFirstWingsCrafting.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlayerActions.Craftings; | ||
|
||
using MUnique.OpenMU.DataModel.Configuration.ItemCrafting; | ||
using MUnique.OpenMU.DataModel.Configuration.Items; | ||
using MUnique.OpenMU.GameLogic.PlayerActions.Items; | ||
|
||
/// <summary> | ||
/// Crafting for Chaos Weapon and First Wings. | ||
/// </summary> | ||
public class ChaosWeaponAndFirstWingsCrafting : SimpleItemCraftingHandler | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ChaosWeaponAndFirstWingsCrafting"/> class. | ||
/// </summary> | ||
/// <param name="settings">The settings.</param> | ||
public ChaosWeaponAndFirstWingsCrafting(SimpleCraftingSettings settings) | ||
: base(settings) | ||
{ | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void AddRandomItemOption(Item resultItem, Player player, byte successRate) | ||
{ | ||
if (resultItem.Definition!.PossibleItemOptions.FirstOrDefault(o => | ||
o.PossibleOptions.Any(p => p.OptionType == ItemOptionTypes.Option)) | ||
is { } option) | ||
{ | ||
int i = Rand.NextInt(0, 3); | ||
if (Rand.NextRandomBool((successRate / 5) + (4 * (i + 1)))) | ||
{ | ||
var link = player.PersistenceContext.CreateNew<ItemOptionLink>(); | ||
link.ItemOption = option.PossibleOptions.First(); | ||
link.Level = 3 - i; | ||
resultItem.ItemOptions.Add(link); | ||
} | ||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void AddRandomLuckOption(Item resultItem, Player player, byte successRate) | ||
{ | ||
if (Rand.NextRandomBool((successRate / 5) + 4) | ||
&& resultItem.Definition!.PossibleItemOptions.FirstOrDefault(o => | ||
o.PossibleOptions.Any(po => po.OptionType == ItemOptionTypes.Luck)) | ||
is { } luck) | ||
{ | ||
var luckOption = player.PersistenceContext.CreateNew<ItemOptionLink>(); | ||
luckOption.ItemOption = luck.PossibleOptions.First(); | ||
resultItem.ItemOptions.Add(luckOption); | ||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void AddRandomSkill(Item resultItem, byte successRate) | ||
{ | ||
if (Rand.NextRandomBool((successRate / 5) + 6) | ||
&& !resultItem.HasSkill | ||
&& resultItem.Definition!.Skill is { }) | ||
{ | ||
resultItem.HasSkill = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// <copyright file="DinorantCrafting.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlayerActions.Craftings; | ||
|
||
using MUnique.OpenMU.DataModel.Configuration.ItemCrafting; | ||
using MUnique.OpenMU.DataModel.Configuration.Items; | ||
using MUnique.OpenMU.GameLogic.Attributes; | ||
using MUnique.OpenMU.GameLogic.PlayerActions.Items; | ||
using MUnique.OpenMU.GameLogic.Views.NPC; | ||
|
||
/// <summary> | ||
/// Crafting for Dinorant. | ||
/// </summary> | ||
public class DinorantCrafting : SimpleItemCraftingHandler | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DinorantCrafting"/> class. | ||
/// </summary> | ||
/// <param name="settings">The settings.</param> | ||
public DinorantCrafting(SimpleCraftingSettings settings) | ||
: base(settings) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override CraftingResult? TryGetRequiredItems(Player player, out IList<CraftingRequiredItemLink> items, out byte successRate) | ||
{ | ||
var craftingResult = base.TryGetRequiredItems(player, out items, out successRate); | ||
|
||
var uniriaLink = items.Where(i => i.ItemRequirement.PossibleItems.Any(i => i.Name == "Horn of Uniria")); | ||
foreach (var item in uniriaLink.First().Items) | ||
{ | ||
if (item.Durability < 255) | ||
{ | ||
return CraftingResult.IncorrectMixItems; | ||
} | ||
} | ||
|
||
return craftingResult; | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void AddRandomItemOption(Item resultItem, Player player, byte successRate) | ||
{ | ||
if (Rand.NextRandomBool(30) | ||
&& resultItem.Definition!.PossibleItemOptions.FirstOrDefault(o => | ||
o.PossibleOptions.Any(p => p.OptionType == ItemOptionTypes.Option)) | ||
is { } option) | ||
{ | ||
var link = player.PersistenceContext.CreateNew<ItemOptionLink>(); | ||
link.ItemOption = option.PossibleOptions.SelectRandom(); | ||
resultItem.ItemOptions.Add(link); | ||
|
||
// There is a second rollout for an additional bonus option to the first (but only if it doesn't coincide). | ||
if (Rand.NextRandomBool(20)) | ||
{ | ||
var bonusOpt = option.PossibleOptions.SelectRandom(); | ||
if (bonusOpt != link.ItemOption) | ||
{ | ||
var bonusLink = player.PersistenceContext.CreateNew<ItemOptionLink>(); | ||
bonusLink.ItemOption = bonusOpt; | ||
resultItem.ItemOptions.Add(bonusLink); | ||
} | ||
} | ||
} | ||
|
||
// Dinorant options were originally coded within the normal item option; each has a different level. | ||
foreach (var dinoOption in resultItem.ItemOptions) | ||
{ | ||
if (dinoOption.ItemOption!.PowerUpDefinition!.TargetAttribute == Stats.DamageReceiveDecrement) | ||
{ | ||
dinoOption.Level = 1; | ||
} | ||
else if (dinoOption.ItemOption!.PowerUpDefinition!.TargetAttribute == Stats.MaximumAbility) | ||
{ | ||
dinoOption.Level = 2; | ||
} | ||
else | ||
{ | ||
dinoOption.Level = 4; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.