|
| 1 | +#include "rtp.h" |
| 2 | + |
| 3 | +struct monst * |
| 4 | +name_rtp(struct monst *mtmp) |
| 5 | +{ |
| 6 | + const char* rtpNames[RTP_NAME_COUNT] = RTP_NAMES; |
| 7 | + int rtp_id = rn2(RTP_NAME_COUNT); |
| 8 | + |
| 9 | + if (FEMALE_RTPS(rtp_id)) { |
| 10 | + mtmp->female = TRUE; |
| 11 | + } |
| 12 | + |
| 13 | + return christen_monst(mtmp, msg_from_string(rtpNames[rtp_id])); |
| 14 | +} |
| 15 | + |
| 16 | +struct obj * |
| 17 | +create_rtp_corpse(struct level *lev, int x, int y, enum rng rng) |
| 18 | +{ |
| 19 | + struct obj *obj = NULL; |
| 20 | + struct obj *orig_obj = NULL; |
| 21 | + // There should be a significant reward in order to tempt the player into |
| 22 | + // trying to kill an RTP. Otherwise it's risk without reward. |
| 23 | + |
| 24 | + // In the future this should be a random selection from a slew of different |
| 25 | + // items ranging in usefulness. |
| 26 | + obj = mksobj_at(MAGIC_MARKER, lev, x, y, TRUE, FALSE, rng); |
| 27 | + |
| 28 | + |
| 29 | + orig_obj = obj; |
| 30 | + |
| 31 | + // What else are RTPs good for :D |
| 32 | + obj = oname(obj, "The Root Password"); |
| 33 | + return obj; |
| 34 | +} |
| 35 | + |
| 36 | +void |
| 37 | +player_killed_rtp(struct level *lev) |
| 38 | +{ |
| 39 | + pline("You hear a faint whisper in the air: \"I'll shred your world\""); |
| 40 | + |
| 41 | + // get a large sample set |
| 42 | + int random = rn2(100); |
| 43 | + |
| 44 | + // Enumerate through all the possibilities when the player kills an |
| 45 | + // RTP |
| 46 | + // |
| 47 | + if (!(random / 10)) { |
| 48 | + change_luck(-3); |
| 49 | + } |
| 50 | + |
| 51 | + // 5% chance that the player hallucinates for a long while |
| 52 | + if (!(random / 20)) { |
| 53 | + make_hallucinated(rn2(420) + 50, TRUE); |
| 54 | + } |
| 55 | + |
| 56 | + // 1% chance the player gets sick and dies after 42 turns |
| 57 | + if (random == 42) { |
| 58 | + make_sick(42, "Right before you killed that RTP 42 turns ago they gave you Heartbleed </3", TRUE, SICK_VOMITABLE); |
| 59 | + } |
| 60 | + |
| 61 | + // 33% chance that alignment changes |
| 62 | + if (!(random / 3)) { |
| 63 | + aligntyp player_align = u.ualign.type; |
| 64 | + aligntyp new_align = A_NEUTRAL; |
| 65 | + |
| 66 | + // If we're not neutral switch to opposite or neutral |
| 67 | + if (player_align) { |
| 68 | + new_align = rn2(1) * -player_align; |
| 69 | + } else { |
| 70 | + new_align = rn2(1)? 1: -1; |
| 71 | + } |
| 72 | + |
| 73 | + if (uarmh && uarmh->otyp == HELM_OF_OPPOSITE_ALIGNMENT) { |
| 74 | + u.ualignbase[A_CURRENT] = new_align; |
| 75 | + } else { |
| 76 | + u.ualign.type = u.ualignbase[A_CURRENT] = new_align; |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | + // 25% chance that you anger your god |
| 81 | + if(!(random / 4)) { |
| 82 | + gods_upset(u.ualign.type); |
| 83 | + } |
| 84 | + |
| 85 | + // 16.67% chance that player loses a level (if > 1) |
| 86 | + if (!(random / 6) && u.ulevel > 1) { |
| 87 | + losexp(NULL, FALSE); |
| 88 | + } |
| 89 | + |
| 90 | + // 20% chance to spawn a random (suitable for the level) angry monster near |
| 91 | + // the player |
| 92 | + if (!(random / 5)) { |
| 93 | + makemon(NULL, lev, u.ux, u.uy, MM_ANGRY); |
| 94 | + } |
| 95 | + |
| 96 | + if (!(random / 10)) { |
| 97 | + // Neat that this function already exists for our usage! |
| 98 | + rndcurse(); |
| 99 | + } |
| 100 | + |
| 101 | + if (!(random / 10)) { |
| 102 | + if(uarmg) erode_obj(uarmg, NULL, ERODE_CORRODE, TRUE, TRUE); |
| 103 | + } |
| 104 | + |
| 105 | + if (!(random / 15)) { |
| 106 | + polyself(FALSE); |
| 107 | + } |
| 108 | +} |
0 commit comments