… | |
… | |
1695 | } |
1695 | } |
1696 | |
1696 | |
1697 | if (hitter->type == SPELL || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE) |
1697 | if (hitter->type == SPELL || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE) |
1698 | friendlyfire = 0; |
1698 | friendlyfire = 0; |
1699 | } |
1699 | } |
|
|
1700 | |
1700 | return friendlyfire; |
1701 | return friendlyfire; |
1701 | } |
1702 | } |
1702 | |
1703 | |
1703 | |
1704 | |
1704 | /* This isn't used just for players, but in fact most objects. |
1705 | /* This isn't used just for players, but in fact most objects. |
… | |
… | |
2012 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
2013 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
2013 | hitter->destroy (); |
2014 | hitter->destroy (); |
2014 | |
2015 | |
2015 | return maxdam; |
2016 | return maxdam; |
2016 | } |
2017 | } |
2017 | |
|
|
2018 | |
2018 | |
2019 | void |
2019 | void |
2020 | poison_player (object *op, object *hitter, int dam) |
2020 | poison_player (object *op, object *hitter, int dam) |
2021 | { |
2021 | { |
2022 | archetype *at = archetype::find ("poisoning"); |
2022 | archetype *at = archetype::find ("poisoning"); |
… | |
… | |
2077 | { |
2077 | { |
2078 | archetype *at = archetype::find ("slowness"); |
2078 | archetype *at = archetype::find ("slowness"); |
2079 | object *tmp; |
2079 | object *tmp; |
2080 | |
2080 | |
2081 | if (at == NULL) |
2081 | if (at == NULL) |
2082 | { |
|
|
2083 | LOG (llevError, "Can't find slowness archetype.\n"); |
2082 | LOG (llevError, "Can't find slowness archetype.\n"); |
2084 | } |
2083 | |
2085 | if ((tmp = present_arch_in_ob (at, op)) == NULL) |
2084 | if ((tmp = present_arch_in_ob (at, op)) == NULL) |
2086 | { |
2085 | { |
2087 | tmp = arch_to_object (at); |
2086 | tmp = arch_to_object (at); |
2088 | tmp = insert_ob_in_ob (tmp, op); |
2087 | tmp = insert_ob_in_ob (tmp, op); |
2089 | new_draw_info (NDI_UNIQUE, 0, op, "The world suddenly moves very fast!"); |
2088 | new_draw_info (NDI_UNIQUE, 0, op, "The world suddenly moves very fast!"); |
2090 | } |
2089 | } |
2091 | else |
2090 | else |
2092 | tmp->stats.food++; |
2091 | tmp->stats.food++; |
|
|
2092 | |
2093 | SET_FLAG (tmp, FLAG_APPLIED); |
2093 | SET_FLAG (tmp, FLAG_APPLIED); |
2094 | tmp->speed_left = 0; |
2094 | tmp->speed_left = 0; |
2095 | op->update_stats (); |
2095 | op->update_stats (); |
2096 | } |
2096 | } |
2097 | |
2097 | |
… | |
… | |
2114 | tmp->speed = 0.05; |
2114 | tmp->speed = 0.05; |
2115 | tmp->subtype = FORCE_CONFUSION; |
2115 | tmp->subtype = FORCE_CONFUSION; |
2116 | tmp->duration = 8 + MAX (1, 5 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2116 | tmp->duration = 8 + MAX (1, 5 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2117 | tmp->name = "confusion"; |
2117 | tmp->name = "confusion"; |
2118 | maxduration = MAX (2, 30 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2118 | maxduration = MAX (2, 30 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
|
|
2119 | |
2119 | if (tmp->duration > maxduration) |
2120 | if (tmp->duration > maxduration) |
2120 | tmp->duration = maxduration; |
2121 | tmp->duration = maxduration; |
2121 | |
2122 | |
2122 | if (op->type == PLAYER && !QUERY_FLAG (op, FLAG_CONFUSED)) |
2123 | if (op->type == PLAYER && !QUERY_FLAG (op, FLAG_CONFUSED)) |
2123 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very confused!"); |
2124 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very confused!"); |
|
|
2125 | |
2124 | SET_FLAG (op, FLAG_CONFUSED); |
2126 | SET_FLAG (op, FLAG_CONFUSED); |
2125 | } |
2127 | } |
2126 | |
2128 | |
2127 | void |
2129 | void |
2128 | blind_player (object *op, object *hitter, int dam) |
2130 | blind_player (object *op, object *hitter, int dam) |
… | |
… | |
2284 | } |
2286 | } |
2285 | } |
2287 | } |
2286 | } |
2288 | } |
2287 | |
2289 | |
2288 | /* adj_attackroll() - adjustments to attacks by various conditions */ |
2290 | /* adj_attackroll() - adjustments to attacks by various conditions */ |
2289 | |
|
|
2290 | int |
2291 | int |
2291 | adj_attackroll (object *hitter, object *target) |
2292 | adj_attackroll (object *hitter, object *target) |
2292 | { |
2293 | { |
2293 | object *attacker = hitter; |
2294 | object *attacker = hitter; |
2294 | int adjust = 0; |
2295 | int adjust = 0; |
… | |
… | |
2368 | |
2369 | |
2369 | /* I broke what used to be one big if into a few nested |
2370 | /* I broke what used to be one big if into a few nested |
2370 | * ones so that figuring out the logic is at least possible. |
2371 | * ones so that figuring out the logic is at least possible. |
2371 | */ |
2372 | */ |
2372 | if (op && (op->move_type & MOVE_FLYING)) |
2373 | if (op && (op->move_type & MOVE_FLYING)) |
2373 | { |
|
|
2374 | if (op->type == ARROW || op->type == THROWN_OBJ) |
2374 | if (op->type == ARROW || op->type == THROWN_OBJ) |
2375 | return 1; |
2375 | return 1; |
2376 | else if (op->type == SPELL_EFFECT && (op->subtype == SP_BULLET || op->subtype == SP_EXPLOSION)) |
2376 | else if (op->type == SPELL_EFFECT && (op->subtype == SP_BULLET || op->subtype == SP_EXPLOSION)) |
2377 | return 1; |
2377 | return 1; |
2378 | } |
|
|
2379 | |
2378 | |
2380 | return 0; |
2379 | return 0; |
2381 | } |
2380 | } |