-
Notifications
You must be signed in to change notification settings - Fork 8
[WIP] Add RTP monster #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
liam-middlebrook
wants to merge
1
commit into
ComputerScienceHouse:master
Choose a base branch
from
liam-middlebrook:add_rtp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef RTP_H | ||
#define RTP_H | ||
|
||
#include <stdbool.h> | ||
|
||
#include "extern.h" | ||
#include "hack.h" | ||
#include "monst.h" | ||
|
||
struct monst *name_rtp(struct monst *mtmp); | ||
|
||
void player_killed_rtp(struct level *lev); | ||
|
||
struct obj *create_rtp_corpse(struct level *lev, int x, int y, enum rng rng); | ||
|
||
#endif // RTP_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#include "rtp.h" | ||
|
||
typedef const struct { | ||
const char* name; | ||
const bool female; | ||
} rtpEntry; | ||
|
||
rtpEntry rtpNames[] = { | ||
{"Angelo DiNardi", false}, | ||
{"Chris Lockfort", false}, | ||
{"Dan Willemsen", false}, | ||
{"Derek Gonyeo", false}, | ||
{"Ethan House", false}, | ||
{"Grant Cohoe", false}, | ||
{"Jordan Rodgers", false}, | ||
{"Kevin Thompson", false}, | ||
{"Liam Middlebrook", false}, | ||
{"McSaucy", false}, | ||
{"Rob Glossop", false}, | ||
{"Russ Harmon", false}, | ||
{"Stephanie Miller", true}, | ||
{"Steve Greene", false}, | ||
{"Will Orr", false}, | ||
{"William Dignazio", false}, | ||
}; | ||
|
||
struct monst * | ||
name_rtp(struct monst *mtmp) | ||
{ | ||
int rtp_id = rn2(sizeof(rtpNames) / sizeof(rtpEntry)); | ||
|
||
if (rtpNames[rtp_id].female) { | ||
mtmp->female = TRUE; | ||
} | ||
|
||
return christen_monst(mtmp, msg_from_string(rtpNames[rtp_id].name)); | ||
} | ||
|
||
struct obj * | ||
create_rtp_corpse(struct level *lev, int x, int y, enum rng rng) | ||
{ | ||
struct obj *obj = NULL; | ||
struct obj *orig_obj = NULL; | ||
// There should be a significant reward in order to tempt the player into | ||
// trying to kill an RTP. Otherwise it's risk without reward. | ||
|
||
// In the future this should be a random selection from a slew of different | ||
// items ranging in usefulness. | ||
obj = mksobj_at(MAGIC_MARKER, lev, x, y, TRUE, FALSE, rng); | ||
|
||
|
||
orig_obj = obj; | ||
|
||
// What else are RTPs good for :D | ||
obj = oname(obj, "The Root Password"); | ||
return obj; | ||
} | ||
|
||
void | ||
player_killed_rtp(struct level *lev) | ||
{ | ||
pline("You hear a faint whisper in the air: \"I'll shred your world\""); | ||
|
||
// get a large sample set | ||
int random = rn2(100); | ||
|
||
// Enumerate through all the possibilities when the player kills an | ||
// RTP | ||
// | ||
if (!(random / 10)) { | ||
change_luck(-3); | ||
} | ||
|
||
// 5% chance that the player hallucinates for a long while | ||
if (!(random / 20)) { | ||
make_hallucinated(rn2(420) + 50, TRUE); | ||
} | ||
|
||
// 1% chance the player gets sick and dies after 42 turns | ||
if (random == 42) { | ||
make_sick(42, "Right before you killed that RTP 42 turns ago they gave you Heartbleed </3", TRUE, SICK_VOMITABLE); | ||
} | ||
|
||
// 33% chance that alignment changes | ||
if (!(random / 3)) { | ||
aligntyp player_align = u.ualign.type; | ||
aligntyp new_align = A_NEUTRAL; | ||
|
||
// If we're not neutral switch to opposite or neutral | ||
if (player_align) { | ||
new_align = rn2(1) * -player_align; | ||
} else { | ||
new_align = rn2(1)? 1: -1; | ||
} | ||
|
||
if (uarmh && uarmh->otyp == HELM_OF_OPPOSITE_ALIGNMENT) { | ||
u.ualignbase[A_CURRENT] = new_align; | ||
} else { | ||
u.ualign.type = u.ualignbase[A_CURRENT] = new_align; | ||
} | ||
} | ||
|
||
// 25% chance that you anger your god | ||
if(!(random / 4)) { | ||
gods_upset(u.ualign.type); | ||
} | ||
|
||
// 16.67% chance that player loses a level (if > 1) | ||
if (!(random / 6) && u.ulevel > 1) { | ||
losexp(NULL, FALSE); | ||
} | ||
|
||
// 20% chance to spawn a random (suitable for the level) angry monster near | ||
// the player | ||
if (!(random / 5)) { | ||
makemon(NULL, lev, u.ux, u.uy, MM_ANGRY); | ||
} | ||
|
||
if (!(random / 10)) { | ||
// Neat that this function already exists for our usage! | ||
rndcurse(); | ||
} | ||
|
||
if (!(random / 10)) { | ||
if(uarmg) erode_obj(uarmg, NULL, ERODE_CORRODE, TRUE, TRUE); | ||
} | ||
|
||
if (!(random / 15)) { | ||
polyself(FALSE); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Potter level the only place an RTP will spawn? Otherwise this seems potentially game-breakingly powerful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm willing to discuss different item options. Perhaps we could make the magic marker have a very low drop chance?