Battle:
The goal of the battle is to get the leader (the bot at the top right of the field) hp to 0. By destroying the head, their hp instantly drops to 0, allowing for quick fights.
You start in a screen like this

Here you can press A to view your parts, or press Start to begin.
Once you press Start, the following addresses in CartWRAM are updated:
0x2433 - Which joint you will target when you press UP
? - Which NPC of the 3 you will target, when you press UP
0x2437 - Which joint you will target when you press RIGHT
? - Which NPC of the 3 you will target, when you press RIGHT
0x243B - Which joint you will target when you press LEFT
? - Which NPC of the 3 you will target, when you press LEFT
The values are:
0 - Head
1 - Right Arm
2 - Left Arm
3 - Legs
On the very first turn, once you selected a joint and pressed A, the npc's will have their target (you, or the other 2 bots you can have) as well as the joint determined.
You will also get this screen

This screen only appears on the first turn. You can take advantage of this screen by delaying frames to manipulate the following:
1. If you or the npc has the head as target, right before the actual attack animation, there's a 2nd roll to see if you/the npc uses a different limb to defend the head. If so, the new joint will be the target rather than the head. This is very bad, and is usually the reason why delays are long. However, if the NPC is targeting your head, this can be very helpful, since it allows more choices of frames to choose from.
2. If the attack misses. This usually doesn't happen, but later on NPCs have high evasive, so it starts becoming a problem
3. If the attack misses, and you used a missile, does the blast still hit?
From english patch:

This is what the Japanese WIP manipulates to occur. If you used the default missile (UP), even if it misses, there's a chance the attack still hits.
4. How fast you and the npc run to the center of the stage to attack. For NPCs with similar speeds as you, this might allow you to KO them before they get to attack.
5. After the 1st turn, what will the NPCs target next + what joint/npc you will target.
From 5, this means that if you cannot KO the leader bot in 1 turn, you must delay at this screen

