| 1 | #!/usr/bin/ruby |
|---|
| 2 | # |
|---|
| 3 | # This is the stub of a module that can be loaded to experiment with the |
|---|
| 4 | # FaerieMUD personas. |
|---|
| 5 | # |
|---|
| 6 | # Time-stamp: <31-Oct-2005 10:14:10 ged> |
|---|
| 7 | # |
|---|
| 8 | |
|---|
| 9 | BEGIN { |
|---|
| 10 | base = File::dirname( File::dirname(__FILE__) ) |
|---|
| 11 | $LOAD_PATH.unshift "#{base}/lib" |
|---|
| 12 | |
|---|
| 13 | require "#{base}/utils.rb" |
|---|
| 14 | include UtilityFunctions |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | require 'fm' |
|---|
| 18 | |
|---|
| 19 | module FaerieMUD::Personas |
|---|
| 20 | |
|---|
| 21 | Characters = {} |
|---|
| 22 | |
|---|
| 23 | gerd = FaerieMUD::Character::new |
|---|
| 24 | |
|---|
| 25 | gerd.name = "Gerd" |
|---|
| 26 | gerd.body.statistic.element = 46 |
|---|
| 27 | gerd.soul.statistic.element = 33 |
|---|
| 28 | gerd.mind.statistic.element = 89 |
|---|
| 29 | |
|---|
| 30 | Characters[ :gerd ] = gerd |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | meriwym = FaerieMUD::Character::new |
|---|
| 34 | |
|---|
| 35 | meriwym.name = "Meriwym" |
|---|
| 36 | meriwym.body.statistic.element = 13 |
|---|
| 37 | meriwym.mind.statistic.element = 73 |
|---|
| 38 | meriwym.soul.statistic.element = 98 |
|---|
| 39 | |
|---|
| 40 | Characters[ :meriwym ] = meriwym |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | ############### |
|---|
| 44 | module_function |
|---|
| 45 | ############### |
|---|
| 46 | |
|---|
| 47 | ### Given a FaerieMUD::Character object +char+, returns a String which |
|---|
| 48 | ### succinctly describes her in a human-readable way. |
|---|
| 49 | def prettyPrintCharacter( char ) |
|---|
| 50 | lines = [] |
|---|
| 51 | |
|---|
| 52 | lines << "== %s the %s ==========" % [ char.name, char.body.noun ] |
|---|
| 53 | |
|---|
| 54 | lines << "" |
|---|
| 55 | lines << " Statistics" |
|---|
| 56 | char.constituents.each do |name, const| |
|---|
| 57 | lines << " %s: (%d %s/%d %s)" % [ |
|---|
| 58 | name.to_s.capitalize, |
|---|
| 59 | const.statistic.linear, |
|---|
| 60 | const.statistic.linear_name, |
|---|
| 61 | const.statistic.developmental, |
|---|
| 62 | const.statistic.devel_name, |
|---|
| 63 | ] |
|---|
| 64 | end |
|---|
| 65 | |
|---|
| 66 | lines << "" |
|---|
| 67 | lines << " Traits" |
|---|
| 68 | lines << " strength: %d intelligence: %d creativity: %d" % |
|---|
| 69 | [ char.strength, char.intelligence, char.creativity ] |
|---|
| 70 | lines << " grace: %d resilience: %d perceptiveness: %d" % |
|---|
| 71 | [ char.grace, char.resilience, char.perceptiveness ] |
|---|
| 72 | lines << " dexterity: %d empathy: %d glamour: %d" % |
|---|
| 73 | [ char.dexterity, char.empathy, char.glamour ] |
|---|
| 74 | lines << " stamina: %d willpower: %d magistry: %d" % |
|---|
| 75 | [ char.stamina, char.willpower, char.magistry ] |
|---|
| 76 | |
|---|
| 77 | puts lines.join("\n") + "\n\n" |
|---|
| 78 | end |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | end # FaerieMUD::Personas |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | if $0 == __FILE__ |
|---|
| 85 | require 'pp' |
|---|
| 86 | |
|---|
| 87 | include FaerieMUD::Personas |
|---|
| 88 | Characters.values.each do |char| |
|---|
| 89 | prettyPrintCharacter( char ) |
|---|
| 90 | end |
|---|
| 91 | end |
|---|
| 92 | |
|---|