1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
36 | #include <sproto.h> |
36 | #include <sproto.h> |
37 | |
37 | |
38 | /** |
38 | /** |
39 | * Returns the id of specified god. |
39 | * Returns the id of specified god. |
40 | */ |
40 | */ |
41 | int |
41 | static int |
42 | lookup_god_by_name (shstr_cmp name) |
42 | lookup_god_by_name (shstr_cmp name) |
43 | { |
43 | { |
44 | if (name) |
44 | if (name) |
45 | for (godlink *gl = first_god; gl; gl = gl->next) |
45 | for (godlink *gl = first_god; gl; gl = gl->next) |
46 | if (gl->name == name) |
46 | if (gl->name == name) |
… | |
… | |
214 | return 0; |
214 | return 0; |
215 | |
215 | |
216 | if (follower_has_similar_item (op, tr->item)) |
216 | if (follower_has_similar_item (op, tr->item)) |
217 | return 0; |
217 | return 0; |
218 | |
218 | |
219 | object *tmp = arch_to_object (tr->item); |
219 | object *tmp = tr->item->instance (); |
220 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
220 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
221 | op->insert (tmp); |
221 | op->insert (tmp); |
222 | |
222 | |
223 | return 1; |
223 | return 1; |
224 | } |
|
|
225 | |
|
|
226 | /** |
|
|
227 | * Player prays at altar. |
|
|
228 | * Checks for god changing, divine intervention, and so on. |
|
|
229 | */ |
|
|
230 | void |
|
|
231 | pray_at_altar (object *pl, object *altar, object *skill) |
|
|
232 | { |
|
|
233 | object *pl_god = find_god (determine_god (pl)); |
|
|
234 | |
|
|
235 | if (INVOKE_PLAYER (PRAY_ALTAR, pl->contr, ARG_OBJECT (altar), ARG_OBJECT (skill))) |
|
|
236 | return; |
|
|
237 | |
|
|
238 | /* If non consecrate altar, don't do anything */ |
|
|
239 | if (!altar->other_arch) |
|
|
240 | return; |
|
|
241 | |
|
|
242 | /* hmm. what happend depends on pl's current god, level, etc */ |
|
|
243 | if (!pl_god) |
|
|
244 | { /*new convert */ |
|
|
245 | become_follower (pl, altar->other_arch); |
|
|
246 | return; |
|
|
247 | } |
|
|
248 | else if (!strcmp (&pl_god->name, altar->other_arch->object::name)) |
|
|
249 | { |
|
|
250 | /* pray at your gods altar */ |
|
|
251 | int bonus = (pl->stats.Wis + skill->level) / 10; |
|
|
252 | |
|
|
253 | /* we can get neg grace up faster */ |
|
|
254 | if (pl->stats.grace < 0) |
|
|
255 | pl->stats.grace += (bonus > -1 * (pl->stats.grace / 10) ? bonus : -1 * (pl->stats.grace / 10)); |
|
|
256 | |
|
|
257 | /* we can super-charge grace to 2x max */ |
|
|
258 | if (pl->stats.grace < 2 * pl->stats.maxgrace) |
|
|
259 | pl->stats.grace += bonus / 2; |
|
|
260 | else |
|
|
261 | pl->stats.grace = 2 * pl->stats.maxgrace; |
|
|
262 | |
|
|
263 | /* Every once in a while, the god decides to checkup on their |
|
|
264 | * follower, and may intervene to help them out. |
|
|
265 | */ |
|
|
266 | bonus = MAX (1, bonus + MAX (pl->stats.luck, -3)); /* -- DAMN -- */ |
|
|
267 | |
|
|
268 | if (((random_roll (0, 399, pl, PREFER_LOW)) - bonus) < 0) |
|
|
269 | god_intervention (pl, pl_god, skill); |
|
|
270 | } |
|
|
271 | else |
|
|
272 | { /* praying to another god! */ |
|
|
273 | uint64 loss = 0; |
|
|
274 | int angry = 1; |
|
|
275 | |
|
|
276 | /* I believe the logic for detecting opposing gods was completely |
|
|
277 | * broken - I think it should work now. altar->other_arch |
|
|
278 | * points to the god of this altar (which we have |
|
|
279 | * already verified is non null). pl_god->other_arch |
|
|
280 | * is the opposing god - we need to verify that exists before |
|
|
281 | * using its values. |
|
|
282 | */ |
|
|
283 | if (pl_god->other_arch && (altar->other_arch->archname == pl_god->other_arch->archname)) |
|
|
284 | { |
|
|
285 | angry = 2; |
|
|
286 | if (random_roll (0, skill->level + 2, pl, PREFER_LOW) - 5 > 0) |
|
|
287 | { |
|
|
288 | object *tmp; |
|
|
289 | |
|
|
290 | /* you really screwed up */ |
|
|
291 | angry = 3; |
|
|
292 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, pl, "Foul Priest! %s punishes you!", &pl_god->name); |
|
|
293 | tmp = get_archetype (LOOSE_MANA); |
|
|
294 | cast_magic_storm (pl, tmp, pl_god->level + 20); |
|
|
295 | } |
|
|
296 | else |
|
|
297 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, pl, "Foolish heretic! %s is livid!", &pl_god->name); |
|
|
298 | } |
|
|
299 | else |
|
|
300 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, pl, "Heretic! %s is angered!", &pl_god->name); |
|
|
301 | |
|
|
302 | /* whether we will be successfull in defecting or not - |
|
|
303 | * we lose experience from the clerical experience obj |
|
|
304 | */ |
|
|
305 | |
|
|
306 | loss = angry * (skill->stats.exp / 10); |
|
|
307 | if (loss) |
|
|
308 | change_exp (pl, -random_roll64 (0, loss, pl, PREFER_LOW), skill ? &skill->skill : "none", SK_SUBTRACT_SKILL_EXP); |
|
|
309 | |
|
|
310 | /* May switch Gods, but its random chance based on our current level |
|
|
311 | * note it gets harder to swap gods the higher we get |
|
|
312 | */ |
|
|
313 | if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) |
|
|
314 | become_follower (pl, altar->other_arch); |
|
|
315 | else |
|
|
316 | { |
|
|
317 | /* toss this player off the altar. He can try again. */ |
|
|
318 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); |
|
|
319 | pl->contr->fire_on = 0; |
|
|
320 | pl->speed_left = 1.f; |
|
|
321 | move_player (pl, absdir (pl->facing + 4)); /* back him off the way he came. */ |
|
|
322 | } |
|
|
323 | } |
|
|
324 | } |
224 | } |
325 | |
225 | |
326 | /** |
226 | /** |
327 | * Removes special prayers given by a god. |
227 | * Removes special prayers given by a god. |
328 | */ |
228 | */ |
… | |
… | |
342 | next_tmp = tmp->below; |
242 | next_tmp = tmp->below; |
343 | |
243 | |
344 | /* we mark special prayers with the STARTEQUIP flag, so if it isn't |
244 | /* we mark special prayers with the STARTEQUIP flag, so if it isn't |
345 | * in that category, not something we need to worry about. |
245 | * in that category, not something we need to worry about. |
346 | */ |
246 | */ |
347 | if (tmp->type != SPELL || !QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
247 | if (tmp->type != SPELL || !tmp->flag [FLAG_STARTEQUIP]) |
348 | continue; |
248 | continue; |
349 | |
249 | |
350 | if (god->randomitems == NULL) |
250 | if (god->randomitems == NULL) |
351 | { |
251 | { |
352 | LOG (llevError, "BUG: check_special_prayers(): god %s without randomitems\n", &god->name); |
252 | LOG (llevError, "BUG: check_special_prayers(): god %s without randomitems\n", &god->name); |
… | |
… | |
380 | do_forget_spell (op, tmp->name); |
280 | do_forget_spell (op, tmp->name); |
381 | } |
281 | } |
382 | } |
282 | } |
383 | |
283 | |
384 | /** |
284 | /** |
|
|
285 | * Unapplies up to number worth of items of type |
|
|
286 | */ |
|
|
287 | static void |
|
|
288 | stop_using_item (object *op, int type, int number) |
|
|
289 | { |
|
|
290 | for (object *tmp = op->inv; tmp && number; tmp = tmp->below) |
|
|
291 | if (tmp->type == type && tmp->flag [FLAG_APPLIED]) |
|
|
292 | { |
|
|
293 | op->apply (tmp, AP_UNAPPLY | AP_IGNORE_CURSE); |
|
|
294 | --number; |
|
|
295 | } |
|
|
296 | } |
|
|
297 | |
|
|
298 | /** |
|
|
299 | * If the god does/doesnt have this flag, we |
|
|
300 | * give/remove it from the experience object if it doesnt/does |
|
|
301 | * already exist. For players only! |
|
|
302 | */ |
|
|
303 | static inline void |
|
|
304 | update_priest_flag (object *god, object *exp_ob, uint32 flag) |
|
|
305 | { |
|
|
306 | exp_ob->flag [flag] = god->flag [flag]; |
|
|
307 | return; |
|
|
308 | |
|
|
309 | // old code follows for reference... |
|
|
310 | if (god->flag [flag] && !exp_ob->flag [flag]) |
|
|
311 | exp_ob->set_flag (flag); |
|
|
312 | else if (exp_ob->flag [flag] && !god->flag [flag]) |
|
|
313 | { |
|
|
314 | /* When this is called with the exp_ob set to the player, |
|
|
315 | * this check is broken, because most all players arch |
|
|
316 | * allow use of weapons. I'm not actually sure why this |
|
|
317 | * check is here - I guess if you had a case where the |
|
|
318 | * value in the archetype (wisdom) should over ride the restrictions |
|
|
319 | * the god places on it, this may make sense. But I don't think |
|
|
320 | * there is any case like that. |
|
|
321 | */ |
|
|
322 | /* if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))*/ |
|
|
323 | exp_ob->clr_flag (flag); |
|
|
324 | }; |
|
|
325 | } |
|
|
326 | |
|
|
327 | /** |
|
|
328 | * Forbids or let player use something item type. |
|
|
329 | * op is the player. |
|
|
330 | * exp_obj is the widsom experience. |
|
|
331 | * flag is the flag to check against. |
|
|
332 | * string is the string to print out. |
|
|
333 | */ |
|
|
334 | static int |
|
|
335 | worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) |
|
|
336 | { |
|
|
337 | if (op->arch->flag [flag]) |
|
|
338 | if (op->flag [flag] != exp_obj->flag [flag]) |
|
|
339 | { |
|
|
340 | update_priest_flag (exp_obj, op, flag); |
|
|
341 | if (op->flag [flag]) |
|
|
342 | new_draw_info_format (NDI_UNIQUE, 0, op, "You may use %s again.", string); |
|
|
343 | else |
|
|
344 | { |
|
|
345 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string); |
|
|
346 | return 1; |
|
|
347 | } |
|
|
348 | } |
|
|
349 | |
|
|
350 | return 0; |
|
|
351 | } |
|
|
352 | |
|
|
353 | /** |
385 | * This function is called whenever a player has |
354 | * This function is called whenever a player has |
386 | * switched to a new god. It handles basically all the stat changes |
355 | * switched to a new god. It handles basically all the stat changes |
387 | * that happen to the player, including the removal of godgiven |
356 | * that happen to the player, including the removal of godgiven |
388 | * items (from the former cult). |
357 | * items (from the former cult). |
389 | */ |
358 | */ |
390 | void |
359 | void |
391 | become_follower (object *op, object *new_god) |
360 | object::become_follower (object *new_god) |
392 | { |
361 | { |
393 | object *old_god = NULL; /* old god */ |
362 | object *old_god = 0; /* old god */ |
394 | treasure *tr; |
363 | treasure *tr; |
395 | object *item, *skop, *next; |
364 | object *item, *skop, *next; |
396 | int i, sk_applied, undeadified = 0; /* Turns to true if changing god can changes the undead status of the player. */ |
365 | int i, sk_applied, undeadified = 0; /* Turns to true if changing god can changes the undead status of the player. */ |
397 | |
366 | |
|
|
367 | if (!contr) |
|
|
368 | return; |
|
|
369 | |
|
|
370 | contr->queue_stats_update (); |
|
|
371 | |
398 | old_god = find_god (determine_god (op)); |
372 | old_god = find_god (determine_god (this)); |
399 | |
373 | |
400 | /* take away any special god-characteristic items. */ |
374 | /* take away any special god-characteristic items. */ |
401 | for (item = op->inv; item; item = next) |
375 | for (item = inv; item; item = next) |
402 | { |
376 | { |
403 | next = item->below; |
377 | next = item->below; |
404 | |
378 | |
405 | // remove all invisible startequip items which are not skill, exp or force |
379 | // remove all invisible startequip items which are not skill, exp or force |
406 | if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && |
380 | if (item->flag [FLAG_STARTEQUIP] && item->invisible |
407 | (item->type != SKILL) && (item->type != FORCE)) |
381 | && item->type != SKILL && item->type != FORCE) |
408 | { |
382 | { |
409 | if (item->type == SPELL) |
383 | if (item->type == SPELL) |
410 | { |
384 | { |
411 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); |
385 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, this, "You lose knowledge of %s.", &item->name); |
412 | esrv_remove_spell (op->contr, item); |
386 | esrv_remove_spell (contr, item); |
413 | } |
387 | } |
414 | |
388 | |
415 | player_unready_range_ob (op->contr, item); |
|
|
416 | item->destroy (); |
389 | item->destroy (); |
417 | } |
390 | } |
418 | } |
391 | } |
419 | |
392 | |
420 | /* remove any godgiven items from the old god */ |
393 | /* remove any godgiven items from the old god */ |
421 | if (old_god) |
394 | if (old_god) |
422 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
395 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
423 | if (tr->item && QUERY_FLAG (tr->item, FLAG_STARTEQUIP)) |
396 | if (tr->item && tr->item->flag [FLAG_STARTEQUIP]) |
424 | follower_remove_similar_item (op, tr->item); |
397 | follower_remove_similar_item (this, tr->item); |
425 | |
398 | |
426 | if (!op || !new_god) |
399 | if (!new_god) |
427 | return; |
400 | return; |
428 | |
401 | |
429 | if (new_god->slaying && op->race.contains (new_god->slaying)) |
402 | if (new_god->slaying && new_god->slaying.contains (race)) |
430 | { |
403 | { |
431 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "Fool! %s detests your kind!", &new_god->name); |
404 | failmsgf ("Fool! %s detests your kind! H<This god does not accept followers of your race.>", &new_god->name); |
432 | |
405 | |
433 | if (random_roll (0, op->level - 1, op, PREFER_LOW) - 5 > 0) |
406 | if (random_roll (0, level - 1, this, PREFER_LOW) - 5 > 0) |
434 | { |
407 | { |
435 | object *tmp = get_archetype (LOOSE_MANA); |
408 | object *tmp = get_archetype (LOOSE_MANA); |
436 | |
409 | |
437 | cast_magic_storm (op, tmp, new_god->level + 10); |
410 | cast_magic_storm (this, tmp, new_god->level + 10); |
438 | } |
411 | } |
439 | |
412 | |
440 | return; |
413 | return; |
441 | } |
414 | } |
442 | |
415 | |
443 | /* give the player any special god-characteristic-items. */ |
416 | /* give the player any special god-characteristic-items. */ |
444 | for (tr = new_god->randomitems->items; tr; tr = tr->next) |
417 | for (tr = new_god->randomitems->items; tr; tr = tr->next) |
445 | { |
|
|
446 | if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK |
418 | if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK |
447 | && tr->item->type != BOOK && tr->item->type != SPELL) |
419 | && tr->item->type != BOOK && tr->item->type != SPELL) |
448 | god_gives_present (op, new_god, tr); |
420 | god_gives_present (this, new_god, tr); |
449 | } |
|
|
450 | |
421 | |
451 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You become a follower of %s!", &new_god->name); |
422 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, this, "You become a follower of %s!", &new_god->name); |
452 | |
423 | |
453 | for (skop = op->inv; skop; skop = skop->below) |
424 | for (skop = inv; skop; skop = skop->below) |
454 | if (skop->type == SKILL && skop->subtype == SK_PRAYING) |
425 | if (skop->type == SKILL && skop->subtype == SK_PRAYING) |
455 | break; |
426 | break; |
456 | |
427 | |
457 | /* Player has no skill - give them the skill */ |
428 | /* Player has no skill - give them the skill */ |
458 | if (!skop) |
429 | if (!skop) |
459 | /* The archetype should always be defined - if we crash here because it doesn't, |
430 | /* The archetype should always be defined - if we crash here because it doesn't, |
460 | * things are really messed up anyways. |
431 | * things are really messed up anyways. |
461 | */ |
432 | */ |
462 | skop = give_skill_by_name (op, get_archetype_by_type_subtype (SKILL, SK_PRAYING)->skill); |
433 | skop = give_skill_by_name (this, shstr_praying); |
463 | |
434 | |
464 | sk_applied = QUERY_FLAG (skop, FLAG_APPLIED); /* save skill status */ |
435 | sk_applied = skop->flag [FLAG_APPLIED]; /* save skill status */ |
465 | |
436 | |
466 | /* Clear the "undead" status. We also need to force a call to change_abil, |
437 | /* Clear the "undead" status. We also need to force a call to change_abil, |
467 | * so I set undeadified for that. |
438 | * so I set undeadified for that. |
468 | * - gros, 21th July 2006. |
439 | * - gros, 21th July 2006. |
469 | */ |
440 | */ |
470 | if (old_god && QUERY_FLAG (old_god, FLAG_UNDEAD)) |
441 | if (old_god && old_god->flag [FLAG_UNDEAD]) |
471 | { |
442 | { |
472 | CLEAR_FLAG (skop, FLAG_UNDEAD); |
443 | skop->clr_flag (FLAG_UNDEAD); |
473 | undeadified = 1; |
444 | undeadified = 1; |
474 | } |
445 | } |
475 | |
446 | |
476 | if (skop->title) |
447 | if (skop->title) |
477 | { |
448 | { |
478 | /* get rid of old god */ |
449 | /* get rid of old god */ |
479 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s's blessing is withdrawn from you.", &skop->title); |
450 | new_draw_info_format (NDI_UNIQUE, 0, this, "%s's blessing is withdrawn from you.", &skop->title); |
480 | |
451 | |
481 | /* The point of this is to really show what abilities the player just lost */ |
452 | /* The point of this is to really show what abilities the player just lost */ |
482 | if (sk_applied || undeadified) |
453 | if (sk_applied || undeadified) |
483 | { |
454 | { |
484 | CLEAR_FLAG (skop, FLAG_APPLIED); |
455 | skop->clr_flag (FLAG_APPLIED); |
485 | change_abil (op, skop); |
456 | change_abil (this, skop); |
486 | } |
457 | } |
487 | } |
458 | } |
488 | |
459 | |
489 | /* now change to the new gods attributes to exp_obj */ |
460 | /* now change to the new gods attributes to exp_obj */ |
490 | skop->title = new_god->name; |
461 | skop->title = new_god->name; |
… | |
… | |
514 | update_priest_flag (new_god, skop, FLAG_MAKE_INVIS); |
485 | update_priest_flag (new_god, skop, FLAG_MAKE_INVIS); |
515 | update_priest_flag (new_god, skop, FLAG_UNDEAD); |
486 | update_priest_flag (new_god, skop, FLAG_UNDEAD); |
516 | update_priest_flag (new_god, skop, FLAG_BLIND); |
487 | update_priest_flag (new_god, skop, FLAG_BLIND); |
517 | update_priest_flag (new_god, skop, FLAG_XRAYS); /* better have this if blind! */ |
488 | update_priest_flag (new_god, skop, FLAG_XRAYS); /* better have this if blind! */ |
518 | |
489 | |
519 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are bathed in %s's aura.", &new_god->name); |
490 | new_draw_info_format (NDI_UNIQUE, 0, this, "You are bathed in %s's aura.", &new_god->name); |
520 | |
491 | |
521 | /* Weapon/armour use are special...handle flag toggles here as this can |
492 | /* Weapon/armour use are special...handle flag toggles here as this can |
522 | * only happen when gods are worshipped and if the new priest could |
493 | * only happen when gods are worshipped and if the new priest could |
523 | * have used armour/weapons in the first place. |
494 | * have used armour/weapons in the first place. |
524 | * |
495 | * |
525 | * This also can happen for monks which cannot use weapons. In this case |
496 | * This also can happen for monks which cannot use weapons. In this case |
526 | * do not allow to use weapons even if the god otherwise would allow it. |
497 | * do not allow to use weapons even if the god otherwise would allow it. |
527 | */ |
498 | */ |
528 | if (!present_in_ob_by_name (FORCE, "no weapon force", op)) |
499 | if (!present_in_ob_by_name (FORCE, "no weapon force", this)) |
529 | update_priest_flag (new_god, skop, FLAG_USE_WEAPON); |
500 | update_priest_flag (new_god, skop, FLAG_USE_WEAPON); |
530 | |
501 | |
531 | update_priest_flag (new_god, skop, FLAG_USE_ARMOUR); |
502 | update_priest_flag (new_god, skop, FLAG_USE_ARMOUR); |
532 | |
503 | |
533 | if (worship_forbids_use (op, skop, FLAG_USE_WEAPON, "weapons")) |
504 | if (worship_forbids_use (this, skop, FLAG_USE_WEAPON, "weapons")) |
534 | stop_using_item (op, WEAPON, 2); |
505 | stop_using_item (this, WEAPON, 2); |
535 | |
506 | |
536 | if (worship_forbids_use (op, skop, FLAG_USE_ARMOUR, "armour")) |
507 | if (worship_forbids_use (this, skop, FLAG_USE_ARMOUR, "armour")) |
537 | { |
508 | { |
538 | stop_using_item (op, ARMOUR, 1); |
509 | stop_using_item (this, ARMOUR, 1); |
539 | stop_using_item (op, HELMET, 1); |
510 | stop_using_item (this, HELMET, 1); |
540 | stop_using_item (op, BOOTS, 1); |
511 | stop_using_item (this, BOOTS, 1); |
541 | stop_using_item (op, GLOVES, 1); |
512 | stop_using_item (this, GLOVES, 1); |
542 | stop_using_item (op, SHIELD, 1); |
513 | stop_using_item (this, SHIELD, 1); |
543 | } |
514 | } |
544 | |
515 | |
545 | SET_FLAG (skop, FLAG_APPLIED); |
516 | skop->set_flag (FLAG_APPLIED); |
546 | (void) change_abil (op, skop); |
517 | change_abil (this, skop); |
547 | |
518 | |
548 | /* return to previous skill status */ |
519 | /* return to previous skill status */ |
549 | if (!sk_applied) |
520 | if (!sk_applied) |
550 | CLEAR_FLAG (skop, FLAG_APPLIED); |
521 | { |
|
|
522 | skop->clr_flag (FLAG_APPLIED); |
|
|
523 | contr->queue_stats_update (); |
|
|
524 | } |
551 | |
525 | |
552 | check_special_prayers (op, new_god); |
526 | check_special_prayers (this, new_god); |
553 | } |
|
|
554 | |
|
|
555 | /** |
|
|
556 | * Forbids or let player use something item type. |
|
|
557 | * op is the player. |
|
|
558 | * exp_obj is the widsom experience. |
|
|
559 | * flag is the flag to check against. |
|
|
560 | * string is the string to print out. |
|
|
561 | */ |
|
|
562 | |
|
|
563 | int |
|
|
564 | worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) |
|
|
565 | { |
|
|
566 | if (QUERY_FLAG (op->arch, flag)) |
|
|
567 | if (QUERY_FLAG (op, flag) != QUERY_FLAG (exp_obj, flag)) |
|
|
568 | { |
|
|
569 | update_priest_flag (exp_obj, op, flag); |
|
|
570 | if (QUERY_FLAG (op, flag)) |
|
|
571 | new_draw_info_format (NDI_UNIQUE, 0, op, "You may use %s again.", string); |
|
|
572 | else |
|
|
573 | { |
|
|
574 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string); |
|
|
575 | return 1; |
|
|
576 | } |
|
|
577 | } |
|
|
578 | |
|
|
579 | return 0; |
|
|
580 | } |
|
|
581 | |
|
|
582 | /** |
|
|
583 | * Unapplies up to number worth of items of type |
|
|
584 | */ |
|
|
585 | void |
|
|
586 | stop_using_item (object *op, int type, int number) |
|
|
587 | { |
|
|
588 | object *tmp; |
|
|
589 | |
|
|
590 | for (tmp = op->inv; tmp && number; tmp = tmp->below) |
|
|
591 | if (tmp->type == type && QUERY_FLAG (tmp, FLAG_APPLIED)) |
|
|
592 | { |
|
|
593 | apply_special (op, tmp, AP_UNAPPLY | AP_IGNORE_CURSE); |
|
|
594 | number--; |
|
|
595 | } |
|
|
596 | } |
|
|
597 | |
|
|
598 | /** |
|
|
599 | * If the god does/doesnt have this flag, we |
|
|
600 | * give/remove it from the experience object if it doesnt/does |
|
|
601 | * already exist. For players only! |
|
|
602 | */ |
|
|
603 | |
|
|
604 | void |
|
|
605 | update_priest_flag (object *god, object *exp_ob, uint32 flag) |
|
|
606 | { |
|
|
607 | if (QUERY_FLAG (god, flag) && !QUERY_FLAG (exp_ob, flag)) |
|
|
608 | SET_FLAG (exp_ob, flag); |
|
|
609 | else if (QUERY_FLAG (exp_ob, flag) && !QUERY_FLAG (god, flag)) |
|
|
610 | { |
|
|
611 | /* When this is called with the exp_ob set to the player, |
|
|
612 | * this check is broken, because most all players arch |
|
|
613 | * allow use of weapons. I'm not actually sure why this |
|
|
614 | * check is here - I guess if you had a case where the |
|
|
615 | * value in the archetype (wisdom) should over ride the restrictions |
|
|
616 | * the god places on it, this may make sense. But I don't think |
|
|
617 | * there is any case like that. |
|
|
618 | */ |
|
|
619 | |
|
|
620 | /* if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))*/ |
|
|
621 | CLEAR_FLAG (exp_ob, flag); |
|
|
622 | }; |
|
|
623 | } |
527 | } |
624 | |
528 | |
625 | archetype * |
529 | archetype * |
626 | determine_holy_arch (object *god, shstr_cmp type) |
530 | determine_holy_arch (object *god, shstr_cmp type) |
627 | { |
531 | { |
… | |
… | |
658 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
562 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
659 | { |
563 | { |
660 | if (tmp->invisible) |
564 | if (tmp->invisible) |
661 | continue; |
565 | continue; |
662 | |
566 | |
663 | if (QUERY_FLAG (tmp, FLAG_DAMNED) && !remove_damnation) |
567 | if (tmp->flag [FLAG_DAMNED] && !remove_damnation) |
664 | continue; |
568 | continue; |
665 | |
569 | |
666 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
570 | if (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED]) |
667 | { |
571 | { |
668 | success = 1; |
572 | success = 1; |
669 | CLEAR_FLAG (tmp, FLAG_DAMNED); |
573 | tmp->clr_flag (FLAG_DAMNED); |
670 | CLEAR_FLAG (tmp, FLAG_CURSED); |
574 | tmp->clr_flag (FLAG_CURSED); |
671 | CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); |
575 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
672 | |
576 | |
673 | if (object *pl = tmp->visible_to ()) |
577 | if (object *pl = tmp->visible_to ()) |
674 | esrv_update_item (UPD_FLAGS, pl, tmp); |
578 | esrv_update_item (UPD_FLAGS, pl, tmp); |
675 | } |
579 | } |
676 | } |
580 | } |
… | |
… | |
695 | |
599 | |
696 | if (level <= 40) |
600 | if (level <= 40) |
697 | return (20 + (level - 20) / 2) / difficulty; |
601 | return (20 + (level - 20) / 2) / difficulty; |
698 | |
602 | |
699 | return (30 + (level - 40) / 4) / difficulty; |
603 | return (30 + (level - 40) / 4) / difficulty; |
|
|
604 | } |
|
|
605 | |
|
|
606 | /** |
|
|
607 | * God checks item the player is using. |
|
|
608 | * Return either -1 (bad), 0 (neutral) or |
|
|
609 | * 1 (item is ok). If you are using the item of an enemy |
|
|
610 | * god, it can be bad...-b.t. |
|
|
611 | */ |
|
|
612 | static int |
|
|
613 | god_examines_item (object *god, object *item) |
|
|
614 | { |
|
|
615 | char buf[MAX_BUF]; |
|
|
616 | |
|
|
617 | if (!god || !item) |
|
|
618 | return 0; |
|
|
619 | |
|
|
620 | if (!item->title) |
|
|
621 | return 1; /* unclaimed item are ok */ |
|
|
622 | |
|
|
623 | sprintf (buf, "of %s", &god->name); |
|
|
624 | if (!strcmp (&item->title, buf)) |
|
|
625 | return 1; /* belongs to that God */ |
|
|
626 | |
|
|
627 | if (god->title) |
|
|
628 | { /* check if we have any enemy blessed item */ |
|
|
629 | sprintf (buf, "of %s", &god->title); |
|
|
630 | if (!strcmp (&item->title, buf)) |
|
|
631 | { |
|
|
632 | if (item->env) |
|
|
633 | { |
|
|
634 | char buf[MAX_BUF]; |
|
|
635 | |
|
|
636 | sprintf (buf, "Heretic! You are using %s!", query_name (item)); |
|
|
637 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, item->env, buf); |
|
|
638 | } |
|
|
639 | |
|
|
640 | return -1; |
|
|
641 | } |
|
|
642 | } |
|
|
643 | |
|
|
644 | return 0; /* item is sacred to a non-enemy god/or is otherwise magical */ |
700 | } |
645 | } |
701 | |
646 | |
702 | /** |
647 | /** |
703 | * God wants to enchant weapon. |
648 | * God wants to enchant weapon. |
704 | * Affected weapon is the applied one (weapon or bow). It's checked to make sure |
649 | * Affected weapon is the applied one (weapon or bow). It's checked to make sure |
… | |
… | |
706 | * attacktype, slaying and such. |
651 | * attacktype, slaying and such. |
707 | */ |
652 | */ |
708 | static int |
653 | static int |
709 | god_enchants_weapon (object *op, object *god, object *tr, object *skill) |
654 | god_enchants_weapon (object *op, object *god, object *tr, object *skill) |
710 | { |
655 | { |
711 | object *weapon; |
656 | if (!op->contr) |
712 | uint32 attacktype; |
657 | return 0; |
713 | int tmp; |
|
|
714 | |
658 | |
715 | for (weapon = op->inv; weapon; weapon = weapon->below) |
659 | object *weapon = op->contr->combat_ob; |
716 | if ((weapon->type == WEAPON || weapon->type == BOW) && QUERY_FLAG (weapon, FLAG_APPLIED)) |
|
|
717 | break; |
|
|
718 | |
660 | |
|
|
661 | if (!weapon) |
|
|
662 | return 0; |
|
|
663 | |
|
|
664 | if (weapon->type != WEAPON && weapon->type != BOW) |
|
|
665 | return 0; |
|
|
666 | |
719 | if (!weapon || god_examines_item (god, weapon) <= 0) |
667 | if (god_examines_item (god, weapon) <= 0) |
720 | return 0; |
668 | return 0; |
721 | |
669 | |
722 | /* First give it a title, so other gods won't touch it */ |
670 | /* First give it a title, so other gods won't touch it */ |
723 | if (!weapon->title) |
671 | if (!weapon->title) |
724 | { |
672 | { |
… | |
… | |
737 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s now hungers to slay enemies of your god!", &weapon->name); |
685 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s now hungers to slay enemies of your god!", &weapon->name); |
738 | return 1; |
686 | return 1; |
739 | } |
687 | } |
740 | |
688 | |
741 | /* Add the gods attacktype */ |
689 | /* Add the gods attacktype */ |
742 | attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; |
690 | uint32 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; |
|
|
691 | |
743 | if ((attacktype & god->attacktype) != god->attacktype) |
692 | if ((attacktype & god->attacktype) != god->attacktype) |
744 | { |
693 | { |
745 | new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); |
694 | new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); |
746 | weapon->attacktype = attacktype | god->attacktype; |
695 | weapon->attacktype = attacktype | god->attacktype; |
747 | return 1; |
696 | return 1; |
748 | } |
697 | } |
749 | |
698 | |
750 | /* Higher magic value */ |
699 | /* Higher magic value */ |
751 | tmp = follower_level_to_enchantments (skill->level, tr->level); |
700 | if (weapon->magic < follower_level_to_enchantments (skill->level, tr->level)) |
752 | if (weapon->magic < tmp) |
|
|
753 | { |
701 | { |
754 | new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); |
702 | new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); |
755 | weapon->magic++; |
703 | weapon->magic++; |
756 | |
704 | |
757 | if (object *pl = weapon->visible_to ()) |
705 | if (object *pl = weapon->visible_to ()) |
… | |
… | |
759 | |
707 | |
760 | return 1; |
708 | return 1; |
761 | } |
709 | } |
762 | |
710 | |
763 | return 0; |
711 | return 0; |
|
|
712 | } |
|
|
713 | |
|
|
714 | /** |
|
|
715 | * Checks and maybe punishes someone praying. |
|
|
716 | * All applied items are examined, if player is using more items of other gods, |
|
|
717 | * s/he loses experience in praying or general experience if no praying. |
|
|
718 | */ |
|
|
719 | static int |
|
|
720 | god_examines_priest (object *op, object *god) |
|
|
721 | { |
|
|
722 | int reaction = 1; |
|
|
723 | object *item = NULL, *skop; |
|
|
724 | |
|
|
725 | for (item = op->inv; item; item = item->below) |
|
|
726 | if (item->flag [FLAG_APPLIED]) |
|
|
727 | reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); |
|
|
728 | |
|
|
729 | /* well, well. Looks like we screwed up. Time for god's revenge */ |
|
|
730 | if (reaction < 0) |
|
|
731 | { |
|
|
732 | int loss = 10000000; |
|
|
733 | int angry = abs (reaction); |
|
|
734 | |
|
|
735 | for (skop = op->inv; skop; skop = skop->below) |
|
|
736 | if (skop->type == SKILL && skop->subtype == SK_PRAYING) |
|
|
737 | break; |
|
|
738 | |
|
|
739 | if (skop) |
|
|
740 | loss = 0.05f * skop->stats.exp; |
|
|
741 | |
|
|
742 | change_exp (op, -random_roll (0, loss * angry - 1, op, PREFER_LOW), skop ? skop->skill : shstr_none, SK_SUBTRACT_SKILL_EXP); |
|
|
743 | |
|
|
744 | if (random_roll (0, angry, op, PREFER_LOW)) |
|
|
745 | { |
|
|
746 | object *tmp = get_archetype (LOOSE_MANA); |
|
|
747 | |
|
|
748 | cast_magic_storm (op, tmp, op->level + (angry * 3)); |
|
|
749 | } |
|
|
750 | |
|
|
751 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "%s becomes angry and punishes you!", &god->name); |
|
|
752 | } |
|
|
753 | |
|
|
754 | return reaction; |
764 | } |
755 | } |
765 | |
756 | |
766 | /** |
757 | /** |
767 | * Every once in a while the god will intervene to help the worshiper. |
758 | * Every once in a while the god will intervene to help the worshiper. |
768 | * Later, this fctn can be used to supply quests, etc for the |
759 | * Later, this fctn can be used to supply quests, etc for the |
769 | * priest. -b.t. |
760 | * priest. -b.t. |
770 | * called from pray_at_altar() currently. |
761 | * called from pray_at_altar() currently. |
771 | */ |
762 | */ |
772 | void |
763 | static void |
773 | god_intervention (object *op, object *god, object *skill) |
764 | god_intervention (object *op, object *god, object *skill) |
774 | { |
765 | { |
775 | treasure *tr; |
766 | treasure *tr; |
776 | |
767 | |
777 | if (!god || !god->randomitems) |
768 | if (!god || !god->randomitems) |
… | |
… | |
905 | { |
896 | { |
906 | object *depl; |
897 | object *depl; |
907 | archetype *at; |
898 | archetype *at; |
908 | int i; |
899 | int i; |
909 | |
900 | |
910 | if ((at = archetype::find (ARCH_DEPLETION)) == NULL) |
901 | if ((at = archetype::find (shstr_depletion)) == NULL) |
911 | { |
902 | { |
912 | LOG (llevError, "Could not find archetype depletion.\n"); |
903 | LOG (llevError, "Could not find archetype depletion.\n"); |
913 | continue; |
904 | continue; |
914 | } |
905 | } |
915 | |
906 | |
… | |
… | |
980 | |
971 | |
981 | new_draw_info (NDI_UNIQUE, 0, op, "You feel rapture."); |
972 | new_draw_info (NDI_UNIQUE, 0, op, "You feel rapture."); |
982 | } |
973 | } |
983 | |
974 | |
984 | /** |
975 | /** |
985 | * Checks and maybe punishes someone praying. |
976 | * Player prays at altar. |
986 | * All applied items are examined, if player is using more items of other gods, |
977 | * Checks for god changing, divine intervention, and so on. |
987 | * s/he loses experience in praying or general experience if no praying. |
|
|
988 | */ |
978 | */ |
989 | int |
979 | void |
990 | god_examines_priest (object *op, object *god) |
980 | pray_at_altar (object *pl, object *altar, object *skill) |
991 | { |
981 | { |
992 | int reaction = 1; |
982 | object *pl_god = find_god (determine_god (pl)); |
993 | object *item = NULL, *skop; |
|
|
994 | |
983 | |
995 | for (item = op->inv; item; item = item->below) |
984 | if (INVOKE_PLAYER (PRAY_ALTAR, pl->contr, ARG_OBJECT (altar), ARG_OBJECT (skill))) |
996 | if (QUERY_FLAG (item, FLAG_APPLIED)) |
|
|
997 | reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); |
|
|
998 | |
|
|
999 | /* well, well. Looks like we screwed up. Time for god's revenge */ |
|
|
1000 | if (reaction < 0) |
|
|
1001 | { |
|
|
1002 | int loss = 10000000; |
|
|
1003 | int angry = abs (reaction); |
|
|
1004 | |
|
|
1005 | for (skop = op->inv; skop; skop = skop->below) |
|
|
1006 | if (skop->type == SKILL && skop->subtype == SK_PRAYING) |
|
|
1007 | break; |
|
|
1008 | |
|
|
1009 | if (skop) |
|
|
1010 | loss = 0.05f * skop->stats.exp; |
|
|
1011 | |
|
|
1012 | change_exp (op, -random_roll (0, loss * angry - 1, op, PREFER_LOW), skop ? &skop->skill : "none", SK_SUBTRACT_SKILL_EXP); |
|
|
1013 | |
|
|
1014 | if (random_roll (0, angry, op, PREFER_LOW)) |
|
|
1015 | { |
|
|
1016 | object *tmp = get_archetype (LOOSE_MANA); |
|
|
1017 | |
|
|
1018 | cast_magic_storm (op, tmp, op->level + (angry * 3)); |
|
|
1019 | } |
|
|
1020 | |
|
|
1021 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "%s becomes angry and punishes you!", &god->name); |
|
|
1022 | } |
|
|
1023 | |
|
|
1024 | return reaction; |
|
|
1025 | } |
|
|
1026 | |
|
|
1027 | /** |
|
|
1028 | * God checks item the player is using. |
|
|
1029 | * Return either -1 (bad), 0 (neutral) or |
|
|
1030 | * 1 (item is ok). If you are using the item of an enemy |
|
|
1031 | * god, it can be bad...-b.t. |
|
|
1032 | */ |
|
|
1033 | int |
|
|
1034 | god_examines_item (object *god, object *item) |
|
|
1035 | { |
|
|
1036 | char buf[MAX_BUF]; |
|
|
1037 | |
|
|
1038 | if (!god || !item) |
|
|
1039 | return 0; |
985 | return; |
1040 | |
986 | |
1041 | if (!item->title) |
987 | /* If non consecrate altar, don't do anything */ |
1042 | return 1; /* unclaimed item are ok */ |
988 | if (!altar->other_arch) |
|
|
989 | return; |
1043 | |
990 | |
1044 | sprintf (buf, "of %s", &god->name); |
991 | /* hmm. what happend depends on pl's current god, level, etc */ |
1045 | if (!strcmp (&item->title, buf)) |
992 | if (!pl_god) |
1046 | return 1; /* belongs to that God */ |
993 | { /*new convert */ |
|
|
994 | pl->become_follower (altar->other_arch); |
|
|
995 | return; |
|
|
996 | } |
|
|
997 | else if (pl_god->name == altar->other_arch->object::name) |
|
|
998 | { |
|
|
999 | /* pray at your gods altar */ |
|
|
1000 | /* this leads to very low levels of wis and pray to result in no doubling! */ |
|
|
1001 | int bonus = (pl->stats.Wis + skill->level) / 10; |
1047 | |
1002 | |
1048 | if (god->title) |
1003 | /* we can get neg grace up faster */ |
1049 | { /* check if we have any enemy blessed item */ |
1004 | if (pl->stats.grace < 0) |
1050 | sprintf (buf, "of %s", &god->title); |
1005 | pl->stats.grace += (bonus > -1 * (pl->stats.grace / 10) ? bonus : -1 * (pl->stats.grace / 10)); |
1051 | if (!strcmp (&item->title, buf)) |
1006 | |
|
|
1007 | /* we can super-charge grace to 2x max */ |
|
|
1008 | if (pl->stats.grace < 2 * pl->stats.maxgrace) |
|
|
1009 | pl->stats.grace += bonus / 2; |
|
|
1010 | else |
|
|
1011 | pl->stats.grace = 2 * pl->stats.maxgrace; |
|
|
1012 | |
|
|
1013 | /* Every once in a while, the god decides to checkup on their |
|
|
1014 | * follower, and may intervene to help them out. |
1052 | { |
1015 | */ |
1053 | if (item->env) |
1016 | bonus = max (1, bonus + max (pl->stats.luck, -3)); /* -- DAMN -- */ |
|
|
1017 | |
|
|
1018 | if (((random_roll (0, 399, pl, PREFER_LOW)) - bonus) < 0) |
|
|
1019 | god_intervention (pl, pl_god, skill); |
|
|
1020 | } |
|
|
1021 | else |
|
|
1022 | { /* praying to another god! */ |
|
|
1023 | uint64 loss = 0; |
|
|
1024 | int angry = 1; |
|
|
1025 | |
|
|
1026 | /* I believe the logic for detecting opposing gods was completely |
|
|
1027 | * broken - I think it should work now. altar->other_arch |
|
|
1028 | * points to the god of this altar (which we have |
|
|
1029 | * already verified is non null). pl_god->other_arch |
|
|
1030 | * is the opposing god - we need to verify that exists before |
|
|
1031 | * using its values. |
|
|
1032 | */ |
|
|
1033 | if (pl_god->other_arch && (altar->other_arch->archname == pl_god->other_arch->archname)) |
|
|
1034 | { |
|
|
1035 | angry = 2; |
|
|
1036 | if (random_roll (0, skill->level + 2, pl, PREFER_LOW) - 5 > 0) |
1054 | { |
1037 | { |
1055 | char buf[MAX_BUF]; |
1038 | object *tmp; |
1056 | |
1039 | |
1057 | sprintf (buf, "Heretic! You are using %s!", query_name (item)); |
1040 | /* you really screwed up */ |
1058 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, item->env, buf); |
1041 | angry = 3; |
|
|
1042 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, pl, "Foul Priest! %s punishes you!", &pl_god->name); |
|
|
1043 | tmp = get_archetype (LOOSE_MANA); |
|
|
1044 | cast_magic_storm (pl, tmp, pl_god->level + 20); |
1059 | } |
1045 | } |
|
|
1046 | else |
|
|
1047 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, pl, "Foolish heretic! %s is livid!", &pl_god->name); |
|
|
1048 | } |
|
|
1049 | else |
|
|
1050 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, pl, "Heretic! %s is angered!", &pl_god->name); |
1060 | |
1051 | |
1061 | return -1; |
1052 | /* whether we will be successfull in defecting or not - |
|
|
1053 | * we lose experience from the clerical experience obj |
|
|
1054 | */ |
|
|
1055 | |
|
|
1056 | loss = angry * (skill->stats.exp / 10); |
|
|
1057 | if (loss) |
|
|
1058 | change_exp (pl, -random_roll64 (0, loss, pl, PREFER_LOW), skill ? skill->skill : shstr_none, SK_SUBTRACT_SKILL_EXP); |
|
|
1059 | |
|
|
1060 | /* May switch Gods, but its random chance based on our current level |
|
|
1061 | * note it gets harder to swap gods the higher we get |
|
|
1062 | */ |
|
|
1063 | if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) |
|
|
1064 | pl->become_follower (altar->other_arch); |
|
|
1065 | else |
1062 | } |
1066 | { |
|
|
1067 | /* toss this player off the altar. He can try again. */ |
|
|
1068 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); |
|
|
1069 | pl->contr->fire_on = 0; |
|
|
1070 | pl->speed_left = 1.f; |
|
|
1071 | move_player (pl, absdir (pl->facing + 4)); /* back him off the way he came. */ |
|
|
1072 | } |
1063 | } |
1073 | } |
1064 | |
|
|
1065 | return 0; /* item is sacred to a non-enemy god/or is otherwise magical */ |
|
|
1066 | } |
|
|
1067 | |
|
|
1068 | /** |
|
|
1069 | * Returns priest's god's id. |
|
|
1070 | * Straight calls lookup_god_by_name |
|
|
1071 | */ |
|
|
1072 | int |
|
|
1073 | get_god (object *priest) |
|
|
1074 | { |
|
|
1075 | return lookup_god_by_name (determine_god (priest)); |
|
|
1076 | } |
1074 | } |
1077 | |
1075 | |
1078 | /** |
1076 | /** |
1079 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1077 | * Changes the attributes of cone, smite, and ball spells as needed by the code. |
1080 | * Returns false if there was no race to assign to the slaying field of the spell, but |
1078 | * Returns false if there was no race to assign to the slaying field of the spell, but |