To make sure
1. You hit the leader's head.
2. On your next turn, the leader is the one targeted, and not the other 2 bots.
3. On your next turn, the leader's head is the one targeted, and not the other 3 limbs.
4. On the NPC's next turn, they don't aim for your head, or any limb that will be destroyed due to low health.
To assist in this, here's the input display
Download medarot data.luaLanguage: lua
local medarot_module = {}
medarot_module.Addresses = {
damage_dealt = 0x20E4,
damage_dealt2 = 0x2409,
target_up = 0x2432,
target_joint_up = 0x2433,
target_right = 0x2436,
target_joint_right = 0x2437,
target_left = 0x243A,
target_joint_left = 0x243B,
p1_base = 0x2C00,
p1_head_id = 0x2C0D,
p1_right_arm_id = 0x2C0E,
p1_left_arm_id = 0x2C0F,
p1_leg_id = 0x2C10,
p1_hp = 0x2C59,
p1_max_hp = 0x2C5B,
p1_medal = 0x2C81,
p1_hp_head = 0x2CC0,
p1_hp_right_arm = 0x2CC1,
p1_hp_left_arm = 0x2CC2,
p1_hp_leg = 0x2CC3,
p1_target_joint = 0x2CCC,
p1_name = 0x2CF0,
p2_base = 0x2D00,
p3_base = 0x2E00,
npc1_base = 0x2F00,
npc1_char1 = 0x2F02,
npc1_medal1 = 0x2F0B,
npc1_head = 0x2F0D,
npc1_right_arm = 0x2F0E,
npc1_left_arm = 0x2F0F,
npc1_legs = 0x2F10,
npc1_hp = 0x2F59,
npc1_max_hp = 0x2F5B,
npc1_medal2 = 0x2F81,
npc1_hp_head = 0x2FC0,
npc1_hp_right_arm = 0x2FC1,
npc1_hp_left_arm = 0x2FC2,
npc1_hp_leg = 0x2FC3,
npc1_joint = 0x2FCA,
npc1_target = 0x2FCB,
npc1_target_joint = 0x2FCC,
npc2_base = 0x3000,
npc3_base = 0x3100,
x_pos = 0xC0D4,
y_pos = 0xC0D5,
timer = 0xC5A0,
rng3 = 0xC5F0,
rng1 = 0xC723,
rng2 = 0xC724,
battle_id = 0xC753,
encounter_timer = 0xC761,
area = 0xC8F9,
money = 0xC93A,
}
medarot_module.Head = {
[0] = {name ="Shotgun", sell = 1200, amount = 0x3521},
[1] = {name ="Hexadon", sell = 1100, amount = 0x3523},
[2] = {name ="Psycho-Wave", sell = 1000, amount = 0x3525},
[3] = {name ="Blast Gun", sell = 1200, amount = 0x3527},
[4] = {name ="Cockpit", sell = 2800, amount = 0x3529},
[5] = {name ="Angel Body", sell = 3000, amount = 0x352B},
[6] = {name ="Meteor Strike", sell = 700, amount = 0x352D},
[7] = {name ="Void", sell = 1000, amount = 0x352F},
[8] = {name ="Hani-Head", sell = 1500, amount = 0x3531},
[9] = {name ="Doguu", sell = 900, amount = 0x3533},
[10] = {name ="Pharnyx", sell = 800, amount = 0x3535},
[11] = {name ="Dragon Crystal", sell = 2300, amount = 0x3537},
[12] = {name ="Field Barrier", sell = 1100, amount = 0x3539},
[13] = {name ="Death Blast", sell = 5000, amount = 0x353B},
[14] = {name ="Body Blow", sell = 1500, amount = 0x353D},
[15] = {name ="Booby Trap", sell = 400, amount = 0x353F},
[16] = {name ="Headband", sell = 300, amount = 0x3541},
[17] = {name ="Hacker", sell = 300, amount = 0x3543},
[18] = {name ="Guardian", sell = 4800, amount = 0x3545},
[19] = {name ="Solar Laser", sell = 1000, amount = 0x3547},
[20] = {name ="Invisi Body", sell = 600, amount = 0x3549},
[21] = {name ="Antenna", sell = 1000, amount = 0x354B},
[22] = {name ="Missile", sell = 1000, amount = 0x354D},
[23] = {name ="Stealth Cloak/Mist Net", sell = 1200, amount = 0x354F},
[24] = {name ="Mikazuchi", sell = 300, amount = 0x3551},
[25] = {name ="Body Press", sell = 800, amount = 0x3553},
[26] = {name ="Air Bag", sell = 300, amount = 0x3555},
[27] = {name ="Samurai Blast", sell = 1500, amount = 0x3557},
[28] = {name ="Linear Cannon", sell = 400, amount = 0x3559},
[29] = {name ="Melt Cone", sell = 2400, amount = 0x355B},
[30] = {name ="Air-con", sell = 1700, amount = 0x355D},
[31] = {name ="Smoke Gas", sell = 1000, amount = 0x355F},
[32] = {name ="Mute Body", sell = 2200, amount = 0x3561},
[33] = {name ="Devil Body", sell = 700, amount = 0x3563},
[34] = {name ="Fighter Hair", sell = 1800, amount = 0x3565},
[35] = {name ="Taser", sell = 1000, amount = 0x3567},
[36] = {name ="Blizzard", sell = 1200, amount = 0x3569},
[37] = {name ="Sanctuary", sell = 1900, amount = 0x356B},
[38] = {name ="Charm Point", sell = 600, amount = 0x356D},
[39] = {name ="Body Conscious", sell = 1900, amount = 0x356F},
[40] = {name ="Body Shot", sell = 1400, amount = 0x3571},
[41] = {name ="Plasma Laser", sell = 400, amount = 0x3573},
[42] = {name ="Morning Call", sell = 1700, amount = 0x3575},
[43] = {name ="Finale", sell = 400, amount = 0x3577},
[44] = {name ="Victory Armor", sell = 300, amount = 0x3579},
[45] = {name ="Clear Shield", sell = 400, amount = 0x357B},
[46] = {name ="Search Radar", sell = 200, amount = 0x357D},
[47] = {name ="Elec-Charger", sell = 200, amount = 0x357F},
[48] = {name ="Battery", sell = 600, amount = 0x3581},
[49] = {name ="Tank Missile", sell = 1500, amount = 0x3583},
[50] = {name ="Debugger", sell = 400, amount = 0x3585},
[51] = {name ="Trample", sell = 1100, amount = 0x3587},
[52] = {name ="Cover Up", sell = 300, amount = 0x3589},
[53] = {name ="Grand Bomb", sell = 2300, amount = 0x358B},
[54] = {name ="Anti-Water", sell = 1000, amount = 0x358D},
[55] = {name ="Elec-Driver", sell = 1000, amount = 0x358F},
[56] = {name ="Pearl", sell = 1000, amount = 0x3591},
[57] = {name ="Kappa Beam", sell = 1000, amount = 0x3593},
[58] = {name ="All Repair", sell = 2300, amount = 0x3595},
[59] = {name ="Resurrector", sell = 4700, amount = 0x3597},
[60] = {name ="", sell = 0, amount = 0x3599},
[61] = {name ="", sell = 0, amount = 0x359B},
[62] = {name ="??", sell = 0, amount = 0x359D},
[63] = {name ="??", sell = 0, amount = 0x359F}
}
medarot_module.Right_Arm = {
[0] = {name ="Cyclone", sell = 300, amount = 0x35A1},
[1] = {name ="Mistouch", sell = 400, amount = 0x35A3},
[2] = {name ="Electro-Wave", sell = 400, amount = 0x35A5},
[3] = {name ="Fire Gun", sell = 600, amount = 0x35A7},
[4] = {name ="Stabilizer", sell = 1000, amount = 0x35A9},
[5] = {name ="Angel Hand", sell = 2200, amount = 0x35AB},
[6] = {name ="Pressure", sell = 2000, amount = 0x35AD},
[7] = {name ="Avoid", sell = 1400, amount = 0x35AF},
[8] = {name ="Mirror", sell = 1500, amount = 0x35B1},
[9] = {name ="Bronze Bell", sell = 1300, amount = 0x35B3},
[10] = {name ="Sound Copy", sell = 300, amount = 0x35B5},
[11] = {name ="Healing Water", sell = 1400, amount = 0x35B7},
[12] = {name ="Energy Barrier", sell = 300, amount = 0x35B9},
[13] = {name ="Death Bomb", sell = 5000, amount = 0x35BB},
[14] = {name ="Sabre", sell = 1500, amount = 0x35BD},
[15] = {name ="Fly Trap", sell = 500, amount = 0x35BF},
[16] = {name ="Wire", sell = 300, amount = 0x35C1},
[17] = {name ="Virus", sell = 800, amount = 0x35C3},
[18] = {name ="Canceller", sell = 8000, amount = 0x35C5},
[19] = {name ="Solar Power", sell = 400, amount = 0x35C7},
[20] = {name ="Invisi Hand", sell = 400, amount = 0x35C9},
[21] = {name ="Chanbara Sword", sell = 1000, amount = 0x35CB},
[22] = {name ="Revolver", sell = 1000, amount = 0x35CD},
[23] = {name ="Kunai", sell = 1200, amount = 0x35CF},
[24] = {name ="Fencing", sell = 400, amount = 0x35D1},
[25] = {name ="Light Axe", sell = 500, amount = 0x35D3},
[26] = {name ="Spin Knuckle", sell = 400, amount = 0x35D5},
[27] = {name ="Beam Saber", sell = 1500, amount = 0x35D7},
[28] = {name ="Snipe Rifle", sell = 500, amount = 0x35D9},
[29] = {name ="Melt Bomb", sell = 2400, amount = 0x35DB},
[30] = {name ="Heat Sink", sell = 1700, amount = 0x35DD},
[31] = {name ="Scout Hand", sell = 900, amount = 0x35DF},
[32] = {name ="Mute Hand", sell = 2200, amount = 0x35E1},
[33] = {name ="Devil Hand", sell = 700, amount = 0x35E3},
[34] = {name ="Machine Gun", sell = 400, amount = 0x35E5},
[35] = {name ="Stun Gun", sell = 1100, amount = 0x35E7},
[36] = {name ="Ice", sell = 1000, amount = 0x35E9},
[37] = {name ="First Aid", sell = 1000, amount = 0x35EB},
[38] = {name ="Powder Bomb", sell = 1400, amount = 0x35ED},
[39] = {name ="Hand Whip", sell = 1900, amount = 0x35EF},
[40] = {name ="Anti-Air Missile", sell = 1400, amount = 0x35F1},
[41] = {name ="Tracking Laser", sell = 200, amount = 0x35F3},
[42] = {name ="Right Beam", sell = 800, amount = 0x35F5},
[43] = {name ="Carnival", sell = 400, amount = 0x35F7},
[44] = {name ="Vulcan", sell = 700, amount = 0x35F9},
[45] = {name ="Knight Shield", sell = 400, amount = 0x35FB},
[46] = {name ="Point Radar", sell = 300, amount = 0x35FD},
[47] = {name ="Charge", sell = 300, amount = 0x35FF},
[48] = {name ="Normal Laser", sell = 600, amount = 0x3601},
[49] = {name ="Homing", sell = 700, amount = 0x3603},
[50] = {name ="Breaker", sell = 400, amount = 0x3605},
[51] = {name ="Right Guard", sell = 500, amount = 0x3607},
[52] = {name ="Trap Buster", sell = 300, amount = 0x3609},
[53] = {name ="Black Hole", sell = 700, amount = 0x360B},
[54] = {name ="VS Water", sell = 300, amount = 0x360D},
[55] = {name ="Plus-Driver", sell = 300, amount = 0x360F},
[56] = {name ="Drainer", sell = 1000, amount = 0x3611},
[57] = {name ="Cucumber Bomb", sell = 600, amount = 0x3613},
[58] = {name ="Cure Hand", sell = 2300, amount = 0x3615},
[59] = {name ="Free Arm", sell = 3900, amount = 0x3617},
[60] = {name ="", sell = 0, amount = 0x3619},
[61] = {name ="", sell = 0, amount = 0x361B},
[62] = {name ="", sell = 0, amount = 0x361D},
[63] = {name ="", sell = 0, amount = 0x361F}
}
medarot_module.Left_Arm = {
[0] = {name ="Tornado", sell = 300, amount = 0x3621},
[1] = {name ="Bugler", sell = 400, amount = 0x3623},
[2] = {name ="Magnet-Wave", sell = 400, amount = 0x3625},
[3] = {name ="Flame Gun", sell = 600, amount = 0x3627},
[4] = {name ="Wing", sell = 1000, amount = 0x3629},
[5] = {name ="Angel Arm", sell = 2200, amount = 0x362B},
[6] = {name ="Masher", sell = 2000, amount = 0x362D},
[7] = {name ="Exit", sell = 1400, amount = 0x362F},
[8] = {name ="Flash", sell = 1500, amount = 0x3631},
[9] = {name ="Bronze Bang", sell = 1300, amount = 0x3633},
[10] = {name ="Return Sound", sell = 300, amount = 0x3635},
[11] = {name ="Revival Spring", sell = 1400, amount = 0x3637},
[12] = {name ="Force Barrier", sell = 300, amount = 0x3639},
[13] = {name ="Death Beam", sell = 5000, amount = 0x363B},
[14] = {name ="Cape Shield", sell = 1500, amount = 0x363D},
[15] = {name ="Sticky Trap", sell = 500, amount = 0x363F},
[16] = {name ="Net", sell = 300, amount = 0x3641},
[17] = {name ="Jack", sell = 300, amount = 0x3643},
[18] = {name ="Recovery", sell = 8000, amount = 0x3645},
[19] = {name ="Solar Plate", sell = 400, amount = 0x3647},
[20] = {name ="Invisi Arm", sell = 400, amount = 0x3649},
[21] = {name ="Picopeco Hammer", sell = 1000, amount = 0x364B},
[22] = {name ="Submachinegun", sell = 1000, amount = 0x364D},
[23] = {name ="Ninjato", sell = 1200, amount = 0x364F},
[24] = {name ="Rapier", sell = 400, amount = 0x3651},
[25] = {name ="Great Axe", sell = 500, amount = 0x3653},
[26] = {name ="Megaton Punch", sell = 400, amount = 0x3655},
[27] = {name ="Samurai Saber", sell = 1500, amount = 0x3657},
[28] = {name ="Assault Rifle", sell = 500, amount = 0x3659},
[29] = {name ="Melt Rain", sell = 2400, amount = 0x365B},
[30] = {name ="Fan", sell = 1700, amount = 0x365D},
[31] = {name ="Scout Arm", sell = 900, amount = 0x365F},
[32] = {name ="Mute Arm", sell = 2200, amount = 0x3661},
[33] = {name ="Devil Arm", sell = 700, amount = 0x3663},
[34] = {name ="Magnum", sell = 400, amount = 0x3665},
[35] = {name ="Stun Stick", sell = 1100, amount = 0x3667},
[36] = {name ="Freeze", sell = 1600, amount = 0x3669},
[37] = {name ="Vaccine", sell = 1000, amount = 0x366B},
[38] = {name ="Hand Grenade", sell = 1400, amount = 0x366D},
[39] = {name ="Arm Candy", sell = 1900, amount = 0x366F},
[40] = {name ="Super Long Cannon", sell = 1400, amount = 0x3671},
[41] = {name ="Homing Laser", sell = 200, amount = 0x3673},
[42] = {name ="Left Beam", sell = 800, amount = 0x3675},
[43] = {name ="Festival", sell = 400, amount = 0x3677},
[44] = {name ="Gatling", sell = 700, amount = 0x3679},
[45] = {name ="Great Shield", sell = 400, amount = 0x367B},
[46] = {name ="Cut Radar", sell = 300, amount = 0x367D},
[47] = {name ="Generator", sell = 300, amount = 0x367F},
[48] = {name ="Hyper Laser", sell = 600, amount = 0x3681},
[49] = {name ="Grenade", sell = 700, amount = 0x3683},
[50] = {name ="Graviton", sell = 400, amount = 0x3685},
[51] = {name ="Left Guard", sell = 500, amount = 0x3687},
[52] = {name ="Barrier Buster", sell = 300, amount = 0x3689},
[53] = {name ="Dark Hole", sell = 700, amount = 0x368B},
[54] = {name ="Spray Water", sell = 300, amount = 0x368D},
[55] = {name ="Minus-Driver", sell = 300, amount = 0x368F},
[56] = {name ="Absorber", sell = 1000, amount = 0x3691},
[57] = {name ="Lotus Bomb", sell = 600, amount = 0x3693},
[58] = {name ="Repair Arm", sell = 2300, amount = 0x3695},
[59] = {name ="New Arm", sell = 3900, amount = 0x3697},
[60] = {name ="", sell = 0, amount = 0x3699},
[61] = {name ="", sell = 0, amount = 0x369B},
[62] = {name ="", sell = 0, amount = 0x369D},
[63] = {name ="", sell = 0, amount = 0x369F}
}
medarot_module.Leg = {
[0] = {name ="Leaf Fan", sell = 900, amount = 0x36A1},
[1] = {name ="Abdomen", sell = 1700, amount = 0x36A3},
[2] = {name ="Coffin", sell = 500, amount = 0x36A5},
[3] = {name ="Red Tail", sell = 500, amount = 0x36A7},
[4] = {name ="Jet Engine", sell = 2700, amount = 0x36A9},
[5] = {name ="Angel Leg", sell = 2300, amount = 0x36AB},
[6] = {name ="Floaty", sell = 600, amount = 0x36AD},
[7] = {name ="Excite", sell = 500, amount = 0x36AF},
[8] = {name ="Haniwan", sell = 1500, amount = 0x36B1},
[9] = {name ="Kaboom", sell = 600, amount = 0x36B3},
[10] = {name ="Pipe Organ", sell = 400, amount = 0x36B5},
[11] = {name ="Dragon's Bed", sell = 1500, amount = 0x36B7},
[12] = {name ="Flower Fly", sell = 900, amount = 0x36B9},
[13] = {name ="Spaghetti", sell = 2500, amount = 0x36BB},
[14] = {name ="Dash Attack", sell = 1500, amount = 0x36BD},
[15] = {name ="Spider Net", sell = 800, amount = 0x36BF},
[16] = {name ="Octo Legs", sell = 300, amount = 0x36C1},
[17] = {name ="Musk", sell = 300, amount = 0x36C3},
[18] = {name ="Racer", sell = 2300, amount = 0x36C5},
[19] = {name ="Roots", sell = 300, amount = 0x36C7},
[20] = {name ="Twirl", sell = 400, amount = 0x36C9},
[21] = {name ="Tatacker", sell = 1000, amount = 0x36CB},
[22] = {name ="Ochitsuker", sell = 1000, amount = 0x36CD},
[23] = {name ="Ninja Legs", sell = 1200, amount = 0x36CF},
[24] = {name ="Hakama", sell = 300, amount = 0x36D1},
[25] = {name ="Kinta Legs", sell = 1000, amount = 0x36D3},
[26] = {name ="Breadwinner", sell = 300, amount = 0x36D5},
[27] = {name ="Commander", sell = 1500, amount = 0x36D7},
[28] = {name ="Gunzer", sell = 100, amount = 0x36D9},
[29] = {name ="Native Step", sell = 2400, amount = 0x36DB},
[30] = {name ="Bunny Hop", sell = 1700, amount = 0x36DD},
[31] = {name ="Quick Legs", sell = 1600, amount = 0x36DF},
[32] = {name ="Mute Legs", sell = 2200, amount = 0x36E1},
[33] = {name ="Devil Leg", sell = 3100, amount = 0x36E3},
[34] = {name ="Miniskirt", sell = 1800, amount = 0x36E5},
[35] = {name ="Cat Walk", sell = 1100, amount = 0x36E7},
[36] = {name ="Sled Ski", sell = 1600, amount = 0x36E9},
[37] = {name ="Apron", sell = 1000, amount = 0x36EB},
[38] = {name ="Thighs", sell = 1400, amount = 0x36ED},
[39] = {name ="Leg-High Heels", sell = 1900, amount = 0x36EF},
[40] = {name ="Plasma Dash", sell = 1400, amount = 0x36F1},
[41] = {name ="Stalker", sell = 300, amount = 0x36F3},
[42] = {name ="Dog Race", sell = 800, amount = 0x36F5},
[43] = {name ="Ballrider", sell = 400, amount = 0x36F7},
[44] = {name ="Armor Car", sell = 300, amount = 0x36F9},
[45] = {name ="Trojan Horse", sell = 400, amount = 0x36FB},
[46] = {name ="Chairly", sell = 300, amount = 0x36FD},
[47] = {name ="Snailcargot", sell = 200, amount = 0x36FF},
[48] = {name ="Shell Tank", sell = 800, amount = 0x3701},
[49] = {name ="Block Tank", sell = 700, amount = 0x3703},
[50] = {name ="Handy Car", sell = 600, amount = 0x3705},
[51] = {name ="Crush Legs", sell = 400, amount = 0x3707},
[52] = {name ="Shovel", sell = 500, amount = 0x3709},
[53] = {name ="Seat", sell = 700, amount = 0x370B},
[54] = {name ="Screw", sell = 2100, amount = 0x370D},
[55] = {name ="Flip-Flap", sell = 400, amount = 0x370F},
[56] = {name ="Undertower", sell = 1000, amount = 0x3711},
[57] = {name ="Coral Reef", sell = 900, amount = 0x3713},
[58] = {name ="Taily", sell = 1500, amount = 0x3715},
[59] = {name ="Fin", sell = 2300, amount = 0x3717},
[60] = {name ="", sell = 0, amount = 0x3719},
[61] = {name ="", sell = 0, amount = 0x371B},
[62] = {name ="", sell = 0, amount = 0x371D},
[63] = {name ="", sell = 0, amount = 0x371F}
}
medarot_module.Bot = {
[0] = "Crow Tengu",
[1] = "Propolis",
[2] = "CoffinBat",
[3] = "HellPhoenix",
[4] = "LadyJet",
[5] = "Heal Angel",
[6] = "Betty Bear",
[7] = "Mistyghost",
[8] = "Haniwa Golem",
[9] = "DonDoguu",
[10] = "Volume 10",
[11] = "Moon Dragon",
[12] = "Pastel Fairy",
[13] = "Beast Master",
[14] = "Red Matador",
[15] = "Trap Spider",
[16] = "Kanehachi",
[17] = "Maxsnake",
[18] = "Acehorn",
[19] = "Flowercharge",
[20] = "Seven Colors",
[21] = "Head Scissors",
[22] = "Metal Beetle",
[23] = "Nin-Ninja",
[24] = "A-Burage",
[25] = "Kin-Tarou",
[26] = "A-Gedama",
[27] = "Samurai",
[28] = "Cyandog",
[29] = "Teepee",
[30] = "Kirabbit",
[31] = "Monkey Gong",
[32] = "Cosmo-Alien",
[33] = "Blackmail",
[34] = "Sailormate",
[35] = "Magentacat",
[36] = "Auroraqueen",
[37] = "Holynurse",
[38] = "Get Ready",
[39] = "Bunnyheart",
[40] = "Landmotor",
[41] = "Rollstar",
[42] = "Comadog",
[43] = "Magical Pierrot",
[44] = "Tank Soldier",
[45] = "Knight Armor",
[46] = "Doctor Study",
[47] = "Escarloader",
[48] = "Yellowturtle",
[49] = "Sekizou",
[50] = "Mad Muscle",
[51] = "Megaphant",
[52] = "Digmole",
[53] = "King Pharaoh",
[54] = "Blue Submarine",
[55] = "Yuchitang",
[56] = "Shell Cushion",
[57] = "River Saucer",
[58] = "Pure Mermaid",
[59] = "Pinguen",
[60] = "--------"
}
return medarot_module
Download medarot.luaLanguage: lua
client.SetGameExtraPadding(0, 0, 160, 34)
local medarot_data = require 'medarot data'
local Addresses = medarot_data.Addresses
local Head = medarot_data.Head
local Right_Arm = medarot_data.Right_Arm
local Left_Arm = medarot_data.Left_Arm
local Leg = medarot_data.Leg
local Bot = medarot_data.Bot
local text
local read8
local read16
local read32
if vba then
text = gui.text
read8 = memory.readbyteunsigned
read16 = memory.readwordunsigned
read32 = memory.readlongunsigned
else
text = gui.pixelText
memory.usememorydomain("System Bus")
read8 = memory.read_u8
read16 = memory.read_u16_le
read16be = memory.read_u16_be
read32 = memory.read_u32_le
end
function waitframe(frame)
local damage_dealt = read8(Addresses.damage_dealt2, "CartRAM")
while (frame >= 0) do
damage_dealt = read8(Addresses.damage_dealt2, "CartRAM")
text(0, 10,'Damage: '.. damage_dealt)
emu.frameadvance()
frame = frame-1
end
end
console.clear()
local function GetStats(addr,o)
o = o or {}
o.address = addr
o.medal = read8(addr + 0x0B, "CartRAM")
o.head = read8(addr + 0x0D, "CartRAM")%128
o.right_arm = read8(addr + 0x0E, "CartRAM")%128
o.left_arm = read8(addr + 0x0F, "CartRAM")%128
o.leg = read8(addr + 0x10, "CartRAM")%128
o.leg_swap = read8(addr + 0x2C, "CartRAM")
o.flux_status = read8(addr + 0x3C, "CartRAM")
o.speed = read8(addr + 0x51, "CartRAM")
o.mobility = read8(addr + 0x52, "CartRAM")
o.fight = read8(addr + 0x53, "CartRAM")
o.shoot = read8(addr + 0x54, "CartRAM")
o.scan = read8(addr + 0x55, "CartRAM")
o.conceal = read8(addr + 0x56, "CartRAM")
o.joint_p = read8(addr + 0x58, "CartRAM")
o.hp = read16be(addr + 0x59, "CartRAM")
o.hp_max = read16be(addr + 0x5B, "CartRAM")
o.medal_level = read8(addr + 0x84, "CartRAM")
o.medal_attack = read8(addr + 0x88, "CartRAM")
o.medal_defence = read8(addr + 0x89, "CartRAM")
o.medal_special = read8(addr + 0x8A, "CartRAM")
o.medal_bonus = read8(addr + 0x8B, "CartRAM")
o.hp_head = read8(addr + 0xC0, "CartRAM")
o.hp_right_arm = read8(addr + 0xC1, "CartRAM")
o.hp_left_arm = read8(addr + 0xC2, "CartRAM")
o.hp_leg = read8(addr + 0xC3, "CartRAM")
o.joint = read8(addr + 0xCA, "CartRAM")
o.target = read8(addr + 0xCB, "CartRAM")
o.target_joint = read8(addr + 0xCC, "CartRAM")
return o
end
local joint = { [0] = "Head", "Right", "Left", "Leg"}
local joint2 = { [0] = "H", "R", "L", "Lg"}
local joint3 = { [0] = Head, Right, Left}
local target = {[0] = "P1", "P2", "P3", "E1", "E2", "E3"}
function display_parts()
local money = read16be(Addresses.money) * 10
local parts_money = 0
local head_money = 0
local right_money = 0
local left_money = 0
local leg_money = 0
local Head_parts = ""
local Right_parts = ""
local Left_parts = ""
local Leg_parts = ""
local H = 0
local R = 0
local L = 0
local Lg = 0
local text_x = 160
local text_y = 0
for i = 0, 63 do
local head_amount = read8(Head[i].amount, "CartRAM")
local right_amount = read8(Right_Arm[i].amount, "CartRAM")
local left_amount = read8(Left_Arm[i].amount, "CartRAM")
local leg_amount = read8(Leg[i].amount, "CartRAM")
head_money = head_money + (head_amount * Head[i].sell)
right_money = right_money + (right_amount * Right_Arm[i].sell)
left_money = left_money + (left_amount * Left_Arm[i].sell)
leg_money = leg_money + (leg_amount * Leg[i].sell)
if (head_amount > 0) then
Head_parts = Head_parts .. Head[i].name .. " (" .. head_amount * Head[i].sell .. ")\n"
H = H+1
end
if (right_amount > 0) then
Right_parts = Right_parts .. Right_Arm[i].name .. " (" .. right_amount * Right_Arm[i].sell .. ")\n"
R = R+1
end
if (left_amount > 0) then
Left_parts = Left_parts .. Left_Arm[i].name .. " (" .. left_amount * Left_Arm[i].sell .. ")\n"
L = L+1
end
if (leg_amount > 0) then
Leg_parts = Leg_parts .. Leg[i].name .. " (" .. leg_amount * Leg[i].sell .. ")\n"
Lg = Lg+1
end
end
parts_money = head_money + right_money + left_money + leg_money
text(text_x, text_y, "Money: " .. money .. " Parts value: " .. parts_money)
text_y = 7
text(text_x, text_y, "Head Value: " .. head_money, "green")
text_y = 14
text(text_x, text_y, Head_parts)
text_y = text_y + (H * 7)
text(text_x, text_y, "Right Arm Value: " .. right_money, "green")
text_y = text_y + 7
text(text_x, text_y, Right_parts)
text_y = text_y + (R * 7)
text(text_x, text_y, "Left Arm Value: " .. left_money, "green")
text_y = text_y + 7
text(text_x, text_y, Left_parts)
text_y = text_y + (L * 7)
text(text_x, text_y, "Leg Value: " .. leg_money, "green")
text_y = text_y + 7
text(text_x, text_y, Leg_parts)
end
function display_robattle()
local p1 = GetStats(Addresses.p1_base)
local p2 = GetStats(Addresses.p2_base)
local p3 = GetStats(Addresses.p3_base)
local npc1 = GetStats(Addresses.npc1_base)
local npc2 = GetStats(Addresses.npc2_base)
local npc3 = GetStats(Addresses.npc3_base)
local target_up = read8(Addresses.target_up, "CartRAM")
local target_right = read8(Addresses.target_right, "CartRAM")
local target_left = read8(Addresses.target_left, "CartRAM")
local target_joint_up = read8(Addresses.target_joint_up, "CartRAM")
local target_joint_right = read8(Addresses.target_joint_right, "CartRAM")
local target_joint_left = read8(Addresses.target_joint_left, "CartRAM")
local damage_dealt = read8(Addresses.damage_dealt2, "CartRAM")
local text_x = 160
local text_y = 0
local text_x_relative = 0
local text_y_relative = 0
local color = "white"
local l_string = ""
local l_joint = ""
local bots = {p1, p2, p3, npc1, npc2, npc3}
text_x = 160
text_y = 0
for i = 1, 6 do
if i == 1 then
text_y = 0
text_x = 160
elseif i == 4 then
text_y = 34
text_x = 160
elseif i == 5 then
text_y = 68
text_x = 160
elseif i == 6 then
text_y = 102
text_x = 160
end
if bots[i].hp > 0 then
if i == 1 or i >= 4 then
text_y_relative = 0
text_x_relative = 0
l_string = target[i-1] .. ": HP: " ..bots[i].hp .. "/" .. bots[i].hp_max
text(text_x + text_x_relative, text_y + text_y_relative, l_string)
l_string = (bots[i].head > 60) and "--" .. bots[i].hp_head .. ")" or Head[bots[i].head].name .. "(" .. bots[i].hp_head .. ")"
color = (bots[i].joint == 0) and "green" or "white"
text_x_relative = 21
text_y_relative = 7
text(text_x + text_x_relative, text_y + text_y_relative,l_string, color)
l_string = (bots[i].right_arm > 60) and "--" .. bots[i].hp_right_arm .. ")" or Right_Arm[bots[i].right_arm].name .. "(" .. bots[i].hp_right_arm .. ")"
color = bots[i].joint == 1 and "green" or "white"
text_y_relative = 14
text(text_x + text_x_relative, text_y + text_y_relative,l_string, color)
l_string = (bots[i].left_arm > 60) and "--" .. bots[i].hp_left_arm .. ")" or Left_Arm[bots[i].left_arm].name .. "(" .. bots[i].hp_left_arm .. ")"
color = bots[i].joint == 2 and "green" or "white"
text_y_relative = 21
text(text_x + text_x_relative, text_y + text_y_relative,l_string, color)
l_string = (bots[i].leg > 60) and "--" .. bots[i].hp_leg .. ")" or Leg[bots[i].leg].name .. "(" .. bots[i].hp_leg .. ")"
text_y_relative = 28
text(text_x + text_x_relative, text_y + text_y_relative,l_string, "white")
l_string = target[bots[i].target] .. " " .. joint2[bots[i].target_joint]
text(text_x, text_y + 7*(bots[i].joint + 1), l_string, "green")
text_x = 0
text_y = 145
if bots[i].joint == 0 then
l_joint = Head[bots[i].head].name
elseif bots[i].joint == 1 then
l_joint = Right_Arm[bots[i].right_arm].name
elseif bots[i].joint == 2 then
l_joint = Left_Arm[bots[i].left_arm].name
end
l_string = target[i-1] .. " used " .. l_joint .. " to attack " .. Bot[bots[bots[i].target+1].head] .. "'s " .. joint[bots[i].target_joint]
if i == 1 then
text_y_relative = 0
elseif i >= 4 then
text_y_relative = 7 * (i - 3)
end
text(text_x, text_y + text_y_relative, l_string)
end
end
end
text_x = 250
text_y = 0
text(text_x, text_y, "UP :" .. joint[target_joint_up] .. "(" .. target[target_up] .. ")\nRight: " .. joint[target_joint_right] .. "(" .. target[target_right] .. ")\nLeft: ".. joint[target_joint_left] .. "(" .. target[target_left] .. ")")
text_y = 34
text(text_x, text_y, "Damage: " .. damage_dealt)
end
local wait = 1000
local save_inner = 1
function bot()
local cond_inner = false
local is_pause = false
local frame_start_inner = emu.framecount()
local frame_dif_inner = 0
local damage_dealt = 0
local p1_target_joint = 0
savestate.saveslot(save_inner)
repeat
local frame_now_inner = emu.framecount()
if (frame_dif_inner ~= (frame_now_inner - frame_start_inner)) then
savestate.saveslot(save_inner)
end
joypad.set({A=1})
emu.frameadvance()
waitframe(wait)
damage_dealt = read8(Addresses.damage_dealt2, "CartRAM")
p1_target_joint = read8(Addresses.p1_target_joint, "CartRAM")
frame_dif_inner = frame_dif_inner + 1
changed = (damage_dealt >= 40 and p1_target_joint == 0)
if changed == false then
savestate.loadslot(save_inner)
emu.frameadvance()
end
until (frame_dif_inner > 300 or changed == true)
client.pause()
console.log("Damage:" .. damage_dealt)
end
while true do
local text_x = 250
local text_y = 0
local timer = read8(Addresses.timer)
local rng1 = read8(Addresses.rng1)
local rng2 = read8(Addresses.rng2)
local rng3 = read8(Addresses.rng3)
local area = read8(Addresses.area)
local encounter_timer = read8(Addresses.encounter_timer)
text_y = 41
text(text_x, text_y, "T: " .. timer .. " R1:" .. bizstring.hex(rng1) .. " R2:" .. bizstring.hex(rng2) .. " R3:" .. bizstring.hex(rng3))
text_y = 48
text(text_x, text_y, "Area :" .. area)
text_y = 55
text(text_x, text_y, "E :" .. encounter_timer)
display_robattle()
emu.frameadvance()
end