Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "terranigma_rng"
- local function computeMaxEnemyLuck(randomNumber)
- local playerLuck = memory.readbyte(0x7e0666)
- local maxEnemyLuck = playerLuck + 8 - AND(randomNumber,0x7f)-1
- if AND(randomNumber,0x7f)<4 then
- maxEnemyLuck = 99
- end
- return maxEnemyLuck
- end
- rng.set_title("Crits")
- rng.set_nr_rows(16)
- rng.set_nr_columns (2)
- rng.set_column_width(6)
- rng.set_text(function(x,y,counter,rn)
- -- Determine the highest enemy luck value that will still yield a critical, given the player's current luck stat, and the provided random number
- local maxEnemyLuck = computeMaxEnemyLuck(rn)
- local actualEnemyLuck = 40
- -- Default text color is red
- local rngColor = 0xFF0000FF
- -- This random number will generate a critical hit -> green text
- if actualEnemyLuck <= maxEnemyLuck then
- rngColor = 0x00FF00FF
- end
- -- Show the highest enemy luck value that will yield a crit
- if maxEnemyLuck < 0 then
- gui.text(x,y,string.upper(string.format('%02x: --',counter)),rngColor)
- else
- gui.text(x,y,string.upper(string.format('%02x: %02d',counter,maxEnemyLuck)),rngColor)
- end
- end)
- rng.show()
- while true do
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement