Skip to content

Instantly share code, notes, and snippets.

@Sanqui
Created September 20, 2013 13:40
Show Gist options
  • Select an option

  • Save Sanqui/6637711 to your computer and use it in GitHub Desktop.

Select an option

Save Sanqui/6637711 to your computer and use it in GitHub Desktop.
how many telefangmons are there
colors = { black= {0, 0, 0}, red= {255, 0, 0}, white= {255, 255, 255}, green={0, 127, 0},
yellow={255,255,0}, purple={255,50,255}}
denjuunames = {
[0x0] = "Tsunonasu",
[0x1] = "Kochia",
[0x2] = "Oshe",
[0x3] = "Keshi",
[0x4] = "Crypto",
[0x5] = "Monstera",
[0x6] = "Fungus",
[0x7] = "Hiougi",
[0x8] = "Punica",
[0x9] = "Gumi",
[0xa] = "Suguri",
[0xb] = "Ganraikou",
[0xc] = "Byakubu",
[0xd] = "Telopea",
[0xe] = "Mantea",
[0xf] = "Ixora",
[0x10] = "Myrtus",
[0x11] = "Lychnis",
[0x12] = "Lapeirousia",
[0x13] = "Bubaria",
[0x14] = "Angios",
[0x15] = "Gymnos",
[0x16] = "Liriope",
[0x17] = "Waratah",
[0x18] = "Sorghum",
[0x19] = "Eryngo",
[0x1a] = "Noriutsugi",
[0x1b] = "Pampas",
[0x1c] = "Rhodanthe",
[0x1d] = "Licorice",
[0x1e] = "Viburnum",
[0x1f] = "Funnel",
[0x20] = "Vanda",
[0x21] = "Uikyou",
[0x22] = "Obana",
[0x23] = "Firekokko",
[0x24] = "Raygoten",
[0x25] = "Drilarmor",
[0x26] = "Chamelan",
[0x27] = "Cryptoarm",
[0x28] = "Shellstera",
[0x29] = "Fungeist",
[0x2a] = "Balltamus",
[0x2b] = "Burenica",
[0x2c] = "Geron",
[0x2d] = "Berzelia",
[0x2e] = "Nigella",
[0x2f] = "Musa",
[0x30] = "Netaro",
[0x31] = "Nejiro",
[0x32] = "Godetia",
[0x33] = "Curcuma",
[0x34] = "Tessen",
[0x35] = "Heliopsis",
[0x36] = "Hagumanoki",
[0x37] = "Gilerth",
[0x38] = "Raygirth",
[0x39] = "Armaru",
[0x3a] = "Chameraid",
[0x3b] = "Cryptoride",
[0x3c] = "Wormiterala",
[0x3d] = "Fungblade",
[0x3e] = "Bulltamus",
[0x3f] = "Puneedle",
[0x40] = "Kerorin",
[0x41] = "Sugulai",
[0x42] = "Cortos",
[0x43] = "Gaiurus",
[0x44] = "Midotor",
[0x45] = "Octor",
[0x46] = "Hitodeight",
[0x47] = "Ghosboar",
[0x48] = "Rasenmai",
[0x49] = "Scorpil",
[0x4a] = "Armcrab",
[0x4b] = "Angiorn",
[0x4c] = "Gymrace",
[0x4d] = "Lirionpu",
[0x4e] = "Whitah",
[0x4f] = "Potzal",
[0x50] = "Araneida",
[0x51] = "Gadhoro",
[0x52] = "Cliogera",
[0x53] = "Gust",
[0x54] = "Reige",
[0x55] = "Togeruka",
[0x56] = "Raigaleon",
[0x57] = "Gadorkuma",
[0x58] = "Abiras",
[0x59] = "Alphagos",
[0x5a] = "Kiyoruka",
[0x5b] = "Gymgarth",
[0x5c] = "Baionpu",
[0x5d] = "Warutah",
[0x5e] = "Guntzatl",
[0x5f] = "Arakuida",
[0x60] = "Badhoro",
[0x61] = "Lampgera",
[0x62] = "Tempest",
[0x63] = "Zudoon",
[0x64] = "Hiyu",
[0x65] = "Gamazumi",
[0x66] = "Papaver",
[0x67] = "Gamuru",
[0x68] = "Bouvardi",
[0x69] = "Gaultheria",
[0x6a] = "Dipsacus",
[0x6b] = "Kaya",
[0x6c] = "Denfare",
[0x6d] = "Angieon",
[0x6e] = "Easydog",
[0x6f] = "Tricerarmor",
[0x70] = "Cryptosnipe",
[0x71] = "Fungboost",
[0x72] = "Veenica",
[0x73] = "Saiguliger",
[0x74] = "Armedurus",
[0x75] = "Octorifle",
[0x76] = "Eraserboar",
[0x77] = "Spearneedle",
[0x78] = "Gilgierth",
[0x79] = "Uniarmor",
[0x7a] = "Cryptoburn",
[0x7b] = "Fungmachine",
[0x7c] = "Punisto",
[0x7d] = "Suguline",
[0x7e] = "Machurus",
[0x7f] = "Octagun",
[0x80] = "Mummyboar",
[0x81] = "Kingpin",
[0x82] = "Beebalm",
[0x83] = "Salal",
[0x84] = "Enishida",
[0x85] = "Tulbaghia",
[0x86] = "Kiringiku",
[0x87] = "Angilance",
[0x88] = "Gymganon",
[0x89] = "Saiope",
[0x8a] = "Wattah",
[0x8b] = "Quetzaking",
[0x8c] = "Arakudabaran",
[0x8d] = "Punkhoro",
[0x8e] = "Vikingurin",
[0x8f] = "Storm",
[0x90] = "Mutoom",
[0x91] = "Gypsophi",
[0x92] = "Ruscus",
[0x93] = "Maoran",
[0x94] = "Zea",
[0x95] = "Gonum",
[0x96] = "Angipower",
[0x97] = "Gymzyrus",
[0x98] = "Canonope",
[0x99] = "Calm",
[0x9a] = "Ryuuguu",
[0x9b] = "Gigagigerth",
[0x9c] = "Barriarm",
[0x9d] = "Cryptoknight",
[0x9e] = "Fungwar",
[0x9f] = "Bashou",
[0xa0] = "Angigorgo",
[0xa1] = "Gymbaron",
[0xa2] = "Lirimonarch",
[0xa3] = "Enteioh",
[0xa4] = "Golaking",
[0xa5] = "Kanzou",
[0xa6] = "Ornithogalum",
[0xa7] = "Gentiana",
[0xa8] = "Yarrow",
[0xa9] = "Angioros",
[0xaa] = "Gymzatan",
[0xab] = "Doomsday",
[0xac] = "Dendel",
[0xad] = "Teletel"
}
movenames = {"Claw", "Rush", "Strike", "Cat Punch", "Bison Hammer", "Kick", "Tail", "Horn", "Beak", "Poison Sting", "Numbing Sting", "Scissor", "Sabre", "Bite", "Body Press", "Horn Drill", "Bloodsuck", "Shuriken", "Bowgun", "Bison Beam", "Stag Beam", "Pulse Beam", "Plasma Laser", "Mega Launcher", "Mega Cannon", "Mega Rifle", "Drill Missile", "Hyper Missile", "Dragon Missile", "Penguin Missile", "Missile Pod", "War Cannon", "Harpoon Missile", "Horn Launcher", "Bird Bazooka", "Nose Magnum", "Ear Vulcan", "Tusk Vulcan", "Machine Gun", "Flamethrower", "Mini Flame", "Mega Flame", "Kamaitachi", "Hurricane", "Mini Snow", "Blizzard", "Egg Bomb", "Whirlpool", "Tsunami", "Mini Bolt", "Mega Bolt", "Earthquake", "Mega Quake", "Rock", "Mega Rock", "Speed Up", "Focus", "Avoid", "Invigorate", "Charge Up", "Heal", "Recover", "Restore", "Shield", "Protect", "Iron Wall", "Camouflage", "Ultrasonic", "EM Wave", "Curse Song", "Lullaby", "Glare", "Sleep Gas", "Smokescreen", "Poison Gas", "Jump", "Flight", "Scream", "Wingbeat", "EM Barrier", "Force Field", "Chill", "Heat Wave", "Water Shot", "Acid", "Lick", "Tentacle", "Ice Ball", "Stat Down", "Status Return", "Iron Claw", "Assault", "Missile Punch", "Razor Punch", "Hoof", "High Kick", "Middle Kick", "Stab", "Triple Attack", "Toxic Sting", "Electric Sting", "Cross Attack", "Vacuum Slash", "Fang Crush", "Punt", "Screw Horn", "Drain", "Denma Shuriken", "Needle", "Quick Step", "Aim", "Evade", "Brace", "Dummy 1", "First Aid", "Repair", "Dummy 2", "Shutter", "Defend", "Dummy 3", "Conceal", "EM Pulse", "Shockwave", "Dummy 4", "Dummy 5", "Stare", "Dummy 6", "Dummy 7", "Dummy 8", "Dummy 9", "Dummy 10", "Tooth Grind", "Dust Cloud", "Electro Screen", "Denma Seal", "Frost Breath", "Petal Storm"}
typenames = {"Mtn", "Fld", "Fst", "Wtr", "Sky", "Dst"}
typeeff = {4, 6, 5, 3, 1, 4}
-- exp per level, bank 27
expperlevel = {0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1830, 1891, 1953, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998}
local rom = assert(io.open("C:\\telefang.gbc", "rb"))
--local data = rom:read("*all")
local denjuudata = {}
local movedata = {}
rom:seek("set", 0x1d4b48)
--print(string.byte(rom:read(1)))
for i=0,174 do
d = {}
d.hp = string.byte(rom:read(1))
d.speed = string.byte(rom:read(1))
d.attack = string.byte(rom:read(1))
d.defense = string.byte(rom:read(1))
d.dattack = string.byte(rom:read(1))
d.ddefense = string.byte(rom:read(1))
d.moves = {}
d.moves[1] = string.byte(rom:read(1))
d.moves[2] = string.byte(rom:read(1))
d.moves[3] = string.byte(rom:read(1))
d.moves[4] = string.byte(rom:read(1))
d.unk = string.byte(rom:read(1))
d.evolvl = string.byte(rom:read(1))
d.evo = string.byte(rom:read(1))
d.type = string.byte(rom:read(1))+1
d.m3lv = string.byte(rom:read(1))
d.m4lv = string.byte(rom:read(1))
denjuudata[i] = d
end
rom:seek("set", 0x9cb28)
for i=0,255 do
movedata[i] = string.byte(rom:read(1))
end
show = true
while true do
inpt = input.get();
if inpt['1'] and not lastinpt['1'] then show = not show; end
if show then
state = memory.readbyte(0xc3e0)
substate = memory.readbyte(0xc3e1)
subsubstate = memory.readbyte(0xc3e2)
--testing = memory.readbyte(0xc3e2)
gui.text(0, 144-6, state..'-'..substate)
if state == 5 then -- overworld
f = memory.readbyte(0xc938)
s = memory.readbyte(0xc939)
m = memory.readbyte(0xc93A)
h = memory.readbyte(0xc93B)
timetext = string.format("%2i:%02i.%02i", h, m, s)--'%02X", h, m, s, f)
gui.text(160-(string.len(timetext)*4), 0, timetext)
wildcounter = memory.readshort(0xC950)
wildcountertext = string.format("%2i%%", wildcounter/800*100)
if wildcounter ~= 0 then
gui.text(160-(string.len(wildcountertext)*4), 144-8, wildcountertext)
end
--expperlevel
end
if state == 7 or state == 8 then -- battle
-- curdenjuu d417 d474
cur = memory.readbyte(0xd474)
d = {}
d.denjuu = memory.readbyte(0xd500 + (cur*0x16))
d.hp = memory.readbyte(0xd502 + (cur*0x16))
d.maxhp = memory.readbyte(0xd503 + (cur*0x16))
d.lv = memory.readbyte(0xd501 + (cur*0x16))
d.type = denjuudata[d.denjuu].type
--show_info = memory.readbyte(0x9821) ~= 0x80
if cur == 0 then
exp = memory.readbyte(0xd4ae)
maxexp = expperlevel[d.lv]
exptext = 'exp: '..exp..'/'..maxexp
--print(exptext)
--gui.text(160-(string.len(exptext)*4), 144-16, exptext)
gui.box(3*8-1, 2*8+6, 9*8+1, 3*8, colors.white, colors.black)
if exp > 0 then
gui.box(3*8, 2*8+6+1, 3*8-1 + (exp/maxexp)*(9*8+1 - 3*8-1), 3*8-1, colors.purple)
end
end
-- curenemydenjuu d415 [d477]
e = {}
enemycur = memory.readbyte(0xd477)
e.denjuu = memory.readbyte(0xD542 + (enemycur*0x16))
e.lv = memory.readbyte(0xd543 + (enemycur*0x16))
e.type = denjuudata[e.denjuu].type
e.hp = memory.readbyte(0xd542+2 + (enemycur*0x16))
e.maxhp = memory.readbyte(0xd542+3 + (enemycur*0x16))
--pickingmove = memory.readbyte(0xc0c0)
pickingmove = memory.readbyte(0xc460) == 63
lvtext = typenames[d.type].." Lv"..d.lv
outline = colors.black
if d.type == typeeff[e.type] then outline = colors.green end
--if enemytype == typeeff[type] then outline = colors.red end
gui.text(74-(string.len(lvtext)*4), 9, lvtext, colors.white, outline)
if e.hp > 0 then
enemydenjuutext = denjuunames[e.denjuu]
gui.text(160-(string.len(enemydenjuutext)*4), 73-8, enemydenjuutext, colors.black, 0)
enemylvtext = typenames[e.type].." Lv"..e.lv
enemyoutline = colors.black
if e.type == typeeff[d.type] then enemyoutline = colors.red end
--if type == typeeff[enemytype] then enemyoutline = colors.green end
gui.text(160-(string.len(enemylvtext)*4), 71, enemylvtext, colors.white, enemyoutline)
end
gui.box(0, 2*8, 3*8-2, 4*8-2, colors.black, colors.black)
hptext = d.hp .. "/" .. d.maxhp
gui.text(8*3-(string.len(hptext)*4), 8*2, hptext)
hptextpct = string.format("%2i%%", d.hp/d.maxhp*100)
gui.text(8*3-(string.len(hptextpct)*4), 8*2+6, hptextpct)
if pickingmove then
for movei=1,4 do
move = denjuudata[d.denjuu].moves[movei]
if move ~= 0 then
movetext = movenames[move]
gui.text(160-(string.len(movetext)*4), 64+(16*movei), movetext, colors.black, colors.yellow)
movedatatext = movedata[move].." power"
gui.text(160-(string.len(movedatatext)*4), 64+7+(16*movei), movedatatext, colors.black, colors.yellow)
end
end
else
if e.hp > 0 then
hptext = e.hp .. "/" .. e.maxhp
gui.text(160-(string.len(hptext)*4), 80, hptext)
hptextpct = string.format("%2i%%", e.hp/e.maxhp*100)
gui.text(160-(string.len(hptextpct)*4), 86, hptextpct)
end
end
end
end
lastinpt = inpt
vba.frameadvance();
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment