Guest User

pkmntypes

a guest
Aug 19th, 2012
290
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TypeNamePointers: ; 7DAE
  2.     dw Type00Name
  3.     dw Type01Name
  4.     dw Type02Name
  5.     dw Type03Name
  6.     dw Type04Name
  7.     dw Type05Name
  8.     dw Type06Name
  9.     dw Type07Name
  10.     dw Type08Name
  11.     dw Type00Name
  12.     dw Type00Name
  13.     dw Type00Name
  14.     dw Type00Name
  15.     dw Type00Name
  16.     dw Type00Name
  17.     dw Type00Name
  18.     dw Type00Name
  19.     dw Type00Name
  20.     dw Type00Name
  21.     dw Type00Name
  22.     dw Type14Name
  23.     dw Type15Name
  24.     dw Type16Name
  25.     dw Type17Name
  26.     dw Type18Name
  27.     dw Type19Name
  28.     dw Type1AName
  29.  
  30. Type00Name:
  31.     db "NORMAL@"
  32. Type01Name:
  33.     db "FIGHTING@"
  34. Type02Name:
  35.     db "FLYING@"
  36. Type03Name:
  37.     db "POISON@"
  38. Type14Name:
  39.     db "FIRE@"
  40. Type15Name:
  41.     db "WATER@"
  42. Type16Name:
  43.     db "GRASS@"
  44. Type17Name:
  45.     db "ELECTRIC@"
  46. Type18Name:
  47.     db "PSYCHIC@"
  48. Type19Name:
  49.     db "ICE@"
  50. Type04Name:
  51.     db "GROUND@"
  52. Type05Name:
  53.     db "ROCK@"
  54. Type06Name:
  55.     db "BIRD@"
  56. Type07Name:
  57.     db "BUG@"
  58. Type08Name:
  59.     db "GHOST@"
  60. Type1AName:
  61.     db "DRAGON@"
  62. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  63. CalculateDamage: ; 0x3ddcf
  64.     xor a
  65.     ld hl, W_DAMAGE ;damage to eventually inflict, intitialise to zero
  66.     ldi [hl], a
  67.     ld [hl], a
  68.     ld hl, W_PLAYERMOVEPOWER
  69.     ld a, [hli]     ;*read attack base power
  70.     and a
  71.     ld d, a         ;*D = attack base, used later
  72.     ret z           ;return if attack is zero
  73.     ld a, [hl]      ;*test attacking type
  74.     cp a, $14       ;types >= $14 are all special
  75.     jr nc, .specialAttack
  76. .physicalAttack
  77.     ld hl, W_ENEMYMONDEFENSE    ;opponent defense
  78.     ld a, [hli]                 ;*BC = opponent defense used later
  79.     ld b, a
  80.     ld c, [hl]
  81.     ld a, [W_ENEMYBATTSTATUS3]  ;test for reflect
  82.     bit 2, a
  83.     jr z, .next\@
  84. .doubleDefense
  85.     sla c  ;x2 defense if bit2 of D069 is set
  86.     rl b
  87. .next\@
  88.     ld hl, $d025  ;attack pointer
  89.     ld a, [$d05e]
  90.     and a
  91.     jr z, .next3\@
  92.     ld c, 3
  93.     call $5f1c
  94.     ld a, [$ff00+$97]
  95.     ld b, a
  96.     ld a, [$ff00+$98]
  97.     ld c, a
  98.     push bc
  99.     ld hl, $d18f
  100.     ld a, [W_PLAYERMONNUMBER]
  101.     ld bc, $002c
  102.     call AddNTimes
  103.     pop bc
  104.     jr .next3\@
  105. .specialAttack
  106.     ld hl, W_ENEMYMONSPECIAL    ;opponent special
  107.     ld a, [hli]                 ;*BC = opponent special defense used later
  108.     ld b, a
  109.     ld c, [hl]
  110.     ld a, [W_ENEMYBATTSTATUS3]  ;test for lightscreen
  111.     bit 1, a
  112.     jr z, .next2\@
RAW Paste Data