1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
30 | #include <skills.h> |
30 | #include <skills.h> |
31 | #include <tod.h> |
31 | #include <tod.h> |
32 | |
32 | |
33 | #include <sproto.h> |
33 | #include <sproto.h> |
34 | |
34 | |
35 | /* Want this regardless of rplay. */ |
|
|
36 | #include <sounds.h> |
|
|
37 | |
|
|
38 | /** |
35 | /** |
39 | * Check if op should abort moving victim because of it's race or slaying. |
36 | * Check if op should abort moving victim because of it's race or slaying. |
40 | * Returns 1 if it should abort, returns 0 if it should continue. |
37 | * Returns 1 if it should abort, returns 0 if it should continue. |
41 | */ |
38 | */ |
42 | int |
39 | int |
… | |
… | |
172 | */ |
169 | */ |
173 | int |
170 | int |
174 | apply_potion (object *op, object *tmp) |
171 | apply_potion (object *op, object *tmp) |
175 | { |
172 | { |
176 | int got_one = 0, i; |
173 | int got_one = 0, i; |
177 | object *force = 0, *floor = 0; |
174 | object *force = 0; |
178 | |
175 | |
179 | floor = GET_MAP_OB (op->map, op->x, op->y); |
176 | object *floor = GET_MAP_OB (op->map, op->x, op->y); |
180 | |
177 | |
181 | if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
178 | if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
182 | { |
179 | { |
183 | op->failmsg ("Gods prevent you from using this here, it's sacred ground!"); |
180 | op->failmsg ("Gods prevent you from using this here, it's sacred ground!"); |
184 | |
181 | |
… | |
… | |
951 | item->nrof *= nr; |
948 | item->nrof *= nr; |
952 | |
949 | |
953 | if (converter->flag [FLAG_PRECIOUS]) |
950 | if (converter->flag [FLAG_PRECIOUS]) |
954 | SET_FLAG (item, FLAG_UNPAID); |
951 | SET_FLAG (item, FLAG_UNPAID); |
955 | |
952 | |
956 | if (is_in_shop (converter)) |
953 | if (converter->is_in_shop ()) |
957 | { |
954 | { |
958 | // converters on shop floors don't work anymore, bug lets check for it |
955 | // converters on shop floors don't work anymore, bug lets check for it |
959 | // and report in case someone still does it. |
956 | // and report in case someone still does it. |
960 | LOG (llevDebug, "ITEMBUG: broken converter, converters on shop floor don't work: %s\n", |
957 | LOG (llevDebug, "ITEMBUG: broken converter, converters on shop floor don't work: %s\n", |
961 | converter->debug_desc ()); |
958 | converter->debug_desc ()); |
… | |
… | |
1164 | /* this is only used for players */ |
1161 | /* this is only used for players */ |
1165 | rv = teleport (shop_mat, SHOP_MAT, op); |
1162 | rv = teleport (shop_mat, SHOP_MAT, op); |
1166 | |
1163 | |
1167 | if (has_unpaid) |
1164 | if (has_unpaid) |
1168 | op->contr->play_sound (sound_find ("shop_buy")); |
1165 | op->contr->play_sound (sound_find ("shop_buy")); |
1169 | else if (is_in_shop (op)) |
1166 | else if (op->is_in_shop ()) |
1170 | op->contr->play_sound (sound_find ("shop_enter")); |
1167 | op->contr->play_sound (sound_find ("shop_enter")); |
1171 | else |
1168 | else |
1172 | op->contr->play_sound (sound_find ("shop_leave")); |
1169 | op->contr->play_sound (sound_find ("shop_leave")); |
1173 | |
1170 | |
1174 | if (shop_mat->msg) |
1171 | if (shop_mat->msg) |
1175 | op->statusmsg (shop_mat->msg); |
1172 | op->statusmsg (shop_mat->msg); |
1176 | /* This check below is a bit simplistic - generally it should be correct, |
1173 | /* This check below is a bit simplistic - generally it should be correct, |
1177 | * but there is never a guarantee that the bottom space on the map is |
1174 | * but there is never a guarantee that the bottom space on the map is |
1178 | * actually the shop floor. |
1175 | * actually the shop floor. |
1179 | */ |
1176 | */ |
1180 | else if (!rv && !is_in_shop (op)) |
1177 | else if (!rv && !op->is_in_shop ()) |
1181 | { |
1178 | { |
1182 | opinion = shopkeeper_approval (op->map, op); |
1179 | opinion = shopkeeper_approval (op->map, op); |
1183 | |
1180 | |
1184 | op->statusmsg ( |
1181 | op->statusmsg ( |
1185 | opinion >= 0.90 ? "The shopkeeper gives you a friendly wave." |
1182 | opinion >= 0.90 ? "The shopkeeper gives you a friendly wave." |
… | |
… | |
1353 | trap->stats.maxsp = 2; |
1350 | trap->stats.maxsp = 2; |
1354 | |
1351 | |
1355 | /* Is this correct? From the docs, it doesn't look like it |
1352 | /* Is this correct? From the docs, it doesn't look like it |
1356 | * should be divided by trap->speed |
1353 | * should be divided by trap->speed |
1357 | */ |
1354 | */ |
1358 | victim->speed_left = -fabs (trap->stats.maxsp * victim->speed / trap->speed); |
1355 | victim->speed_left = -trap->stats.maxsp * victim->speed / trap->speed; |
1359 | |
1356 | |
1360 | /* Just put in some sanity check. I think there is a bug in the |
1357 | /* Just put in some sanity check. I think there is a bug in the |
1361 | * above with some objects have zero speed, and thus the player |
1358 | * above with some objects have zero speed, and thus the player |
1362 | * getting permanently paralyzed. |
1359 | * getting permanently paralyzed. |
1363 | */ |
1360 | */ |
… | |
… | |
1488 | if (victim->type == PLAYER && EXIT_PATH (trap)) |
1485 | if (victim->type == PLAYER && EXIT_PATH (trap)) |
1489 | { |
1486 | { |
1490 | /* Basically, don't show exits leading to random maps the |
1487 | /* Basically, don't show exits leading to random maps the |
1491 | * players output. |
1488 | * players output. |
1492 | */ |
1489 | */ |
1493 | if (trap->msg && !EXIT_PATH (trap).starts_with ("/!")) |
1490 | if (trap->msg && EXIT_PATH (trap) != shstr_random_map_exit) |
1494 | victim->statusmsg (trap->msg, NDI_NAVY); |
1491 | victim->statusmsg (trap->msg, NDI_NAVY); |
1495 | |
1492 | |
1496 | trap->play_sound (trap->sound); |
1493 | trap->play_sound (trap->sound); |
1497 | victim->enter_exit (trap); |
1494 | victim->enter_exit (trap); |
1498 | } |
1495 | } |
… | |
… | |
1576 | : lev_diff < 15 ? "This book is way beyond your comprehension." |
1573 | : lev_diff < 15 ? "This book is way beyond your comprehension." |
1577 | : "This book is totally beyond your comprehension."); |
1574 | : "This book is totally beyond your comprehension."); |
1578 | return; |
1575 | return; |
1579 | } |
1576 | } |
1580 | |
1577 | |
|
|
1578 | // we currently don't use the message types for anything. |
1581 | readable_message_type *msgType = get_readable_message_type (tmp); |
1579 | // readable_message_type *msgType = get_readable_message_type (tmp); |
|
|
1580 | |
|
|
1581 | tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("apply_book")); |
1582 | |
1582 | |
1583 | if (player *pl = op->contr) |
1583 | if (player *pl = op->contr) |
1584 | if (client *ns = pl->ns) |
1584 | if (client *ns = pl->ns) |
1585 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); |
1585 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); |
1586 | |
1586 | |
… | |
… | |
1739 | LOG (llevError, "BUG: do_forget_spell(): spell not known\n"); |
1739 | LOG (llevError, "BUG: do_forget_spell(): spell not known\n"); |
1740 | return; |
1740 | return; |
1741 | } |
1741 | } |
1742 | |
1742 | |
1743 | op->failmsg (format ("You lose knowledge of %s.", spell)); |
1743 | op->failmsg (format ("You lose knowledge of %s.", spell)); |
1744 | player_unready_range_ob (op->contr, spob); |
|
|
1745 | esrv_remove_spell (op->contr, spob); |
1744 | esrv_remove_spell (op->contr, spob); |
1746 | spob->destroy (); |
1745 | spob->destroy (); |
1747 | } |
1746 | } |
1748 | |
1747 | |
1749 | /** |
1748 | /** |
… | |
… | |
1766 | * instead of having their spell stored in stats.sp. These are |
1765 | * instead of having their spell stored in stats.sp. These are |
1767 | * legacy spellbooks |
1766 | * legacy spellbooks |
1768 | */ |
1767 | */ |
1769 | if (tmp->slaying) |
1768 | if (tmp->slaying) |
1770 | { |
1769 | { |
1771 | spell = arch_to_object (find_archetype_by_object_name (tmp->slaying)); |
1770 | spell = find_archetype_by_object_name (tmp->slaying)->instance (); |
|
|
1771 | |
1772 | if (!spell) |
1772 | if (!spell) |
1773 | { |
1773 | { |
1774 | op->failmsg (format ("The book's formula for %s is incomplete.", &tmp->slaying)); |
1774 | op->failmsg (format ("The book's formula for %s is incomplete.", &tmp->slaying)); |
1775 | return; |
1775 | return; |
1776 | } |
1776 | } |
… | |
… | |
1805 | op->failmsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low, it must be at least %d.>", |
1805 | op->failmsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low, it must be at least %d.>", |
1806 | &tmp->skill, learn_level)); |
1806 | &tmp->skill, learn_level)); |
1807 | return; |
1807 | return; |
1808 | } |
1808 | } |
1809 | |
1809 | |
1810 | op->statusmsg (format ("The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name)); |
1810 | op->statusmsg (format ("The spellbook contains the %s level spell %s.", ordinal (spell->level), &spell->name)); |
1811 | |
1811 | |
1812 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1812 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1813 | identify (tmp); |
1813 | identify (tmp); |
1814 | |
1814 | |
1815 | /* I removed the check for special_prayer_mark here - it didn't make |
1815 | /* I removed the check for special_prayer_mark here - it didn't make |
… | |
… | |
1827 | { |
1827 | { |
1828 | spell_skill = find_skill_by_name (op, spell->skill); |
1828 | spell_skill = find_skill_by_name (op, spell->skill); |
1829 | |
1829 | |
1830 | if (!spell_skill) |
1830 | if (!spell_skill) |
1831 | { |
1831 | { |
1832 | op->failmsg (format ("You lack the skill %s to use this spell.", &spell->skill)); |
1832 | op->failmsg (format ("You lack the %s skill to use this spell.", &spell->skill)); |
1833 | return; |
1833 | return; |
1834 | } |
1834 | } |
1835 | |
1835 | |
1836 | if (spell_skill->level < spell->level) |
1836 | if (spell_skill->level < spell->level) |
1837 | { |
1837 | { |
… | |
… | |
1997 | int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */ |
1997 | int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */ |
1998 | int winners = 0; /* number of winners */ |
1998 | int winners = 0; /* number of winners */ |
1999 | int i; /* index */ |
1999 | int i; /* index */ |
2000 | |
2000 | |
2001 | /* let's make sure and doublecheck the parameters */ |
2001 | /* let's make sure and doublecheck the parameters */ |
2002 | if (meal->type != FLESH || !is_dragon_pl (op)) |
2002 | if (meal->type != FLESH || !op->is_dragon ()) |
2003 | return 0; |
2003 | return 0; |
2004 | |
2004 | |
2005 | /* now grab the 'dragon_skin'- and 'dragon_ability'-forces |
2005 | /* now grab the 'dragon_skin'- and 'dragon_ability'-forces |
2006 | from the player's inventory */ |
2006 | from the player's inventory */ |
2007 | for (tmp = op->inv; tmp; tmp = tmp->below) |
2007 | for (tmp = op->inv; tmp; tmp = tmp->below) |
… | |
… | |
2015 | which is not to be considered a dragon -> bail out */ |
2015 | which is not to be considered a dragon -> bail out */ |
2016 | if (skin == NULL || abil == NULL) |
2016 | if (skin == NULL || abil == NULL) |
2017 | return 0; |
2017 | return 0; |
2018 | |
2018 | |
2019 | /* now start by filling stomache and health, according to food-value */ |
2019 | /* now start by filling stomache and health, according to food-value */ |
2020 | if ((999 - op->stats.food) < meal->stats.food) |
2020 | if ((MAX_FOOD - op->stats.food) < meal->stats.food) |
2021 | op->stats.hp += (999 - op->stats.food) / 50; |
2021 | op->stats.hp += (MAX_FOOD - op->stats.food) / 50; |
2022 | else |
2022 | else |
2023 | op->stats.hp += meal->stats.food / 50; |
2023 | op->stats.hp += meal->stats.food / 50; |
2024 | |
2024 | |
2025 | if (op->stats.hp > op->stats.maxhp) |
2025 | min_it (op->stats.hp, op->stats.maxhp); |
2026 | op->stats.hp = op->stats.maxhp; |
|
|
2027 | |
|
|
2028 | op->stats.food = min (999, op->stats.food + meal->stats.food); |
2026 | op->stats.food = min (MAX_FOOD, op->stats.food + meal->stats.food); |
2029 | |
2027 | |
2030 | /*LOG(llevDebug, "-> player: %d, flesh: %d\n", op->level, meal->level); */ |
2028 | /*LOG(llevDebug, "-> player: %d, flesh: %d\n", op->level, meal->level); */ |
2031 | |
2029 | |
2032 | /* on to the interesting part: chances for adding resistance */ |
2030 | /* on to the interesting part: chances for adding resistance */ |
2033 | for (i = 0; i < NROFATTACKS; i++) |
2031 | for (i = 0; i < NROFATTACKS; i++) |
… | |
… | |
2145 | if (op->type != PLAYER) |
2143 | if (op->type != PLAYER) |
2146 | op->stats.hp = op->stats.maxhp; |
2144 | op->stats.hp = op->stats.maxhp; |
2147 | else |
2145 | else |
2148 | { |
2146 | { |
2149 | /* check if this is a dragon (player), eating some flesh */ |
2147 | /* check if this is a dragon (player), eating some flesh */ |
2150 | if (tmp->type == FLESH && is_dragon_pl (op) && dragon_eat_flesh (op, tmp)) |
2148 | if (tmp->type == FLESH && op->is_dragon () && dragon_eat_flesh (op, tmp)) |
2151 | ; |
2149 | ; |
2152 | else |
2150 | else |
2153 | { |
2151 | { |
2154 | /* usual case - no dragon meal: */ |
2152 | /* usual case - no dragon meal: */ |
2155 | if (op->stats.food + tmp->stats.food > 999) |
2153 | if (op->stats.food + tmp->stats.food > MAX_FOOD) |
2156 | { |
2154 | { |
2157 | if (tmp->type == FOOD || tmp->type == FLESH) |
2155 | if (tmp->type == FOOD || tmp->type == FLESH) |
2158 | op->failmsg ("You feel full, but what a waste of food!"); |
2156 | op->failmsg ("You feel full, but what a waste of food!"); |
2159 | else |
2157 | else |
2160 | op->statusmsg ("Most of the drink goes down your face not your throat!"); |
2158 | op->statusmsg ("Most of the drink goes down your face not your throat!"); |
… | |
… | |
2170 | |
2168 | |
2171 | if (!QUERY_FLAG (tmp, FLAG_CURSED)) |
2169 | if (!QUERY_FLAG (tmp, FLAG_CURSED)) |
2172 | { |
2170 | { |
2173 | const char *buf; |
2171 | const char *buf; |
2174 | |
2172 | |
2175 | if (!is_dragon_pl (op)) |
2173 | if (!op->is_dragon ()) |
2176 | { |
2174 | { |
2177 | /* eating message for normal players */ |
2175 | /* eating message for normal players */ |
2178 | if (tmp->type == DRINK) |
2176 | if (tmp->type == DRINK) |
2179 | buf = format ("Ahhh...that %s tasted good.", &tmp->name); |
2177 | buf = format ("Ahhh...that %s tasted good.", &tmp->name); |
2180 | else |
2178 | else |
… | |
… | |
2184 | /* eating message for dragon players */ |
2182 | /* eating message for dragon players */ |
2185 | buf = format ("The %s tasted terrible!", &tmp->name); |
2183 | buf = format ("The %s tasted terrible!", &tmp->name); |
2186 | |
2184 | |
2187 | op->statusmsg (buf); |
2185 | op->statusmsg (buf); |
2188 | |
2186 | |
2189 | capacity_remaining = 999 - op->stats.food; |
2187 | capacity_remaining = MAX_FOOD - op->stats.food; |
2190 | op->stats.food += tmp->stats.food; |
2188 | op->stats.food += tmp->stats.food; |
2191 | if (capacity_remaining < tmp->stats.food) |
2189 | if (capacity_remaining < tmp->stats.food) |
2192 | op->stats.hp += capacity_remaining / 50; |
2190 | op->stats.hp += capacity_remaining / 50; |
2193 | else |
2191 | else |
2194 | op->stats.hp += tmp->stats.food / 50; |
2192 | op->stats.hp += tmp->stats.food / 50; |
2195 | |
2193 | |
2196 | if (op->stats.hp > op->stats.maxhp) |
2194 | min_it (op->stats.hp, op->stats.maxhp); |
2197 | op->stats.hp = op->stats.maxhp; |
2195 | min_it (op->stats.food, MAX_FOOD); |
2198 | if (op->stats.food > 999) |
|
|
2199 | op->stats.food = 999; |
|
|
2200 | } |
2196 | } |
2201 | |
2197 | |
2202 | /* special food hack -b.t. */ |
2198 | /* special food hack -b.t. */ |
2203 | if (tmp->title || QUERY_FLAG (tmp, FLAG_CURSED)) |
2199 | if (tmp->title || QUERY_FLAG (tmp, FLAG_CURSED)) |
2204 | eat_special_food (op, tmp); |
2200 | eat_special_food (op, tmp); |
… | |
… | |
2265 | hit_player (op, poison->stats.hp, tmp, AT_POISON, 1); |
2261 | hit_player (op, poison->stats.hp, tmp, AT_POISON, 1); |
2266 | } |
2262 | } |
2267 | |
2263 | |
2268 | op->stats.food -= op->stats.food / 4; |
2264 | op->stats.food -= op->stats.food / 4; |
2269 | poison->destroy (); |
2265 | poison->destroy (); |
2270 | } |
|
|
2271 | |
|
|
2272 | /** |
|
|
2273 | * This function return true if the exit is not a 2 ways one or it is 2 ways, valid exit. |
|
|
2274 | * A valid 2 way exit means: |
|
|
2275 | * -You can come back (there is another exit at the other side) |
|
|
2276 | * -You are |
|
|
2277 | * ° the owner of the exit |
|
|
2278 | * ° or in the same party as the owner |
|
|
2279 | * |
|
|
2280 | * Note: a owner in a 2 way exit is saved as the owner's name |
|
|
2281 | * in the field exit->name cause the field exit->owner doesn't |
|
|
2282 | * survive in the swapping (in fact the whole exit doesn't survive). |
|
|
2283 | */ |
|
|
2284 | static int |
|
|
2285 | is_legal_2ways_exit (object *op, object *exit) |
|
|
2286 | { |
|
|
2287 | if (exit->stats.exp != 1) |
|
|
2288 | return 1; /*This is not a 2 way, so it is legal */ |
|
|
2289 | |
|
|
2290 | #if 0 //TODO |
|
|
2291 | if (!has_been_loaded (EXIT_PATH (exit)) && exit->race) |
|
|
2292 | return 0; /* This is a reset town portal */ |
|
|
2293 | #endif |
|
|
2294 | |
|
|
2295 | LOG (llevError | logBacktrace, "sync map load due to %s\n", exit->debug_desc ()); |
|
|
2296 | |
|
|
2297 | maptile *exitmap = maptile::find_sync (EXIT_PATH (exit), exit->map); |
|
|
2298 | |
|
|
2299 | if (exitmap) |
|
|
2300 | { |
|
|
2301 | exitmap->load_sync (); |
|
|
2302 | |
|
|
2303 | object *tmp = exitmap->at (EXIT_X (exit), EXIT_Y (exit)).bot; |
|
|
2304 | |
|
|
2305 | if (!tmp) |
|
|
2306 | return 0; |
|
|
2307 | |
|
|
2308 | for (; tmp; tmp = tmp->above) |
|
|
2309 | { |
|
|
2310 | if (tmp->type != EXIT) |
|
|
2311 | continue; /*Not an exit */ |
|
|
2312 | |
|
|
2313 | if (!EXIT_PATH (tmp)) |
|
|
2314 | continue; /*Not a valid exit */ |
|
|
2315 | |
|
|
2316 | if ((EXIT_X (tmp) != exit->x) || (EXIT_Y (tmp) != exit->y)) |
|
|
2317 | continue; /*Not in the same place */ |
|
|
2318 | |
|
|
2319 | if (exit->map->path != EXIT_PATH (tmp)) |
|
|
2320 | continue; /*Not in the same map */ |
|
|
2321 | |
|
|
2322 | /* From here we have found the exit is valid. However we do |
|
|
2323 | * here the check of the exit owner. It is important for the |
|
|
2324 | * town portals to prevent strangers from visiting your appartments |
|
|
2325 | */ |
|
|
2326 | if (!exit->race) |
|
|
2327 | return 1; /*No owner, free for all! */ |
|
|
2328 | |
|
|
2329 | object *exit_owner = 0; |
|
|
2330 | |
|
|
2331 | for_all_players (pp) |
|
|
2332 | { |
|
|
2333 | if (!pp->ob) |
|
|
2334 | continue; |
|
|
2335 | |
|
|
2336 | if (pp->ob->name != exit->race) |
|
|
2337 | continue; |
|
|
2338 | |
|
|
2339 | exit_owner = pp->ob; /*We found a player which correspond to the player name */ |
|
|
2340 | break; |
|
|
2341 | } |
|
|
2342 | |
|
|
2343 | if (!exit_owner) |
|
|
2344 | return 0; /* No more owner */ |
|
|
2345 | |
|
|
2346 | if (exit_owner->contr == op->contr) |
|
|
2347 | return 1; /*It is your exit */ |
|
|
2348 | |
|
|
2349 | if (exit_owner && /*There is a owner */ |
|
|
2350 | (op->contr) && /*A player tries to pass */ |
|
|
2351 | ((exit_owner->contr->party == NULL) || /*No pass if controller has no party */ |
|
|
2352 | (exit_owner->contr->party != op->contr->party))) /* Or not the same as op */ |
|
|
2353 | return 0; |
|
|
2354 | |
|
|
2355 | return 1; |
|
|
2356 | } |
|
|
2357 | } |
|
|
2358 | |
|
|
2359 | return 0; |
|
|
2360 | } |
2266 | } |
2361 | |
2267 | |
2362 | /** |
2268 | /** |
2363 | * This function will try to apply a lighter and in case no lighter |
2269 | * This function will try to apply a lighter and in case no lighter |
2364 | * is specified it will try to find a lighter in the players inventory, |
2270 | * is specified it will try to find a lighter in the players inventory, |
… | |
… | |
2619 | static void |
2525 | static void |
2620 | apply_item_transformer (object *pl, object *transformer) |
2526 | apply_item_transformer (object *pl, object *transformer) |
2621 | { |
2527 | { |
2622 | object *marked; |
2528 | object *marked; |
2623 | object *new_item; |
2529 | object *new_item; |
2624 | char *find; |
2530 | const char *find; |
2625 | char *separator; |
2531 | char *separator; |
2626 | int yield; |
2532 | int yield; |
2627 | char got[MAX_BUF]; |
2533 | char got[MAX_BUF]; |
2628 | int len; |
2534 | int len; |
2629 | |
2535 | |
… | |
… | |
2672 | while (*find == ' ') |
2578 | while (*find == ' ') |
2673 | find++; |
2579 | find++; |
2674 | |
2580 | |
2675 | memset (got, 0, MAX_BUF); |
2581 | memset (got, 0, MAX_BUF); |
2676 | |
2582 | |
2677 | if ((separator = strchr (find, ';')) != NULL) |
2583 | if ((separator = (char *) strchr (find, ';'))) |
2678 | len = separator - find; |
2584 | len = separator - find; |
2679 | else |
2585 | else |
2680 | len = strlen (find); |
2586 | len = strlen (find); |
2681 | |
2587 | |
2682 | if (len > MAX_BUF - 1) |
2588 | min_it (len, MAX_BUF - 1); |
2683 | len = MAX_BUF - 1; |
|
|
2684 | |
2589 | |
2685 | strcpy (got, find); |
2590 | strcpy (got, find); |
2686 | got[len] = '\0'; |
2591 | got[len] = '\0'; |
2687 | |
2592 | |
2688 | /* Now create new item, remove used ones when required. */ |
2593 | /* Now create new item, remove used ones when required. */ |
… | |
… | |
2721 | * being applied. |
2626 | * being applied. |
2722 | * |
2627 | * |
2723 | * aflag is special (always apply/unapply) flags. Nothing is done with |
2628 | * aflag is special (always apply/unapply) flags. Nothing is done with |
2724 | * them in this function - they are passed to apply_special |
2629 | * them in this function - they are passed to apply_special |
2725 | */ |
2630 | */ |
2726 | int |
2631 | static int |
2727 | manual_apply (object *who, object *op, int aflag) |
2632 | manual_apply (object *who, object *op, int aflag) |
2728 | { |
2633 | { |
2729 | op = op->head_ (); |
2634 | op = op->head_ (); |
2730 | |
2635 | |
2731 | if (QUERY_FLAG (op, FLAG_UNPAID) && !QUERY_FLAG (op, FLAG_APPLIED)) |
2636 | if (op->flag [FLAG_UNPAID] && !op->flag [FLAG_APPLIED]) |
2732 | { |
2637 | { |
2733 | if (who->type == PLAYER) |
2638 | if (who->type == PLAYER) |
2734 | { |
2639 | { |
2735 | examine (who, op); |
2640 | examine (who, op); |
2736 | //who->failmsg ("You should pay for it first! H<You cannot use items marked as unpaid.>");//TODO remove |
2641 | //who->failmsg ("You should pay for it first! H<You cannot use items marked as unpaid.>");//TODO remove |
… | |
… | |
2767 | |
2672 | |
2768 | case EXIT: |
2673 | case EXIT: |
2769 | if (who->type != PLAYER) |
2674 | if (who->type != PLAYER) |
2770 | return 0; |
2675 | return 0; |
2771 | |
2676 | |
2772 | if (!EXIT_PATH (op) || !is_legal_2ways_exit (who, op)) |
2677 | if (!EXIT_PATH (op)) |
2773 | who->failmsg (format ("The %s is closed. H<And will stay closed, until somebody fires up the map editor and adds it.>", query_name (op))); |
2678 | who->failmsg (format ("The %s is closed. H<And will stay closed, until somebody fires up the map editor and adds it.>", query_name (op))); |
2774 | else |
2679 | else |
2775 | { |
2680 | { |
2776 | /* Don't display messages for random maps. */ |
2681 | /* Don't display messages for random maps. */ |
2777 | if (op->msg && !EXIT_PATH (op).starts_with ("/!")) |
2682 | if (op->msg && EXIT_PATH (op) != shstr_random_map_exit) |
2778 | who->statusmsg (op->msg, NDI_NAVY); |
2683 | who->statusmsg (op->msg, NDI_NAVY); |
2779 | |
2684 | |
2780 | who->enter_exit (op); |
2685 | who->enter_exit (op); |
2781 | } |
2686 | } |
2782 | |
2687 | |
… | |
… | |
2863 | case CLOAK: |
2768 | case CLOAK: |
2864 | case WAND: |
2769 | case WAND: |
2865 | case ROD: |
2770 | case ROD: |
2866 | case HORN: |
2771 | case HORN: |
2867 | case SKILL: |
2772 | case SKILL: |
|
|
2773 | case SPELL: |
2868 | case BOW: |
2774 | case BOW: |
|
|
2775 | case RANGED: |
2869 | case BUILDER: |
2776 | case BUILDER: |
2870 | case SKILL_TOOL: |
2777 | case SKILL_TOOL: |
2871 | if (op->env != who) |
2778 | if (op->env != who) |
2872 | return 2; /* not in inventory */ |
2779 | who->failmsg (format ("You must get it first! H<You can only apply the %s if it is in your inventory.>\n", query_name (op))); |
2873 | |
2780 | else |
2874 | apply_special (who, op, aflag); |
2781 | apply_special (who, op, aflag); |
|
|
2782 | |
2875 | return 1; |
2783 | return 1; |
2876 | |
2784 | |
2877 | case DRINK: |
2785 | case DRINK: |
2878 | case FOOD: |
2786 | case FOOD: |
2879 | case FLESH: |
2787 | case FLESH: |
… | |
… | |
2943 | case ITEM_TRANSFORMER: |
2851 | case ITEM_TRANSFORMER: |
2944 | apply_item_transformer (who, op); |
2852 | apply_item_transformer (who, op); |
2945 | return 1; |
2853 | return 1; |
2946 | |
2854 | |
2947 | default: |
2855 | default: |
|
|
2856 | who->statusmsg (format ("I don't know how to apply the %s.", query_name (op))); |
2948 | return 0; |
2857 | return 0; |
2949 | } |
2858 | } |
2950 | } |
2859 | } |
2951 | |
2860 | |
2952 | /* quiet suppresses the "don't know how to apply" and "you must get it first" |
2861 | /* |
2953 | * messages as needed by player_apply_below(). But there can still be |
|
|
2954 | * "but you are floating high above the ground" messages. |
|
|
2955 | * |
|
|
2956 | * Same return value as apply() function. |
2862 | * Same return value as apply() function. |
2957 | */ |
2863 | */ |
2958 | int |
2864 | bool |
2959 | player_apply (object *pl, object *op, int aflag, int quiet) |
2865 | player_apply (object *pl, object *op, int aflag) |
2960 | { |
2866 | { |
2961 | if (!op->env && (pl->move_type & MOVE_FLYING)) |
2867 | if (!op->env && (pl->move_type & MOVE_FLYING)) |
2962 | { |
2868 | { |
2963 | /* player is flying and applying object not in inventory */ |
2869 | /* player is flying and applying object not in inventory */ |
2964 | if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING)) |
2870 | if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING)) |
… | |
… | |
2970 | } |
2876 | } |
2971 | } |
2877 | } |
2972 | |
2878 | |
2973 | pl->contr->last_used = op; |
2879 | pl->contr->last_used = op; |
2974 | |
2880 | |
2975 | int tmp = manual_apply (pl, op, aflag); |
2881 | return pl->apply (op, aflag); |
2976 | |
|
|
2977 | if (!quiet) |
|
|
2978 | { |
|
|
2979 | if (tmp == 0) |
|
|
2980 | pl->statusmsg (format ("I don't know how to apply the %s.", query_name (op))); |
|
|
2981 | else if (tmp == 2) |
|
|
2982 | pl->failmsg ("You must get it first!\n"); |
|
|
2983 | } |
|
|
2984 | |
|
|
2985 | return tmp; |
|
|
2986 | } |
2882 | } |
2987 | |
2883 | |
2988 | /** |
2884 | /** |
2989 | * player_apply_below attempts to apply the object 'below' the player. |
2885 | * player_apply_below attempts to apply the object 'below' the player. |
2990 | * If the player has an open container, we use that for below, otherwise |
2886 | * If the player has an open container, we use that for below, otherwise |
… | |
… | |
3001 | * we don't use a corrupt pointer for the next object, so we get the |
2897 | * we don't use a corrupt pointer for the next object, so we get the |
3002 | * next object in the stack before applying. This is can only be a |
2898 | * next object in the stack before applying. This is can only be a |
3003 | * problem if player_apply() has a bug in that it uses the object but does |
2899 | * problem if player_apply() has a bug in that it uses the object but does |
3004 | * not return a proper value. |
2900 | * not return a proper value. |
3005 | */ |
2901 | */ |
|
|
2902 | //TODO: no longer at multiple floors |
|
|
2903 | // and also not on move_on floors. what was this for, anyways? |
3006 | for (object *next, *tmp = pl->container_ () ? pl->container_ ()->inv : pl->below; tmp; tmp = next) |
2904 | for (object *next, *tmp = pl->container_ () ? pl->container_ ()->inv : pl->below; tmp; tmp = next) |
3007 | { |
2905 | { |
3008 | next = tmp->below; |
2906 | next = tmp->below; |
3009 | |
2907 | |
3010 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
2908 | if (tmp->type == SPELL_EFFECT) |
3011 | floors++; |
2909 | continue; |
3012 | else if (floors > 0) |
|
|
3013 | return; /* process only floor objects after first floor object */ |
|
|
3014 | |
2910 | |
3015 | /* If it is visible, player can apply it. If it is applied by |
2911 | /* If it is visible, player can apply it. |
3016 | * person moving on it, also activate. Added code to make it |
|
|
3017 | * so that at least one of players movement types be that which |
|
|
3018 | * the item needs. |
|
|
3019 | */ |
2912 | */ |
3020 | if (!tmp->invisible || (tmp->move_on & pl->move_type)) |
2913 | if (!tmp->invisible) |
3021 | if (player_apply (pl, tmp, 0, 1) == 1) |
2914 | if (player_apply (pl, tmp, 0)) |
3022 | return; |
2915 | break; |
3023 | |
|
|
3024 | if (floors >= 2) |
|
|
3025 | return; /* process at most two floor objects */ |
|
|
3026 | } |
2916 | } |
3027 | } |
2917 | } |
3028 | |
2918 | |
3029 | /** |
2919 | /** |
3030 | * Unapplies specified item. |
2920 | * Unapplies specified item. |
… | |
… | |
3037 | { |
2927 | { |
3038 | if (INVOKE_OBJECT (BE_UNREADY, op, ARG_OBJECT (who), ARG_INT (aflags)) |
2928 | if (INVOKE_OBJECT (BE_UNREADY, op, ARG_OBJECT (who), ARG_INT (aflags)) |
3039 | || INVOKE_OBJECT (UNREADY, who, ARG_OBJECT (op), ARG_INT (aflags))) |
2929 | || INVOKE_OBJECT (UNREADY, who, ARG_OBJECT (op), ARG_INT (aflags))) |
3040 | return RESULT_INT (0); |
2930 | return RESULT_INT (0); |
3041 | |
2931 | |
3042 | CLEAR_FLAG (op, FLAG_APPLIED); |
2932 | if (who->current_weapon == op) |
|
|
2933 | who->current_weapon = 0; |
|
|
2934 | |
|
|
2935 | op->flag [FLAG_APPLIED] = false; |
3043 | |
2936 | |
3044 | switch (op->type) |
2937 | switch (op->type) |
3045 | { |
2938 | { |
3046 | case SKILL_TOOL: |
2939 | case SKILL: |
|
|
2940 | if (player *pl = who->contr) |
|
|
2941 | if (op->invisible) |
|
|
2942 | pl->statusmsg (format ("You can no longer use the %s skill.", &op->skill)); |
|
|
2943 | else |
|
|
2944 | pl->statusmsg (format ("You stop using the %s.", query_name (op))); |
|
|
2945 | |
|
|
2946 | change_abil (who, op); |
|
|
2947 | who->flag [FLAG_READY_SKILL] = false; |
|
|
2948 | break; |
|
|
2949 | |
|
|
2950 | case WEAPON: |
|
|
2951 | who->statusmsg (format ("You unwield %s.", query_name (op))); |
|
|
2952 | change_abil (who, op); |
|
|
2953 | who->flag [FLAG_READY_WEAPON] = false; |
|
|
2954 | |
3047 | // unapplying a skill tool should also unapply the skill it governs |
2955 | // unapplying a weapon or skill tool should also unapply the skill it governs |
3048 | // but this is hard, as it shouldn't do so when the skill can |
2956 | // but this is hard, as it shouldn't do so when the skill can |
3049 | // be used for other reasons |
2957 | // be used for other reasons |
3050 | for (object *tmp = who->inv; tmp; tmp = tmp->below) |
2958 | if (who->chosen_skill) |
3051 | if (tmp->skill == op->skill |
2959 | if (!who->chosen_skill->flag [FLAG_CAN_USE_SKILL]) |
3052 | && tmp->type == SKILL |
|
|
3053 | && tmp->flag [FLAG_APPLIED] |
|
|
3054 | && !tmp->flag [FLAG_CAN_USE_SKILL]) |
|
|
3055 | unapply_special (who, tmp, 0); |
2960 | unapply_special (who, op, 0); |
3056 | |
2961 | |
3057 | change_abil (who, op); |
|
|
3058 | break; |
2962 | break; |
3059 | |
2963 | |
|
|
2964 | case BOW: |
3060 | case WEAPON: |
2965 | case WAND: |
|
|
2966 | case ROD: |
|
|
2967 | case HORN: |
|
|
2968 | case RANGED: |
3061 | if (player *pl = who->contr) |
2969 | if (player *pl = who->contr) |
3062 | if (op == pl->combat_ob) |
|
|
3063 | { |
|
|
3064 | pl->combat_ob = 0; |
|
|
3065 | who->change_weapon (pl->ranged_ob); |
|
|
3066 | } |
|
|
3067 | |
|
|
3068 | who->statusmsg (format ("You unwield %s.", query_name (op))); |
|
|
3069 | |
|
|
3070 | change_abil (who, op); |
|
|
3071 | CLEAR_FLAG (who, FLAG_READY_WEAPON); |
|
|
3072 | break; |
|
|
3073 | |
|
|
3074 | case SKILL: |
|
|
3075 | if (who->contr) |
|
|
3076 | { |
2970 | { |
3077 | if (IS_COMBAT_SKILL (op->subtype)) |
2971 | who->statusmsg (format ("You unready %s.", query_name (op))); |
3078 | who->change_weapon (who->contr->combat_ob = 0); |
2972 | change_abil (who, op); |
3079 | else if (IS_RANGED_SKILL (op->subtype)) |
2973 | } |
3080 | who->change_weapon (who->contr->ranged_ob = 0); |
2974 | else |
|
|
2975 | { |
|
|
2976 | who->change_skill (0); |
3081 | |
2977 | |
3082 | if (op->invisible) |
2978 | if (op->type == BOW) |
3083 | who->statusmsg (format ("You can no longer use the skill: %s.", &op->skill)); |
2979 | op->flag [FLAG_READY_BOW ] = false; |
3084 | else |
2980 | else |
3085 | who->statusmsg (format ("You stop using the %s.", query_name (op))); |
2981 | op->flag [FLAG_READY_RANGE] = false; |
3086 | } |
2982 | } |
3087 | |
2983 | |
3088 | change_abil (who, op); |
|
|
3089 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
|
|
3090 | break; |
2984 | break; |
3091 | |
2985 | |
3092 | case ARMOUR: |
2986 | case ARMOUR: |
3093 | case HELMET: |
2987 | case HELMET: |
3094 | case SHIELD: |
2988 | case SHIELD: |
… | |
… | |
3101 | case CLOAK: |
2995 | case CLOAK: |
3102 | who->statusmsg (format ("You unwear %s.", query_name (op))); |
2996 | who->statusmsg (format ("You unwear %s.", query_name (op))); |
3103 | change_abil (who, op); |
2997 | change_abil (who, op); |
3104 | break; |
2998 | break; |
3105 | |
2999 | |
|
|
3000 | case SPELL: |
3106 | case BOW: |
3001 | case BUILDER: |
3107 | case WAND: |
|
|
3108 | case ROD: |
|
|
3109 | case HORN: |
|
|
3110 | if (player *pl = who->contr) |
|
|
3111 | { |
|
|
3112 | if (op == pl->ranged_ob) |
|
|
3113 | { |
|
|
3114 | pl->ranged_ob = 0; |
|
|
3115 | who->change_weapon (pl->combat_ob); |
|
|
3116 | } |
|
|
3117 | |
|
|
3118 | who->statusmsg (format ("You unready %s.", query_name (op))); |
3002 | who->statusmsg (format ("You unready %s.", query_name (op))); |
3119 | } |
|
|
3120 | else |
|
|
3121 | { |
|
|
3122 | who->change_skill (0); |
|
|
3123 | |
|
|
3124 | if (op->type == BOW) |
|
|
3125 | CLEAR_FLAG (who, FLAG_READY_BOW); |
|
|
3126 | else |
|
|
3127 | CLEAR_FLAG (who, FLAG_READY_RANGE); |
|
|
3128 | } |
|
|
3129 | |
|
|
3130 | break; |
3003 | break; |
3131 | |
3004 | |
3132 | case BUILDER: |
3005 | //case SKILL_TOOL://TODO |
3133 | if (who->contr) |
|
|
3134 | who->statusmsg (format ("You unready %s.", query_name (op))); |
|
|
3135 | break; |
|
|
3136 | |
|
|
3137 | default: |
3006 | default: |
3138 | who->statusmsg (format ("You unapply %s.", query_name (op))); |
3007 | who->statusmsg (format ("You unapply %s.", query_name (op))); |
3139 | break; |
3008 | break; |
3140 | } |
3009 | } |
3141 | |
3010 | |
… | |
… | |
3165 | static object * |
3034 | static object * |
3166 | get_next_item_from_body_location (int loc, object *start) |
3035 | get_next_item_from_body_location (int loc, object *start) |
3167 | { |
3036 | { |
3168 | for (object *tmp = start; tmp; tmp = tmp->below) |
3037 | for (object *tmp = start; tmp; tmp = tmp->below) |
3169 | if (tmp->flag [FLAG_APPLIED] |
3038 | if (tmp->flag [FLAG_APPLIED] |
3170 | && tmp->slot[loc].info |
3039 | && tmp->slot [loc].info |
3171 | && (!tmp->invisible || tmp->type == SKILL)) |
3040 | && (!tmp->invisible || tmp->type == SKILL || tmp->type == SPELL)) |
3172 | return tmp; |
3041 | return tmp; |
3173 | |
3042 | |
3174 | return 0; |
3043 | return 0; |
3175 | } |
3044 | } |
3176 | |
3045 | |
… | |
… | |
3321 | continue; |
3190 | continue; |
3322 | } |
3191 | } |
3323 | |
3192 | |
3324 | object *tmp1 = get_next_item_from_body_location (i, who->inv); |
3193 | object *tmp1 = get_next_item_from_body_location (i, who->inv); |
3325 | if (!tmp1) |
3194 | if (!tmp1) |
3326 | { |
|
|
3327 | #if 0 |
|
|
3328 | /* This is sort of an error, but happens a lot when old players |
|
|
3329 | * join in with more stuff equipped than they are now allowed. |
|
|
3330 | */ |
|
|
3331 | LOG (llevError, "Can't find object using location %d on %s\n", i, who->name); |
|
|
3332 | #endif |
|
|
3333 | retval |= CAN_APPLY_NEVER; |
3195 | retval |= CAN_APPLY_NEVER; |
3334 | } |
|
|
3335 | else |
3196 | else |
3336 | { |
3197 | { |
3337 | /* need to unapply something. However, if this something |
3198 | /* need to unapply something. However, if this something |
3338 | * is different than we had found before, it means they need |
3199 | * is different than we had found before, it means they need |
3339 | * to apply multiple objects |
3200 | * to apply multiple objects |
… | |
… | |
3390 | if (op->type == BOW && !QUERY_FLAG (who, FLAG_USE_BOW)) |
3251 | if (op->type == BOW && !QUERY_FLAG (who, FLAG_USE_BOW)) |
3391 | retval |= CAN_APPLY_RESTRICTION; |
3252 | retval |= CAN_APPLY_RESTRICTION; |
3392 | } |
3253 | } |
3393 | |
3254 | |
3394 | return retval; |
3255 | return retval; |
|
|
3256 | } |
|
|
3257 | |
|
|
3258 | // saner interface, returns successful status |
|
|
3259 | bool |
|
|
3260 | object::apply (object *ob, int aflags) |
|
|
3261 | { |
|
|
3262 | if (!ob) // simplifies a lot of callers |
|
|
3263 | return true; |
|
|
3264 | |
|
|
3265 | bool want_apply = |
|
|
3266 | aflags & AP_APPLY ? true |
|
|
3267 | : aflags & AP_UNAPPLY ? false |
|
|
3268 | : !ob->flag [FLAG_APPLIED]; // AP_TOGGLE |
|
|
3269 | |
|
|
3270 | object_ptr *slot = 0; |
|
|
3271 | |
|
|
3272 | // detect the slot, if this is a player |
|
|
3273 | if (contr && !(aflags & AP_NO_SLOT)) |
|
|
3274 | { |
|
|
3275 | object *oslot; |
|
|
3276 | |
|
|
3277 | switch (ob->type) |
|
|
3278 | { |
|
|
3279 | case WEAPON: |
|
|
3280 | slot = &contr->combat_ob; |
|
|
3281 | oslot = contr->ranged_ob; |
|
|
3282 | break; |
|
|
3283 | |
|
|
3284 | case BOW: |
|
|
3285 | case RANGED: |
|
|
3286 | case SPELL: |
|
|
3287 | case WAND: |
|
|
3288 | case ROD: |
|
|
3289 | case HORN: |
|
|
3290 | case BUILDER: |
|
|
3291 | slot = &contr->ranged_ob; |
|
|
3292 | oslot = contr->combat_ob; |
|
|
3293 | break; |
|
|
3294 | |
|
|
3295 | // oh, the humanity |
|
|
3296 | case SKILL: |
|
|
3297 | if (aflags & AP_NO_SLOT) |
|
|
3298 | break; |
|
|
3299 | |
|
|
3300 | if (skill_flags [ob->subtype] & SF_NEED_ITEM) |
|
|
3301 | break; |
|
|
3302 | |
|
|
3303 | if (skill_flags [ob->subtype] & SF_COMBAT) |
|
|
3304 | { |
|
|
3305 | slot = &contr->combat_ob; |
|
|
3306 | oslot = contr->ranged_ob; |
|
|
3307 | } |
|
|
3308 | else if (skill_flags [ob->subtype] & SF_RANGED) |
|
|
3309 | { |
|
|
3310 | slot = &contr->ranged_ob; |
|
|
3311 | oslot = contr->combat_ob; |
|
|
3312 | } |
|
|
3313 | |
|
|
3314 | break; |
|
|
3315 | } |
|
|
3316 | |
|
|
3317 | // now handle slot exclusions |
|
|
3318 | if (slot) |
|
|
3319 | { |
|
|
3320 | // only one slot can be active |
|
|
3321 | if (want_apply) |
|
|
3322 | apply (oslot, AP_UNAPPLY); |
|
|
3323 | |
|
|
3324 | // clear item from slot if applied |
|
|
3325 | if (!want_apply && *slot == ob) |
|
|
3326 | { |
|
|
3327 | *slot = 0; |
|
|
3328 | |
|
|
3329 | if (current_weapon == ob) |
|
|
3330 | current_weapon = 0; |
|
|
3331 | } |
|
|
3332 | } |
|
|
3333 | } |
|
|
3334 | |
|
|
3335 | if (ob->flag [FLAG_APPLIED] != want_apply) |
|
|
3336 | manual_apply (this, ob, aflags); |
|
|
3337 | |
|
|
3338 | if (ob->flag [FLAG_APPLIED] != want_apply) |
|
|
3339 | return false; |
|
|
3340 | |
|
|
3341 | if (slot) |
|
|
3342 | current_weapon = *slot = ob; |
|
|
3343 | |
|
|
3344 | return true; |
3395 | } |
3345 | } |
3396 | |
3346 | |
3397 | /** |
3347 | /** |
3398 | * who is the object using the object. It can be a monster. |
3348 | * who is the object using the object. It can be a monster. |
3399 | * op is the object they are using. op is an equipment type item, |
3349 | * op is the object they are using. op is an equipment type item, |
… | |
… | |
3422 | " H<You lack enough unused item power to use this weapon, see the skills command.>" |
3372 | " H<You lack enough unused item power to use this weapon, see the skills command.>" |
3423 | |
3373 | |
3424 | int |
3374 | int |
3425 | apply_special (object *who, object *op, int aflags) |
3375 | apply_special (object *who, object *op, int aflags) |
3426 | { |
3376 | { |
3427 | int basic_flag = aflags & AP_BASIC_FLAGS; |
3377 | int basic_flag = aflags & AP_MODE; |
3428 | object *tmp, *tmp2, *skop = NULL; |
3378 | object *tmp, *tmp2, *skop = NULL; |
3429 | |
3379 | |
3430 | if (who == NULL) |
3380 | if (who == NULL) |
3431 | { |
3381 | { |
3432 | LOG (llevError, "apply_special() from object without environment.\n"); |
3382 | LOG (llevError, "apply_special() from object without environment.\n"); |
… | |
… | |
3451 | |
3401 | |
3452 | return unapply_special (who, op, aflags); |
3402 | return unapply_special (who, op, aflags); |
3453 | } |
3403 | } |
3454 | else if (basic_flag == AP_UNAPPLY) |
3404 | else if (basic_flag == AP_UNAPPLY) |
3455 | return 0; |
3405 | return 0; |
3456 | |
|
|
3457 | // if the item is combat/ranged, wield the relevant slot first |
|
|
3458 | // to resolve conflicts. |
|
|
3459 | if (player *pl = who->contr) |
|
|
3460 | switch (op->slottype ()) |
|
|
3461 | { |
|
|
3462 | case slot_combat: who->change_weapon (pl->combat_ob); break; |
|
|
3463 | case slot_ranged: who->change_weapon (pl->ranged_ob); break; |
|
|
3464 | } |
|
|
3465 | |
3406 | |
3466 | splay (op); |
3407 | splay (op); |
3467 | |
3408 | |
3468 | /* Can't just apply this object. Lets see what not and what to do */ |
3409 | /* Can't just apply this object. Lets see what not and what to do */ |
3469 | if (int i = can_apply_object (who, op)) |
3410 | if (int i = can_apply_object (who, op)) |
… | |
… | |
3503 | } |
3444 | } |
3504 | } |
3445 | } |
3505 | |
3446 | |
3506 | if (op->skill && op->type != SKILL && op->type != SKILL_TOOL) |
3447 | if (op->skill && op->type != SKILL && op->type != SKILL_TOOL) |
3507 | { |
3448 | { |
|
|
3449 | // try to ready attached skill first |
3508 | skop = find_skill_by_name (who, op->skill); |
3450 | skop = find_skill_by_name (who, op->skill); |
3509 | |
3451 | |
3510 | if (!skop) |
3452 | if (!skop) |
3511 | { |
3453 | { |
3512 | who->failmsg (format ("You need the %s skill to use this item!", &op->skill)); |
3454 | who->failmsg (format ("You need the %s skill to use this item!", &op->skill)); |
3513 | return 1; |
3455 | return 1; |
3514 | } |
3456 | } |
3515 | else |
3457 | else if (!who->apply (skop, AP_APPLY | AP_NO_SLOT)) |
3516 | /* While experience will be credited properly, we want to change the |
|
|
3517 | * skill so that the dam and wc get updated |
|
|
3518 | */ |
3458 | { |
3519 | who->change_skill (skop); |
3459 | who->failmsg (format ("You can't use the required %s skill!", &op->skill)); |
|
|
3460 | return 1; |
|
|
3461 | } |
3520 | } |
3462 | } |
3521 | |
3463 | |
3522 | if (!check_item_power (who, op->item_power)) |
3464 | if (!check_item_power (who, op->item_power)) |
3523 | { |
3465 | { |
3524 | who->failmsg ("Equipping that combined with other items would consume your soul!" LACK_ITEM_POWER); |
3466 | who->failmsg ("Equipping that combined with other items would consume your soul!" LACK_ITEM_POWER); |
… | |
… | |
3527 | |
3469 | |
3528 | /* Ok. We are now at the state where we can apply the new object. |
3470 | /* Ok. We are now at the state where we can apply the new object. |
3529 | * Note that we don't have the checks for can_use_... |
3471 | * Note that we don't have the checks for can_use_... |
3530 | * below - that is already taken care of by can_apply_object. |
3472 | * below - that is already taken care of by can_apply_object. |
3531 | */ |
3473 | */ |
|
|
3474 | |
|
|
3475 | // split away all the other items from the stack, so only one item is left |
3532 | tmp = op->nrof > 1 ? op->split (op->nrof - 1) : 0; |
3476 | tmp = op->nrof > 1 ? op->split (op->nrof - 1) : 0; |
3533 | |
3477 | |
3534 | if (INVOKE_OBJECT (BE_READY, op, ARG_OBJECT (who)) || INVOKE_OBJECT (READY, who, ARG_OBJECT (op))) |
3478 | if (INVOKE_OBJECT (BE_READY, op, ARG_OBJECT (who)) || INVOKE_OBJECT (READY, who, ARG_OBJECT (op))) |
3535 | return RESULT_INT (0); |
3479 | return RESULT_INT (0); |
3536 | |
3480 | |
3537 | switch (op->type) |
3481 | switch (op->type) |
3538 | { |
3482 | { |
3539 | case WEAPON: |
3483 | case WEAPON: |
3540 | //TODO: this obviously fails for players using a shorter prefix |
3484 | if (op->level && (!op->name.starts_with (who->name) || op->name [who->name.length ()] != '\'')) |
3541 | // i.e. "R" can use Ragnarok's sword. |
|
|
3542 | if (op->level && !op->name.starts_with (who->name)) |
|
|
3543 | { |
3485 | { |
3544 | /* if the weapon does not have the name as the character, can't use it. */ |
3486 | /* if the weapon does not have the name as the character, can't use it. */ |
3545 | /* (Ragnarok's sword attempted to be used by Foo: won't work) */ |
3487 | /* (Ragnarok's sword attempted to be used by Foo: won't work) */ |
3546 | who->failmsg ("The weapon does not recognize you as its owner. H<Its name indicates that it belongs to somebody else.>"); |
3488 | who->failmsg ("The weapon does not recognize you as its owner. " |
3547 | |
3489 | "H<Its name indicates that it belongs to somebody else.>"); |
3548 | if (tmp) |
3490 | if (tmp) who->insert (tmp); |
3549 | insert_ob_in_ob (tmp, who); |
|
|
3550 | |
|
|
3551 | return 1; |
3491 | return 1; |
3552 | } |
3492 | } |
3553 | |
3493 | |
3554 | if (!skop) |
3494 | op->flag [FLAG_APPLIED] = true; |
|
|
3495 | |
|
|
3496 | if (player *pl = who->contr) |
3555 | { |
3497 | { |
3556 | who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO |
3498 | who->statusmsg (format ("You wield %s.", query_name (op))); |
3557 | return 1; |
3499 | change_abil (who, op); |
3558 | } |
3500 | } |
3559 | |
3501 | else |
3560 | SET_FLAG (op, FLAG_APPLIED); |
|
|
3561 | who->change_skill (skop); |
3502 | who->change_skill (skop); |
3562 | |
3503 | |
3563 | if (who->contr) |
3504 | op->flag [FLAG_READY_WEAPON] = true; |
3564 | who->change_weapon (who->contr->combat_ob = op); |
|
|
3565 | |
|
|
3566 | who->statusmsg (format ("You wield %s.", query_name (op))); |
|
|
3567 | |
|
|
3568 | SET_FLAG (who, FLAG_READY_WEAPON); |
|
|
3569 | change_abil (who, op); |
|
|
3570 | break; |
3505 | break; |
3571 | |
3506 | |
3572 | case ARMOUR: |
3507 | case ARMOUR: |
3573 | case HELMET: |
3508 | case HELMET: |
3574 | case SHIELD: |
3509 | case SHIELD: |
… | |
… | |
3583 | who->statusmsg (format ("You wear %s.", query_name (op))); |
3518 | who->statusmsg (format ("You wear %s.", query_name (op))); |
3584 | change_abil (who, op); |
3519 | change_abil (who, op); |
3585 | break; |
3520 | break; |
3586 | |
3521 | |
3587 | case SKILL_TOOL: |
3522 | case SKILL_TOOL: |
3588 | // applying a skill tool also readies the skill |
3523 | // applying a skill tool does not ready the skill |
|
|
3524 | // if something needs the skill, it has to ready it itself |
|
|
3525 | //TODO: unapplying should unapply the skill, though |
3589 | SET_FLAG (op, FLAG_APPLIED); |
3526 | SET_FLAG (op, FLAG_APPLIED); |
|
|
3527 | break; |
3590 | |
3528 | |
|
|
3529 | case SKILL: |
3591 | if (!(aflags & AP_NO_READY)) |
3530 | if (!(aflags & AP_NO_SLOT)) |
3592 | { |
3531 | { |
3593 | skop = find_skill_by_name (who, op->skill); |
3532 | // skill is used on it's own, as opposed to being a chosen_skill |
3594 | if (!skop->flag [FLAG_APPLIED]) |
|
|
3595 | apply_special (who, skop, AP_APPLY); |
|
|
3596 | } |
|
|
3597 | break; |
|
|
3598 | |
3533 | |
3599 | case SKILL: |
3534 | if (skill_flags [op->subtype] & (SF_NEED_ITEM | SF_MANA)) |
3600 | if (player *pl = who->contr) |
|
|
3601 | { |
|
|
3602 | if (IS_COMBAT_SKILL (op->subtype)) |
|
|
3603 | { |
3535 | { |
3604 | if (skill_flags [op->subtype] & SF_NEED_WEAPON) |
|
|
3605 | { |
|
|
3606 | for (object *item = who->inv; item; item = item->below) |
|
|
3607 | if (item->type == WEAPON && item->flag [FLAG_APPLIED]) |
|
|
3608 | { |
|
|
3609 | if (item->skill == op->skill) |
|
|
3610 | { |
|
|
3611 | who->change_weapon (pl->combat_ob = item); |
|
|
3612 | goto found_weapon; |
|
|
3613 | } |
|
|
3614 | } |
|
|
3615 | |
|
|
3616 | who->failmsg (format ( |
3536 | who->failmsg (format ( |
3617 | "You need to apply a '%s' melee weapon before readying this skill. " |
3537 | "You feel as if you wanted to do something funny, but you can't remember what. " |
3618 | "H<Some skills need an item, in this case a melee weapon, to function.>", |
3538 | "H<The %s skill needs something else to function, for example a tool, weapon, rod, or spell. " |
3619 | &op->skill |
3539 | "It cannot be used on its own.>", |
3620 | )); |
|
|
3621 | return 1; |
|
|
3622 | |
|
|
3623 | found_weapon:; |
|
|
3624 | } |
|
|
3625 | else |
|
|
3626 | who->change_weapon (pl->combat_ob = op); |
|
|
3627 | } |
|
|
3628 | else if (IS_RANGED_SKILL (op->subtype)) |
|
|
3629 | { |
|
|
3630 | if (skill_flags [op->subtype] & SF_NEED_BOW) |
|
|
3631 | { |
|
|
3632 | for (object *item = who->inv; item; item = item->below) |
|
|
3633 | if (item->type == BOW && item->flag [FLAG_APPLIED]) |
|
|
3634 | { |
|
|
3635 | //TODO: bows should/must all have skill missile weapon right now |
|
|
3636 | who->change_weapon (pl->ranged_ob = item); |
|
|
3637 | goto found_bow; |
|
|
3638 | } |
|
|
3639 | |
|
|
3640 | who->failmsg ( |
|
|
3641 | "You need to apply a missile weapon before readying this skill. " |
|
|
3642 | "H<Some skills need an item, in this case a missile weapon, to function.>" |
|
|
3643 | ); |
|
|
3644 | return 1; |
|
|
3645 | |
|
|
3646 | found_bow:; |
|
|
3647 | } |
|
|
3648 | else |
|
|
3649 | who->change_weapon (pl->ranged_ob = op); |
|
|
3650 | } |
|
|
3651 | |
|
|
3652 | if (!op->invisible) |
|
|
3653 | { |
|
|
3654 | who->statusmsg (format ( |
|
|
3655 | "You ready %s." |
|
|
3656 | "You can now use the skill: %s.", |
|
|
3657 | query_name (op), |
|
|
3658 | &op->skill |
3540 | &op->skill |
3659 | )); |
3541 | )); |
|
|
3542 | if (tmp) who->insert (tmp); |
|
|
3543 | return 1; |
3660 | } |
3544 | } |
|
|
3545 | |
|
|
3546 | if (skill_flags [op->subtype] & SF_AUTARK |
|
|
3547 | || !(skill_flags [op->subtype] & (SF_COMBAT | SF_RANGED))) |
|
|
3548 | { |
|
|
3549 | if (skill_flags [op->subtype] & SF_USE) |
|
|
3550 | who->failmsg (format ( |
|
|
3551 | "You feel as if you wanted to do something funny, but you can't remember what. " |
|
|
3552 | "H<The %s skill cannot be readied, instead, try C<use_skill %s>.>", |
|
|
3553 | &op->skill, &op->skill |
|
|
3554 | )); |
3661 | else |
3555 | else |
3662 | who->statusmsg (format ("Readied skill: %s.", op->skill ? &op->skill : &op->name)); |
3556 | who->failmsg (format ( |
|
|
3557 | "You feel as if you wanted to do something funny, but you can't remember what. " |
|
|
3558 | "H<The %s skill cannot be readied or used, it is always active.>", |
|
|
3559 | &op->skill |
|
|
3560 | )); |
|
|
3561 | |
|
|
3562 | if (tmp) who->insert (tmp); |
|
|
3563 | |
|
|
3564 | return 1; |
|
|
3565 | } |
|
|
3566 | |
|
|
3567 | if (who->contr) |
|
|
3568 | who->statusmsg (format ( |
|
|
3569 | op->invisible ? "You can now use the %s skill." : "You ready %s.", |
|
|
3570 | query_name (op), |
|
|
3571 | &op->skill |
|
|
3572 | )); |
3663 | } |
3573 | } |
3664 | else |
3574 | |
3665 | { |
|
|
3666 | SET_FLAG (op, FLAG_APPLIED); |
|
|
3667 | change_abil (who, op); |
|
|
3668 | who->chosen_skill = op; |
|
|
3669 | SET_FLAG (who, FLAG_READY_SKILL); |
3575 | SET_FLAG (who, FLAG_READY_SKILL); |
3670 | } |
3576 | SET_FLAG (op, FLAG_APPLIED); |
3671 | |
3577 | change_abil (who, op); |
3672 | break; |
3578 | break; |
3673 | |
3579 | |
3674 | case BOW: |
3580 | case BOW: |
3675 | if (op->level && !op->name.starts_with (who->name)) |
3581 | if (op->level && (!op->name.starts_with (who->name) || op->name [who->name.length ()] != '\'')) |
3676 | { |
3582 | { |
3677 | who->failmsg ("The weapon does not recognize you as its owner. " |
3583 | who->failmsg ("The weapon does not recognize you as its owner. " |
3678 | "H<Its name indicates that it belongs to somebody else.>"); |
3584 | "H<Its name indicates that it belongs to somebody else.>"); |
3679 | if (tmp) |
3585 | if (tmp) who->insert (tmp); |
3680 | insert_ob_in_ob (tmp, who); |
|
|
3681 | |
|
|
3682 | return 1; |
3586 | return 1; |
3683 | } |
3587 | } |
|
|
3588 | |
|
|
3589 | if (player *pl = who->contr) |
|
|
3590 | { |
|
|
3591 | op->flag [FLAG_APPLIED] = true; |
|
|
3592 | who->statusmsg (format ("You wield the %s.", query_name (op))); |
|
|
3593 | change_abil (who, op); |
|
|
3594 | } |
|
|
3595 | break; |
|
|
3596 | |
|
|
3597 | case RANGED: |
|
|
3598 | if (player *pl = who->contr) |
|
|
3599 | { |
|
|
3600 | op->flag [FLAG_APPLIED] = true; |
|
|
3601 | who->statusmsg (format ("You applied the %s.", query_name (op))); |
|
|
3602 | } |
|
|
3603 | break; |
|
|
3604 | |
|
|
3605 | case SPELL: |
|
|
3606 | if (player *pl = who->contr) |
|
|
3607 | { |
|
|
3608 | op->flag [FLAG_APPLIED] = true; |
|
|
3609 | who->statusmsg (format ("You ready the spell %s.", query_name (op))); |
|
|
3610 | } |
|
|
3611 | break; |
3684 | |
3612 | |
3685 | /*FALLTHROUGH*/ |
3613 | /*FALLTHROUGH*/ |
3686 | case WAND: |
3614 | case WAND: |
3687 | case ROD: |
3615 | case ROD: |
3688 | case HORN: |
3616 | case HORN: |
3689 | /* check for skill, alter player status */ |
3617 | /* check for skill, alter player status */ |
3690 | |
3618 | |
3691 | if (!skop) |
3619 | if (!skop) |
3692 | { |
3620 | { |
3693 | who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO |
3621 | who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO |
|
|
3622 | if (tmp) who->insert (tmp); |
3694 | return 1; |
3623 | return 1; |
3695 | } |
3624 | } |
3696 | |
3625 | |
3697 | SET_FLAG (op, FLAG_APPLIED); |
3626 | op->flag [FLAG_APPLIED] = true; |
3698 | who->change_skill (skop); |
|
|
3699 | |
3627 | |
3700 | if (who->contr) |
3628 | if (player *pl = who->contr) |
3701 | { |
3629 | { |
3702 | who->contr->ranged_ob = op; |
|
|
3703 | |
|
|
3704 | who->statusmsg (format ("You ready %s.", query_name (op))); |
3630 | who->statusmsg (format ("You ready %s.", query_name (op))); |
3705 | |
3631 | |
3706 | if (op->type == BOW) |
3632 | if (op->type == BOW) |
3707 | { |
|
|
3708 | who->current_weapon = op; |
|
|
3709 | change_abil (who, op); |
|
|
3710 | who->statusmsg (format ("You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op))); |
3633 | who->statusmsg (format ("You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op))); |
3711 | } |
3634 | |
|
|
3635 | change_abil (who, op); |
3712 | } |
3636 | } |
3713 | else |
3637 | else |
3714 | { |
3638 | { |
|
|
3639 | who->change_skill (skop); |
|
|
3640 | |
3715 | if (op->type == BOW) |
3641 | if (op->type == BOW) |
3716 | SET_FLAG (who, FLAG_READY_BOW); |
3642 | op->flag [FLAG_READY_BOW ] = true; |
3717 | else |
3643 | else |
3718 | SET_FLAG (who, FLAG_READY_RANGE); |
3644 | op->flag [FLAG_READY_RANGE] = true; |
3719 | } |
3645 | } |
3720 | |
3646 | |
3721 | break; |
3647 | break; |
3722 | |
3648 | |
3723 | case BUILDER: |
3649 | case BUILDER: |
3724 | if (who->type == PLAYER) |
3650 | if (player *pl = who->contr) |
3725 | { |
3651 | { |
3726 | //TODO: wtf does this do? shouldn't this be managed automatically (slots?) |
|
|
3727 | if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER) |
|
|
3728 | unapply_special (who, who->contr->ranged_ob, 0); |
|
|
3729 | |
|
|
3730 | who->statusmsg (format ("You ready your %s.", query_name (op))); |
3652 | who->statusmsg (format ("You ready your %s.", query_name (op))); |
3731 | |
3653 | //TODO: change_abil? |
3732 | who->contr->ranged_ob = op; |
|
|
3733 | } |
3654 | } |
3734 | break; |
3655 | break; |
3735 | |
3656 | |
3736 | default: |
3657 | default: |
3737 | who->statusmsg (format ("You apply %s.", query_name (op))); |
3658 | who->statusmsg (format ("You apply %s.", query_name (op))); |
3738 | } |
3659 | } |
3739 | |
3660 | |
3740 | SET_FLAG (op, FLAG_APPLIED); |
3661 | SET_FLAG (op, FLAG_APPLIED); |
3741 | |
3662 | |
3742 | if (tmp) |
|
|
3743 | who->insert (tmp); |
3663 | if (tmp) who->insert (tmp); |
3744 | |
3664 | |
3745 | who->update_stats (); |
3665 | who->update_stats (); |
3746 | |
3666 | |
3747 | /* We exclude spell casting objects. The fire code will set the |
3667 | /* We exclude spell casting objects. The fire code will set the |
3748 | * been applied flag when they are used - until that point, |
3668 | * been applied flag when they are used - until that point, |
… | |
… | |
3879 | * treasure again for this object |
3799 | * treasure again for this object |
3880 | */ |
3800 | */ |
3881 | invtmp->randomitems = NULL; |
3801 | invtmp->randomitems = NULL; |
3882 | } |
3802 | } |
3883 | } |
3803 | } |
|
|
3804 | |
3884 | /* This is really temporary - the code at the bottom will |
3805 | /* This is really temporary - the code at the bottom will |
3885 | * also set randomitems to null. The problem is there are bunches |
3806 | * also set randomitems to null. The problem is there are bunches |
3886 | * of maps/players already out there with items that have spells |
3807 | * of maps/players already out there with items that have spells |
3887 | * which haven't had the randomitems set to null yet. |
3808 | * which haven't had the randomitems set to null yet. |
3888 | * MSW 2004-05-13 |
3809 | * MSW 2004-05-13 |
… | |
… | |
3892 | * Ryo 2004-08-16 |
3813 | * Ryo 2004-08-16 |
3893 | */ |
3814 | */ |
3894 | if (tmp->type == WAND || tmp->type == ROD || tmp->type == SCROLL |
3815 | if (tmp->type == WAND || tmp->type == ROD || tmp->type == SCROLL |
3895 | || tmp->type == HORN || tmp->type == FIREWALL || tmp->type == POTION || tmp->type == ALTAR || tmp->type == SPELLBOOK) |
3816 | || tmp->type == HORN || tmp->type == FIREWALL || tmp->type == POTION || tmp->type == ALTAR || tmp->type == SPELLBOOK) |
3896 | tmp->randomitems = NULL; |
3817 | tmp->randomitems = NULL; |
3897 | |
|
|
3898 | } |
3818 | } |
3899 | |
3819 | |
3900 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
3820 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
3901 | auto_apply (tmp); |
3821 | auto_apply (tmp); |
3902 | else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && tmp->has_random_items ()) |
3822 | else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && tmp->has_random_items ()) |
… | |
… | |
3959 | /* bigger morsel of food = longer effect time */ |
3879 | /* bigger morsel of food = longer effect time */ |
3960 | int duration = TIME2TICK (food->stats.food); |
3880 | int duration = TIME2TICK (food->stats.food); |
3961 | |
3881 | |
3962 | if (force = who->force_find (key)) |
3882 | if (force = who->force_find (key)) |
3963 | { |
3883 | { |
3964 | if (duration > abs (force->speed_left / force->speed)) |
3884 | if (duration > fabs (force->speed_left / force->speed)) |
3965 | { |
3885 | { |
3966 | new_draw_info_format (NDI_UNIQUE, 0, who, "More magical force spreads through you. H<The effect will last for about %.10g more seconds.>", TICK2TIME (duration)); |
3886 | new_draw_info_format (NDI_UNIQUE, 0, who, "More magical force spreads through you. H<The effect will last for about %.10g more seconds.>", TICK2TIME (duration)); |
3967 | force->force_set_timer (duration); |
3887 | force->force_set_timer (duration); |
3968 | } |
3888 | } |
3969 | else |
3889 | else |