1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_spell_attack_c = |
3 | * static char *rcsid_spell_attack_c = |
4 | * "$Id: spell_attack.C,v 1.9 2006/09/10 15:59:57 root Exp $"; |
4 | * "$Id: spell_attack.C,v 1.11 2006/09/11 20:26:41 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | |
7 | |
8 | /* |
8 | /* |
9 | CrossFire, A Multiplayer game for X-windows |
9 | CrossFire, A Multiplayer game for X-windows |
… | |
… | |
185 | { |
185 | { |
186 | remove_ob (op); |
186 | remove_ob (op); |
187 | free_object (op); |
187 | free_object (op); |
188 | return; |
188 | return; |
189 | } |
189 | } |
|
|
190 | |
190 | hit_map (op, 0, op->attacktype, 1); |
191 | hit_map (op, 0, op->attacktype, 1); |
191 | |
192 | |
192 | if (!op->direction) |
193 | if (!op->direction) |
193 | return; |
194 | return; |
194 | |
195 | |
… | |
… | |
468 | |
469 | |
469 | copy_owner (tmp, op); |
470 | copy_owner (tmp, op); |
470 | tmp->skill = op->skill; |
471 | tmp->skill = op->skill; |
471 | |
472 | |
472 | owner = get_owner (op); |
473 | owner = get_owner (op); |
|
|
474 | |
473 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
475 | if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) |
474 | { |
476 | { |
475 | remove_ob (op); |
477 | remove_ob (op); |
476 | free_object (op); |
478 | free_object (op); |
477 | return; |
479 | return; |
478 | } |
480 | } |
|
|
481 | |
479 | tmp->x = op->x; |
482 | tmp->x = op->x; |
480 | tmp->y = op->y; |
483 | tmp->y = op->y; |
481 | |
484 | |
482 | /* special for bombs - it actually has sane values for these */ |
485 | /* special for bombs - it actually has sane values for these */ |
483 | if (op->type == SPELL_EFFECT && op->subtype == SP_BOMB) |
486 | if (op->type == SPELL_EFFECT && op->subtype == SP_BOMB) |
… | |
… | |
931 | tmp->y = sy; |
934 | tmp->y = sy; |
932 | tmp->attacktype = spell->attacktype; |
935 | tmp->attacktype = spell->attacktype; |
933 | |
936 | |
934 | /* holy word stuff */ |
937 | /* holy word stuff */ |
935 | if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER)) |
938 | if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER)) |
936 | { |
|
|
937 | if (!tailor_god_spell (tmp, op)) |
939 | if (!tailor_god_spell (tmp, op)) |
938 | return 0; |
940 | return 0; |
939 | } |
|
|
940 | |
941 | |
941 | if (dir) |
942 | if (dir) |
942 | tmp->stats.sp = dir; |
943 | tmp->stats.sp = dir; |
943 | else |
944 | else |
944 | tmp->stats.sp = i; |
945 | tmp->stats.sp = i; |
… | |
… | |
950 | { |
951 | { |
951 | tmp->range /= 4; |
952 | tmp->range /= 4; |
952 | if (tmp->range < 2 && spell->range >= 2) |
953 | if (tmp->range < 2 && spell->range >= 2) |
953 | tmp->range = 2; |
954 | tmp->range = 2; |
954 | } |
955 | } |
|
|
956 | |
955 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
957 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
956 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
958 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
957 | |
959 | |
958 | /* Special bonus for fear attacks */ |
960 | /* Special bonus for fear attacks */ |
959 | if (tmp->attacktype & AT_FEAR) |
961 | if (tmp->attacktype & AT_FEAR) |
… | |
… | |
961 | if (caster->type == PLAYER) |
963 | if (caster->type == PLAYER) |
962 | tmp->duration += fear_bonus[caster->stats.Cha]; |
964 | tmp->duration += fear_bonus[caster->stats.Cha]; |
963 | else |
965 | else |
964 | tmp->duration += caster->level / 3; |
966 | tmp->duration += caster->level / 3; |
965 | } |
967 | } |
|
|
968 | |
966 | if (tmp->attacktype & (AT_HOLYWORD | AT_TURN_UNDEAD)) |
969 | if (tmp->attacktype & (AT_HOLYWORD | AT_TURN_UNDEAD)) |
967 | { |
970 | { |
968 | if (caster->type == PLAYER) |
971 | if (caster->type == PLAYER) |
969 | tmp->duration += turn_bonus[caster->stats.Wis] / 5; |
972 | tmp->duration += turn_bonus[caster->stats.Wis] / 5; |
970 | else |
973 | else |
971 | tmp->duration += caster->level / 3; |
974 | tmp->duration += caster->level / 3; |
972 | } |
975 | } |
973 | |
976 | |
974 | |
|
|
975 | if (!(tmp->move_type & MOVE_FLY_LOW)) |
977 | if (!(tmp->move_type & MOVE_FLY_LOW)) |
976 | LOG (llevDebug, "cast_cone(): arch %s doesn't have flying 1\n", &spell->other_arch->name); |
978 | LOG (llevDebug, "cast_cone(): arch %s doesn't have flying 1\n", &spell->other_arch->name); |
977 | |
979 | |
978 | if (!tmp->move_on && tmp->stats.dam) |
980 | if (!tmp->move_on && tmp->stats.dam) |
979 | { |
981 | { |
980 | LOG (llevDebug, "cast_cone(): arch %s doesn't have move_on set\n", &spell->other_arch->name); |
982 | LOG (llevDebug, "cast_cone(): arch %s doesn't have move_on set\n", &spell->other_arch->name); |
981 | } |
983 | } |
|
|
984 | |
982 | insert_ob_in_map (tmp, m, op, 0); |
985 | insert_ob_in_map (tmp, m, op, 0); |
983 | |
986 | |
984 | /* This is used for tracking spells so that one effect doesn't hit |
987 | /* This is used for tracking spells so that one effect doesn't hit |
985 | * a single space too many times. |
988 | * a single space too many times. |
986 | */ |
989 | */ |
987 | tmp->stats.maxhp = tmp->count; |
990 | tmp->stats.maxhp = tmp->count; |
988 | |
991 | |
989 | if (tmp->other_arch) |
992 | if (tmp->other_arch) |
990 | cone_drop (tmp); |
993 | cone_drop (tmp); |
991 | } |
994 | } |
|
|
995 | |
992 | return success; |
996 | return success; |
993 | } |
997 | } |
994 | |
998 | |
995 | /**************************************************************************** |
999 | /**************************************************************************** |
996 | * |
1000 | * |
… | |
… | |
1009 | object *env, *tmp; |
1013 | object *env, *tmp; |
1010 | archetype *at; |
1014 | archetype *at; |
1011 | |
1015 | |
1012 | if (op->state != NUM_ANIMATIONS (op) - 1) |
1016 | if (op->state != NUM_ANIMATIONS (op) - 1) |
1013 | return; |
1017 | return; |
1014 | |
|
|
1015 | |
1018 | |
1016 | env = object_get_env_recursive (op); |
1019 | env = object_get_env_recursive (op); |
1017 | |
1020 | |
1018 | if (op->env) |
1021 | if (op->env) |
1019 | { |
1022 | { |