Skip to content

Instantly share code, notes, and snippets.

@Lincoln-LM
Created January 15, 2023 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lincoln-LM/d2a9239910e71c8f9e9d71f48e092af2 to your computer and use it in GitHub Desktop.
Save Lincoln-LM/d2a9239910e71c8f9e9d71f48e092af2 to your computer and use it in GitHub Desktop.
sv mark generation lua function
-- Time
local Time_DayDawn = 0
local Time_Dusk = 1
local Time_Night = 2
-- Weather
local Weather_None = 0
local Weather_Cloudy = 1
local Weather_Rainy = 2
local Weather_Stormy = 3
local Weather_Snowy = 4
local Weather_Blizzard = 5
local Weather_Dry = 6
local Weather_Sandstorm = 7
local Weather_Misty = 8
-- Marks
local Mark_Lunchtime = 53
local Mark_SleepyTime = 54
local Mark_Dusk = 55
local Mark_Dawn = 56
local Mark_Cloudy = 57
local Mark_Rainy = 58
local Mark_Stormy = 59
local Mark_Snowy = 60
local Mark_Blizzard = 61
local Mark_Dry = 62
local Mark_Sandstorm = 63
local Mark_Misty = 64
local Mark_Destiny = 65
local Mark_Fishing = 66
local Mark_Curry = 67
local Mark_Uncommon = 68
local Mark_Rare = 69
local Mark_Rowdy = 70
local Mark_AbsentMinded = 71
local Mark_Jittery = 72
local Mark_Excited = 73
local Mark_Charismatic = 74
local Mark_Calmness = 75
local Mark_Intense = 76
local Mark_ZonedOut = 77
local Mark_Joyful = 78
local Mark_Angry = 79
local Mark_Smiley = 80
local Mark_Teary = 81
local Mark_Upbeat = 82
local Mark_Peeved = 83
local Mark_Intellectual = 84
local Mark_Ferocious = 85
local Mark_Crafty = 86
local Mark_Scowling = 87
local Mark_Kindly = 88
local Mark_Flustered = 89
local Mark_PumpedUp = 90
local Mark_ZeroEnergy = 91
local Mark_Prideful = 92
local Mark_Unsure = 93
local Mark_Humble = 94
local Mark_Thorny = 95
local Mark_Vigor = 96
local Mark_Slump = 97
local Mark_None = -1
function LotRibbon(arg0)
local rand_val, weather, time_period, current_hour
-- fDAAAA586 appears to be some form of rand(minimum, maximum) of [minimum, maximum]
rand_val = arg0.fDAAAA586(0, 999)
-- 1/1000
if 0 == rand_val then
return Mark_Rare
-- 10/1000
elseif rand_val >= 1 and rand_val <= 10 then
-- random personality mark
-- 1/28 per
return 70 + arg0.fDAAAA586(0, 27)
-- 20/1000
elseif rand_val >= 11 and rand_val <= 30 then
return Mark_Uncommon
-- 40/1000
elseif rand_val >= 31 and rand_val <= 70 then
if C2B428A63695FD2C7.CheckBirthday() then
return Mark_Destiny
end
-- 20/1000
elseif rand_val >= 71 and rand_val <= 90 then
weather = main.env.weather.WeatherManager.s_impl[5].type
if Weather_Cloudy == weather then
return Mark_Cloudy
elseif Weather_Rainy == weather then
return Mark_Rainy
elseif Weather_Stormy == weather then
return Mark_Stormy
elseif Weather_Snowy == weather then
return Mark_Snowy
elseif Weather_Blizzard == weather then
return Mark_Blizzard
elseif Weather_Sandstorm == weather then
return Mark_Sandstorm
elseif Weather_Misty == weather then
return Mark_Misty
end
-- 20/1000
elseif rand_val >= 91 and rand_val <= 110 then
time_period = main.system.game_time.GameTimeManager.s_impl.F36837B48B38D4857(
main.system.game_time.GameTimeManager.s_impl,
main.system.game_time.GameTimeManager.s_impl[5].gameTime
)
if time_period == Time_DayDawn then
function getSecondInDay()
local current_second
current_second = nil
if main.system.game_time.GameTimeManager.s_impl[5] ~= main.system.game_time.GameTimeManager.s_impl[4] then
current_second = main.system.game_time.GameTimeManager.s_impl[5].gameTime
else
current_second = main.system.game_time.GameTimeManager.s_impl.F8C8B225CB8805704(
main.system.game_time.GameTimeManager.s_impl,
main.system.game_time.GameTimeManager.s_impl[5].gameTime
)
end
return current_second
end
current_hour = getSecondInDay() / 3600
if current_hour >= 12 and current_hour < 18 then
return Mark_Lunchtime
else
return Mark_Dawn
end
elseif time_period == Time_Dusk then
return Mark_Dusk
elseif time_period == Time_Night then
return Mark_SleepyTime
end
end
return Mark_None
end
@Lincoln-LM
Copy link
Author

Lincoln-LM commented Jan 15, 2023

The game always rolls a single rand(0, 999) (inclusive)

  • if rand == 0 (always 1/1000 odds) the mon has a rare mark
  • if rand is in the range [1, 10] (inclusive, always 10/1000, 1/100) the mon has a personality mark
    • the game will then roll a rand(0, 27) (inclusive) to determine which of the 28 personality marks it gets
  • if rand is in the range [11, 30] (inclusive, always 20/1000, 1/50) the mon has an uncommon mark
  • if rand is in the range [31, 70] (inclusive, always 40/1000, 1/25) the mon is susceptible to having a destiny mark
    • the destiny mark will only be applied if it is the player's birthday, otherwise no mark at all will be applied
  • if rand is in the range [71, 90] (inclusive, always 20/1000, 1/50) the mon is susceptible to having a weather mark
    • the game checks for Cloudy, Rainy, Stormy, Snowy, Blizzard, Sandstorm, and Misty weather in that order to give the corresponding marks
    • if there is no weather no mark is applied
    • see other research for which weathers are actually legal in-game as I do not know crowd-sourced weather sheet provided by Anubis (@Lusamine)
  • if rand is in the range [91, 110] (inclusive, always 20/1000, 1/50) the mon is susceptible to having a time mark
    • the game checks for 12 <= current 24-hour clock hour < 18 for Lunchtime
    • Dusk/SleepyTime/Dawn have their own way of checking time that was not immediately obvious which time period they apply to, probably the same as swsh

I am unsure if Mark Charm has an effect (if so it would very likely just be repeating this entire roll system up to 3 times or until a mark is selected) but it is not legitimately obtainable in SV anyway.

These odds are very slightly different than SWSH as SWSH had consecutive rolls for each mark type, skipping the rest of the rolls if a mark is chosen.

@Lincoln-LM
Copy link
Author

Easy to read table containing this rate information as well as when the title powers are applied courtesy of Anubis:

https://mobile.twitter.com/Sibuna_Switch/status/1625345500869271553
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment