;;-*-Lisp-*-
(in-package goal)

;; name: penetrate-h.gc
;; name in dgo: penetrate-h
;; dgos: ENGINE, GAME

;; +++penetrate
(defenum penetrate
  :bitfield #t
  :type uint64
  (touch             0) ;; 1
  (generic-attack    1) ;; 2
  (lunge             2) ;; 4
  (flop              3) ;; 8
  (punch             4) ;; 16
  (spin              5) ;; 32
  (roll              6) ;; 64
  (uppercut          7) ;; 128
  (bonk              8) ;; 256
  (tube              9) ;; 512
  (vehicle           10) ;; 1024
  (flut-attack       11) ;; 2048
  (board             12) ;; 4096
  (mech              13) ;; 8192
  (mech-punch        14) ;; 16384
  (mech-bonk         15) ;; 32768
  (dark-skin         16) ;; hi 1
  (dark-punch        17) ;; hi 2
  (dark-bomb         18) ;; hi 4
  (dark-giant        19) ;; hi 8
  (shield            20) ;; hi 16
  (explode           21) ;; hi 32
  (jak-yellow-shot   22) ;; hi 64
  (jak-red-shot      23) ;; hi 128
  (jak-blue-shot     24) ;; hi 256
  (jak-dark-shot     25) ;; hi 512
  (enemy-yellow-shot 26) ;; hi 1024
  (enemy-dark-shot   27) ;; hi 2048
  (eco-yellow        28) ;; hi 4096
  (eco-red           29) ;; hi 8192
  (eco-blue          30) ;; hi 16384
  (eco-green         31) ;; hi 32768
  (knocked           32) ;; hihi 1
  (penetrate-33      33)
  (penetrate-34      34)
  (penetrate-35      35)
  (penetrate-36      36)
  (penetrate-37      37)
  (penetrate-38      38)
  (penetrate-39      39)
  (penetrate-40      40)
  (penetrate-41      41)
  (penetrate-42      42)
  (penetrate-43      43)
  (penetrate-44      44)
  (penetrate-45      45)
  (penetrate-46      46)
  (penetrate-47      47)
  (penetrate-48      48)
  (penetrate-49      49)
  (penetrate-50      50)
  (penetrate-51      51)
  (penetrate-52      52)
  (penetrate-53      53)
  (penetrate-54      54)
  (penetrate-55      55)
  (penetrate-56      56)
  (penetrate-57      57)
  (penetrate-58      58)
  (penetrate-59      59)
  (penetrate-60      60)
  (penetrate-61      61)
  (penetrate-62      62)
  (penetrate-63      63)
  )
;; ---penetrate


;; DECOMP BEGINS

(defun penetrate-using->damage ((arg0 penetrate))
  (cond
    ((logtest? (penetrate dark-bomb dark-giant) arg0)
     15
     )
    ((logtest? arg0 (penetrate mech-punch mech-bonk))
     5
     )
    ((logtest? (penetrate) arg0)
     4
     )
    ((logtest? (penetrate punch spin jak-dark-shot enemy-dark-shot) arg0)
     3
     )
    ((logtest? (penetrate
                 flop
                 uppercut
                 tube
                 flut-attack
                 dark-punch
                 explode
                 jak-yellow-shot
                 jak-red-shot
                 jak-blue-shot
                 enemy-yellow-shot
                 eco-yellow
                 )
               arg0
               )
     2
     )
    ((logtest? arg0 (penetrate generic-attack roll bonk board))
     1
     )
    (else
      0
      )
    )
  )

;; WARN: Return type mismatch uint vs penetrate.
(defun penetrated-by-all&hit-points->penetrated-by ((arg0 penetrate) (arg1 int))
  (let ((a0-1 arg1))
    (the-as penetrate (logior (logclear arg0 (penetrate
                                               generic-attack
                                               flop
                                               punch
                                               spin
                                               roll
                                               uppercut
                                               bonk
                                               tube
                                               vehicle
                                               flut-attack
                                               board
                                               mech-punch
                                               mech-bonk
                                               dark-skin
                                               dark-punch
                                               dark-bomb
                                               dark-giant
                                               shield
                                               explode
                                               jak-yellow-shot
                                               jak-red-shot
                                               jak-blue-shot
                                               jak-dark-shot
                                               enemy-yellow-shot
                                               enemy-dark-shot
                                               eco-yellow
                                               knocked
                                               )
                                        )
                              (cond
                                ((or (zero? a0-1) (= a0-1 1))
                                 (the-as int (the-as uint #x11fffdffa))
                                 )
                                ((= a0-1 2)
                                 #x1feeceb8
                                 )
                                ((= a0-1 3)
                                 #xa0cc430
                                 )
                                ((= a0-1 4)
                                 #xcc400
                                 )
                                ((= a0-1 5)
                                 #xcc400
                                 )
                                ((or (= a0-1 6)
                                     (= a0-1 7)
                                     (= a0-1 8)
                                     (= a0-1 9)
                                     (= a0-1 10)
                                     (= a0-1 11)
                                     (= a0-1 12)
                                     (= a0-1 13)
                                     (= a0-1 14)
                                     (= a0-1 15)
                                     )
                                 #xc0400
                                 )
                                (else
                                  1024
                                  )
                                )
                              )
            )
    )
  )
