diff --git a/data/items/items.xml b/data/items/items.xml
index 5e464330019..b1a1c6b003f 100644
--- a/data/items/items.xml
+++ b/data/items/items.xml
@@ -1252,7 +1252,6 @@
-
-
@@ -1327,7 +1326,6 @@
-
-
@@ -1386,7 +1384,6 @@
-
-
@@ -1401,7 +1398,6 @@
-
-
@@ -1490,7 +1486,6 @@
-
-
@@ -1565,7 +1560,6 @@
-
-
@@ -1624,7 +1618,6 @@
-
-
@@ -1639,7 +1632,6 @@
-
-
@@ -2267,7 +2259,6 @@
-
-
@@ -2342,7 +2333,6 @@
-
-
@@ -2401,7 +2391,6 @@
-
-
@@ -2416,7 +2405,6 @@
-
-
@@ -2488,7 +2476,6 @@
-
-
@@ -2567,7 +2554,6 @@
-
-
@@ -2626,7 +2612,6 @@
-
-
@@ -2641,7 +2626,6 @@
-
-
@@ -8266,7 +8250,6 @@
-
-
@@ -8280,7 +8263,6 @@
-
-
@@ -8316,7 +8298,6 @@
-
-
@@ -8397,7 +8378,6 @@
-
-
@@ -8438,7 +8418,6 @@
-
-
@@ -8460,7 +8439,6 @@
-
-
@@ -8499,7 +8477,6 @@
-
-
@@ -8607,7 +8584,6 @@
-
-
@@ -8700,7 +8676,6 @@
-
-
@@ -8771,7 +8746,6 @@
-
-
@@ -8793,7 +8767,6 @@
-
-
@@ -8816,7 +8789,6 @@
-
-
@@ -8963,7 +8935,6 @@
-
-
@@ -8977,7 +8948,6 @@
-
-
@@ -8998,7 +8968,6 @@
-
-
@@ -9073,7 +9042,6 @@
-
-
@@ -9217,7 +9185,6 @@
-
-
@@ -9259,7 +9226,6 @@
-
-
@@ -9281,7 +9247,6 @@
-
-
@@ -9338,7 +9303,6 @@
-
-
@@ -9416,7 +9380,6 @@
-
-
@@ -9460,7 +9423,6 @@
-
-
@@ -9520,7 +9482,6 @@
-
-
@@ -9567,7 +9528,6 @@
-
-
@@ -9579,7 +9539,6 @@
-
-
@@ -10826,7 +10785,6 @@
-
-
@@ -15646,7 +15604,6 @@
-
-
@@ -17988,7 +17945,6 @@
-
-
@@ -18116,7 +18072,6 @@
-
-
@@ -19368,7 +19323,6 @@
-
-
@@ -19391,7 +19345,6 @@
-
-
@@ -19427,7 +19380,6 @@
-
-
@@ -19507,7 +19459,6 @@
-
-
@@ -19593,7 +19544,6 @@
-
-
@@ -19615,7 +19565,6 @@
-
-
@@ -19673,7 +19622,6 @@
-
-
@@ -19695,7 +19643,6 @@
-
-
@@ -19738,7 +19685,6 @@
-
-
@@ -19761,7 +19707,6 @@
-
-
@@ -19783,7 +19728,6 @@
-
-
@@ -19886,7 +19830,6 @@
-
-
@@ -19909,7 +19852,6 @@
-
-
@@ -20084,7 +20026,6 @@
-
-
@@ -20105,7 +20046,6 @@
-
-
@@ -20119,7 +20059,6 @@
-
-
@@ -20140,7 +20079,6 @@
-
-
@@ -20155,7 +20093,6 @@
-
-
@@ -20171,7 +20108,6 @@
-
-
@@ -20321,7 +20257,6 @@
-
-
@@ -20363,7 +20298,6 @@
-
-
@@ -20420,7 +20354,6 @@
-
-
@@ -20434,7 +20367,6 @@
-
-
@@ -20476,7 +20408,6 @@
-
-
@@ -20498,7 +20429,6 @@
-
-
@@ -20513,7 +20443,6 @@
-
-
@@ -21455,7 +21384,6 @@
-
-
@@ -21478,7 +21406,6 @@
-
-
@@ -21502,7 +21429,6 @@
-
-
@@ -21525,7 +21451,6 @@
-
-
@@ -21547,7 +21472,6 @@
-
-
@@ -21571,7 +21495,6 @@
-
-
@@ -21595,7 +21518,6 @@
-
-
@@ -21610,7 +21532,6 @@
-
-
@@ -21633,7 +21554,6 @@
-
-
@@ -21648,7 +21568,6 @@
-
-
@@ -22372,7 +22291,6 @@
-
-
@@ -22428,7 +22346,6 @@
-
-
@@ -22483,7 +22400,6 @@
-
-
@@ -25284,7 +25200,6 @@
-
-
@@ -25372,7 +25287,6 @@
-
-
@@ -25395,7 +25309,6 @@
-
-
@@ -27222,7 +27135,6 @@
-
-
@@ -27237,7 +27149,6 @@
-
-
@@ -27273,7 +27184,6 @@
-
-
@@ -27295,7 +27205,6 @@
-
-
@@ -27375,7 +27284,6 @@
-
-
@@ -28880,7 +28788,6 @@
-
-
@@ -30740,7 +30647,6 @@
-
-
@@ -30883,7 +30789,6 @@
-
-
@@ -31909,7 +31814,6 @@
-
-
@@ -32299,7 +32203,6 @@
-
-
@@ -32656,7 +32559,6 @@
-
-
@@ -32673,7 +32575,6 @@
-
-
@@ -32935,7 +32836,6 @@
-
-
@@ -34607,7 +34507,6 @@
-
-
@@ -34631,7 +34530,6 @@
-
-
@@ -36065,7 +35963,6 @@
-
-
@@ -39421,7 +39318,6 @@
-
-
@@ -39486,7 +39382,6 @@
-
-
@@ -39628,7 +39523,6 @@
-
-
@@ -39958,7 +39852,6 @@
-
-
@@ -39980,7 +39873,6 @@
-
-
@@ -40003,7 +39895,6 @@
-
-
@@ -40078,7 +39969,6 @@
-
-
@@ -40100,7 +39990,6 @@
-
-
@@ -40123,7 +40012,6 @@
-
-
@@ -40198,7 +40086,6 @@
-
-
@@ -40220,7 +40107,6 @@
-
-
@@ -40243,7 +40129,6 @@
-
-
@@ -40260,7 +40145,6 @@
-
-
@@ -40284,7 +40168,6 @@
-
-
@@ -40309,7 +40192,6 @@
-
-
@@ -40326,7 +40208,6 @@
-
-
@@ -40350,7 +40231,6 @@
-
-
@@ -40375,7 +40255,6 @@
-
-
@@ -41958,7 +41837,6 @@
-
-
@@ -41994,7 +41872,6 @@
-
-
@@ -42026,7 +41903,6 @@
-
-
@@ -42044,7 +41920,6 @@
-
-
@@ -42062,7 +41937,6 @@
-
@@ -44339,7 +44213,6 @@ Awarded by TibiaMisterios.com.br"/>
-
-
@@ -44353,7 +44226,6 @@ Awarded by TibiaMisterios.com.br"/>
-
@@ -45198,7 +45070,6 @@ Awarded by TibiaMisterios.com.br"/>
-
-
@@ -45692,7 +45563,6 @@ Awarded by TibiaMisterios.com.br"/>
-
-
@@ -45716,7 +45586,6 @@ Awarded by TibiaMisterios.com.br"/>
-
-
@@ -51748,7 +51617,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -51789,7 +51657,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -51830,7 +51697,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -51853,7 +51719,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -51876,7 +51741,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -54205,7 +54069,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -54310,7 +54173,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -54334,7 +54196,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -55254,7 +55115,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -55472,7 +55332,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -55516,7 +55375,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -57319,7 +57177,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -59171,7 +59028,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -59312,7 +59168,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -61759,7 +61614,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -64025,7 +63879,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -64077,7 +63930,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -64129,7 +63981,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -64157,7 +64008,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -64185,7 +64035,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -64602,7 +64451,6 @@ hands of its owner. Granted by TibiaRoyal.com"/>
-
-
@@ -65927,7 +65775,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -65999,7 +65846,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67397,7 +67243,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67422,7 +67267,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67446,7 +67290,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67495,7 +67338,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67520,7 +67362,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67566,7 +67407,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -67593,7 +67433,6 @@ former students at the Noodles Academy. Awarded by TibiaLabs.com"/>
-
-
@@ -71644,7 +71483,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75313,7 +75151,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75338,7 +75175,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75363,7 +75199,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75388,7 +75223,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75413,7 +75247,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75438,7 +75271,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75481,7 +75313,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75509,7 +75340,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75537,7 +75367,6 @@ Granted by TibiaGoals.com"/>
-
-
@@ -75565,7 +75394,6 @@ Granted by TibiaGoals.com"/>
-
-
diff --git a/data/modules/scripts/gamestore/init.lua b/data/modules/scripts/gamestore/init.lua
index 4fa9daea28b..a927715cd93 100644
--- a/data/modules/scripts/gamestore/init.lua
+++ b/data/modules/scripts/gamestore/init.lua
@@ -1739,8 +1739,8 @@ function GameStore.processExpBoostPuchase(player)
player:setStoreXpBoost(50)
player:setExpBoostStamina(currentExpBoostTime + 3600)
- if player:getStorageValue(GameStore.Storages.expBoostCount) == -1 or expBoostCount == 6 then
- player:setStorageValue(GameStore.Storages.expBoostCount, 1)
+ if expBoostCount == -1 or expBoostCount == 6 then
+ expBoostCount = 1
end
player:setStorageValue(GameStore.Storages.expBoostCount, expBoostCount + 1)
diff --git a/data/scripts/globalevents/global_server_save.lua b/data/scripts/globalevents/global_server_save.lua
index 00eaebbc3c3..c68c3dedc88 100644
--- a/data/scripts/globalevents/global_server_save.lua
+++ b/data/scripts/globalevents/global_server_save.lua
@@ -5,7 +5,8 @@ local function ServerSave()
if configManager.getBoolean(configKeys.GLOBAL_SERVER_SAVE_CLOSE) then
Game.setGameState(GAME_STATE_CLOSED)
- elseif configManager.getBoolean(configKeys.GLOBAL_SERVER_SAVE_SHUTDOWN) then
+ end
+ if configManager.getBoolean(configKeys.GLOBAL_SERVER_SAVE_SHUTDOWN) then
Game.setGameState(GAME_STATE_SHUTDOWN)
end
diff --git a/src/creatures/players/wheel/player_wheel.cpp b/src/creatures/players/wheel/player_wheel.cpp
index b2fa39960e1..77a15f7cbf7 100644
--- a/src/creatures/players/wheel/player_wheel.cpp
+++ b/src/creatures/players/wheel/player_wheel.cpp
@@ -32,6 +32,47 @@ const static std::vector wheelGemBasicSlot1Allowed = {
WheelGemBasicModifier_t::Vocation_Health_IceResistance,
WheelGemBasicModifier_t::Vocation_Health_EnergyResistance,
WheelGemBasicModifier_t::Vocation_Health_EarthResistance,
+ WheelGemBasicModifier_t::Vocation_Mana_FireResistance,
+ WheelGemBasicModifier_t::Vocation_Mana_EnergyResistance,
+ WheelGemBasicModifier_t::Vocation_Mana_Earth_Resistance,
+ WheelGemBasicModifier_t::Vocation_Mana_Ice_Resistance,
+ WheelGemBasicModifier_t::Vocation_Capacity_FireResistance,
+ WheelGemBasicModifier_t::Vocation_Capacity_EnergyResistance,
+ WheelGemBasicModifier_t::Vocation_Capacity_EarthResistance,
+ WheelGemBasicModifier_t::Vocation_Capacity_IceResistance,
+};
+
+const static std::vector wheelGemBasicSlot2Allowed = {
+ WheelGemBasicModifier_t::General_FireResistance,
+ WheelGemBasicModifier_t::General_IceResistance,
+ WheelGemBasicModifier_t::General_EnergyResistance,
+ WheelGemBasicModifier_t::General_EarthResistance,
+ WheelGemBasicModifier_t::General_PhysicalResistance,
+ WheelGemBasicModifier_t::General_HolyResistance,
+ WheelGemBasicModifier_t::General_HolyResistance_DeathWeakness,
+ WheelGemBasicModifier_t::General_DeathResistance_HolyWeakness,
+ WheelGemBasicModifier_t::General_FireResistance_EarthResistance,
+ WheelGemBasicModifier_t::General_FireResistance_IceResistance,
+ WheelGemBasicModifier_t::General_FireResistance_EnergyResistance,
+ WheelGemBasicModifier_t::General_EarthResistance_IceResistance,
+ WheelGemBasicModifier_t::General_EarthResistance_EnergyResistance,
+ WheelGemBasicModifier_t::General_IceResistance_EnergyResistance,
+ WheelGemBasicModifier_t::General_FireResistance_EarthWeakness,
+ WheelGemBasicModifier_t::General_FireResistance_IceWeakness,
+ WheelGemBasicModifier_t::General_FireResistance_EnergyWeakness,
+ WheelGemBasicModifier_t::General_EarthResistance_FireWeakness,
+ WheelGemBasicModifier_t::General_EarthResistance_IceWeakness,
+ WheelGemBasicModifier_t::General_EarthResistance_EnergyWeakness,
+ WheelGemBasicModifier_t::General_IceResistance_EarthWeakness,
+ WheelGemBasicModifier_t::General_IceResistance_FireWeakness,
+ WheelGemBasicModifier_t::General_IceResistance_EnergyWeakness,
+ WheelGemBasicModifier_t::General_EnergyResistance_EarthWeakness,
+ WheelGemBasicModifier_t::General_EnergyResistance_IceWeakness,
+ WheelGemBasicModifier_t::General_EnergyResistance_FireWeakness,
+ WheelGemBasicModifier_t::General_ManaDrainResistance,
+ WheelGemBasicModifier_t::General_LifeDrainResistance,
+ WheelGemBasicModifier_t::General_ManaDrainResistance_LifeDrainResistance,
+ WheelGemBasicModifier_t::General_MitigationMultiplier,
};
// To avoid conflict in other files that might use a function with the same name
@@ -835,7 +876,7 @@ void PlayerWheel::revealGem(WheelGemQuality_t quality) {
gem.basicModifier2 = {};
gem.supremeModifier = {};
if (quality >= WheelGemQuality_t::Regular) {
- gem.basicModifier2 = static_cast(uniform_random(0, magic_enum::enum_count() - 1));
+ gem.basicModifier2 = selectBasicModifier2(gem.basicModifier1);
}
if (quality >= WheelGemQuality_t::Greater && !supremeModifiers.empty()) {
gem.supremeModifier = supremeModifiers[uniform_random(0, supremeModifiers.size() - 1)];
@@ -3106,3 +3147,11 @@ float PlayerWheel::calculateMitigation() const {
mitigation += (mitigation * (float)getMitigationMultiplier()) / 100.f;
return mitigation;
}
+
+WheelGemBasicModifier_t PlayerWheel::selectBasicModifier2(WheelGemBasicModifier_t modifier1) const {
+ WheelGemBasicModifier_t modifier = modifier1;
+ while (modifier == modifier1) {
+ modifier = wheelGemBasicSlot2Allowed[uniform_random(0, wheelGemBasicSlot2Allowed.size() - 1)];
+ }
+ return modifier;
+}
diff --git a/src/creatures/players/wheel/player_wheel.hpp b/src/creatures/players/wheel/player_wheel.hpp
index 3ede17c339d..303063beb9b 100644
--- a/src/creatures/players/wheel/player_wheel.hpp
+++ b/src/creatures/players/wheel/player_wheel.hpp
@@ -454,6 +454,8 @@ class PlayerWheel {
}
}
+ WheelGemBasicModifier_t selectBasicModifier2(WheelGemBasicModifier_t modifier1) const;
+
private:
friend class Player;
// Reference to the player
diff --git a/src/io/io_wheel.cpp b/src/io/io_wheel.cpp
index 6e7c2b02b0f..e8ad30a5d80 100644
--- a/src/io/io_wheel.cpp
+++ b/src/io/io_wheel.cpp
@@ -416,7 +416,7 @@ void IOWheel::slotGreen200(const std::shared_ptr &player, uint16_t point
// SLOT_GREEN_TOP_150 = 2
void IOWheel::slotGreenTop150(const std::shared_ptr &player, uint16_t points, uint8_t, PlayerWheelMethodsBonusData &bonusData) const {
bonusData.mitigation += MITIGATION_INCREASE * points;
- if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_GREEN_BOTTOM_150)) {
+ if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_GREEN_TOP_150)) {
bonusData.leech.manaLeech += MANA_LEECH_INCREASE;
}
}
@@ -522,7 +522,7 @@ void IOWheel::slotGreenTop75(const std::shared_ptr &player, uint16_t poi
} else {
bonusData.stats.mana += 6 * points;
}
- if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_GREEN_TOP_100)) {
+ if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_GREEN_TOP_75)) {
bonusData.leech.lifeLeech += HEALTH_LEECH_INCREASE;
}
}
@@ -566,7 +566,7 @@ void IOWheel::slotRedBottom150(const std::shared_ptr &player, uint16_t p
} else {
bonusData.stats.health += 1 * points;
}
- if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_RED_TOP_150)) {
+ if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_RED_BOTTOM_150)) {
bonusData.leech.manaLeech += MANA_LEECH_INCREASE;
}
}
@@ -760,7 +760,7 @@ void IOWheel::slotBlueTop150(const std::shared_ptr &player, uint16_t poi
} else {
bonusData.stats.capacity += 2 * points;
}
- if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_BLUE_BOTTOM_150)) {
+ if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_BLUE_TOP_150)) {
bonusData.leech.lifeLeech += HEALTH_LEECH_INCREASE;
}
}
@@ -796,7 +796,7 @@ void IOWheel::slotBlueBottom75(const std::shared_ptr &player, uint16_t p
// SLOT_PURPLE_BOTTOM_75 = 28
void IOWheel::slotPurpleBottom75(const std::shared_ptr &player, uint16_t points, uint8_t, PlayerWheelMethodsBonusData &bonusData) const {
bonusData.mitigation += MITIGATION_INCREASE * points;
- if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_PURPLE_BOTTOM_100)) {
+ if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_PURPLE_BOTTOM_75)) {
bonusData.leech.manaLeech += MANA_LEECH_INCREASE;
}
}
@@ -898,7 +898,7 @@ void IOWheel::slotPurpleBottom150(const std::shared_ptr &player, uint16_
} else {
bonusData.stats.mana += 6 * points;
}
- if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_PURPLE_TOP_150)) {
+ if (isMaxPointAddedToSlot(player, points, WheelSlots_t::SLOT_PURPLE_BOTTOM_150)) {
bonusData.leech.lifeLeech += HEALTH_LEECH_INCREASE;
}
}
diff --git a/src/items/weapons/weapons.cpp b/src/items/weapons/weapons.cpp
index aa90fda6c2d..6c0d56d882e 100644
--- a/src/items/weapons/weapons.cpp
+++ b/src/items/weapons/weapons.cpp
@@ -224,7 +224,6 @@ void Weapon::internalUseWeapon(std::shared_ptr player, std::shared_ptr player, std::shared_ptrdoCombatChain(player, target, params.aggressive);
+ g_logger().debug("Weapon::internalUseWeapon - Chain callback executed.");
} else {
Combat::doCombatHealth(player, target, damage, params);
}
@@ -888,17 +888,26 @@ int32_t WeaponWand::getWeaponDamage(std::shared_ptr player, std::shared_
}
// If chain system is enabled, calculates magic-based damage
- int32_t attackSkill;
- int32_t attackValue;
- float attackFactor;
- [[maybe_unused]] int16_t elementAttack;
+ int32_t attackSkill = 0;
+ int32_t attackValue = 0;
+ float attackFactor = 0.0;
+ [[maybe_unused]] int16_t elementAttack = 0;
[[maybe_unused]] CombatDamage combatDamage;
calculateSkillFormula(player, attackSkill, attackValue, attackFactor, elementAttack, combatDamage);
auto magLevel = player->getMagicLevel();
auto level = player->getLevel();
- double min = (level / 5.0) + (magLevel + attackValue) / 3.0;
- double max = (level / 5.0) + (magLevel + attackValue);
+
+ // Check if level is greater than zero before performing division
+ auto levelDivision = level > 0 ? level / 5.0 : 0.0;
+
+ auto totalAttackValue = magLevel + attackValue;
+
+ // Check if magLevel is greater than zero before performing division
+ auto magicLevelDivision = totalAttackValue > 0 ? totalAttackValue / 3.0 : 0.0;
+
+ double min = levelDivision + magicLevelDivision;
+ double max = levelDivision + totalAttackValue;
// Returns the calculated maximum damage or a random value between the calculated minimum and maximum
return maxDamage ? -max : -normal_random(min, max);