Fixed elf master skill s and added extra projectile attribute

(cherry picked from commit 983db566e6ac315acdcda5d1ac35cdf12d49c8bf)
This commit is contained in:
ze-dom
2026-07-16 11:04:36 +01:00
committed by Acentech Dev
parent 7325e1a1d6
commit 7166513681
10 changed files with 61 additions and 42 deletions

View File

@@ -91,7 +91,7 @@ public static class AttackableExtensions
else
{
var defenseAttribute = defender.GetDefenseAttribute(attacker);
defense = (int)(defender.Attributes[defenseAttribute] * defender.Attributes[Stats.DefenseDecrement]);
defense = (int)((defender.Attributes[defenseAttribute] + defender.Attributes[Stats.GreaterDefenseBonus]) * defender.Attributes[Stats.DefenseDecrement]);
if (defense < 0)
{
defense = 0;
@@ -378,7 +378,7 @@ public static class AttackableExtensions
if (regeneration != null)
{
var regenerationValue = player.Attributes.CreateElement(powerUpDefinition);
var value = skillEntry.Level == 0 ? regenerationValue.Value : regenerationValue.Value + skillEntry.CalculateValue();
var value = regenerationValue.Value + (skillEntry.Level == 0 ? 0 : regenerationValue.Value * skillEntry.CalculateValue() / 100);
target.Attributes[regeneration.CurrentAttribute] = Math.Min(
target.Attributes[regeneration.CurrentAttribute] + value,
target.Attributes[regeneration.MaximumAttribute]);

View File

@@ -17,8 +17,8 @@ public class MonsterAttributeHolder : IAttributeSystem
new Dictionary<AttributeDefinition, Func<AttackableNpcBase, float>>
{
{ Stats.CurrentHealth, m => m.Health },
{ Stats.DefensePvm, m => m.Attributes.GetValueOfAttribute(Stats.DefenseBase) + ((m as Monster)?.SummonedBy?.Attributes?[Stats.SummonedMonsterDefenseIncrease] ?? 0) },
{ Stats.DefensePvp, m => m.Attributes.GetValueOfAttribute(Stats.DefenseBase) + ((m as Monster)?.SummonedBy?.Attributes?[Stats.SummonedMonsterDefenseIncrease] ?? 0) },
{ Stats.DefensePvm, m => m.Attributes.GetValueOfAttribute(Stats.DefenseBase) * (1 + ((m as Monster)?.SummonedBy?.Attributes?[Stats.SummonedMonsterDefenseIncrease] ?? 0)) },
{ Stats.DefensePvp, m => m.Attributes.GetValueOfAttribute(Stats.DefenseBase) * (1 + ((m as Monster)?.SummonedBy?.Attributes?[Stats.SummonedMonsterDefenseIncrease] ?? 0)) },
{ Stats.DamageReceiveDecrement, m => 1.0f },
{ Stats.AttackDamageIncrease, m => 1.0f },
{ Stats.MovementSpeedFactor, m => 1.0f },

View File

@@ -1,4 +1,4 @@
// <copyright file="Stats.cs" company="MUnique">
// <copyright file="Stats.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
@@ -524,6 +524,12 @@ public class Stats
/// </summary>
public static AttributeDefinition CrossBowMasteryBonusDamage { get; } = new(new Guid("B3AF7F51-6D6B-42FB-B8FF-689D03890F3E"), "Cross Bow Mastery PvP Bonus Damage (MST)", string.Empty);
/// <summary>
/// Gets the extra projectiles attribute definition.
/// </summary>
/// <remarks>Can be increased by equipping certain (cross)bows and/or unlocking triple shot mastery.</remarks>
public static AttributeDefinition ExtraProjectiles { get; } = new(new Guid("B9E4F3C2-A1D5-4B8E-7F2C-6D3A9E1F5C8B"), "Extra Projectiles", "The number of extra projectiles shot with triple shot skill.");
/// <summary>
/// Gets elf's melee attack mode attribute definition.
/// </summary>
@@ -554,6 +560,11 @@ public class Stats
/// </summary>
public static AttributeDefinition ArcheryMaxDmg { get; } = new(new Guid("EC807B7C-4004-4D13-BED2-326E13F8EFEB"), "Archery Maximum Damage", "The elf's maximum archery damage, which is added to projectile weapon attacks.");
/// <summary>
/// Gets the elf's greater defense buff bonus defense attribute definition.
/// </summary>
public static AttributeDefinition GreaterDefenseBonus { get; } = new(new Guid("5A7C3E9B-D1F4-4B82-8A6D-2F3E1C9B7A4D"), "Greater Defense Bonus", string.Empty);
/// <summary>
/// Gets the elf's greater damage buff bonus damage attribute definition.
/// </summary>
@@ -729,7 +740,7 @@ public class Stats
public static AttributeDefinition SummonedMonsterHealthIncrease { get; } = new(new Guid("7B0625C8-DA1A-4A5D-BCA5-26AACDA0BDC6"), "Summoned Monster Health Increase %", string.Empty);
/// <summary>
/// Gets the summoned monster defense increase, absolute.
/// Gets the summoned monster defense increase, percentage.
/// </summary>
public static AttributeDefinition SummonedMonsterDefenseIncrease { get; } = new(new Guid("0D55CFCA-751F-4E66-B327-635576A9A0B3"), "Summoned Monster Defense Increase", string.Empty);
@@ -775,7 +786,7 @@ public class Stats
/// <see cref="AggregateType.Multiplicate"/> values include:
/// <see cref="DefenseIncreaseWithEquippedShield"/>.
/// <see cref="AggregateType.AddFinal"/> values include:
/// Greater defense buff; MST bonus defense with shield (shield strengthener); MST dark horse strengthener; Jack O'Lantern Cry bonus (halved); Berserker defense reduction.
/// MST bonus defense with shield (shield strengthener); MST dark horse strengthener; Jack O'Lantern Cry bonus (halved); Berserker defense reduction.
/// </remarks>
public static AttributeDefinition DefenseFinal { get; } = new(new Guid("0888AD48-0CC8-47CA-B6A3-99F3771AA5FC"), "Final Defense", string.Empty);

View File

@@ -1646,11 +1646,9 @@ public class Player : AsyncDisposable, IBucketMapObserver, IAttackable, IAttacke
var durationExtended = false;
foreach (var powerUpDef in powerUps)
{
IElement powerUp;
IElement powerUp = this.Attributes!.CreateElement(powerUpDef);
if (skillEntry.Level > 0)
{
powerUp = this.Attributes!.CreateElement(powerUpDef);
foreach (var masterSkillEntry in GetMasterSkillEntries(skillEntry))
{
var extendsDuration = masterSkillEntry.Skill?.MasterDefinition?.ExtendsDuration ?? false;
@@ -1658,13 +1656,9 @@ public class Player : AsyncDisposable, IBucketMapObserver, IAttackable, IAttacke
{
durationElement = new CombinedElement(durationElement, new ConstantElement(masterSkillEntry.CalculateValue()));
}
else if (extendsDuration)
if (masterSkillEntry.Skill?.MasterDefinition?.TargetAttribute is not null)
{
continue;
}
else
{
// Apply either for all, or just for the specified TargetAttribute of the master skill
powerUp = AppedMasterSkillPowerUp(masterSkillEntry, powerUpDef, powerUp);
}
}
@@ -1672,10 +1666,6 @@ public class Player : AsyncDisposable, IBucketMapObserver, IAttackable, IAttacke
// After the first iteration all possible duration extensions have been applied
durationExtended = true;
}
else
{
powerUp = this.Attributes!.CreateElement(powerUpDef);
}
result[i] = (powerUpDef.TargetAttribute!, powerUp);
i++;
@@ -1694,15 +1684,12 @@ public class Player : AsyncDisposable, IBucketMapObserver, IAttackable, IAttacke
IElement AppedMasterSkillPowerUp(SkillEntry masterSkillEntry, PowerUpDefinition powerUpDef, IElement powerUp)
{
if (masterSkillEntry.Skill?.MasterDefinition is not { } masterSkillDefinition)
{
return powerUp;
}
var masterSkillDefinition = masterSkillEntry.Skill!.MasterDefinition!;
if (masterSkillDefinition.TargetAttribute is { } masterSkillTargetAttribute
&& masterSkillTargetAttribute == powerUpDef.TargetAttribute)
if (masterSkillDefinition.TargetAttribute == powerUpDef.TargetAttribute
&& masterSkillDefinition.Aggregation == powerUp.AggregateType)
{
var additionalValue = new SimpleElement(masterSkillEntry.CalculateValue(), masterSkillEntry.Skill.MasterDefinition?.Aggregation ?? powerUp.AggregateType);
var additionalValue = new SimpleElement(masterSkillEntry.CalculateValue(), masterSkillDefinition.Aggregation);
powerUp = new CombinedElement(powerUp, additionalValue);
}
@@ -1770,7 +1757,6 @@ public class Player : AsyncDisposable, IBucketMapObserver, IAttackable, IAttacke
area.MaximumHealthOverride = (int)monster.Attributes[Stats.MaximumHealth];
area.MaximumHealthOverride += (int)(monster.Attributes[Stats.MaximumHealth] * this.Attributes?[Stats.SummonedMonsterHealthIncrease] ?? 0);
// todo: Stats.SummonedMonsterDefenseIncrease
this.Summon = (monster, intelligence);
monster.Initialize();
await gameMap.AddAsync(monster).ConfigureAwait(false);

View File

@@ -237,7 +237,6 @@ public class AreaSkillAttackAction
var minAttacks = areaSkillSettings.MinimumNumberOfHitsPerAttack == 0 ? maxAttacks : areaSkillSettings.MinimumNumberOfHitsPerAttack;
var currentDelay = TimeSpan.Zero;
// Order targets by distance to process nearest targets first
var orderedTargets = targets.ToList();
FrustumBasedTargetFilter? filter = null;
var projectileCount = 1;
@@ -245,9 +244,10 @@ public class AreaSkillAttackAction
if (areaSkillSettings is { UseFrustumFilter: true, ProjectileCount: > 1 })
{
// Order targets by distance to process nearest targets first
orderedTargets.Sort((a, b) => player.GetDistanceTo(a).CompareTo(player.GetDistanceTo(b)));
filter = FrustumFilters.GetOrAdd(areaSkillSettings, static s => new FrustumBasedTargetFilter(s.FrustumStartWidth, s.FrustumEndWidth, s.FrustumDistance, s.ProjectileCount));
projectileCount = areaSkillSettings.ProjectileCount;
projectileCount = areaSkillSettings.ProjectileCount + (int)(player.Attributes?[Stats.ExtraProjectiles] ?? 0);
attackRounds = 1; // One attack round per projectile
extraTarget = orderedTargets.FirstOrDefault(t => t.Id == extraTargetId);
@@ -256,7 +256,7 @@ public class AreaSkillAttackAction
// In this case we just calculate the angle on server side, so that lags
// or desynced positions may not have such a big impact
var angle = (float)player.Position.GetAngleDegreeTo(extraTarget.Position);
rotation = (byte)((angle / 360.0f) * 256.0f);
rotation = (byte)(angle / 360.0f * 256.0f);
}
}

View File

@@ -19,8 +19,9 @@ public sealed class SkillList : ISkillList, IDisposable
private const ushort DurabilityReduction1FistMasterSkillId = 578;
private const short TwistingSlashMasterySkillId = 332;
private const short RagefulBlowMasterySkillId = 333;
private const short TripleShotMasterySkillId = 418;
private readonly short[] _castedSkillsWithPassiveBoost = [TwistingSlashMasterySkillId, RagefulBlowMasterySkillId];
private readonly short[] _castedSkillsWithPassiveBoost = [TwistingSlashMasterySkillId, RagefulBlowMasterySkillId, TripleShotMasterySkillId];
private readonly IDictionary<ushort, SkillEntry> _availableSkills;