diff --git a/utils/sql/git/required/2014_09_09_attack_delay.sql b/utils/sql/git/required/2014_09_09_attack_delay.sql new file mode 100644 index 000000000..87efa043a --- /dev/null +++ b/utils/sql/git/required/2014_09_09_attack_delay.sql @@ -0,0 +1,3 @@ +ALTER TABLE `npc_types` ADD `attack_delay` TINYINT(3) UNSIGNED DEFAULT '30' NOT NULL AFTER `attack_speed`; +UPDATE `npc_types` SET `attack_delay` = 36 + 36 * (`attack_speed` / 100); +UPDATE `npc_types` SET `attack_delay` = 30 WHERE `attack_speed` = 0; diff --git a/zone/attack.cpp b/zone/attack.cpp index e4aa80225..a694351cb 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4907,7 +4907,7 @@ void Client::SetAttackTimer() void NPC::SetAttackTimer() { - float PermaHaste = GetPermaHaste(); + float PermaHaste = GetPermaHaste() * 100.0f; //default value for attack timer in case they have //an invalid weapon equipped: @@ -4941,7 +4941,7 @@ void NPC::SetAttackTimer() // What they do is take the lower of their set delay and the weapon's // ex. Mob's delay set to 20, weapon set to 19, delay 19 // Mob's delay set to 20, weapon set to 21, delay 20 - int speed = static_cast((36 * (100 + DelayMod) / 100) * (100.0f + attack_speed) * PermaHaste); + int speed = static_cast((attack_delay * (100 + DelayMod) / 100) * PermaHaste); TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true); } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 73c3ec068..fdce628c4 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -174,8 +174,9 @@ Mob::Mob(const char* in_name, drakkin_heritage = in_drakkin_heritage; drakkin_tattoo = in_drakkin_tattoo; drakkin_details = in_drakkin_details; - attack_speed= 0; - slow_mitigation= 0; + attack_speed = 0; + attack_delay = 0; + slow_mitigation = 0; findable = false; trackable = true; has_shieldequiped = false; diff --git a/zone/mob.h b/zone/mob.h index 16c45ce1f..b1c40c72f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1053,6 +1053,7 @@ protected: Timer attack_dw_timer; Timer ranged_timer; float attack_speed; //% increase/decrease in attack speed (not haste) + int8 attack_delay; //delay between attacks in 10ths of seconds float slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%) Timer tic_timer; Timer mana_timer; diff --git a/zone/npc.cpp b/zone/npc.cpp index 151852a2b..8804c488b 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -248,6 +248,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float delaytimer = false; combat_event = false; attack_speed = d->attack_speed; + attack_delay = d->attack_delay; slow_mitigation = d->slow_mitigation; EntityList::RemoveNumbers(name); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 787e3a94e..9bf5cb9d3 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1045,6 +1045,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { "npc_types.adventure_template_id," "npc_types.trap_template," "npc_types.attack_speed," + "npc_types.attack_delay," "npc_types.STR," "npc_types.STA," "npc_types.DEX," @@ -1148,6 +1149,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->adventure_template = atoi(row[r++]); tmpNPCType->trap_template = atoi(row[r++]); tmpNPCType->attack_speed = atof(row[r++]); + tmpNPCType->attack_delay = atoi(row[r++]); tmpNPCType->STR = atoi(row[r++]); tmpNPCType->STA = atoi(row[r++]); tmpNPCType->DEX = atoi(row[r++]); @@ -3233,4 +3235,4 @@ void ZoneDatabase::StoreCharacterLookup(uint32 char_id) { " FROM `character_` " " WHERE `id` = %i ", char_id); QueryDatabase(c_lookup); -} \ No newline at end of file +} diff --git a/zone/zonedump.h b/zone/zonedump.h index 0d2bcb1d2..a96d276cd 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -111,6 +111,7 @@ struct NPCType uint8 spawn_limit; //only this many may be in zone at a time (0=no limit) uint8 mount_color; //only used by horse class float attack_speed; //%+- on attack delay of the mob. + uint8 attack_delay; //delay between attacks in 10ths of a second int accuracy_rating; //10 = 1% accuracy int avoidance_rating; //10 = 1% avoidance bool findable; //can be found with find command