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