shithub: andre_quest

ref: e7a63797032c596bab7db243afe16a11c5b17b48
dir: /andre/

View raw version
!#/bin/rc 
# ANDRE QUEST
# git/clone and rc andre in its directory. 
rfork e
echo scroll >/dev/wctl

l = ./l
init = 1
slp = 2

fn slp { sleep $slp }
fn dice { awk 'BEGIN{ srand(); print int(1 + rand() * '$1^' ) }' }
fn rand_w { dice `{ awk 'END{print NR}' $1 } }

fn char_gen {
 level = 9
 max_sex_appeal = `{ echo `{dice 6} + `{dice 6} | bc }
 max_psa = `{ echo `{dice 6} \* 9 | bc }
 sex_appeal = $max_sex_appeal
 psa = $max_psa
 mood = (`{ sed -n `{rand_w $l/adj}^p $l/adj })
 dest = (`{ sed -n `{rand_w $l/dest}^p $l/dest })
 dist = `{ echo `{dice 20} + 9 | bc }
 score = 0
}

fn enemy_gen {
 e_mood = (`{ sed -n `{rand_w $l/adj}^p $l/adj })
 e_name = (`{ sed -n `{rand_w $l/names}^p $l/names })
 e_hp = `{ echo `{dice 6} + 9 | bc }
}

fn init {
 if (~ $init 1) { 
   echo
   echo Your $"mood Andre wants to get to the $"dest.
   echo 'It''s '$dist' kilometers away.'
   echo 
   echo Begin walking...
   init = 0
   read
                }
}

fn battle {
 
 while (test $e_hp -gt 0) {
 hud >/dev/text
 if (test $psa -lt 1) { echo Andre is out of Pure Psychic Automatism. He rests a round.
                        psa = `{dice $max_psa}; slp }
 a_strike = `{dice $psa}
 psa = `{ echo $psa - $a_strike | bc }
 echo Andre uses $a_strike points of Pure Psychic Automatism.
 stat_ck
 e_hp = `{ echo $e_hp - $a_strike | bc}
 slp
 }

 echo Your $mood Andre defeated $"e_name.
 last_mood = $mood
 mood = (`{ sed -n `{rand_w $l/adj}^p $l/adj })
 
 if (~ $last_mood $mood) echo Andre doesn''t care.
 if not echo This made your Andre $mood.

 sleep 2
 dest = `{ sed -n `{rand_w $l/dest}^p $l/dest }
 dist = `{ echo `{dice 20} + 9 | bc }
 score = `{ echo $score + 1 | bc }
 init = 1
 slp

}

fn stat_ck {
 if (test $psa -lt 1) psa = 0
 if (test $psa -gt $max_psa) psa = $max_psa
 if (test $sex_appeal -lt 1) sex_appeal = 0
 if (test $sex_appeal -gt $max_sex_appeal) sex_appeal = $max_sex_appeal
}

fn arrival {
 hud > /dev/text
 echo Your $mood Andre arrives to the $"dest.
 enemy_gen
 sleep 1
 echo A wild $e_mood $"e_name appears! 
 echo Andre prepares for battle!
 echo ENTER
 read
 battle
}

fn re_ck {
 if (test $dist -lt 1) { dist=0; arrival }
}

fn walk {
 echo; echo -n .; sleep 0.`{dice 6}; echo -n .; sleep 0.`{dice 6}; echo -n .; 
 echo
 dist = `{echo $dist - `{dice 3} | bc }
 re_ck
}

fn hud { 
cat << eof
                                 
            ysaw``     .                  
          y$@@@s=TT~^` =k ^               
        _a@P~`           "  __            
        @@~                ug@w           
       j@F:                 $RR_          
       g$  _yagay  aEyy_    '`$@          
       @@_ fyyg@@  "~~~~~   gg@@L         
      4@@$  F~`             A@@@          
      `@@@,      _y__       '$@~          
       ~@@$      ?PF~        @~           
         ~W      .___LL_    @#            
          @yg   a@F~`  `    ~             
           ` )__` 'MPF    , .             
              N@y___ __yy@^ `    $mood Andre
          __a@k$@@@@@@@@@F  .       level: $level
       yg@@@@@Wy~@@@@@@@@~     sex_appeal: $sex_appeal
     .d@@@@@@@L7$`5@@@P~              PSA: $psa
    a@0@@@@@@@$ 7@@F~    enemies defeated: $score
   _@K@$@@@@@@$ a@L    
  -4@@@@@@@@@@@W@@$     

  Destination: $dest
     Distance: $dist^km
eof
}

fn game {
 hud > /dev/text
 init
 walk

}

cat << eof > /dev/text

Welcome to 
           A N D R E 
            Q U E S T
                 9
  version


 Press ENTER to generate your
  Andre_

eof

read
char_gen
hud

while() game