Use rune natural attack speed for unarmed mobs
Unarmed mobs used a flat 5000 ms swing delay. Parse rune_naturalattacks from the rune template and use its speed (x100 ms) instead, with the AttackDelay modifier and 1.0 s floor applied as for weapons. Siege engines now fire every 17.5 s (speed 175); most creatures swing every 3.5 s. Falls back to 5000 ms when the rune has no natural attack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab1c3f12d3
commit
9aa44d4e9a
2 files changed
+54
No files matched your search
@@ -215,6 +215,22 @@ public enum CombatManager {
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
|
||||
delay = (long)wepSpeed * 100L;
|
||||
} else if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||
|
||||
//unarmed mob, use the natural attack speed from its rune
|
||||
|
||||
float naturalSpeed = getNaturalAttackSpeed((Mob) attacker, slot);
|
||||
|
||||
if (naturalSpeed > 0) {
|
||||
|
||||
if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None) != 0f) //add effects speed bonus
|
||||
naturalSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None));
|
||||
|
||||
if (naturalSpeed < 10)
|
||||
naturalSpeed = 10;
|
||||
|
||||
delay = (long) naturalSpeed * 100L;
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -646,6 +662,25 @@ public enum CombatManager {
|
||||
|
||||
}
|
||||
|
||||
public static float getNaturalAttackSpeed(Mob mob, mbEnums.EquipSlotType slot) {
|
||||
|
||||
// Returns the rune natural attack speed (x100 ms) for this hand, or 0 if the rune has none.
|
||||
|
||||
ItemTemplate rune = ItemTemplate.templates.get(mob.loadID);
|
||||
int hand = slot.equals(mbEnums.EquipSlotType.LHELD) ? 2 : 1;
|
||||
|
||||
if (rune == null || rune.rune_natural_attacks.isEmpty())
|
||||
return 0;
|
||||
|
||||
for (float[] attack : rune.rune_natural_attacks)
|
||||
if (attack.length > 3 && (int) attack[3] == hand)
|
||||
return attack[0];
|
||||
|
||||
// No entry for this hand, fall back to the first natural attack
|
||||
|
||||
return rune.rune_natural_attacks.get(0)[0];
|
||||
}
|
||||
|
||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
||||
//damage calc for pet
|
||||
float range;
|
||||
|
||||
Reference in new issue
Block a user