Advertisement
IdainTV

CheckBattleEggGroupCompatibility

Jun 25th, 2021
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CheckBattleEggGroupCompatibility:
  2. ; Similar to CheckBreedingEggGroupCompatibility, but with battling mons.
  3.  
  4. ; Ditto is automatically discarded.
  5. ; If not Ditto, load the breeding groups into b/c and d/e.
  6.    
  7.     ld a, [wTempEnemyMonSpecies]
  8.     cp DITTO
  9.     jr z, .Incompatible
  10.  
  11.     ld [wCurSpecies], a
  12.     call GetBaseData
  13.     ld a, [wBaseEggGroups]
  14.     push af
  15.     and $f
  16.     cp EGG_NONE
  17.     jr z, .pop_incompatible
  18.     ld b, a
  19.     pop af
  20.     and $f0
  21.     cp EGG_NONE << 4
  22.     jr z, .Incompatible
  23.     swap a
  24.     ld c, a
  25.  
  26.     ld a, [wTempBattleMonSpecies]
  27.     cp DITTO
  28.     jr z, .Incompatible
  29.  
  30.     ld [wCurSpecies], a
  31.     call GetBaseData
  32.     ld a, [wBaseEggGroups]
  33.     push af
  34.     and $f
  35.     cp EGG_NONE
  36.     jr z, .pop_incompatible
  37.     ld d, a
  38.     pop af
  39.     and $f0
  40.     cp EGG_NONE << 4
  41.     jr z, .Incompatible
  42.     swap a
  43.     ld e, a
  44.  
  45.     ld a, d
  46.     cp b
  47.     jr z, .Compatible
  48.     cp c
  49.     jr z, .Compatible
  50.  
  51.     ld a, e
  52.     cp b
  53.     jr z, .Compatible
  54.     cp c
  55.     jr z, .Compatible
  56.     jr .Incompatible
  57.  
  58. .pop_incompatible:
  59.     pop af
  60. .Incompatible:
  61.     and a
  62.     ret
  63.  
  64. .Compatible:
  65.     scf
  66.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement