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.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
<Compile Include="MagicItemEffects\ModifyHealthRegen.cs" />
<Compile Include="MagicItemEffects\ModifyJumpStaminaUsage.cs" />
<Compile Include="MagicItemEffects\ModifyParry.cs" />
<Compile Include="MagicItemEffects\ModifyParryForce.cs" />
<Compile Include="MagicItemEffects\ModifyParryWindow.cs" />
<Compile Include="MagicItemEffects\ModifyResistance.cs" />
<Compile Include="MagicItemEffects\ModifyRunStaminaDrain.cs" />
Expand Down
17 changes: 12 additions & 5 deletions EpicLoot/ItemDrop_Patch_MagicItemTooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ private static bool Prefix(ref string __result, ItemDrop.ItemData item, int qual
var magicParry = magicItem.HasEffect(MagicEffectType.ModifyParry);
var totalParryBonusMod = magicItem.GetTotalEffectValue(MagicEffectType.ModifyParry, 0.01f);
var magicParryColor = magicParry ? magicColor : "orange";
var magicParryForce = magicItem.HasEffect(MagicEffectType.ModifyParryForce);
var magicParryForceColor = magicParryForce ? magicColor : "orange";
var deflectionForce = item.GetDeflectionForce(qualityLevel);
switch (item.m_shared.m_itemType)
{
case ItemDrop.ItemData.ItemType.Consumable:
Expand Down Expand Up @@ -172,10 +175,12 @@ private static bool Prefix(ref string __result, ItemDrop.ItemData item, int qual
var blockPowerTooltipValue = item.GetBlockPowerTooltip(qualityLevel);
var blockPowerPercentageString = blockPowerTooltipValue.ToString("0");
text.Append($"\n$item_blockpower: <color={magicBlockColor1}>{baseBlockPower1}</color> <color={magicBlockColor2}>({blockPowerPercentageString})</color>");
if (deflectionForce > 0)
{
text.Append($"\n$item_deflection: <color={magicParryForceColor}>{deflectionForce}</color>");
}
if (item.m_shared.m_timedBlockBonus > 1.0)
{
text.Append($"\n$item_deflection: <color={magicParryColor}>{item.GetDeflectionForce(qualityLevel)}</color>");

var timedBlockBonus = item.m_shared.m_timedBlockBonus;
if (magicParry)
{
Expand Down Expand Up @@ -214,10 +219,12 @@ private static bool Prefix(ref string __result, ItemDrop.ItemData item, int qual
blockPowerTooltipValue = item.GetBlockPowerTooltip(qualityLevel);
var str5 = blockPowerTooltipValue.ToString("0");
text.Append($"\n$item_blockpower: <color={magicBlockColor1}>{baseBlockPower2}</color> <color={magicBlockColor2}>({str5})</color>");
if (deflectionForce > 0)
{
text.Append($"\n$item_deflection: <color={magicParryForceColor}>{deflectionForce}</color>");
}
if (item.m_shared.m_timedBlockBonus > 1.0)
{
text.Append($"\n$item_deflection: <color={magicParryColor}>{item.GetDeflectionForce(qualityLevel)}</color>");

var timedBlockBonus = item.m_shared.m_timedBlockBonus;
if (magicParry)
{
Expand Down Expand Up @@ -559,7 +566,7 @@ public static Tuple<string, string> PreprocessTooltipStat(ItemDrop.ItemData item
break;

case "$item_deflection":
if (magicItem.HasEffect(MagicEffectType.ModifyParry))
if (magicItem.HasEffect(MagicEffectType.ModifyParryForce))
{
value = $"<color={magicColor}>{item.GetDeflectionForce(item.m_quality)}</color>";
}
Expand Down
1 change: 1 addition & 0 deletions EpicLoot/MagicItemEffectDefinitions_Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static partial class MagicEffectType
public static string RemoveSpeedPenalty = nameof(RemoveSpeedPenalty);
public static string ModifyBlockPower = nameof(ModifyBlockPower);
public static string ModifyParry = nameof(ModifyParry);
public static string ModifyParryForce = nameof(ModifyParryForce);
public static string ModifyArmor = nameof(ModifyArmor);
public static string ModifyBackstab = nameof(ModifyBackstab);
public static string IncreaseHealth = nameof(IncreaseHealth);
Expand Down
6 changes: 3 additions & 3 deletions EpicLoot/MagicItemEffects/ModifyBlockPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
totalBlockPowerMod += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, __instance, effect, 0.01f);
});

__result *= 1.0f + totalBlockPowerMod;

if (player != null && player.m_leftItem == null && player.HasActiveMagicEffect(MagicEffectType.Duelist))
{
__result += __instance.GetDamage().GetTotalDamage() * player.GetTotalActiveMagicEffectValue(MagicEffectType.Duelist, 0.01f);
totalBlockPowerMod += player.GetTotalActiveMagicEffectValue(MagicEffectType.Duelist, 0.01f);
}

__result *= 1.0f + totalBlockPowerMod;

__result = (float)Math.Round(__result, 1);
}
}
Expand Down
23 changes: 0 additions & 23 deletions EpicLoot/MagicItemEffects/ModifyParry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,6 @@

namespace EpicLoot.MagicItemEffects
{
//public float GetDeflectionForce(int quality)
[HarmonyPatch(typeof(ItemDrop.ItemData), nameof(ItemDrop.ItemData.GetDeflectionForce), typeof(int))]
public static class ModifyParry_ItemData_GetDeflectionForce_Patch
{
public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
{
var player = PlayerExtensions.GetPlayerWithEquippedItem(__instance);
var totalParryMod = 0f;
ModifyWithLowHealth.Apply(player, MagicEffectType.ModifyParry, effect =>
{
totalParryMod += MagicEffectsHelper.GetTotalActiveMagicEffectValueForWeapon(player, __instance, effect, 0.01f);
});

__result *= 1.0f + totalParryMod;
if (player != null && player.m_leftItem == null && MagicEffectsHelper.HasActiveMagicEffect(player, __instance, MagicEffectType.Duelist))
{
__result += __instance.GetDamage().GetTotalDamage() / 2 * MagicEffectsHelper.GetTotalActiveMagicEffectValueForWeapon(player, __instance, MagicEffectType.Duelist, 0.01f);
}

__result = (float) Math.Round(__result, 1);
}
}

//public override bool BlockAttack(HitData hit, Character attacker)
[HarmonyPatch(typeof(Humanoid), nameof(Humanoid.BlockAttack))]
public static class ModifyParry_Humanoid_BlockAttack_Patch
Expand Down
29 changes: 29 additions & 0 deletions EpicLoot/MagicItemEffects/ModifyParryForce.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using HarmonyLib;

namespace EpicLoot.MagicItemEffects
{
//public float GetDeflectionForce(int quality)
[HarmonyPatch(typeof(ItemDrop.ItemData), nameof(ItemDrop.ItemData.GetDeflectionForce), typeof(int))]
public static class ModifyParryForce_ItemData_GetDeflectionForce_Patch
{
public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
{
var player = PlayerExtensions.GetPlayerWithEquippedItem(__instance);
var totalParryForceMod = 0f;
ModifyWithLowHealth.Apply(player, MagicEffectType.ModifyParryForce, effect =>
{
totalParryForceMod += MagicEffectsHelper.GetTotalActiveMagicEffectValueForWeapon(player, __instance, effect, 0.01f);
});

if (player != null && player.m_leftItem == null && MagicEffectsHelper.HasActiveMagicEffect(player, __instance, MagicEffectType.Duelist))
{
totalParryForceMod += MagicEffectsHelper.GetTotalActiveMagicEffectValueForWeapon(player, __instance, MagicEffectType.Duelist, 0.01f) / 2.0f;
}

__result *= 1.0f + totalParryForceMod;

__result = (float) Math.Round(__result, 1);
}
}
}
32 changes: 32 additions & 0 deletions EpicLoot/magiceffects.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,38 @@
"$mod_epicloot_me_modifyparry_suffix1"
]
},
{
"Type" : "ModifyParryForce",
"DisplayText" : "$mod_epicloot_me_modifyparryforce_display",
"Description" : "$mod_epicloot_me_modifyparryforce_desc",
"Requirements" : {
"AllowedItemTypes" : [
"Shield",
"TwoHandedWeapon"
],
"ExcludedSkillTypes": [
"Pickaxes"
],
"ExcludedItemNames": [
"$item_shield_serpentscale"
],
"ItemHasParryPower" : true
},
"ValuesPerRarity" : {
"Magic" : { "MinValue" : 10, "MaxValue" : 20, "Increment" : 1 },
"Rare" : { "MinValue" : 10, "MaxValue" : 20, "Increment" : 1 },
"Epic" : { "MinValue" : 10, "MaxValue" : 20, "Increment" : 1 },
"Legendary" : { "MinValue" : 15, "MaxValue" : 25, "Increment" : 1 }
},
"SelectionWeight" : 1,
"Prefixes": [
"$mod_epicloot_me_modifyparryforce_prefix1",
"$mod_epicloot_me_modifyparryforce_prefix2"
],
"Suffixes": [
"$mod_epicloot_me_modifyparryforce_suffix1"
]
},
{
"Type" : "ModifyArmor",
"DisplayText" : "$mod_epicloot_me_modifyarmor_display",
Expand Down
9 changes: 7 additions & 2 deletions EpicLoot/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,15 @@
"mod_epicloot_me_modifyblockpower_suffix1": "Stopping",
"mod_epicloot_me_modifyblockpower_suffix2": "the Defender",
"mod_epicloot_me_modifyparry_display": "Parry +{0:0.#}%",
"mod_epicloot_me_modifyparry_desc": "Increase the parry block armor, parry force, and parry bonus of the magic by +<b><color=yellow>X</color></b>%.",
"mod_epicloot_me_modifyparry_desc": "Increase the parry block armor and parry bonus of the magic item by +<b><color=yellow>X</color></b>%.",
"mod_epicloot_me_modifyparry_prefix1": "Elusive",
"mod_epicloot_me_modifyparry_prefix2": "Rebuking",
"mod_epicloot_me_modifyparry_suffix1": "Repelling",
"mod_epicloot_me_modifyparryforce_display": "Parry Force +{0:0.#}%",
"mod_epicloot_me_modifyparryforce_desc": "Increase the parry force of the magic item by +<b><color=yellow>X</color></b>%.",
"mod_epicloot_me_modifyparryforce_prefix1": "Weighty",
"mod_epicloot_me_modifyparryforce_prefix2": "Ponderous",
"mod_epicloot_me_modifyparryforce_suffix1": "Tossing",
"mod_epicloot_me_modifyarmor_display": "Armor +{0:0.#}%",
"mod_epicloot_me_modifyarmor_desc": "Increase the armor value of the magic equipment by +<b><color=yellow>X</color></b>%.",
"mod_epicloot_me_modifyarmor_prefix1": "Heavy",
Expand Down Expand Up @@ -950,7 +955,7 @@
"mod_epicloot_me_opportunist_prefix1": "Opportunist's",
"mod_epicloot_me_opportunist_suffix1": "Opportunity",
"mod_epicloot_me_duelist_display": "Duelist +{0:0.#}%",
"mod_epicloot_me_duelist_desc": "When using the magic weapon without anything in the player's off hand, its block armor is increased by +<b><color=yellow>X</color></b>% of the weapon's attack power, and its parry force is increased by +<b><color=yellow>X/2</color></b>% of the weapon's attack power.",
"mod_epicloot_me_duelist_desc": "When using the magic weapon without anything in the player's off hand, its block armor is increased by +<b><color=yellow>X</color></b>%. Half of the effect value applied to parry force.",
"mod_epicloot_me_duelist_prefix1": "Duelist's",
"mod_epicloot_me_duelist_suffix1": "Dueling",
"mod_epicloot_me_immovable_display": "Immovable",
Expand Down