diff --git a/changelog/snippets/fix.6121.md b/changelog/snippets/fix.6121.md new file mode 100644 index 0000000000..79f894d5ad --- /dev/null +++ b/changelog/snippets/fix.6121.md @@ -0,0 +1,3 @@ +- (#6121) Fix UEF SACU fire rate upgrade using inaccurate fire rate value. + + The upgrade displayed 1.82x fire rate, but in fact provided 2x fire rate because of how fire rate is rounded to game ticks. diff --git a/loc/RU/strings_db.lua b/loc/RU/strings_db.lua index dbd29558df..3f7af81948 100644 --- a/loc/RU/strings_db.lua +++ b/loc/RU/strings_db.lua @@ -1860,7 +1860,7 @@ Unit_Description_0019="Заменяет персональный щит АКБП Unit_Description_0020="Добавляет радиолокационный глушитель, создающий вокруг АКБП ложные цели на радаре. Бесполезен в зоне действия всеволнового сенсора." Unit_Description_0021="Увеличивает выработку ресурсов АКБП на 10 материи/сек и 1000 энергии/сек." Unit_Description_0022="Значительно увеличивает дальность действия сенсоров АКБП." -Unit_Description_0023="Позволяет главному орудию АКБП стрелять в 1,82 раза чаще." +Unit_Description_0023="Позволяет главному орудию АКБП стрелять в 2 раза чаще." Unit_Description_0024="Усиливает стрельбу АКБП эффектом ударной волны, также значительно увеличивается дальнобойность орудия." -- UEF -- Land Units Unit_Description_0025="Быстрая разведывательная машина. Оснащена легким пулеметом и стандартным набором сенсоров." diff --git a/loc/US/strings_db.lua b/loc/US/strings_db.lua index f7f741d84d..97eb7db75d 100644 --- a/loc/US/strings_db.lua +++ b/loc/US/strings_db.lua @@ -1447,7 +1447,7 @@ Unit_Description_0019="Replaces the SACU's Personal Shield with a Bubble Shield Unit_Description_0020="Adds a Radar Jammer which creates false radar images. Countered by omni sensors." Unit_Description_0021="Increases SACU's resource generation by 10 mass per second and 1000 energy per second." Unit_Description_0022="Greatly expands the range of the standard on-board SACU sensor systems.\n\n+64 Omni Radius\n+15 Vision Radius" -Unit_Description_0023="Primary weapon now fires 1.82 times as fast.\n\n+82% Rate of Fire" +Unit_Description_0023="Primary weapon now fires twice as fast.\n\n+100% Rate of Fire" Unit_Description_0024="Equips the standard SACU Cannon with Area-Of-Effect damage and much higher range.\n\n+10 Main cannon range\n+2 Main cannon damage radius" -- UEF -- Land Units diff --git a/tests/blueprint/unit.spec.lua b/tests/blueprint/unit.spec.lua index afa30affef..4e493884fa 100644 --- a/tests/blueprint/unit.spec.lua +++ b/tests/blueprint/unit.spec.lua @@ -55,6 +55,48 @@ end ------------------------------------------------------------------------------- + +-- The game runs in ticks and therefore not every rate of +-- fire is possible. The game will round the rate of fire, +-- but as a result minor changes may not always have an +-- actual impact in-game. These tests guarantee that when +-- a rate of fire is adjusted that it is always the actual +-- rate of fire that the game uses. +---@param rateOfFire number +local function rateOfFireTest(rateOfFire) + return function() + luft.expect(rateOfFire).to.be.number() + + if rateOfFire > 6.6666 then + luft.expect(rateOfFire).to.be.close.to(10) + elseif rateOfFire > 4.0 then + luft.expect(rateOfFire).to.be.close.to(5) + elseif rateOfFire > 2.8571 then + luft.expect(rateOfFire).to.be.close.to(3.333) + elseif rateOfFire > 2.2222 then + luft.expect(rateOfFire).to.be.close.to(2.5) + elseif rateOfFire > 1.8182 then + luft.expect(rateOfFire).to.be.close.to(2.0) + elseif rateOfFire > 1.5384 then + luft.expect(rateOfFire).to.be.close.to(1.666) + elseif rateOfFire > 1.3333 then + luft.expect(rateOfFire).to.be.close.to(1.428) + elseif rateOfFire > 1.1765 then + luft.expect(rateOfFire).to.be.close.to(1.25) + elseif rateOfFire > 1.0526 then + luft.expect(rateOfFire).to.be.close.to(1.111) + elseif rateOfFire > 0.9524 then + luft.expect(rateOfFire).to.be.close.to(1.0) + elseif rateOfFire > 0.8696 then + luft.expect(rateOfFire).to.be.close.to(0.909) + elseif rateOfFire > 0.8 then + luft.expect(rateOfFire).to.be.close.to(0.833) + elseif rateOfFire > 0.7407 then + luft.expect(rateOfFire).to.be.close.to(0.769) + end + end +end + -- this file is generated by the bash script that runs the test dofile("./tests/generated/unit-blueprint-list.lua") @@ -279,38 +321,45 @@ luft.describe( if rateOfFire then luft.test( "Rate of fire", - function() - - luft.expect(rateOfFire).to.be.number() - - if rateOfFire > 6.6666 then - luft.expect(rateOfFire).to.be.close.to(10) - elseif rateOfFire > 4.0 then - luft.expect(rateOfFire).to.be.close.to(5) - elseif rateOfFire > 2.8571 then - luft.expect(rateOfFire).to.be.close.to(3.333) - elseif rateOfFire > 2.2222 then - luft.expect(rateOfFire).to.be.close.to(2.5) - elseif rateOfFire > 1.8182 then - luft.expect(rateOfFire).to.be.close.to(2.0) - elseif rateOfFire > 1.5384 then - luft.expect(rateOfFire).to.be.close.to(1.666) - elseif rateOfFire > 1.3333 then - luft.expect(rateOfFire).to.be.close.to(1.428) - elseif rateOfFire > 1.1765 then - luft.expect(rateOfFire).to.be.close.to(1.25) - elseif rateOfFire > 1.0526 then - luft.expect(rateOfFire).to.be.close.to(1.111) - elseif rateOfFire > 0.9524 then - luft.expect(rateOfFire).to.be.close.to(1.0) - elseif rateOfFire > 0.8696 then - luft.expect(rateOfFire).to.be.close.to(0.909) - elseif rateOfFire > 0.8 then - luft.expect(rateOfFire).to.be.close.to(0.833) - elseif rateOfFire > 0.7407 then - luft.expect(rateOfFire).to.be.close.to(0.769) - end - end + rateOfFireTest(rateOfFire) + ) + end + + --#endregion + + end + ) + end + + if unitBlueprint.Enhancements then + local enhancements = {} + for enhancementKey, enhancement in pairs(unitBlueprint.Enhancements) do + enhancements[enhancementKey] = enhancement + end + + luft.describe_each( + "Enhancement %s", + enhancements, + + ---@param name string + ---@param enhancementBlueprint UnitBlueprintEnhancement + function(name, enhancementBlueprint) + + ----------------------------------------------------------- + --#region Rate of fire limitations + + -- The game runs in ticks and therefore not every rate of + -- fire is possible. The game will round the rate of fire, + -- but as a result minor changes may not always have an + -- actual impact in-game. These tests guarantee that when + -- a rate of fire is adjusted that it is always the actual + -- rate of fire that the game uses. + + local rateOfFire = enhancementBlueprint.NewRateOfFire + if rateOfFire then + luft.test( + "New Rate of fire", + rateOfFireTest(rateOfFire) ) end diff --git a/units/UEL0301/UEL0301_unit.bp b/units/UEL0301/UEL0301_unit.bp index 5ae0390533..e262ad4537 100644 --- a/units/UEL0301/UEL0301_unit.bp +++ b/units/UEL0301/UEL0301_unit.bp @@ -263,7 +263,7 @@ UnitBlueprint{ BuildTime = 5040, Icon = "acu", Name = "Energy Accelerator", - NewRateOfFire = 1.82, + NewRateOfFire = 2, Slot = "LCH", UpgradeUnitAmbientBones = { "UEL0301" }, },