Home | History | Annotate | Line # | Download | only in larn
      1 /*	$NetBSD: fortune.c,v 1.7 2009/08/12 08:04:05 dholland Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1991 The Regents of the University of California.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. Neither the name of the University nor the names of its contributors
     16  *    may be used to endorse or promote products derived from this software
     17  *    without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  */
     31 
     32 #include <sys/cdefs.h>
     33 #ifndef lint
     34 #if 0
     35 static char     sccsid[] = "@(#)fortune.c	5.5 (Berkeley) 6/10/91";
     36 #else
     37 __RCSID("$NetBSD: fortune.c,v 1.7 2009/08/12 08:04:05 dholland Exp $");
     38 #endif
     39 #endif				/* not lint */
     40 
     41 #include <stdlib.h>
     42 
     43 #include "header.h"
     44 #include "extern.h"
     45 /* fortune.c		 Larn is copyrighted 1986 by Noah Morgan. */
     46 
     47 /*
     48  * function to return a random fortune from the fortune file
     49  */
     50 
     51 static const char *flines[] = {
     52 	"gem value = gem * 2 ^ perfection",
     53 	"sitting down can have unexpected results",
     54 	"don't pry into the affairs of others",
     55 	"drinking can be hazardous to your health",
     56 	"beware of the gusher!",
     57 	"some monsters are greedy",
     58 	"nymphs have light fingers",
     59 	"try kissing a disenchantress!",
     60 	"hammers and brains don't mix",
     61 	"what does a potion of cure dianthroritis taste like?",
     62 	"hit point gain/loss when raising a level depends on constitution",
     63 	"healing a mighty wizard can be exhilarating",
     64 	"be sure to pay your taxes",
     65 	"are Vampires afraid of something?",
     66 	"some dragons can fly",
     67 	"dos thou strive for perfection?",
     68 	"patience is a virtue, unless your daughter dies",
     69 	"what does the Eye of Larn see in its guardian?",
     70 	"a level 25 player casts like crazy!",
     71 	"energy rings affect spell regeneration",
     72 	"difficulty affects regeneration",
     73 	"control of the pesty spirits is most helpful",
     74 	"don't fall into a bottomless pit",
     75 	"dexterity allows you to carry more",
     76 	"you can get 2 points of WC for the price of one",
     77 	"never enter the dungeon naked!  the monsters will laugh at you!",
     78 	"did someone put itching powder in your armor?",
     79 	"you klutz!",
     80 	"avoid opening doors.  you never know whats on the other side.",
     81 	"infinite regeneration ---> temptation",
     82 	"the greatest weapon in the game has not the highest Weapon Class",
     83 	"you can't buy the most powerful scroll",
     84 	"identify things before you use them",
     85 	"there's more than one way through a wall"
     86 };
     87 
     88 #define NFORTUNES	34
     89 
     90 const char *
     91 fortune(void)
     92 {
     93 	return (flines[random() % NFORTUNES]);
     94 }
     95