forked from hajsdfgj/modular-overhaul
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCombatConfig.cs
95 lines (79 loc) · 3.35 KB
/
CombatConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
namespace DaLion.Overhaul.Modules.Combat;
#region using directives
using DaLion.Overhaul.Modules.Combat.Configs;
using DaLion.Shared.Constants;
using DaLion.Shared.Extensions.SMAPI;
using DaLion.Shared.Integrations.GMCM.Attributes;
using Newtonsoft.Json;
using StardewValley.Objects;
#endregion using directives
/// <summary>The user-configurable settings for CMBT.</summary>
public sealed class CombatConfig
{
private bool _newResistanceFormula = true;
/// <inheritdoc cref="WeaponsSlingshotsConfig"/>
[JsonProperty]
[GMCMInnerConfig("DaLion.Overhaul.Modules.Combat/WeaponsSlingshots", "cmbt.weapons_slingshots", true)]
public WeaponsSlingshotsConfig WeaponsSlingshots { get; internal set; } = new();
/// <inheritdoc cref="RingsEnchantmentsConfig"/>
[JsonProperty]
[GMCMInnerConfig("DaLion.Overhaul.Modules.Combat/RingsEnchantments", "cmbt.rings_enchantments", true)]
public RingsEnchantmentsConfig RingsEnchantments { get; internal set; } = new();
/// <inheritdoc cref="QuestsConfig"/>
[JsonProperty]
[GMCMInnerConfig("DaLion.Overhaul.Modules.Combat/Quests", "cmbt.quests", true)]
public QuestsConfig Quests { get; internal set; } = new();
/// <inheritdoc cref="EnemiesConfig"/>
[JsonProperty]
[GMCMInnerConfig("DaLion.Overhaul.Modules.Combat/Enemies", "cmbt.enemies", true)]
public EnemiesConfig Enemies { get; internal set; } = new();
/// <inheritdoc cref="ControlsUiConfig"/>
[JsonProperty]
[GMCMInnerConfig("DaLion.Overhaul.Modules.Combat/ControlsUi", "controls_ui", true)]
public ControlsUiConfig ControlsUi { get; internal set; } = new();
/// <summary>Gets a value indicating whether to overhaul the defense stat with better scaling and other features.</summary>
[JsonProperty]
[GMCMSection("cmbt.general")]
[GMCMPriority(0)]
public bool NewResistanceFormula
{
get => this._newResistanceFormula;
internal set
{
if (value == this._newResistanceFormula)
{
return;
}
this._newResistanceFormula = value;
ModHelper.GameContent.InvalidateCacheAndLocalized("Data/ObjectInformation");
if (!Context.IsWorldReady)
{
return;
}
Utility.iterateAllItems(item =>
{
if (item is not Ring { ParentSheetIndex: ObjectIds.TopazRing } topaz)
{
return;
}
var key = "rings.topaz.desc" + (value ? "resist" : "defense");
topaz.description = _I18n.Get(key);
});
}
}
/// <summary>Gets a value indicating whether to overhaul the knockback stat adding collision damage.</summary>
[JsonProperty]
[GMCMSection("cmbt.general")]
[GMCMPriority(1)]
public bool KnockbackHurts { get; internal set; } = true;
/// <summary>Gets a value indicating whether back attacks gain double crit. chance.</summary>
[JsonProperty]
[GMCMSection("cmbt.general")]
[GMCMPriority(3)]
public bool CriticalBackAttacks { get; internal set; } = true;
/// <summary>Gets a value indicating whether to enable status conditions like Bleed and Stun on enemies.</summary>
[JsonProperty]
[GMCMSection("cmbt.general")]
[GMCMPriority(4)]
public bool EnableStatusConditions { get; internal set; } = true;
}