advice on coding change concerning altar destruction


Questions, Explanations, Howtos

Halls Hopper

Posts: 74

Joined: Sunday, 21st February 2016, 14:55

Post Wednesday, 6th April 2016, 15:32

advice on coding change concerning altar destruction

This is a question for those very familiar with the crawl code base:

I want to make a change that allows players to destroy altars, giving the player a boost of experience, but invoking wrath on the player at the same time. It could be done with a new command, but probably would be easier to just use a wand of destruction. I'm thinking of inserting into the beam finalization code the check to see if the target is an altar, and if so, call the altar destruction function. It feels like feature and/or altar destruction may have existed in crawls long dark past (or maybe I'm thinking of nethack?), so if there is already code in there somewhere that supports what I'm trying to do that would be nice.

Any ideas would be appreciated.

Dungeon Master

Posts: 3618

Joined: Thursday, 23rd December 2010, 12:43

Post Wednesday, 6th April 2016, 16:31

Re: advice on coding change concerning altar destruction

Altar destruction has never existed in a stable version of Crawl. You must be thinking of another game. :) Or you are thinking of something that did exist in a trunk-only branch: altar desecration (this is a form of destruction) in the name of Lugonu. It's been a while, and I cannot look it up right now, but I think reaverb did this. If you search the git log for "Lugonu" and or "desecration", you should find it. (Be sure to not look just on master.)

Sorry to be so imprecise.

Regarding your feature: I think as-is it'd be problematic. This feature is very hard to balance *and* to communicate to players (so they can make a reasonable estimate about the wisdom of this action).

Of course, I like altar destruction like the next man, so for the record, here is what I originally wanted: part of the backstory is that Lugonu is the evil or fallen (you could say banished) god and that's why she hates all the other gods (whereas tensions like Trog-Sif or Xom-Zin are more your family grudges that occur in any proper pantheon). So a worshipper would be able to desecrate altars and thereby gain piety while incurring wrath. This got coded but turned out to be unfun because there are so many altars.
I still think it is neat, and a welcome change for piety gain, so it'd be nice to give Lugonu what she needs. Obviously, altar desecration should then be more limited, and some ideas I had for that: (1) Lugonu asks you to desecrate an altar to one particular god she currently loathes most, (2) you can desecrate at most one altar per god (flavour: say that after doing it once, that altar will now intently watch the remaining altars), or (3) desecrating altars of the same gods incur wraths of others gods, too (they're helping each other).

For this message the author dpeg has received thanks:
jeremygurr

Dungeon Master

Posts: 295

Joined: Monday, 18th August 2014, 20:04

Post Wednesday, 6th April 2016, 17:01

Re: advice on coding change concerning altar destruction

I believe that right now lugonu corrupt does convert altars to lugonu (not destroy them) so that might be one place to look.

For this message the author advil has received thanks:
jeremygurr
User avatar

Dungeon Master

Posts: 502

Joined: Wednesday, 7th March 2012, 13:25

Location: Lexington, KY, US

Post Wednesday, 6th April 2016, 17:15

Re: advice on coding change concerning altar destruction

You want dungeon_terrain_changed:
  Code:
void dungeon_terrain_changed(const coord_def &pos,
                             dungeon_feature_type nfeat,
                             bool preserve_features = false,
                             bool preserve_items = false,
                             bool temporary = false,
                             bool wizmode = false)


The defaults are to permanently replace even "critical" features like altars, which sounds like what you want. preserve_items doesn't matter because you'd be turning the altar into a feature that still allows items.

  Code:
    dungeon_terrain_changed(pos, DNGN_FLOOR);


Edit: The rest of the complexity of Lugonu's _corrupt_square is about choosing a feature, making sure things don't get stuck in walls, and changing to abyssal floor/wall tiles. None of those are relevant here—only the call to dungeon_terrain_changed.

For this message the author neil has received thanks:
jeremygurr

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.