Roblox Fisch
-- Untitled Fishing Engine
-- Version 1.7
-- WIP
-- Things To be added:
-- currency (gaining and saving money from fish)
-- Bait [might be possible] (second input is choosing your bait)
-- ================================
-- Rod Definitions
-- ================================
local rods = {
["Basic Rod"] = {luck = 1, description = "A simple rod suitable for beginners🌿."},
["Lucky Rod"] = {luck = 1.5, description = "A well-crafted rod with special bait🦈."},
["Divine Rod"] = {luck = 4, description = "A legendary rod blessed by the fishing gods☀."},
["Megalodon Rod"] = {luck = 5, description = "A legendary rod made to catch megalodons☀."},
["Kings Rod"] = {luck = 25, description = "A legendary rod that only kings may hold☀."},
["Cursed Rod"] = {luck = 0.001, description = "Test you rng with x100 rarity🔥."},
["Overpowered Rod"] = {luck = 50, description = "An rod that makes every fish overpowered."},
}
-- ================================
-- Fish Definitions
-- ================================
local fishEncounterRarity = {
Goldfish = 1500,
Salmon = 1000,
Crab = 800,
Shark = 100,
GiantSquid = 250,
SeaSerpent = 200,
Megalodon = 10,
Nessie = 5,
Kraken = 5,
Whale = 55,
ColossalSquid = 32,
Nuke = 50,
TravisScot = 60,
BananaFish = 73,
Scylla = 105,
Megalevaithant = 100
}
local fishCatchRarity = {
Goldfish = 1,
Salmon = 5,
Crab = 10,
Shark = 50,
GiantSquid = 100,
SeaSerpent = 90,
Megalodon = 600,
Nessie = 5,
Kraken = 520,
Whale = 550,
ColossalSquid = 100,
Nuke = 120,
TravisScot = 1000,
BananaFish = 1500,
Scylla = 3000,
Megalevaithant = 1000
}
-- ================================
-- Function to Catch Fish
-- ================================
function catchFish(selectedRodLuck)
local fishTypes = {}
-- Adjusting fish rarity based on the selected rod's luck
for fish, rarity in pairs(fishEncounterRarity) do
local adjustedEncounterRarity = math.floor(rarity / selectedRodLuck)
local adjustedCatchRarity = math.floor(fishCatchRarity[fish] / selectedRodLuck)
table.insert(fishTypes, {
name = fish,
encounterChance = adjustedEncounterRarity,
catchChance = adjustedCatchRarity
})
end
-- Calculate total weight for weighted random selection
local totalWeight = 0
for _, fish in ipairs(fishTypes) do
totalWeight = totalWeight + fish.encounterChance
end
-- Select a fish based on encounter weights
local randomWeight = math.random(1, totalWeight)
local selectedFish
for _, fish in ipairs(fishTypes) do
if randomWeight <= fish.encounterChance then
selectedFish = fish
break
else
randomWeight = randomWeight - fish.encounterChance
end
end
-- Display encounter information
print("\n--- Encounter Information ---")
print("You encountered a " .. selectedFish.name .. "!")
print("Catch rarity: 1 in " .. selectedFish.catchChance .. "!\n")
-- Check for mutation (shiny, mythical, ancient)
local mutationChance = math.random(1, 100) -- Random number between 1 and 100
local mutationType = ""
if mutationChance > 100 then -- 95% chance for Normal
mutationType = "Normal"
elseif mutationChance <= 20 then -- 20% chance for Shiny
mutationType = "Shiny"
elseif mutationChance <= 10 then -- 10% chance for Mythical
mutationType = "Mythical"
elseif mutationChance <= 1 then -- 1% chance for Ancient
mutationType = "Ancient"
elseif mutationChance <= 0.1 then
mutationType = "Shadow" -- 0.1% chance for Shadow
end
-- Display results
if mutationType ~= "" then
print("You caught a " .. mutationType .. " " .. selectedFish.name .. "!")
else
if math.random(1, selectedFish.catchChance) == 1 then
print("Fish caught: " .. selectedFish.name)
else
print("The fish got away!")
end
end
print("-----------------------------\n")
end
-- ================================
-- Main Function (mostly printing and error calls)
-- ================================
print("Choose your fishing rod:")
print("Basic Rod, Lucky Rod, Divine Rod, Megalodon Rod, Kings Rod")
local selectedRod = io.read("*l")
if rods[selectedRod] then
local selectedRodLuck = rods[selectedRod].luck
local selectedRodDescription = rods[selectedRod].description
print("\n--- Rod Information ---")
print("Rod: " .. selectedRod .. ": luck multiplier of " .. selectedRodLuck .. ".")
print("Description: " .. selectedRodDescription .. "\n")
catchFish(selectedRodLuck)
else
print("\nInvalid rod name. Please choose a valid rod.\n")
end