… | |
… | |
1535 | */ |
1535 | */ |
1536 | int |
1536 | int |
1537 | fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy) |
1537 | fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy) |
1538 | { |
1538 | { |
1539 | object *left, *bow; |
1539 | object *left, *bow; |
1540 | int bowspeed, mflags; |
1540 | int mflags; |
1541 | maptile *m; |
1541 | maptile *m; |
1542 | |
1542 | |
1543 | if (!dir) |
1543 | if (!dir) |
1544 | { |
1544 | { |
1545 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1545 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
… | |
… | |
1580 | { |
1580 | { |
1581 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is broken.", &bow->name); |
1581 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is broken.", &bow->name); |
1582 | return 0; |
1582 | return 0; |
1583 | } |
1583 | } |
1584 | |
1584 | |
1585 | bowspeed = bow->stats.sp + dex_bonus[op->stats.Dex]; |
|
|
1586 | |
|
|
1587 | /* penalize ROF for bestarrow */ |
|
|
1588 | if (op->type == PLAYER && op->contr->bowtype == bow_bestarrow) |
|
|
1589 | bowspeed -= dex_bonus[op->stats.Dex] + 5; |
|
|
1590 | |
|
|
1591 | if (bowspeed < 1) |
|
|
1592 | bowspeed = 1; |
|
|
1593 | |
|
|
1594 | if (arrow == NULL) |
1585 | if (arrow == NULL) |
1595 | { |
1586 | { |
1596 | if ((arrow = find_arrow (op, bow->race)) == NULL) |
1587 | if ((arrow = find_arrow (op, bow->race)) == NULL) |
1597 | { |
1588 | { |
1598 | if (op->type == PLAYER) |
1589 | if (op->type == PLAYER) |
… | |
… | |
1641 | if (arrow->slaying) |
1632 | if (arrow->slaying) |
1642 | arrow->spellarg = strdup (arrow->slaying); |
1633 | arrow->spellarg = strdup (arrow->slaying); |
1643 | |
1634 | |
1644 | if (player *pl = op->contr) |
1635 | if (player *pl = op->contr) |
1645 | { |
1636 | { |
1646 | if (!pl->has_hit) |
|
|
1647 | { |
|
|
1648 | op->speed_left -= op->speed; |
|
|
1649 | pl->has_hit = 1; |
1637 | pl->has_hit = 1; |
1650 | } |
1638 | #if 0 |
|
|
1639 | float speed = pl->weapon_sp; |
1651 | |
1640 | |
1652 | op->speed_left += 0.01f - abs (op->speed) * 100.f / bowspeed; |
1641 | /* penalize ROF for bestarrow */ |
1653 | op->update_stats (); |
1642 | if (pl->bowtype == bow_bestarrow) |
|
|
1643 | speed *= .9f; |
|
|
1644 | else |
|
|
1645 | speed *= 1.f + dex_bonus[op->stats.Dex] * .2f; |
|
|
1646 | |
|
|
1647 | op->speed_left += speed - op->speed; |
|
|
1648 | #endif |
1654 | } |
1649 | } |
1655 | |
1650 | |
1656 | SET_ANIMATION (arrow, arrow->direction); |
1651 | SET_ANIMATION (arrow, arrow->direction); |
1657 | |
1652 | |
1658 | /* update the speed */ |
1653 | /* update the speed */ |
… | |
… | |
2172 | * that party_number -1 is no party, so attacks can still happen. |
2167 | * that party_number -1 is no party, so attacks can still happen. |
2173 | */ |
2168 | */ |
2174 | else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) && |
2169 | else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) && |
2175 | ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party))) |
2170 | ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party))) |
2176 | { |
2171 | { |
2177 | /* If the player hasn't hit something this tick, and does |
|
|
2178 | * so, give them speed boost based on weapon speed. Doing |
|
|
2179 | * it here is better than process_players2, which basically |
|
|
2180 | * incurred a 1 tick offset. |
|
|
2181 | */ |
|
|
2182 | if (!op->contr->has_hit) |
2172 | op->contr->has_hit = 1; |
2183 | { |
|
|
2184 | op->speed_left += op->contr->weapon_sp - op->speed; |
|
|
2185 | op->contr->has_hit = 1; /* The last action was to hit, so use weapon_sp */ |
|
|
2186 | } |
|
|
2187 | |
2173 | |
2188 | skill_attack (mon, op, 0, 0, 0); |
2174 | skill_attack (mon, op, 0, 0, 0); |
2189 | |
2175 | |
2190 | /* If attacking another player, that player gets automatic |
2176 | /* If attacking another player, that player gets automatic |
2191 | * hitback, and doesn't loose luck either. |
2177 | * hitback, and doesn't loose luck either. |
… | |
… | |
2268 | handle_newcs_player (object *op) |
2254 | handle_newcs_player (object *op) |
2269 | { |
2255 | { |
2270 | if (QUERY_FLAG (op, FLAG_SCARED)) |
2256 | if (QUERY_FLAG (op, FLAG_SCARED)) |
2271 | { |
2257 | { |
2272 | flee_player (op); |
2258 | flee_player (op); |
|
|
2259 | |
2273 | /* If player is still scared, that is his action for this tick */ |
2260 | /* If player is still scared, that is his action for this tick */ |
2274 | if (QUERY_FLAG (op, FLAG_SCARED)) |
2261 | if (op->flag [FLAG_SCARED]) |
2275 | { |
2262 | { |
2276 | op->speed_left--; |
2263 | --op->speed_left; |
2277 | return 0; |
2264 | return 0; |
2278 | } |
2265 | } |
2279 | } |
2266 | } |
2280 | |
2267 | |
2281 | /* call this here - we also will call this in do_ericserver, but |
2268 | /* call this here - we also will call this in do_ericserver, but |
… | |
… | |
2288 | if (op->speed_left > 0) |
2275 | if (op->speed_left > 0) |
2289 | { |
2276 | { |
2290 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2277 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2291 | { |
2278 | { |
2292 | /* All move commands take 1 tick, at least for now */ |
2279 | /* All move commands take 1 tick, at least for now */ |
2293 | op->speed_left--; |
2280 | --op->speed_left; |
2294 | |
2281 | |
2295 | /* Instead of all the stuff below, let move_player take care |
2282 | /* Instead of all the stuff below, let move_player take care |
2296 | * of it. Also, some of the skill stuff is only put in |
2283 | * of it. Also, some of the skill stuff is only put in |
2297 | * there, as well as the confusion stuff. |
2284 | * there, as well as the confusion stuff. |
2298 | */ |
2285 | */ |