diff --git a/src/GameLogic/Attributes/Stats.cs b/src/GameLogic/Attributes/Stats.cs index d37a7bd08..e9a867261 100644 --- a/src/GameLogic/Attributes/Stats.cs +++ b/src/GameLogic/Attributes/Stats.cs @@ -284,7 +284,28 @@ public class Stats /// /// Gets the attack speed attribute definition. /// - public static AttributeDefinition AttackSpeed { get; } = new (new Guid("BACC1115-1E8B-4E62-B952-8F8DDB58A949"), "Attack Speed", string.Empty); + public static AttributeDefinition AttackSpeed { get; } = new(new Guid("BACC1115-1E8B-4E62-B952-8F8DDB58A949"), "Attack Speed", string.Empty) + { + MaximumValue = 200, + }; + + /// + /// Gets the attack speed by weapon attribute definition. + /// + public static AttributeDefinition AttackSpeedByWeapon { get; } = new(new Guid("45EEEDEE-C76B-40E6-A0BC-2B493E10B140"), "Attack Speed by Weapons", string.Empty); + + /// + /// Gets the attribute which says, if two weapons are equipped. + /// + public static AttributeDefinition AreTwoWeaponsEquipped { get; } = new(new Guid("56DA895D-BAFD-4A5C-9864-B17AB8369998"), "Are two weapons equipped", string.Empty) + { + MaximumValue = 1, + }; + + /// + /// Gets the attribute which counts the equipped weapons. + /// + public static AttributeDefinition EquippedWeaponCount { get; } = new(new Guid("15D6493F-549D-455F-9FFF-A0D589FD7DA2"), "Equipped Weapon Count", string.Empty); /// /// Gets the magic speed attribute definition which is used for some skills. diff --git a/src/Persistence/Initialization/CharacterClasses/CharacterClassInitialization.cs b/src/Persistence/Initialization/CharacterClasses/CharacterClassInitialization.cs index 4498203aa..1e22b81a6 100644 --- a/src/Persistence/Initialization/CharacterClasses/CharacterClassInitialization.cs +++ b/src/Persistence/Initialization/CharacterClasses/CharacterClassInitialization.cs @@ -107,6 +107,17 @@ private void AddCommonAttributeRelationships(ICollection attributeRelationships.Add(this.CreateAttributeRelationship(Stats.DefensePvm, 1, Stats.DefenseBase)); attributeRelationships.Add(this.CreateAttributeRelationship(Stats.DefensePvp, 1, Stats.DefenseBase)); + attributeRelationships.Add(this.CreateAttributeRelationship(Stats.AttackSpeed, 1, Stats.AttackSpeedByWeapon)); + attributeRelationships.Add(this.CreateAttributeRelationship(Stats.MagicSpeed, 1, Stats.AttackSpeedByWeapon)); + + // If two weapons are equipped we subtract the half of the sum of the speeds again from the attack speed + attributeRelationships.Add(this.CreateAttributeRelationship(Stats.AreTwoWeaponsEquipped, 1, Stats.EquippedWeaponCount)); + var tempSpeed = this.Context.CreateNew(Guid.NewGuid(), "Temp Half weapon attack speed", string.Empty); + this.GameConfiguration.Attributes.Add(tempSpeed); + attributeRelationships.Add(this.CreateAttributeRelationship(tempSpeed, -0.5f, Stats.AttackSpeedByWeapon)); + attributeRelationships.Add(this.CreateConditionalRelationship(Stats.AttackSpeed, Stats.AreTwoWeaponsEquipped, tempSpeed)); + attributeRelationships.Add(this.CreateConditionalRelationship(Stats.MagicSpeed, Stats.AreTwoWeaponsEquipped, tempSpeed)); + attributeRelationships.Add(this.CreateConditionalRelationship(Stats.DefenseBase, Stats.IsShieldEquipped, Stats.BonusDefenseWithShield)); var tempDefense = this.Context.CreateNew(Guid.NewGuid(), "Temp Defense Bonus multiplier with Shield", string.Empty); @@ -140,6 +151,7 @@ private void AddCommonBaseAttributeValues(ICollection baseA baseAttributeValues.Add(this.CreateConstValueAttribute(0.03f, Stats.PoisonDamageMultiplier)); baseAttributeValues.Add(this.CreateConstValueAttribute(1, Stats.ItemDurationIncrease)); baseAttributeValues.Add(this.CreateConstValueAttribute(2, Stats.AbilityRecoveryAbsolute)); + baseAttributeValues.Add(this.CreateConstValueAttribute(-1, Stats.AreTwoWeaponsEquipped)); if (isMaster) { diff --git a/src/Persistence/Initialization/VersionSeasonSix/Items/Weapons.cs b/src/Persistence/Initialization/VersionSeasonSix/Items/Weapons.cs index b1e768fa6..e8213df07 100644 --- a/src/Persistence/Initialization/VersionSeasonSix/Items/Weapons.cs +++ b/src/Persistence/Initialization/VersionSeasonSix/Items/Weapons.cs @@ -321,7 +321,7 @@ protected void CreateWeapon(byte @group, byte number, byte slot, int skillNumber maxDamagePowerUp.BonusPerLevelTable = this._weaponDamageIncreaseTable; item.BasePowerUpAttributes.Add(maxDamagePowerUp); - var speedPowerUp = this.CreateItemBasePowerUpDefinition(Stats.AttackSpeed, attackSpeed, AggregateType.AddRaw); + var speedPowerUp = this.CreateItemBasePowerUpDefinition(Stats.AttackSpeedByWeapon, attackSpeed, AggregateType.AddRaw); item.BasePowerUpAttributes.Add(speedPowerUp); this.CreateItemRequirementIfNeeded(item, Stats.Level, levelRequirement); @@ -368,6 +368,11 @@ protected void CreateWeapon(byte @group, byte number, byte slot, int skillNumber } } + if (height > 1) // exclude bolts and arrows + { + item.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.EquippedWeaponCount, 1, AggregateType.AddRaw)); + } + if (group == (int)ItemGroups.Bows && height > 1) { item.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.AmmunitionConsumptionRate, 1, AggregateType.AddRaw));