opposing trainer and pokemon editing:
(my notes):
type1 8 bytes
u8 strength(iv set- ((strength * 31) / 255)
u8 abil: >>4 if 1 abil1, if 2 abil2, gender:0 skip get rate, else get gender rate for set gender
u8 level
u8 pad
u16 species
u16 form
type2 16 bytes, 4
u8 strength(iv set- ((strength * 31) / 255)
u8 abil: >>4 if 1 abil1, if 2 abil2, gender:0 skip get rate, else get gender rate for set gender
u8 level
u8 pad
u16 species
u16 form
u16 move1
u16 move2
u16 move3
u16 move4
type3 10 bytes, 796
u8 strength(iv set- ((strength * 31) / 255)
u8 abil: >>4 if 1 abil1, if 2 abil2, gender:0 skip get rate, else get gender rate for set gender
u8 level
u8 pad
u16 species
u16 form
u16 item
type4 18 bytes, 813
u8 strength(iv set- ((strength * 31) / 255) the result is used for all 6 ivs
u8 abil/gender: >>4 if 1 abil1, if 2 abil2, gender:0 skip get rate, else get gender rate for set gender
u8 level
u8 pad
u16 species
u16 form
u16 item
u16 move1
u16 move2
u16 move3
u16 move4
nature comes from pid: pid % 25
pkm byte 1, gender/abil byte: abil1 = 10, abil2 = 20, abilDW = 30
they check if the poke has frustration as a move. if not, happiness is 255. if so, set it to 0.
trainer
u8 template
u8 class
u8 battle type
u8 poke count
u16 item1
u16 item2
u16 item3
u16 item4
u32 trainer AI
u8 & 1 healer
u8 cash
u16 item, post battle
template is 0-3, affects pkm type- up above
the rest of healer is not used
post battle item is given out once
trainer AI is a char-sized bitfield. it's read as a u32 though, likely for the sake of future expansion. trainer AI is made up of many parts though(i've spent some time poking at it), so it's not just using the 8 bits as parts to pick through. your best bet for now is to look trainers up and use them as templates. i.e. 1 for normal trainer battles, 7 for event battles, 81 for double battles, 87 for 2v2, etc etc. eventually we'll know what it all does and be able to edit it. it's very complex and very large.