Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/hxc.clj @ 292:c31cb3043087
Tinkering with types and encounters.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Fri, 30 Mar 2012 05:57:12 -0500 |
parents | eec3e69500d9 |
children | 2873f50b7291 |
comparison
equal
deleted
inserted
replaced
291:c8b0db518de3 | 292:c31cb3043087 |
---|---|
447 | 447 |
448 | 448 |
449 | 449 |
450 | 450 |
451 (defn hxc-advantage | 451 (defn hxc-advantage |
452 "The hardcoded type advantages in memory, returned as tuples of atk-type def-type multiplier. By default (i.e. if not listed here), | 452 ;; in-game multipliers are stored as 10x their effective value |
453 the multiplier is 1." | 453 ;; to allow for fractional multipliers like 1/2 |
454 | |
455 "The hardcoded type advantages in memory, returned as tuples of | |
456 atk-type def-type multiplier. By default (i.e. if not listed here), | |
457 the multiplier is 1. List begins at 0x3E62D." | |
454 ([] (hxc-advantage com.aurellem.gb.gb-driver/original-rom)) | 458 ([] (hxc-advantage com.aurellem.gb.gb-driver/original-rom)) |
455 ([rom] | 459 ([rom] |
456 (map | 460 (map |
457 (fn [[atk def mult]] [(get pkmn-types atk (hex atk)) | 461 (fn [[atk def mult]] [(get pkmn-types atk (hex atk)) |
458 (get pkmn-types def (hex def)) | 462 (get pkmn-types def (hex def)) |
748 | 752 |
749 ))) | 753 ))) |
750 | 754 |
751 | 755 |
752 | 756 |
757 | |
758 | |
759 (defn hxc-ptrs-wild | |
760 "A list of the hardcoded wild encounter data in memory. Pointers | |
761 begin at ROM@0CB95; data begins at ROM@0x04D89" | |
762 ([] (hxc-ptrs-wild com.aurellem.gb.gb-driver/original-rom)) | |
763 ([rom] | |
764 (let [ptrs | |
765 (map (fn [[a b]] (+ a (* 0x100 b))) | |
766 (take-while (partial not= (list 0xFF 0xFF)) | |
767 (partition 2 (drop 0xCB95 rom))))] | |
768 ptrs))) | |
769 | |
770 | |
771 | |
772 (defn hxc-wilds | |
773 "A list of the hardcoded wild encounter data in memory. Pointers | |
774 begin at ROM@0CB95; data begins at ROM@0x04D89" | |
775 ([] (hxc-wilds com.aurellem.gb.gb-driver/original-rom)) | |
776 ([rom] | |
777 (let [pokenames (zipmap (range) (hxc-pokenames rom))] | |
778 (map | |
779 (partial map (fn [[a b]] {:species (pokenames (dec b)) :level | |
780 a})) | |
781 (partition 10 | |
782 | |
783 (take-while (comp (partial not= 1) | |
784 first) | |
785 (partition 2 | |
786 (drop 0xCD8C rom)) | |
787 | |
788 )))))) | |
789 | |
790 | |
791 | |
792 | |
793 | |
794 | |
795 | |
796 | |
797 | |
798 | |
799 | |
800 | |
801 | |
802 | |
753 ;; ********************** MANIPULATION FNS | 803 ;; ********************** MANIPULATION FNS |
754 | 804 |
755 | 805 |
756 (defn same-type | 806 (defn same-type |
757 ([pkmn move] | 807 ([pkmn move] |