… | |
… | |
261 | */ |
261 | */ |
262 | object * |
262 | object * |
263 | check_spell_known (object *op, const char *name) |
263 | check_spell_known (object *op, const char *name) |
264 | { |
264 | { |
265 | object *spop; |
265 | object *spop; |
|
|
266 | shstr_cmp name_ (name); |
266 | |
267 | |
267 | for (spop = op->inv; spop; spop = spop->below) |
268 | for (spop = op->inv; spop; spop = spop->below) |
268 | if (spop->type == SPELL && !strcmp (spop->name, name)) |
269 | if (spop->type == SPELL && spop->name == name) |
269 | return spop; |
270 | return spop; |
270 | |
271 | |
271 | return NULL; |
272 | return 0; |
272 | } |
273 | } |
273 | |
274 | |
274 | |
275 | |
275 | /* |
276 | /* |
276 | * Look at object 'op' and see if they know the spell |
277 | * Look at object 'op' and see if they know the spell |
… | |
… | |
438 | /* |
439 | /* |
439 | * Combine similar spell effects into one spell effect. Needed for |
440 | * Combine similar spell effects into one spell effect. Needed for |
440 | * performance reasons with meteor swarm and the like, but also for |
441 | * performance reasons with meteor swarm and the like, but also for |
441 | * playability reasons. |
442 | * playability reasons. |
442 | */ |
443 | */ |
443 | if (tmp->arch == op->arch |
444 | if (tmp->arch == op->arch /* no harm if not comparing by name here */ |
444 | && tmp->type == op->type |
445 | && tmp->type == op->type |
445 | && tmp->subtype == op->subtype |
446 | && tmp->subtype == op->subtype |
446 | && tmp->owner == op->owner |
447 | && tmp->owner == op->owner |
447 | && ((tmp->subtype == SP_EXPLOSION) || (tmp->subtype == SP_CONE && tmp->stats.sp == op->stats.sp))) |
448 | && ((tmp->subtype == SP_EXPLOSION) || (tmp->subtype == SP_CONE && tmp->stats.sp == op->stats.sp))) |
448 | { |
449 | { |
… | |
… | |
692 | create_treasure (head->randomitems, head, GT_INVISIBLE, op->map->difficulty, 0); |
693 | create_treasure (head->randomitems, head, GT_INVISIBLE, op->map->difficulty, 0); |
693 | |
694 | |
694 | insert_ob_in_map (head, op->map, op, 0); |
695 | insert_ob_in_map (head, op->map, op, 0); |
695 | |
696 | |
696 | /* thought it'd be cool to insert a burnout, too. */ |
697 | /* thought it'd be cool to insert a burnout, too. */ |
697 | op->map->insert (get_archetype ("burnout"), op->x + freearr_x[dir], op->y + freearr_y[dir], op); |
698 | op->map->insert (archetype::get (shstr_burnout), op->x + freearr_x[dir], op->y + freearr_y[dir], op); |
698 | } |
699 | } |
699 | } |
700 | } |
700 | |
701 | |
701 | /* peterm: function which summons hostile monsters and |
702 | /* peterm: function which summons hostile monsters and |
702 | * places them in nearby squares. |
703 | * places them in nearby squares. |
… | |
… | |
1004 | { |
1005 | { |
1005 | skill = find_skill_by_name (op, spell_ob->skill); |
1006 | skill = find_skill_by_name (op, spell_ob->skill); |
1006 | |
1007 | |
1007 | if (!skill) |
1008 | if (!skill) |
1008 | { |
1009 | { |
1009 | op->failmsg (format ("You need the skill %s to cast %s!", &spell_ob->skill, &spell_ob->name)); |
1010 | op->failmsg (format ("You need the skill %s to cast %s! " |
|
|
1011 | "H<You either need to learn the skill via a skill scroll " |
|
|
1012 | "or you need to wear a talisman or holy symbol.>", |
|
|
1013 | &spell_ob->skill, &spell_ob->name)); |
1010 | return 0; |
1014 | return 0; |
1011 | } |
1015 | } |
1012 | |
1016 | |
|
|
1017 | int casting_level = min_casting_level (op, spell_ob); |
|
|
1018 | |
1013 | if (min_casting_level (op, spell_ob) > cast_level && !QUERY_FLAG (op, FLAG_WIZ)) |
1019 | if (casting_level > cast_level && !QUERY_FLAG (op, FLAG_WIZ)) |
1014 | { |
1020 | { |
1015 | op->failmsg ("You lack enough skill to cast that spell!"); |
1021 | op->failmsg (format ("You lack enough skill to cast that spell! " |
|
|
1022 | "H<Your cast level is %d, but level %d is required. Maybe you are repelled?>", |
|
|
1023 | cast_level, casting_level)); |
1016 | return 0; |
1024 | return 0; |
1017 | } |
1025 | } |
1018 | } |
1026 | } |
1019 | |
1027 | |
1020 | /* If the caster is the wiz, they don't ever fail, and don't have |
1028 | /* If the caster is the wiz, they don't ever fail, and don't have |