diff clojure/com/aurellem/world/new_types.clj @ 292:c31cb3043087

Tinkering with types and encounters.
author Dylan Holmes <ocsenave@gmail.com>
date Fri, 30 Mar 2012 05:57:12 -0500
parents df9cad9909d2
children
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/world/new_types.clj	Thu Mar 29 18:23:20 2012 -0500
     1.2 +++ b/clojure/com/aurellem/world/new_types.clj	Fri Mar 30 05:57:12 2012 -0500
     1.3 @@ -1,5 +1,121 @@
     1.4  (ns com.aurellem.world.new-types
     1.5 -  (:import (com.aurelem.gb.gb_driver))
     1.6 -  (:use (com.aurellem.gb hxc))
     1.7 -  )
     1.8 +  (:use (com.aurellem.gb gb-driver util hxc characters util assembly))
     1.9 +  (:use (com.aurellem.world practice))
    1.10 +  (:import [com.aurellem.gb.gb_driver SaveState]))
    1.11    
    1.12 +
    1.13 +;; GEN II type differences
    1.14 +;; bug against poison: 2x -> 1/2
    1.15 +;; poison against bug: 2x -> 1x
    1.16 +;; !! our article is wrong. bug against ghost 1x -X-> 2x
    1.17 +;; ghost against psychic: 0x -> 2x
    1.18 +;; ice against fire: 1x -> 1/2
    1.19 +
    1.20 +;; steel against rock: 2x
    1.21 +;; steel against steel: 1/2
    1.22 +;; steel against fire : 1/2
    1.23 +;; steel against water: 1/2
    1.24 +;; steel against electric: 1/2
    1.25 +;; steel against ice: 2x
    1.26 +
    1.27 +;; normal against steel: 1/2
    1.28 +;; fighting against steel: 2x
    1.29 +;; flying against steel: 1/2
    1.30 +;; poison against steel: 0
    1.31 +;; ground against steel: 2
    1.32 +;; rock against steel: 1/2
    1.33 +;; bug against steel: 1/2
    1.34 +;; ghost against steel: 1/2
    1.35 +;; fire against steel: 2
    1.36 +;; grass against steel: 1/2
    1.37 +;; psychic against steel: 1/2
    1.38 +;; ice against steel: 1/2
    1.39 +;; dragon against steel: 1/2
    1.40 +;; dark against steel: 1/2
    1.41 +
    1.42 +;; dark against fighting 1/2
    1.43 +;; dark against ghost 2x
    1.44 +;; dark against steel 1/2
    1.45 +;; dark against psychic 2x
    1.46 +;; dark against dark 1/2
    1.47 +
    1.48 +;; fighting against dark 1/2
    1.49 +;; bug against dark 2x
    1.50 +;; ghost against dark 1/2
    1.51 +;; psychic against dark 0
    1.52 +
    1.53 +
    1.54 +;; #BIRD -> #DARK at 27DE8
    1.55 +
    1.56 +(defn hack-encounter
    1.57 +  "(BROKEN) Change the wild encounter pokemon of the given area in the current state. Volatile ---
    1.58 +only changes the current area, and then only as long as you remain in
    1.59 +  the area."
    1.60 +  ([pokemon]
    1.61 +     (hack-encounter pokemon 11))
    1.62 +  ([pokemon level]
    1.63 +     (let [id ((zipmap (hxc-pokenames) (range)) pokemon)]
    1.64 +       (rewrite-memory (vec(memory))
    1.65 +                       0xD888
    1.66 +                       (cons level
    1.67 +                             (interleave
    1.68 +                              (repeat 5 level)
    1.69 +                              (repeat (inc id)))
    1.70 +                              )))))
    1.71 +  
    1.72 +  
    1.73 +(defn hack-encounter*
    1.74 +  "Certainly Encounter a certain pokemon in the grass outside celadon. You must
    1.75 +walk out of the wild and back to load the data into RAM." 
    1.76 +  ([mem pkmn] (encounter mem pkmn 11))
    1.77 +  ([mem pkmn lvl]
    1.78 +  (let [pkmn-id ((zipmap (hxc-pokenames) (range)) pkmn)
    1.79 +        pkmn-id (if (nil? pkmn-id) 76 (inc pkmn-id))
    1.80 +        ] 
    1.81 +    (rewrite-memory
    1.82 +     mem
    1.83 +     0xCF6C
    1.84 +     (interleave (repeat lvl 10) (repeat pkmn-id))))))
    1.85 +
    1.86 +
    1.87 +(defn hack-gen-2-types
    1.88 +  []
    1.89 +  (->
    1.90 +   (vec (rom))
    1.91 +   (rewrite-memory 0x3E6DD [20]) ;; ghost is 2x effective against psychic
    1.92 +   (rewrite-memory 0x3E6C5 [5])  ;; bug is half-effective against poison
    1.93 +   
    1.94 +   ;; ice is half-effective against fire.
    1.95 +   ;; since this overwrites "poison is 2x against bug",
    1.96 +   ;; poison is now, by default, 1x effective against bug.
    1.97 +   (rewrite-memory 0x3E681 [25 20 5])
    1.98 +   
    1.99 +   
   1.100 +   (rewrite-memory 0x27DE9 ["DARK"]) ;; replace BIRD with DARK
   1.101 +   (rewrite-memory 0x38105 [6]) ;; BITE is a dark-type attack
   1.102 +
   1.103 +   ;; the following commands write into risky unknown memory.
   1.104 +
   1.105 +   (rewrite-memory 0x27DFF
   1.106 +                   ["STEEL" 0x50])
   1.107 +   
   1.108 +   (rewrite-memory 0x3E6f0
   1.109 +                   [6 1 5   ;; dark fighting 1/2
   1.110 +                    6 24 20 ;; dark psychic 2
   1.111 +                    6 8 20  ;; dark ghost 2
   1.112 +                    6 6 5  ;; dark dark 1/2
   1.113 +
   1.114 +                    1 6 20  ;; fighting dark 2
   1.115 +                    24 6 0  ;; psychic dark 0
   1.116 +                    7 6 20  ;; bug dark 2
   1.117 +                    8 6 5   ;; ghost dark 1/2
   1.118 +                    
   1.119 +                    0xff
   1.120 +                    ])
   1.121 +   ;;(rewrite-rom _ 
   1.122 +   ;;(write-rom!)
   1.123 + 
   1.124 +   ))
   1.125 +  
   1.126 +
   1.127 +