Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: recklessness updates #3074

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions Source/ACE.Server/Entity/DamageEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class DamageEvent

public float DamageRatingBaseMod;
public float RecklessnessMod;
public bool SelfReckless;
public float SneakAttackMod;
public float HeritageMod;

Expand Down Expand Up @@ -209,7 +210,7 @@ private float DoCalculateDamage(Creature attacker, Creature defender, WorldObjec

// ratings
DamageRatingBaseMod = Creature.GetPositiveRatingMod(attacker.GetDamageRating());
RecklessnessMod = Creature.GetRecklessnessMod(attacker, defender);
RecklessnessMod = Creature.GetRecklessnessMod(attacker, defender, out SelfReckless);
SneakAttackMod = attacker.GetSneakAttackMod(defender);
HeritageMod = attacker.GetHeritageBonus(Weapon) ? 1.05f : 1.0f;

Expand Down Expand Up @@ -578,7 +579,7 @@ public AttackConditions AttackConditions

if (CriticalDefended)
attackConditions |= AttackConditions.CriticalProtectionAugmentation;
if (RecklessnessMod > 1.0f)
if (RecklessnessMod > 1.0f && SelfReckless)
attackConditions |= AttackConditions.Recklessness;
if (SneakAttackMod > 1.0f)
attackConditions |= AttackConditions.SneakAttack;
Expand Down
29 changes: 18 additions & 11 deletions Source/ACE.Server/WorldObjects/Creature_Combat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,22 +719,29 @@ public float GetShieldMod(WorldObject attacker, DamageType damageType, WorldObje
/// Returns the total applicable Recklessness modifier,
/// taking into account both attacker and defender players
/// </summary>
public static float GetRecklessnessMod(Creature attacker, Creature defender)
public static float GetRecklessnessMod(Creature attacker, Creature defender, out bool selfReckless)
{
var playerAttacker = attacker as Player;
var playerDefender = defender as Player;

var recklessnessMod = 1.0f;

// multiplicative or additive?
// multiplicative or additive? (probably additive)
// defender is a negative Damage Reduction Rating
// 20 DR combined with 20 DRR = 1.2 * 0.8333... = 1.0
// 20 DR combined with -20 DRR = 1.2 * 1.2 = 1.44
if (playerAttacker != null)
recklessnessMod *= playerAttacker.GetRecklessnessMod();
// should be 1.4

var recklessRatingSelf = 0;
var recklessRatingTarget = 0;

selfReckless = false;

if (attacker is Player playerAttacker)
{
recklessRatingSelf = playerAttacker.GetRecklessRating();
selfReckless = recklessRatingSelf > 0;
}

if (defender is Player playerDefender)
recklessRatingTarget = playerDefender.GetRecklessRating();

if (playerDefender != null)
recklessnessMod *= playerDefender.GetRecklessnessMod();
var recklessnessMod = GetPositiveRatingMod(recklessRatingSelf + recklessRatingTarget);

return recklessnessMod;
}
Expand Down
18 changes: 10 additions & 8 deletions Source/ACE.Server/WorldObjects/Player_Combat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,27 +612,27 @@ public int GetAttackStamina(PowerAccuracy powerAccuracy)
}

/// <summary>
/// Returns the damage rating modifier for an applicable Recklessness attack
/// Returns the damage rating increase for an applicable Recklessness attack
/// </summary>
/// <param name="powerAccuracyBar">The 0.0 - 1.0 power/accurary bar</param>
public float GetRecklessnessMod(/*float powerAccuracyBar*/)
public int GetRecklessRating(/*float powerAccuracyBar*/)
{
// ensure melee or missile combat mode
if (CombatMode != CombatMode.Melee && CombatMode != CombatMode.Missile)
return 1.0f;
return 0;

var skill = GetCreatureSkill(Skill.Recklessness);

// recklessness skill must be either trained or specialized to use
if (skill.AdvancementClass < SkillAdvancementClass.Trained)
return 1.0f;
return 0;

// recklessness is active when attack bar is between 20% and 80% (according to wiki)
// client attack bar range seems to indicate this might have been updated, between 10% and 90%?
var powerAccuracyBar = GetPowerAccuracyBar();
//if (powerAccuracyBar < 0.2f || powerAccuracyBar > 0.8f)
if (powerAccuracyBar < 0.1f || powerAccuracyBar > 0.9f)
return 1.0f;
return 0;

// recklessness only applies to non-critical hits,
// which is handled outside of this method.
Expand All @@ -655,9 +655,11 @@ public float GetRecklessnessMod(/*float powerAccuracyBar*/)
// The damage rating adjustment for incoming damage is also adjusted proportinally if your Recklessness skill
// is lower than your active attack skill

var recklessnessMod = GetDamageRating(damageRating); // trained DR 1.10 = 10% additional damage
// specialized DR 1.20 = 20% additional damage
return recklessnessMod;
//var recklessnessMod = GetDamageRating(damageRating); // trained DR 1.10 = 10% additional damage
// specialized DR 1.20 = 20% additional damage

// return as rating here, instead of multiplier, for easier combination
return damageRating;
}

/// <summary>
Expand Down