Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TypeNamePointers: ; 7DAE
- dw Type00Name
- dw Type01Name
- dw Type02Name
- dw Type03Name
- dw Type04Name
- dw Type05Name
- dw Type06Name
- dw Type07Name
- dw Type08Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type00Name
- dw Type14Name
- dw Type15Name
- dw Type16Name
- dw Type17Name
- dw Type18Name
- dw Type19Name
- dw Type1AName
- Type00Name:
- db "NORMAL@"
- Type01Name:
- db "FIGHTING@"
- Type02Name:
- db "FLYING@"
- Type03Name:
- db "POISON@"
- Type14Name:
- db "FIRE@"
- Type15Name:
- db "WATER@"
- Type16Name:
- db "GRASS@"
- Type17Name:
- db "ELECTRIC@"
- Type18Name:
- db "PSYCHIC@"
- Type19Name:
- db "ICE@"
- Type04Name:
- db "GROUND@"
- Type05Name:
- db "ROCK@"
- Type06Name:
- db "BIRD@"
- Type07Name:
- db "BUG@"
- Type08Name:
- db "GHOST@"
- Type1AName:
- db "DRAGON@"
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- CalculateDamage: ; 0x3ddcf
- xor a
- ld hl, W_DAMAGE ;damage to eventually inflict, intitialise to zero
- ldi [hl], a
- ld [hl], a
- ld hl, W_PLAYERMOVEPOWER
- ld a, [hli] ;*read attack base power
- and a
- ld d, a ;*D = attack base, used later
- ret z ;return if attack is zero
- ld a, [hl] ;*test attacking type
- cp a, $14 ;types >= $14 are all special
- jr nc, .specialAttack
- .physicalAttack
- ld hl, W_ENEMYMONDEFENSE ;opponent defense
- ld a, [hli] ;*BC = opponent defense used later
- ld b, a
- ld c, [hl]
- ld a, [W_ENEMYBATTSTATUS3] ;test for reflect
- bit 2, a
- jr z, .next\@
- .doubleDefense
- sla c ;x2 defense if bit2 of D069 is set
- rl b
- .next\@
- ld hl, $d025 ;attack pointer
- ld a, [$d05e]
- and a
- jr z, .next3\@
- ld c, 3
- call $5f1c
- ld a, [$ff00+$97]
- ld b, a
- ld a, [$ff00+$98]
- ld c, a
- push bc
- ld hl, $d18f
- ld a, [W_PLAYERMONNUMBER]
- ld bc, $002c
- call AddNTimes
- pop bc
- jr .next3\@
- .specialAttack
- ld hl, W_ENEMYMONSPECIAL ;opponent special
- ld a, [hli] ;*BC = opponent special defense used later
- ld b, a
- ld c, [hl]
- ld a, [W_ENEMYBATTSTATUS3] ;test for lightscreen
- bit 1, a
- jr z, .next2\@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement