view 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 source
1 (ns com.aurellem.world.new-types
2 (:use (com.aurellem.gb gb-driver util hxc characters util assembly))
3 (:use (com.aurellem.world practice))
4 (:import [com.aurellem.gb.gb_driver SaveState]))
7 ;; GEN II type differences
8 ;; bug against poison: 2x -> 1/2
9 ;; poison against bug: 2x -> 1x
10 ;; !! our article is wrong. bug against ghost 1x -X-> 2x
11 ;; ghost against psychic: 0x -> 2x
12 ;; ice against fire: 1x -> 1/2
14 ;; steel against rock: 2x
15 ;; steel against steel: 1/2
16 ;; steel against fire : 1/2
17 ;; steel against water: 1/2
18 ;; steel against electric: 1/2
19 ;; steel against ice: 2x
21 ;; normal against steel: 1/2
22 ;; fighting against steel: 2x
23 ;; flying against steel: 1/2
24 ;; poison against steel: 0
25 ;; ground against steel: 2
26 ;; rock against steel: 1/2
27 ;; bug against steel: 1/2
28 ;; ghost against steel: 1/2
29 ;; fire against steel: 2
30 ;; grass against steel: 1/2
31 ;; psychic against steel: 1/2
32 ;; ice against steel: 1/2
33 ;; dragon against steel: 1/2
34 ;; dark against steel: 1/2
36 ;; dark against fighting 1/2
37 ;; dark against ghost 2x
38 ;; dark against steel 1/2
39 ;; dark against psychic 2x
40 ;; dark against dark 1/2
42 ;; fighting against dark 1/2
43 ;; bug against dark 2x
44 ;; ghost against dark 1/2
45 ;; psychic against dark 0
48 ;; #BIRD -> #DARK at 27DE8
50 (defn hack-encounter
51 "(BROKEN) Change the wild encounter pokemon of the given area in the current state. Volatile ---
52 only changes the current area, and then only as long as you remain in
53 the area."
54 ([pokemon]
55 (hack-encounter pokemon 11))
56 ([pokemon level]
57 (let [id ((zipmap (hxc-pokenames) (range)) pokemon)]
58 (rewrite-memory (vec(memory))
59 0xD888
60 (cons level
61 (interleave
62 (repeat 5 level)
63 (repeat (inc id)))
64 )))))
67 (defn hack-encounter*
68 "Certainly Encounter a certain pokemon in the grass outside celadon. You must
69 walk out of the wild and back to load the data into RAM."
70 ([mem pkmn] (encounter mem pkmn 11))
71 ([mem pkmn lvl]
72 (let [pkmn-id ((zipmap (hxc-pokenames) (range)) pkmn)
73 pkmn-id (if (nil? pkmn-id) 76 (inc pkmn-id))
74 ]
75 (rewrite-memory
76 mem
77 0xCF6C
78 (interleave (repeat lvl 10) (repeat pkmn-id))))))
81 (defn hack-gen-2-types
82 []
83 (->
84 (vec (rom))
85 (rewrite-memory 0x3E6DD [20]) ;; ghost is 2x effective against psychic
86 (rewrite-memory 0x3E6C5 [5]) ;; bug is half-effective against poison
88 ;; ice is half-effective against fire.
89 ;; since this overwrites "poison is 2x against bug",
90 ;; poison is now, by default, 1x effective against bug.
91 (rewrite-memory 0x3E681 [25 20 5])
94 (rewrite-memory 0x27DE9 ["DARK"]) ;; replace BIRD with DARK
95 (rewrite-memory 0x38105 [6]) ;; BITE is a dark-type attack
97 ;; the following commands write into risky unknown memory.
99 (rewrite-memory 0x27DFF
100 ["STEEL" 0x50])
102 (rewrite-memory 0x3E6f0
103 [6 1 5 ;; dark fighting 1/2
104 6 24 20 ;; dark psychic 2
105 6 8 20 ;; dark ghost 2
106 6 6 5 ;; dark dark 1/2
108 1 6 20 ;; fighting dark 2
109 24 6 0 ;; psychic dark 0
110 7 6 20 ;; bug dark 2
111 8 6 5 ;; ghost dark 1/2
113 0xff
114 ])
115 ;;(rewrite-rom _
116 ;;(write-rom!)
118 ))