comparison clojure/com/aurellem/gb/hxc.clj @ 281:ca1afcef3542

Replaced manually listed move data in gb.moves with a call to hxc-move-data. Also, began work on hxc-shops, which lists shop inventory. todo: find out how the game converts internal order to pokedex order; todo: get hardcoded tm data.
author Dylan Holmes <ocsenave@gmail.com>
date Tue, 27 Mar 2012 22:41:24 -0500
parents 69184558fcf3
children 0c3fbb313e49
comparison
equal deleted inserted replaced
280:d5e5c73af7e6 281:ca1afcef3542
1 (ns com.aurellem.gb.hxc 1 (ns com.aurellem.gb.hxc
2 (:use (com.aurellem.gb assembly characters gb-driver util 2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants)) 3 constants species))
4 (:use (com.aurellem.world practice)) 4 (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState])) 5 (:import [com.aurellem.gb.gb_driver SaveState]))
6 6
7 7
8 8
303 ([] 303 ([]
304 (hxc-move-data com.aurellem.gb.gb-driver/original-rom)) 304 (hxc-move-data com.aurellem.gb.gb-driver/original-rom))
305 ([rom] 305 ([rom]
306 (let [names (vec (hxc-move-names rom)) 306 (let [names (vec (hxc-move-names rom))
307 move-count (count names) 307 move-count (count names)
308 move-size 6] 308 move-size 6
309 types pkmn-types ;;; !! hardcoded types
310 ]
309 (zipmap (map format-name names) 311 (zipmap (map format-name names)
310 (map 312 (map
311 (fn [[idx effect power type accuracy pp]] 313 (fn [[idx effect power type-id accuracy pp]]
312 {:name (names (dec idx)) 314 {:name (names (dec idx))
313 :power power 315 :power power
314 :accuracy accuracy 316 :accuracy accuracy
315 :pp pp 317 :pp pp
318 :type (types type-id)
316 :fx-id effect 319 :fx-id effect
317 :fx-txt (get move-effects effect) 320 :fx-txt (get move-effects effect)
318 } 321 }
319 ) 322 )
320 323
412 (get pkmn-types def (hex def)) 415 (get pkmn-types def (hex def))
413 (/ mult 10)]) 416 (/ mult 10)])
414 (partition 3 417 (partition 3
415 (take-while (partial not= 0xFF) 418 (take-while (partial not= 0xFF)
416 (drop 0x3E62D rom)))))) 419 (drop 0x3E62D rom))))))
420
417 421
418 422
419 (defn format-evo 423 (defn format-evo
420 [coll] 424 [coll]
421 (let [method (first coll)] 425 (let [method (first coll)]
648 (partition entry-size 652 (partition entry-size
649 (take (* entry-size pkmn-count) 653 (take (* entry-size pkmn-count)
650 (drop 0x383DE 654 (drop 0x383DE
651 rom))))))) 655 rom)))))))
652 656
657 (defn hxc-shops
658 ([] (hxc-shops com.aurellem.gb.gb-driver/original-rom))
659 ([rom]
660 (let [items (zipmap (range) (map format-name (hxc-items rom)))
661
662 ;; temporarily softcode the TM items
663 items (into
664 items
665 (map (juxt identity
666 (comp keyword
667 (partial str "tm-")
668 (partial + 1 -200)
669 ))
670 (take 200 (drop 200 (range)))))
671
672 ]
673
674 ((fn parse-shop [coll [num-items & items-etc]]
675 (let [inventory (take (dec num-items) (rest items-etc))
676 [separator & items-etc] (drop num-items (rest items-etc))]
677 (if (= separator 0x50)
678 (map (partial mapv (comp items dec)) (conj coll inventory))
679 (recur (conj coll inventory) items-etc)
680 )
681 ))
682
683 '()
684 (take 1000 (drop 0x233C rom)))
685
686
687 )))
688
689
653 690
654 ;; ********************** MANIPULATION FNS 691 ;; ********************** MANIPULATION FNS
655 692
656 693
657 694
700 737
701 ;; note for later: credits start at F1290 738 ;; note for later: credits start at F1290
702 739
703 740
704 741
742
743 ;; (def dex-order
744 ;; [:bulbasaur
745 ;; :ivysaur
746 ;; :venusaur
747 ;; :charmander
748 ;; :charmeleon
749 ;; :charizard])
750
751
752 ;; (defn same-type-attack-bonus?
753 ;; ([pkmn move]
754 ;; (same-type-attack-bonus?
755 ;; com.aurellem.gb.gb-driver/original-rom pkmn move))
756 ;; ([rom pkmn move]
757 ;; (hxc-pokemon-base rom)))
758
759
760
761
762
763
705 (comment 764 (comment
706 765
707 (def hxc-later 766 (def hxc-later
708 "Running this code produces, e.g. hardcoded names NPCs give 767 "Running this code produces, e.g. hardcoded names NPCs give
709 their pokemon. Will sort through it later." 768 their pokemon. Will sort through it later."
722 (take-nth 4 dex)))) 781 (take-nth 4 dex))))
723 ) 782 )
724 783
725 784
726 785
786
787
788