… | |
… | |
1550 | { |
1550 | { |
1551 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1551 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1552 | return 0; |
1552 | return 0; |
1553 | } |
1553 | } |
1554 | |
1554 | |
1555 | if (player *pl = op->contr) |
1555 | if (op->contr) |
1556 | { |
1556 | bow = op->current_weapon; |
1557 | bow = pl->ranged_ob; |
|
|
1558 | if (!op->change_weapon (bow)) |
|
|
1559 | return 0; |
|
|
1560 | } |
|
|
1561 | else |
1557 | else |
1562 | { |
1558 | { |
1563 | for (bow = op->inv; bow; bow = bow->below) |
1559 | for (bow = op->inv; bow; bow = bow->below) |
1564 | /* Don't check for applied - monsters don't apply bows - in that way, they |
1560 | /* Don't check for applied - monsters don't apply bows - in that way, they |
1565 | * don't need to switch back and forth between bows and weapons. |
1561 | * don't need to switch back and forth between bows and weapons. |
… | |
… | |
1853 | object *ob = pl->ranged_ob; |
1849 | object *ob = pl->ranged_ob; |
1854 | |
1850 | |
1855 | if (!ob) |
1851 | if (!ob) |
1856 | return; |
1852 | return; |
1857 | |
1853 | |
|
|
1854 | if (!op->change_weapon (ob)) |
|
|
1855 | return; |
|
|
1856 | |
1858 | switch (ob->type) |
1857 | switch (ob->type) |
1859 | { |
1858 | { |
1860 | case BOW: |
1859 | case BOW: |
1861 | player_fire_bow (op, dir); |
1860 | player_fire_bow (op, dir); |
1862 | break; |
1861 | break; |
… | |
… | |
1868 | case BUILDER: |
1867 | case BUILDER: |
1869 | apply_map_builder (op, dir); |
1868 | apply_map_builder (op, dir); |
1870 | break; |
1869 | break; |
1871 | |
1870 | |
1872 | case SKILL: |
1871 | case SKILL: |
1873 | case SKILL_TOOL: |
|
|
1874 | do_skill (op, op, ob, dir, 0); |
1872 | do_skill (op, op, ob, dir, 0); |
1875 | break; |
1873 | break; |
1876 | |
1874 | |
1877 | default: |
1875 | default: |
1878 | fire_misc_object (op, dir); |
1876 | fire_misc_object (op, dir); |
… | |
… | |
2106 | |
2104 | |
2107 | /* If the creature is a pet, push it even if the player is not |
2105 | /* If the creature is a pet, push it even if the player is not |
2108 | * peaceful. Our assumption is the creature is a pet if the |
2106 | * peaceful. Our assumption is the creature is a pet if the |
2109 | * player owns it and it is either friendly or unagressive. |
2107 | * player owns it and it is either friendly or unagressive. |
2110 | */ |
2108 | */ |
2111 | if ((op->type == PLAYER) |
2109 | if (op->type == PLAYER |
2112 | #if COZY_SERVER |
|
|
2113 | && |
|
|
2114 | ((mon->owner && mon->owner->contr |
2110 | && ((mon->owner && mon->owner->contr |
2115 | && same_party (mon->owner->contr->party, op->contr->party)) || mon->owner == op) |
2111 | && same_party (mon->owner->contr->party, op->contr->party)) |
2116 | #else |
|
|
2117 | && mon->owner == op |
2112 | || mon->owner == op) |
2118 | #endif |
|
|
2119 | && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) |
2113 | && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) |
2120 | { |
2114 | { |
2121 | /* If we're braced, we don't want to switch places with it */ |
2115 | /* If we're braced, we don't want to switch places with it */ |
2122 | if (op->contr->braced) |
2116 | if (op->contr->braced) |
2123 | return; |
2117 | return; |
… | |
… | |
2133 | /* in certain circumstances, you shouldn't attack friendly |
2127 | /* in certain circumstances, you shouldn't attack friendly |
2134 | * creatures. Note that if you are braced, you can't push |
2128 | * creatures. Note that if you are braced, you can't push |
2135 | * someone, but put it inside this loop so that you won't |
2129 | * someone, but put it inside this loop so that you won't |
2136 | * attack them either. |
2130 | * attack them either. |
2137 | */ |
2131 | */ |
2138 | if ((mon->type == PLAYER || mon->enemy != op) && |
2132 | if ((mon->type == PLAYER || mon->enemy != op) |
2139 | (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) && ( |
2133 | && (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) |
2140 | #ifdef PROHIBIT_PLAYERKILL |
|
|
2141 | (op->contr->peaceful |
2134 | && ((op->contr->peaceful |
2142 | || (mon->type == PLAYER |
2135 | || (mon->type == PLAYER && mon->contr->peaceful)) |
2143 | && mon->contr-> |
|
|
2144 | peaceful)) && |
|
|
2145 | #else |
|
|
2146 | op->contr->peaceful && |
|
|
2147 | #endif |
|
|
2148 | !on_battleground)) |
2136 | && !on_battleground)) |
2149 | { |
2137 | { |
2150 | if (!op->contr->braced) |
2138 | if (!op->contr->braced) |
2151 | { |
2139 | { |
2152 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2140 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2153 | push_ob (mon, dir, op); |
2141 | push_ob (mon, dir, op); |
… | |
… | |
2576 | } |
2564 | } |
2577 | |
2565 | |
2578 | /* Digestion */ |
2566 | /* Digestion */ |
2579 | if (--op->last_eat < 0) |
2567 | if (--op->last_eat < 0) |
2580 | { |
2568 | { |
2581 | #ifdef COZY_SERVER |
|
|
2582 | int dg = op->contr->digestion >= 0 && op->contr->digestion < 2 ? 2 : op->contr->digestion; |
|
|
2583 | int bonus = dg > 0 ? dg : 0, penalty = dg < 0 ? -dg : 0; |
|
|
2584 | #else |
|
|
2585 | int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; |
2569 | int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; |
2586 | #endif |
|
|
2587 | |
2570 | |
2588 | if (op->contr->gen_hp > 0) |
2571 | if (op->contr->gen_hp > 0) |
2589 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2572 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2590 | else |
2573 | else |
2591 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |
2574 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |