Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/pokemon.clj @ 203:85a2c2e2d318
have to add default types for all pokemon.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 23 Mar 2012 04:00:42 -0500 |
parents | 1ce54929bc0c |
children | 32ac21c9a30d |
comparison
equal
deleted
inserted
replaced
202:1ce54929bc0c | 203:85a2c2e2d318 |
---|---|
347 (give-status state num status)) | 347 (give-status state num status)) |
348 state | 348 state |
349 (range (party-number state)))) | 349 (range (party-number state)))) |
350 ([status] | 350 ([status] |
351 (give-status-all @current-state status))) | 351 (give-status-all @current-state status))) |
352 | |
353 | |
354 (def pokemon-base | |
355 {:dv {:attack 15 :hp 15 :defense 15 | |
356 :special 15 :speed 15} | |
357 :species :ditto | |
358 :original-trainer "RLM" | |
359 :ID 5195 | |
360 :status :normal | |
361 :experience | |
362 {:main-exp 500 | |
363 :attack-exp 0xFF | |
364 :defense-exp 0xFF | |
365 :speed-exp 0xFF | |
366 :special-exp 0xFF | |
367 :hp-exp 0xFF} | |
368 | |
369 :stats | |
370 ;; TODO recalculate these from a real ditto | |
371 {:level 7 | |
372 :current-hp 50 | |
373 :hp 50 | |
374 :attack 50 | |
375 :defense 50 | |
376 :speed 50 | |
377 :special 50} | |
378 | |
379 | |
380 :moves [[:transform {:pp-up 3 :pp 5}]]}) | |
381 | |
382 (defn expand-pokemon | |
383 "Given a map describing a pokemon, fill in any missing | |
384 values based on the ones already present." | |
385 [pokemon] | |
386 (-> (merge pokemon-base pokemon) | |
387 ;; if no nickname is supplied, default to the | |
388 ;; uppercase name of the species, as r/b/y do | |
389 ;; when a pokemon is captured. | |
390 ((fn [pokemon] | |
391 (if (nil? (:name pokemon)) | |
392 (assoc pokemon :name (.toUpperCase | |
393 (.substring | |
394 (str (:species pokemon)) 1))) | |
395 pokemon))) | |
396 ;; species2 should almost always just be the | |
397 ;; same as species. | |
398 ((fn [pokemon] | |
399 (if (nil? (:species2 pokemon)) | |
400 (assoc pokemon :species2 (:species pokemon))))) | |
401 | |
402 ;; enable the date in :moves to be any combo of | |
403 ;; [:move-1 :move-2] | |
404 ;; [[:move-1 {:pp 20}] :move-2] | |
405 ;; [[:move-1 {:pp 20 :pp-up 3}] :move-2] | |
406 ;; default to full pp for the move, with no | |
407 ;; pp-ups. | |
408 ((fn [pokemon] | |
409 (let [moves (:moves pokemon)] | |
410 (assoc pokemon :moves | |
411 (for [move moves] | |
412 (cond | |
413 (keyword? move) | |
414 [move {:pp (max-pp move) :pp-up 0}] | |
415 (vector? move) | |
416 [(first move) | |
417 (merge {:pp (max-pp (first move)) | |
418 :pp-up 0} (second move))])))))) | |
419 | |
420 | |
421 | |
422 | |
423 )) | |
424 |