| 862 | | /* Describe experience if known */ |
|---|
| 863 | | if (l_ptr->tkills) |
|---|
| 864 | | { |
|---|
| 865 | | /* Introduction */ |
|---|
| 866 | | if (l_ptr->flags[0] & RF0_UNIQUE) |
|---|
| 867 | | text_out("Killing"); |
|---|
| 868 | | else |
|---|
| 869 | | text_out("A kill of"); |
|---|
| 870 | | |
|---|
| 871 | | text_out(" this creature"); |
|---|
| 872 | | |
|---|
| 873 | | /* calculate the integer exp part */ |
|---|
| 874 | | i = (long)r_ptr->mexp * r_ptr->level / p_ptr->lev; |
|---|
| 875 | | |
|---|
| 876 | | /* calculate the fractional exp part scaled by 100, */ |
|---|
| 877 | | /* must use long arithmetic to avoid overflow */ |
|---|
| 878 | | j = ((((long)r_ptr->mexp * r_ptr->level % p_ptr->lev) * |
|---|
| 879 | | (long)1000 / p_ptr->lev + 5) / 10); |
|---|
| 880 | | |
|---|
| 881 | | /* Calculate textual representation */ |
|---|
| 882 | | strnfmt(buf, sizeof(buf), "%ld", (long)i); |
|---|
| 883 | | if (j) my_strcat(buf, format(".%02ld", (long)j), sizeof(buf)); |
|---|
| 884 | | |
|---|
| 885 | | /* Mention the experience */ |
|---|
| 886 | | text_out(" is worth "); |
|---|
| 887 | | text_out_c(TERM_ORANGE, buf); |
|---|
| 888 | | text_out(" point%s", PLURAL((i == 1) && (j == 0))); |
|---|
| 889 | | |
|---|
| 890 | | /* Take account of annoying English */ |
|---|
| 891 | | p = "th"; |
|---|
| 892 | | i = p_ptr->lev % 10; |
|---|
| 893 | | if ((p_ptr->lev / 10) == 1) /* nothing */; |
|---|
| 894 | | else if (i == 1) p = "st"; |
|---|
| 895 | | else if (i == 2) p = "nd"; |
|---|
| 896 | | else if (i == 3) p = "rd"; |
|---|
| 897 | | |
|---|
| 898 | | /* Take account of "leading vowels" in numbers */ |
|---|
| 899 | | q = ""; |
|---|
| 900 | | i = p_ptr->lev; |
|---|
| 901 | | if ((i == 8) || (i == 11) || (i == 18)) q = "n"; |
|---|
| 902 | | |
|---|
| 903 | | /* Mention the dependance on the player's level */ |
|---|
| 904 | | text_out(" for a%s %lu%s level character. ", q, (long)i, p); |
|---|
| 905 | | } |
|---|
| | 862 | /* Introduction */ |
|---|
| | 863 | if (l_ptr->flags[0] & RF0_UNIQUE) |
|---|
| | 864 | text_out("Killing"); |
|---|
| | 865 | else |
|---|
| | 866 | text_out("A kill of"); |
|---|
| | 867 | |
|---|
| | 868 | text_out(" this creature"); |
|---|
| | 869 | |
|---|
| | 870 | /* calculate the integer exp part */ |
|---|
| | 871 | i = (long)r_ptr->mexp * r_ptr->level / p_ptr->lev; |
|---|
| | 872 | |
|---|
| | 873 | /* calculate the fractional exp part scaled by 100, */ |
|---|
| | 874 | /* must use long arithmetic to avoid overflow */ |
|---|
| | 875 | j = ((((long)r_ptr->mexp * r_ptr->level % p_ptr->lev) * |
|---|
| | 876 | (long)1000 / p_ptr->lev + 5) / 10); |
|---|
| | 877 | |
|---|
| | 878 | /* Calculate textual representation */ |
|---|
| | 879 | strnfmt(buf, sizeof(buf), "%ld", (long)i); |
|---|
| | 880 | if (j) my_strcat(buf, format(".%02ld", (long)j), sizeof(buf)); |
|---|
| | 881 | |
|---|
| | 882 | /* Mention the experience */ |
|---|
| | 883 | text_out(" is worth "); |
|---|
| | 884 | text_out_c(TERM_ORANGE, buf); |
|---|
| | 885 | text_out(" point%s", PLURAL((i == 1) && (j == 0))); |
|---|
| | 886 | |
|---|
| | 887 | /* Take account of annoying English */ |
|---|
| | 888 | p = "th"; |
|---|
| | 889 | i = p_ptr->lev % 10; |
|---|
| | 890 | if ((p_ptr->lev / 10) == 1) /* nothing */; |
|---|
| | 891 | else if (i == 1) p = "st"; |
|---|
| | 892 | else if (i == 2) p = "nd"; |
|---|
| | 893 | else if (i == 3) p = "rd"; |
|---|
| | 894 | |
|---|
| | 895 | /* Take account of "leading vowels" in numbers */ |
|---|
| | 896 | q = ""; |
|---|
| | 897 | i = p_ptr->lev; |
|---|
| | 898 | if ((i == 8) || (i == 11) || (i == 18)) q = "n"; |
|---|
| | 899 | |
|---|
| | 900 | /* Mention the dependance on the player's level */ |
|---|
| | 901 | text_out(" for a%s %lu%s level character. ", q, (long)i, p); |
|---|