Re: alignment

From: ShadowLord (dkoepke@california.com)
Date: 04/26/96


On Fri, 26 Apr 1996, Marcelo Valle Moreira wrote:

>   if (GET_ALIGNMENT(ch) >= 10000)
>     strcpy(alinhamento,  "You are a Saint.\r\n");
>   else if (GET_ALIGNMENT(ch) >= 9000)
>     strcpy(alinhamento,  "You are a Sacred Angel.\r\n");
>   else if (GET_ALIGNMENT(ch) >= 7500)
>     strcpy(alinhamento,  "You are an Angel.\r\n");
>   else if (GET_ALIGNMENT(ch) >= 5000)
>     strcpy(alinhamento,  "You are totally Good.\r\n");
>   else if (GET_ALIGNMENT(ch) >= 3000)
>     strcpy(alinhamento,  "You are Very Good.\r\n");
>   else if (GET_ALIGNMENT(ch) >= 351)
>     strcpy(alinhamento,  "You are Good.\r\n");
>   else if (GET_ALIGNMENT(ch) == 350)
>     strcpy(alinhamento,  "You are getting Good.\r\n");
>   else if (GET_ALIGNMENT(ch) >= -349)
>     strcpy(alinhamento,  "You are Neutral.\r\n");
>   else if (GET_ALIGNMENT(ch) == -350)
>     strcpy(alinhamento,  "You are getting Evil.\r\n");
>   else if (GET_ALIGNMENT(ch) >= -351)
>     strcpy(alinhamento,  "You are Evil.\r\n");
>   else if (GET_ALIGNMENT(ch) >= -3000)
>     strcpy(alinhamento,  "You are Very Evil.\r\n");
>   else if (GET_ALIGNMENT(ch) >= -5000)
>     strcpy(alinhamento,  "You are a Devil.\r\n");
>   else if (GET_ALIGNMENT(ch) >= -7500)
>     strcpy(alinhamento,  "You are a Damned Devil.\r\n");
>   else if (GET_ALIGNMENT(ch) >= -9000)
>     strcpy(alinhamento,  "You are totally Evil.\r\n");
>   else
>     strcpy(alinhamento,  "You are Damned Evil like Lucifer.\r\n");

	Ehm, unless you've changed it, alignment is between -1000 and 1000
with -350 through 350 being neutral, -351 through -1000 being evil, and
351 through 1000 being good.

	Next, I might suggest using an array (I'm array happy, so sue me
:)).  I guess since you already wrote the above it doesn't make much of a
difference, so you needn't bother with this, but, it's much nicer to just
be able to do:

int align_index(int align)
{
  return (align >= 1000 ? 0 :
          align >=  750 ? 1 :
          align >=  500 ? 2 :
          align >=  350 ? 3 : 4);
}

and in do_score, simply do:

[at the top of the function]

  int align = GET_ALIGNMENT(ch);
  int align_index(int align);

  static char *align[6][2] = {
    { "Angelic Good", "Satanic Evil" },
    { "Saintly Good", "Demonic Evil" },
    { "Lawful Good" , "Chaotic Evil" },
    { "Good"        , "Evil"         },
    { "Neutral Good", "Neutral Evil" }
  };

[where ever the alignment thing is]

  /* make negative aligns positive temporarily */
  if (align < 0) align += (align*2);

  sprintf(buf, "%sYou have %d/10 AC and are %s.\r\n", buf,
          GET_AC(ch), 
	  align[align_index(align)][GET_ALIGNMENT(ch) >= 0 ? 0 : 1]);

------------------------------------------------------------------------

	It's not the easiest way, but, IMHO, it's quicker to add in and it
probably works :)  I didn't try it, I actually wrote it right here in my
newsreader, so I might have screwed up a bit.  I made the align variable
make negative alignments positive for a purpose.  Ooops, I guess "0"
should return "Negative" not "Neutral Good"?  Simple fix...  you can do it
:)



This archive was generated by hypermail 2b30 : 12/18/00 PST