… | |
… | |
441 | { |
441 | { |
442 | object *op; |
442 | object *op; |
443 | |
443 | |
444 | if (OUT_OF_REAL_MAP (m, x, y)) |
444 | if (OUT_OF_REAL_MAP (m, x, y)) |
445 | return 0; |
445 | return 0; |
446 | for (op = get_map_ob (m, x, y); op != NULL; op = op->above) |
446 | for (op = GET_MAP_OB (m, x, y); op != NULL; op = op->above) |
447 | if (QUERY_FLAG (op, FLAG_REFL_SPELL) && (!QUERY_FLAG (op, FLAG_ALIVE) || |
447 | if (QUERY_FLAG (op, FLAG_REFL_SPELL) |
448 | sp_op->type == LIGHTNING || (rndm (0, 99)) < 90 - (sp_op->level / 10))) |
448 | && (!QUERY_FLAG (op, FLAG_ALIVE) |
|
|
449 | || (rndm (0, 99)) < 90 - (sp_op->level / 10))) |
449 | return 1; |
450 | return 1; |
450 | |
451 | |
451 | return 0; |
452 | return 0; |
452 | } |
453 | } |
453 | |
454 | |
… | |
… | |
504 | return 0; |
505 | return 0; |
505 | |
506 | |
506 | if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (mp, x, y))) |
507 | if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (mp, x, y))) |
507 | return 0; |
508 | return 0; |
508 | |
509 | |
509 | for (tmp = get_map_ob (mp, x, y); tmp != NULL; tmp = tmp->above) |
510 | for (tmp = GET_MAP_OB (mp, x, y); tmp != NULL; tmp = tmp->above) |
510 | { |
511 | { |
511 | /* If there is a counterspell on the space, and this |
512 | /* If there is a counterspell on the space, and this |
512 | * object is using magic, don't progress. I believe we could |
513 | * object is using magic, don't progress. I believe we could |
513 | * leave this out and let in progress, and other areas of the code |
514 | * leave this out and let in progress, and other areas of the code |
514 | * will then remove it, but that would seem to to use more |
515 | * will then remove it, but that would seem to to use more |
… | |
… | |
693 | y = op->y + freearr_y[dir]; |
694 | y = op->y + freearr_y[dir]; |
694 | |
695 | |
695 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
696 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
696 | |
697 | |
697 | if (mflags & P_OUT_OF_MAP) |
698 | if (mflags & P_OUT_OF_MAP) |
698 | tmp = NULL; |
699 | tmp = 0; |
699 | else |
700 | else |
700 | { |
701 | tmp = m->at (x, y).player (); |
701 | for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = tmp->above) |
|
|
702 | if (tmp->type == PLAYER) |
|
|
703 | break; |
|
|
704 | } |
|
|
705 | } |
702 | } |
|
|
703 | |
706 | /* didn't find a player there, look in current square for a player */ |
704 | /* didn't find a player there, look in current square for a player */ |
707 | if (tmp == NULL) |
705 | if (!tmp) |
708 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
706 | tmp = op->ms ().player (); |
709 | { |
|
|
710 | if (tmp->type == PLAYER) |
|
|
711 | break; |
|
|
712 | } |
|
|
713 | |
707 | |
714 | return tmp; |
708 | return tmp; |
715 | } |
709 | } |
716 | |
710 | |
717 | |
711 | |
… | |
… | |
749 | mp = m; |
743 | mp = m; |
750 | mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny); |
744 | mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny); |
751 | if (mflags & (P_OUT_OF_MAP | P_BLOCKSVIEW)) |
745 | if (mflags & (P_OUT_OF_MAP | P_BLOCKSVIEW)) |
752 | continue; |
746 | continue; |
753 | |
747 | |
754 | tmp = get_map_ob (mp, nx, ny); |
748 | tmp = GET_MAP_OB (mp, nx, ny); |
755 | |
749 | |
756 | while (tmp != NULL && (((owner_type == PLAYER && |
750 | while (tmp != NULL && (((owner_type == PLAYER && |
757 | !QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_GENERATOR)) || |
751 | !QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_GENERATOR)) || |
758 | (owner_type != PLAYER && tmp->type != PLAYER)) || (tmp == exclude || (tmp->head && tmp->head == exclude)))) |
752 | (owner_type != PLAYER && tmp->type != PLAYER)) || (tmp == exclude || (tmp->head && tmp->head == exclude)))) |
759 | tmp = tmp->above; |
753 | tmp = tmp->above; |
… | |
… | |
1067 | if (caster->contr->party == NULL) |
1061 | if (caster->contr->party == NULL) |
1068 | { |
1062 | { |
1069 | spell->remove (); |
1063 | spell->remove (); |
1070 | return success; |
1064 | return success; |
1071 | } |
1065 | } |
1072 | for (pl = first_player; pl != NULL; pl = pl->next) |
1066 | for_all_players (pl) |
1073 | if ((pl->ob->contr->party == caster->contr->party) && (on_same_map (pl->ob, caster))) |
1067 | if ((pl->ob->contr->party == caster->contr->party) && (on_same_map (pl->ob, caster))) |
1074 | { |
1068 | { |
1075 | cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg); |
1069 | cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg); |
1076 | } |
1070 | } |
1077 | spell->remove (); |
1071 | spell->remove (); |
… | |
… | |
1277 | * spell is actually cast, it knows about the stringarg. |
1271 | * spell is actually cast, it knows about the stringarg. |
1278 | * necessary for the invoke command spells. |
1272 | * necessary for the invoke command spells. |
1279 | */ |
1273 | */ |
1280 | if (stringarg) |
1274 | if (stringarg) |
1281 | { |
1275 | { |
1282 | op->spellarg = strdup_local (stringarg); |
1276 | op->spellarg = strdup (stringarg); |
1283 | } |
1277 | } |
1284 | else |
1278 | else |
1285 | op->spellarg = NULL; |
1279 | op->spellarg = NULL; |
1286 | return 0; |
1280 | return 0; |
1287 | } |
1281 | } |