Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/pokemon.clj @ 208:45f1376b578c
saving progress
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 23 Mar 2012 04:39:24 -0500 |
parents | 32ac21c9a30d |
children | 912496041f98 |
comparison
equal
deleted
inserted
replaced
206:32ac21c9a30d | 208:45f1376b578c |
---|---|
364 :original-trainer "RLM" | 364 :original-trainer "RLM" |
365 :ID 5195 | 365 :ID 5195 |
366 :status :normal | 366 :status :normal |
367 :experience | 367 :experience |
368 {:main-exp 500 | 368 {:main-exp 500 |
369 :attack-exp 0xFF | 369 :attack-exp 0xFFFF |
370 :defense-exp 0xFF | 370 :defense-exp 0xFFFF |
371 :speed-exp 0xFF | 371 :speed-exp 0xFFFF |
372 :special-exp 0xFF | 372 :special-exp 0xFFFF |
373 :hp-exp 0xFF} | 373 :hp-exp 0xFFFF} |
374 | 374 |
375 :stats | 375 :stats |
376 ;; TODO recalculate these from a real ditto | 376 ;; TODO recalculate these from a real ditto |
377 {:level 7 | 377 {:level 7 |
378 :current-hp 50 | 378 :current-hp 50 |
379 :hp 50 | 379 :hp 50 |
380 :attack 50 | 380 :attack 50 |
381 :defense 50 | 381 :defense 50 |
382 :speed 50 | 382 :speed 50 |
383 :special 50} | 383 :special 50} |
384 | 384 :moves [[:transform {:pp-up 3 :pp 5}]]}) |
385 | |
386 :moves [[:transform {:pp-up 3 :pp 5}]]}) | |
387 | 385 |
388 (defn expand-pokemon | 386 (defn expand-pokemon |
389 "Given a map describing a pokemon, fill in any missing | 387 "Given a map describing a pokemon, fill in any missing |
390 values based on the ones already present." | 388 values based on the ones already present." |
391 [pokemon] | 389 [pokemon] |
418 (cond | 416 (cond |
419 (keyword? move) | 417 (keyword? move) |
420 [move {:pp (max-pp move) :pp-up 0}] | 418 [move {:pp (max-pp move) :pp-up 0}] |
421 (vector? move) | 419 (vector? move) |
422 [(first move) | 420 [(first move) |
423 (merge {:pp (max-pp (first move)) | 421 (merge {:pp (max-pp (first move) 0) |
424 :pp-up 0} (second move))])))))) | 422 :pp-up 0} (second move))])))))) |
425 ;; The game stores the pokemon's type redundantly | 423 ;; The game stores the pokemon's type redundantly |
426 ;; along with the species. If it's not specified | 424 ;; along with the species. If it's not specified |
427 ;; then it should default to that species default type. | 425 ;; then it should default to that species default type. |
428 ((fn [pokemon] | 426 ((fn [pokemon] |
429 (if (nil? (:type pokemon)) | 427 (if (nil? (:type pokemon)) |
430 (assoc pokemon :type | 428 (assoc pokemon :type |
431 (pokemon->type (:species pokemon))) | 429 (pokemon->type (:species pokemon))) |
432 pokemon))) | 430 pokemon))))) |
433 | 431 |
434 | |
435 | |
436 )) | |
437 |