Skip to content

Commit

Permalink
The rest of the rebalance
Browse files Browse the repository at this point in the history
  • Loading branch information
Jofairden committed Sep 20, 2018
1 parent bc4c1c6 commit fd88223
Show file tree
Hide file tree
Showing 34 changed files with 67 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Core/ModifierProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public ModifierProperties RollMagnitudeAndPower(float magnitudePower = 1f, float

private float RollMagnitude(float magnitudePower, float lukStat)
{
float useMin = MinMagnitude * (1f + 0.01f * lukStat);
float useMin = MinMagnitude * (1f + magnitudePower / 10f);
float useMax = MaxMagnitude * magnitudePower;
float randomMag = (useMin + Main.rand.NextFloat() * (useMax - useMin));
return randomMag * MagnitudeStrength;
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/DodgeChance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class DodgeChance : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f, rollChance: 0.333f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/HealthPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class HealthPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 20f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f, rollChance: 0.333f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/ImmunityTimePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ImmunityTimePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 20f);
return base.GetModifierProperties(item).Set(maxMagnitude: 3f, rollChance: 0.222f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/LifeRegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class LifeRegen : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 45f);
return base.GetModifierProperties(item).Set(maxMagnitude: 15f, rollChance: 0.5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/ManaPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ManaPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 20f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f, rollChance: 0.333f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/ManaShield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ManaShield : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 6f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f, rollChance: 0.75f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/PercentDefenseBonus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class PercentDefenseBonus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/SurvivalChance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class SurvivalChance : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 15f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f, rollChance: 0.333f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Defensive/Thorns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Thorns : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 50f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/CritDamagePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class CritDamagePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 15f);
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 15f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/HealthyFoesBonus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class HealthyFoesBonus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 20f);
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 15f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/MagicCritPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MagicCritPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/MagicDamagePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MagicDamagePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/MeleeCritPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MeleeCritPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/MeleeDamagePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MeleeDamagePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/MinionDamagePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MinionDamagePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/RangedCritPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RangedCritPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/RangedDamagePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RangedDamagePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/ThrownCritPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ThrownCritPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Offensive/ThrownDamagePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ThrownDamagePlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Utility/FishingPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class FishingPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 8f);
return base.GetModifierProperties(item).Set(maxMagnitude: 2f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Utility/LightPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class LightPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
return base.GetModifierProperties(item).Set(maxMagnitude: 2f);
}

// todo Just pass ModifierPlayer here?
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Utility/LuckPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class LuckPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
return base.GetModifierProperties(item).Set(maxMagnitude: 2f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Utility/MiningSpeedPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MiningSpeedPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
return base.GetModifierProperties(item).Set(maxMagnitude: 7.5f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Utility/MoveSpeedPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MoveSpeedPlus : EquipModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 10f);
return base.GetModifierProperties(item).Set(basePower: 1/5f, maxMagnitude: 50f);
}

public override void UpdateEquip(Item item, Player player)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/EquipModifiers/Utility/WingTimePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class WingTimePlus : EquipModifier
{
public override ModifierTooltipLine[] TooltipLines => new[]
{
new ModifierTooltipLine { Text = $"+{Math.Round(Properties.RoundedPower/60, 2)}s flight time", Color = Color.LimeGreen},
new ModifierTooltipLine { Text = $"+{Math.Round(Properties.RoundedPower/60f, 2)}s flight time", Color = Color.LimeGreen},
};

public override ModifierProperties GetModifierProperties(Item item)
Expand Down
9 changes: 7 additions & 2 deletions Modifiers/WeaponDebuffModifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ public abstract class WeaponDebuffModifier : WeaponModifier
{
public override ModifierTooltipLine[] TooltipLines => new[]
{
new ModifierTooltipLine {Text = $"+{Properties.RoundedPower}% chance to inflict {GetBuffName()} for {BuffTime / 60f}s", Color = Color.Lime}
new ModifierTooltipLine {Text = $"+{Properties.RoundedPower}% chance to inflict {GetBuffName()} for {RoundedBuffTime()}s", Color = Color.Lime}
};

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 12.5f, roundPrecision: 1);
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 10f, roundPrecision: 1);
}

private float RoundedBuffTime()
{
return (float)Math.Round((double)BuffTime / 60f, Properties.RoundPrecision);
}

public abstract int BuffType { get; }
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/WeaponModifiers/DamagePlusDaytime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class DamagePlusDaytime : WeaponModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(basePower: 1/5f, minMagnitude: 10f, maxMagnitude: 50f, rollChance: 50f);
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 15f, rollChance: 2f);
}

private bool _duringDay;
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/WeaponModifiers/DamageWithManaCost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DamageWithManaCost : WeaponModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 12f);
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 15f);
}

