Skip to content

Commit

Permalink
Fix damage add cap
Browse files Browse the repository at this point in the history
* The cap was 11.34 at level 50, which for example prevented Reaver's level 36 and 44 self damage adds from using their full value.
* Fixed by removing the cap if the caster is also the recipient.
* Note: `EffectService.RestoreAllEffects` is flawed and restore effects by using the effect's target as the caster of the spell. This will allow players to bypass the cap (albeit with a very high variance, probably).
  • Loading branch information
bm01 committed Aug 2, 2024
1 parent 6b564b1 commit db8eab3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 30 deletions.
11 changes: 3 additions & 8 deletions GameServer/realmabilities/handlers/AngerOfTheGodsAbility.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using DOL.GS;
using DOL.GS.PacketHandler;
using DOL.Database;
using DOL.GS.Spells;

namespace DOL.GS.RealmAbilities
{
public class AngerOfTheGodsAbility : TimedRealmAbility
{
public class AngerOfTheGodsAbility : TimedRealmAbility
{
private DbSpell m_dbspell;
private Spell m_spell = null;
private SpellLine m_spellline;
Expand Down Expand Up @@ -56,10 +52,9 @@ protected void CastSpell(GameLiving target)
if (target.IsAlive && m_spell != null)
{
ISpellHandler dd = ScriptMgr.CreateSpellHandler(m_player, m_spell, m_spellline);
dd.IgnoreDamageCap = true;
dd.StartSpell(target);
}
}
}

public override int GetReUseDelay(int level)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ protected virtual void Execute(string name, int icon, int clientEffect, int dama
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED))
return;

if (living is GamePlayer)
CreateSpell(name, icon, clientEffect, damageType, GetDamageAddAmount(living));

ISpellHandler spellHandler = ScriptMgr.CreateSpellHandler(living, m_spell, m_spellline);
spellHandler.IgnoreDamageCap = true;

ISpellHandler spellHandler = ScriptMgr.CreateSpellHandler(living, m_spell, m_spellline);
new AtlasOF_RainOfBaseECSEffect(new ECSGameEffectInitParams(living, duration, 1, spellHandler));
DisableSkill(living);
}
Expand Down
3 changes: 1 addition & 2 deletions GameServer/spells/DamageAddAndShield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public override void Handle(AttackData attackData, double effectiveness)
if (Spell.Damage > 0)
{
CalculateDamageVariance(target, out double minVariance, out double maxVariance);
double dpsCap = (1.2 + 0.3 * attacker.Level) * 0.7;
double dps = IgnoreDamageCap ? Spell.Damage : Math.Min(Spell.Damage, dpsCap);
double dps = Caster == Target ? Spell.Damage : Math.Min(Spell.Damage, (1.2 + 0.3 * attacker.Level) * 0.7);
effectiveness *= 1 + Caster.GetModified(eProperty.BuffEffectiveness) * 0.01;
damage = dps * effectiveness * attackData.WeaponSpeed * 0.001;
damage = Util.Random((int) (damage * minVariance), (int) (damage * maxVariance));
Expand Down
7 changes: 1 addition & 6 deletions GameServer/spells/ISpellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ public interface ISpellHandler
/// </summary>
bool AllowCoexisting { get; }

/// <summary>
/// Does this spell ignore all damage caps?
/// </summary>
bool IgnoreDamageCap { get; set; }

long CastStartTick { get; }
long CastStartTick { get; }
/// <summary>
/// Should this spell use the minimum variance for the type?
/// Followup style effects, for example, always use the minimum variance
Expand Down
11 changes: 0 additions & 11 deletions GameServer/spells/SpellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,7 @@ public virtual bool UnstealthCasterOnFinish
/// </summary>
public const string INTERRUPT_TIMEOUT_PROPERTY = "CAST_INTERRUPT_TIMEOUT";

protected bool m_ignoreDamageCap = false;
private long _lastDuringCastLosCheckTime;

/// <summary>
/// Does this spell ignore any damage cap?
/// </summary>
public bool IgnoreDamageCap
{
get { return m_ignoreDamageCap; }
set { m_ignoreDamageCap = value; }
}

protected bool m_useMinVariance = false;

/// <summary>
Expand Down

0 comments on commit db8eab3

Please sign in to comment.