1 | /* |
1 | /* |
2 | * static char *rcsid_rune_c = |
2 | * static char *rcsid_rune_c = |
3 | * "$Id: rune.C,v 1.2 2006/08/29 08:01:38 root Exp $"; |
3 | * "$Id: rune.C,v 1.3 2006/09/03 00:18:42 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
106 | runename); |
106 | runename); |
107 | return 0; |
107 | return 0; |
108 | } |
108 | } |
109 | if (rune_spell->skill != spell->skill) { |
109 | if (rune_spell->skill != spell->skill) { |
110 | new_draw_info_format(NDI_UNIQUE, 0, op, "You can't cast %s with %s", |
110 | new_draw_info_format(NDI_UNIQUE, 0, op, "You can't cast %s with %s", |
111 | rune_spell->name, spell->name); |
111 | &rune_spell->name, &spell->name); |
112 | return 0; |
112 | return 0; |
113 | } |
113 | } |
114 | if (caster->path_denied & spell->path_attuned) { |
114 | if (caster->path_denied & spell->path_attuned) { |
115 | new_draw_info_format(NDI_UNIQUE, 0,op, "%s belongs to a spell path denied to you.", |
115 | new_draw_info_format(NDI_UNIQUE, 0,op, "%s belongs to a spell path denied to you.", |
116 | rune_spell->name); |
116 | &rune_spell->name); |
117 | return 0; |
117 | return 0; |
118 | } |
118 | } |
119 | if (caster_level(caster, rune_spell) < rune_spell->level) { |
119 | if (caster_level(caster, rune_spell) < rune_spell->level) { |
120 | new_draw_info_format(NDI_UNIQUE, 0,op, "%s is beyond your ability to cast!", |
120 | new_draw_info_format(NDI_UNIQUE, 0,op, "%s is beyond your ability to cast!", |
121 | rune_spell->name); |
121 | &rune_spell->name); |
122 | return 0; |
122 | return 0; |
123 | } |
123 | } |
124 | if (SP_level_spellpoint_cost(caster, rune_spell, SPELL_MANA) > op->stats.sp) { |
124 | if (SP_level_spellpoint_cost(caster, rune_spell, SPELL_MANA) > op->stats.sp) { |
125 | new_draw_info(NDI_UNIQUE, 0,op,"You don't have enough mana."); |
125 | new_draw_info(NDI_UNIQUE, 0,op,"You don't have enough mana."); |
126 | return 0; |
126 | return 0; |
… | |
… | |
135 | /* already proper rune. Note this should only be the case if other_arch was set */ |
135 | /* already proper rune. Note this should only be the case if other_arch was set */ |
136 | if (rune_spell->type == RUNE) { |
136 | if (rune_spell->type == RUNE) { |
137 | rune = rune_spell; |
137 | rune = rune_spell; |
138 | } else { |
138 | } else { |
139 | rune = get_archetype(GENERIC_RUNE); |
139 | rune = get_archetype(GENERIC_RUNE); |
140 | sprintf(buf,"You set off a rune of %s\n",rune_spell->name); |
140 | sprintf(buf,"You set off a rune of %s\n",&rune_spell->name); |
141 | rune->msg=add_string(buf); |
141 | rune->msg=buf; |
142 | tmp = get_object(); |
142 | tmp = get_object(); |
143 | copy_object(rune_spell, tmp); |
143 | copy_object(rune_spell, tmp); |
144 | insert_ob_in_ob(tmp, rune); |
144 | insert_ob_in_ob(tmp, rune); |
145 | if (spell->face != blank_face) |
145 | if (spell->face != blank_face) |
146 | rune->face = spell->face; |
146 | rune->face = spell->face; |
… | |
… | |
361 | chance = random_roll(0, 99, op, PREFER_HIGH);; |
361 | chance = random_roll(0, 99, op, PREFER_HIGH);; |
362 | |
362 | |
363 | /* decide if we see the rune or not */ |
363 | /* decide if we see the rune or not */ |
364 | if((trap->stats.Cha==1) || (chance > MIN(95,MAX(5,((int)((float) (op->map->difficulty |
364 | if((trap->stats.Cha==1) || (chance > MIN(95,MAX(5,((int)((float) (op->map->difficulty |
365 | + trap->level + trap->stats.Cha-op->level)/10.0 * 50.0)))))) { |
365 | + trap->level + trap->stats.Cha-op->level)/10.0 * 50.0)))))) { |
366 | new_draw_info_format(NDI_UNIQUE, 0,op,"You spot a %s!",trap->name); |
366 | new_draw_info_format(NDI_UNIQUE, 0,op,"You spot a %s!",&trap->name); |
367 | return 1; |
367 | return 1; |
368 | } |
368 | } |
369 | return 0; |
369 | return 0; |
370 | } |
370 | } |
371 | |
371 | |
… | |
… | |
393 | |
393 | |
394 | if(!(random_roll(0, (MAX(2, MIN(20,trap->level-skill->level |
394 | if(!(random_roll(0, (MAX(2, MIN(20,trap->level-skill->level |
395 | +5 - disarmer->stats.Dex/2))-1), disarmer, PREFER_LOW))) |
395 | +5 - disarmer->stats.Dex/2))-1), disarmer, PREFER_LOW))) |
396 | { |
396 | { |
397 | new_draw_info_format(NDI_UNIQUE, 0,disarmer, |
397 | new_draw_info_format(NDI_UNIQUE, 0,disarmer, |
398 | "You successfully disarm the %s!",trap->name); |
398 | "You successfully disarm the %s!",&trap->name); |
399 | destroy_object(trap); |
399 | destroy_object(trap); |
400 | /* If it is your own trap, (or any players trap), don't you don't |
400 | /* If it is your own trap, (or any players trap), don't you don't |
401 | * get exp for it. |
401 | * get exp for it. |
402 | */ |
402 | */ |
403 | if (trap->owner && trap->owner->type!=PLAYER && risk) |
403 | if (trap->owner && trap->owner->type!=PLAYER && risk) |
… | |
… | |
405 | else return 1; /* give minimal exp and say success */ |
405 | else return 1; /* give minimal exp and say success */ |
406 | } |
406 | } |
407 | else |
407 | else |
408 | { |
408 | { |
409 | new_draw_info_format(NDI_UNIQUE, 0,disarmer, |
409 | new_draw_info_format(NDI_UNIQUE, 0,disarmer, |
410 | "You fail to disarm the %s.",trap->name); |
410 | "You fail to disarm the %s.",&trap->name); |
411 | if(! (random_roll(0, (MAX(2,skill->level-trap->level |
411 | if(! (random_roll(0, (MAX(2,skill->level-trap->level |
412 | + disarmer->stats.Dex/2-6))-1, disarmer, PREFER_LOW)) &&risk) { |
412 | + disarmer->stats.Dex/2-6))-1, disarmer, PREFER_LOW)) &&risk) { |
413 | new_draw_info(NDI_UNIQUE, 0,disarmer,"In fact, you set it off!"); |
413 | new_draw_info(NDI_UNIQUE, 0,disarmer,"In fact, you set it off!"); |
414 | spring_trap(trap,disarmer); |
414 | spring_trap(trap,disarmer); |
415 | } |
415 | } |