public override bool CanRoll(ModifierContext ctx)
Expand Down
2 changes: 1 addition & 1 deletion Modifiers/WeaponModifiers/MissingHealthDamage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MissingHealthDamage : WeaponModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(minMagnitude: 2f, maxMagnitude: 10f);
return base.GetModifierProperties(item).Set(minMagnitude: 5f, maxMagnitude: 15f);
}

public override void GetWeaponDamage(Item item, Player player, ref int damage)
Expand Down
35 changes: 28 additions & 7 deletions Modifiers/WeaponModifiers/RandomDebuff.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Loot.Core;
using System.Collections.Generic;
using System.IO;
Expand All @@ -15,12 +16,12 @@ public sealed class RandomDebuff : WeaponDebuffModifier
{
internal static DebuffTrigger[] BuffPairs =
{
new DebuffTrigger {BuffType = BuffID.Confused, BuffTime = 120, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.CursedInferno, BuffTime = 180, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.Frostburn, BuffTime = 240, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.OnFire, BuffTime = 300, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.Poisoned, BuffTime = 480, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.Ichor, BuffTime = 180, InflictionChance = 1f}
new DebuffTrigger {BuffType = BuffID.Confused, BuffTime = 100, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.CursedInferno, BuffTime = 100, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.Frostburn, BuffTime = 100, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.OnFire, BuffTime = 100, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.Poisoned, BuffTime = 100, InflictionChance = 1f},
new DebuffTrigger {BuffType = BuffID.Ichor, BuffTime = 100, InflictionChance = 1f}
};

private readonly int _len = BuffPairs.GetLength(0);
Expand All @@ -32,24 +33,42 @@ public override void NetReceive(Item item, BinaryReader reader)
{
base.NetReceive(item, reader);
_index = reader.ReadInt32();
_timeScaleFactor = reader.ReadSingle();
}

public override void NetSend(Item item, BinaryWriter writer)
{
base.NetSend(item, writer);
writer.Write(_index);
writer.Write(_timeScaleFactor);
}

public override void Save(Item item, TagCompound tag)
{
base.Save(item, tag);
tag.Add("_index", _index);
tag.Add("_timeScaleFactor", _timeScaleFactor);
}

public override void Load(Item item, TagCompound tag)
{
base.Load(item, tag);
_index = tag.GetAsInt("_index");
// Showcase rolling a stat properly that previously wasn't present
if (tag.ContainsKey("_timeScaleFactor"))
{
_timeScaleFactor = tag.GetAsShort("timeScaleFactor");
if (_timeScaleFactor <= 0f) RollTimeScaleFactor();
}
else
{
RollTimeScaleFactor();
}
}

private void RollTimeScaleFactor()
{
_timeScaleFactor = (0.5f + Main.rand.NextFloat() * (0.25f)) + Properties.Power / 100f;
}

public override void Roll(ModifierContext ctx, IEnumerable<Modifier> rolledModifiers)
Expand All @@ -62,6 +81,7 @@ public override void Roll(ModifierContext ctx, IEnumerable<Modifier> rolledModif
var rollableBuffTypes = BuffPairs.Select(x => x.BuffType).Except(similarModsBuffTypes);
int randBuffIndex = Main.rand.Next(rollableBuffTypes.Count());
_index = BuffPairs.ToList().FindIndex(x => x.BuffType == rollableBuffTypes.ElementAt(randBuffIndex));
RollTimeScaleFactor();
}

public override bool PostRoll(ModifierContext ctx, IEnumerable<Modifier> rolledModifiers)
Expand All @@ -74,8 +94,9 @@ public override bool PostRoll(ModifierContext ctx, IEnumerable<Modifier> rolledM
.All(x => x?.GetRolledIndex() != _index);
}

private float _timeScaleFactor = 1f;
public override int BuffType => BuffPairs[_index].BuffType;
public override int BuffTime => BuffPairs[_index].BuffTime;
public override int BuffTime => (int)(BuffPairs[_index].BuffTime * _timeScaleFactor);
public override float BuffInflictionChance => BuffPairs[_index].InflictionChance;
}
}
2 changes: 1 addition & 1 deletion Modifiers/WeaponModifiers/SpeedPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SpeedPlus : WeaponModifier

public override ModifierProperties GetModifierProperties(Item item)
{
return base.GetModifierProperties(item).Set(maxMagnitude: 5f);
return base.GetModifierProperties(item).Set(basePower: 1/5f, maxMagnitude: 25f);
}

public override void Apply(Item item)
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = Jofairden
version = 0.1.1.2
version = 0.1.2.0
displayName = Even More Modifiers
homepage = https://forums.terraria.org/index.php?threads/even-more-modifiers-relaunch-beta.68438/
hideCode = false
Expand Down

0 comments on commit fd88223

Please sign in to comment.