User File #15492428218079853

Upload All User Files

#15492428218079853 - Mini Moldorm, Spiny Beetle

Mini-Moldorm,SpinyBeetle.lua
795 downloads
Uploaded 6/20/2014 4:30 PM by SBD (see all 61)
----
--Mini-Moldorm,SpinyBeetle
----
----
--drop:          6/8
----
--Heart:         4/32
--1 Rupee:       5/32
--5 Rupees:      3/32
--Fairy:         1/32
--Bombs:         4/32
--Ember Seeds:   3/32
--Mystery Seeds: 3/32
--Scent Seeds:   3/32
--Pegasus Seeds: 3/32
--Gale Seeds:    3/32
----


local function RNG (low,high)

  low=3*low
  if high>85 then low=low+1 end
  if high>170 then low=low+1 end
  if low>255 then low=low-256 end
  if low>255 then low=low-256 end
  high=high+low
  if high>255 then high=high-256 end

  return low, high
end

memory.usememorydomain("HRAM")

while true do

  local low0,high0 = memory.readbyte (0x0015), memory.readbyte (0x0014)
  local low1,high1 = RNG (low0,high0)
  local low2,high2 = RNG (low1,high1)
  local low3,high3 = RNG (low2,high2)
  local lh1 = high1%64
  local lh2 = high2%32


  if lh1==0x01 or
     lh1==0x03 or
     lh1==0x04 or
     lh1==0x05 or
     lh1==0x07 or
     lh1==0x08 or
     lh1==0x09 or
     lh1==0x0A or
     lh1==0x0B or
     lh1==0x0C or
     lh1==0x0D or
     lh1==0x0E or
     lh1==0x0F or
     lh1==0x11 or
     lh1==0x13 or
     lh1==0x15 or
     lh1==0x16 or
     lh1==0x17 or
     lh1==0x18 or
     lh1==0x1A or
     lh1==0x1B or
     lh1==0x1C or
     lh1==0x1E or
     lh1==0x1F or
     lh1==0x20 or
     lh1==0x22 or
     lh1==0x23 or
     lh1==0x24 or
     lh1==0x25 or
     lh1==0x27 or
     lh1==0x28 or
     lh1==0x29 or
     lh1==0x2A or
     lh1==0x2B or
     lh1==0x2C or
     lh1==0x2D or
     lh1==0x2F or
     lh1==0x31 or
     lh1==0x32 or
     lh1==0x34 or
     lh1==0x36 or
     lh1==0x37 or
     lh1==0x38 or
     lh1==0x3A or
     lh1==0x3B or
     lh1==0x3D or
     lh1==0x3E or
     lh1==0x3F

    then

    if lh2==0x00 then
      drop="Heart"
    elseif lh2==0x01 then
      drop="Heart"
    elseif lh2==0x02 then
      drop="Heart"
    elseif lh2==0x03 then
      drop="Heart"
    elseif lh2==0x04 then
      drop="1 Rupee"
    elseif lh2==0x05 then
      drop="1 Rupee"
    elseif lh2==0x06 then
      drop="1 Rupee"
    elseif lh2==0x07 then
      drop="1 Rupee"
    elseif lh2==0x08 then
      drop="1 Rupee"
    elseif lh2==0x09 then
      drop="5 Rupees"
    elseif lh2==0x0A then
      drop="5 Rupees"
    elseif lh2==0x0B then
      drop="5 Rupees"
    elseif lh2==0x0C then
      drop="Fairy"
    elseif lh2==0x0D then
      drop="Bombs"
    elseif lh2==0x0E then
      drop="Bombs"
    elseif lh2==0x0F then
      drop="Bombs"
    elseif lh2==0x10 then
      drop="Bombs"
    elseif lh2==0x11 then
      drop="Mystery Seeds"
    elseif lh2==0x12 then
      drop="Mystery Seeds"
    elseif lh2==0x13 then
      drop="Gale Seeds"
    elseif lh2==0x14 then
      drop="Gale Seeds"
    elseif lh2==0x15 then
      drop="Gale Seeds"
    elseif lh2==0x16 then
      drop="Pegasus Seeds"
    elseif lh2==0x17 then
      drop="Pegasus Seeds"
    elseif lh2==0x18 then
      drop="Pegasus Seeds"
    elseif lh2==0x19 then
      drop="Scent Seeds"
    elseif lh2==0x1A then
      drop="Scent Seeds"
    elseif lh2==0x1B then
      drop="Scent Seeds"
    elseif lh2==0x1C then
      drop="Mystery Seeds"
    elseif lh2==0x1D then
      drop="Ember Seeds"
    elseif lh2==0x1E then
      drop="Ember Seeds"
    elseif lh2==0x1F then
      drop="Ember Seeds"
    end

  else drop = "-"
  end


  gui.text(0,16,drop)
  emu.frameadvance()
end