Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions EpicLoot/EpicLoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private static void RegisterMagicEffectEvents() {
MagicItemEffects.Shards.LuckyLoot.RegisterDisplayValues();
MagicItemEffects.Shards.Bloodrage.RegisterDisplayValues();
MagicItemEffects.Shards.MeteorSummoner.RegisterDisplayValues();
MagicItemEffects.Shards.EikthyrShockingCharge.RegisterDisplayValues();
MagicItemEffects.Shards.BlockAsDodgeAsBlock.RegisterDisplayValues();
MagicItemEffects.Shards.BlockAsWoodCuttingAndPickaxes.RegisterDisplayValues();

Expand Down
1 change: 1 addition & 0 deletions EpicLoot/config/shardstones.json
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,7 @@
"Config": {
"MaxCharges": 15,
"DamageFraction": 0.3,
"ValueReference": 15,
"ConeLength": 4,
"ConeMaxWidth": 4,
"DischargeIgnoreWindow": 0.3
Expand Down
4 changes: 2 additions & 2 deletions EpicLoot/localizations/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
"mod_epicloot_me_stormrider_display": "+{0}% Movement Speed in Storms",
"mod_epicloot_me_stormrider_desc": "+{0}% movement speed while a storm rages.",

"mod_epicloot_me_shockingcharge_display": "Shocking Charge",
"mod_epicloot_me_shockingcharge_display": "Shocking Charge: {0:0.#}% Banked Damage after {1} Hits",
"mod_epicloot_me_shockingcharge_desc": "Your combat hits build charges. At max charge, the next hit unleashes a forward lightning shockwave that deals a portion of your previous hits' damage.",
"mod_epicloot_me_forestsaid_display": "Forest's Aid",
"mod_epicloot_me_forestsaid_desc": "When you are hit, ensnaring roots erupt and immobilize nearby enemies.",
Expand Down Expand Up @@ -2179,4 +2179,4 @@
"mod_epicloot_criticalsuccess": "Critical Success",
"mod_epicloot_criticalfail": "Critical Fail",
"mod_epicloot_temper": "Temper"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,41 @@ namespace EpicLoot.MagicItemEffects.Shards {
public static class EikthyrShockingCharge {
// All tunable in this effect's Config block in config/shardstones.json, under these key names.
//
// Hits required to trigger a discharge, and the portion of the banked combat damage the shockwave
// delivers. Cone geometry: reach straight ahead, and the full width of the cone at that reach --
// Hits required to trigger a discharge, the portion of the banked combat damage the Epic shard
// delivers, and the shard value that represents that reference rarity. Other rarities scale the
// damage fraction in direct proportion to their value. Cone geometry: reach straight ahead, and
// the full width of the cone at that reach --
// the half-width grows linearly from 0 at the player to (ConeMaxWidth / 2) at ConeLength. The
// ignore window is how long after a discharge the shockwave's own hits are kept from rebuilding
// the charge.
public const int DefaultMaxCharges = 15;
public const float DefaultDamageFraction = 0.3f;
public const float DefaultValueReference = 15f;
public const float DefaultConeLength = 4f;
public const float DefaultConeMaxWidth = 4f;
public const float DefaultDischargeIgnoreWindow = 0.3f;

private const string MaxChargesKey = "MaxCharges";
private const string DamageFractionKey = "DamageFraction";
private const string ValueReferenceKey = "ValueReference";
private const string ConeLengthKey = "ConeLength";
private const string ConeMaxWidthKey = "ConeMaxWidth";
private const string DischargeIgnoreWindowKey = "DischargeIgnoreWindow";

public static readonly Dictionary<string, float> DefaultConfig = new Dictionary<string, float> {
{ MaxChargesKey, DefaultMaxCharges },
{ DamageFractionKey, DefaultDamageFraction },
{ ValueReferenceKey, DefaultValueReference },
{ ConeLengthKey, DefaultConeLength },
{ ConeMaxWidthKey, DefaultConeMaxWidth },
{ DischargeIgnoreWindowKey, DefaultDischargeIgnoreWindow },
};

public static void RegisterDisplayValues() {
MagicItem.RegisterDisplayValues(MagicEffectType.ShockingCharge,
value => new object[] { GetDamageFraction(value) * 100f, (float)GetMaxCharges() });
}

// Clamped to at least 1 so a misconfiguration can't discharge on every hit through a zero threshold.
private static int GetMaxCharges() {
return EffectConfig.GetIntAtLeast(MagicEffectType.ShockingCharge,
Expand All @@ -44,6 +54,16 @@ private static float GetConeLength() {
EffectConfig.Get(MagicEffectType.ShockingCharge, ConeLengthKey, DefaultConeLength));
}

// The configured fraction is the Epic baseline. Keeping the reference value configurable preserves
// that balance when a server replaces the default rarity ramp.
private static float GetDamageFraction(float value) {
float referenceValue = Mathf.Max(0.1f, EffectConfig.Get(MagicEffectType.ShockingCharge,
ValueReferenceKey, DefaultValueReference));
float baseFraction = Mathf.Max(0f, EffectConfig.Get(MagicEffectType.ShockingCharge,
DamageFractionKey, DefaultDamageFraction));
return baseFraction * value / referenceValue;
}

private const string ShockwaveFx = "fx_eikthyr_forwardshockwave";

private static int _charges;
Expand Down Expand Up @@ -101,8 +121,7 @@ public static void OnDamageDealt(Character __instance, HitData hit, Character at
_charges = 0;
_ignoreUntil = Time.time + EffectConfig.Get(MagicEffectType.ShockingCharge,
DischargeIgnoreWindowKey, DefaultDischargeIgnoreWindow);
var shotDamage = _bankedDamage * EffectConfig.Get(MagicEffectType.ShockingCharge,
DamageFractionKey, DefaultDamageFraction);
float shotDamage = _bankedDamage * GetDamageFraction(value);
_bankedDamage = 0f;
FireShockwave(player, hit.m_dir, shotDamage);
}
Expand Down
Loading