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,2009 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 (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 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. |
… | |
… | |
136 | esrv_send_inventory (ob, ob); |
136 | esrv_send_inventory (ob, ob); |
137 | esrv_add_spells (this, 0); |
137 | esrv_add_spells (this, 0); |
138 | |
138 | |
139 | ob->flag [FLAG_READY_WEAPON] = false; |
139 | ob->flag [FLAG_READY_WEAPON] = false; |
140 | ob->flag [FLAG_READY_SKILL] = false; |
140 | ob->flag [FLAG_READY_SKILL] = false; |
|
|
141 | ob->flag [FLAG_READY_RANGE] = false; |
141 | ob->flag [FLAG_READY_BOW] = false; |
142 | ob->flag [FLAG_READY_BOW] = false; |
142 | |
143 | |
143 | for (object *op = ob->inv; op; op = op->below) |
144 | for (object *op = ob->inv; op; op = op->below) |
144 | if (op->flag [FLAG_APPLIED]) |
145 | if (op->flag [FLAG_APPLIED]) |
145 | switch (op->type) |
146 | switch (op->type) |
… | |
… | |
838 | dir = absdir (4 + rv.direction); |
839 | dir = absdir (4 + rv.direction); |
839 | for (diff = 0; diff < 3; diff++) |
840 | for (diff = 0; diff < 3; diff++) |
840 | { |
841 | { |
841 | int m = 1 - rndm (2) * 2; |
842 | int m = 1 - rndm (2) * 2; |
842 | |
843 | |
843 | if (move_ob (op, absdir (dir + diff * m), op) || (diff == 0 && move_ob (op, absdir (dir - diff * m), op))) |
844 | if (op->move (absdir (dir + diff * m)) || (diff == 0 && op->move (absdir (dir - diff * m)))) |
844 | return; |
845 | return; |
845 | } |
846 | } |
846 | |
847 | |
847 | /* Cornered, get rid of scared */ |
848 | /* Cornered, get rid of scared */ |
848 | CLEAR_FLAG (op, FLAG_SCARED); |
849 | CLEAR_FLAG (op, FLAG_SCARED); |
… | |
… | |
858 | { |
859 | { |
859 | object *tmp, *next; |
860 | object *tmp, *next; |
860 | int stop = 0; |
861 | int stop = 0; |
861 | int wvratio; |
862 | int wvratio; |
862 | |
863 | |
863 | /* if you're flying, you cna't pick up anything */ |
864 | /* if you're flying, you can't pick up anything */ |
864 | if (op->move_type & MOVE_FLYING) |
865 | if (op->move_type & MOVE_FLYING) |
865 | return 1; |
866 | return 1; |
866 | |
867 | |
867 | next = op->below; |
868 | next = op->below; |
868 | |
869 | |
… | |
… | |
1692 | |
1693 | |
1693 | case SKILL: |
1694 | case SKILL: |
1694 | do_skill (op, op, ob, dir, 0); |
1695 | do_skill (op, op, ob, dir, 0); |
1695 | break; |
1696 | break; |
1696 | |
1697 | |
|
|
1698 | case SKILL_TOOL: |
|
|
1699 | // change_weapon ensures that chosen_skill is uptodate |
|
|
1700 | do_skill (op, op, op->chosen_skill, dir, 0); |
|
|
1701 | break; |
|
|
1702 | |
1697 | default: |
1703 | default: |
1698 | fire_misc_object (op, dir); |
1704 | fire_misc_object (op, dir); |
1699 | break; |
1705 | break; |
1700 | } |
1706 | } |
1701 | |
1707 | |
… | |
… | |
1856 | * going to try and move (not fire weapons). |
1862 | * going to try and move (not fire weapons). |
1857 | */ |
1863 | */ |
1858 | bool |
1864 | bool |
1859 | move_player_attack (object *op, int dir) |
1865 | move_player_attack (object *op, int dir) |
1860 | { |
1866 | { |
1861 | if (!op->contr->braced && op->speed_left > 0.f && move_ob (op, dir, op)) |
1867 | if (!op->contr->braced && op->speed_left > 0.f && op->move (dir)) |
1862 | { |
1868 | { |
1863 | --op->speed_left; |
1869 | --op->speed_left; |
1864 | return true; |
1870 | return true; |
1865 | } |
1871 | } |
1866 | |
1872 | |
… | |
… | |
3231 | */ |
3237 | */ |
3232 | void |
3238 | void |
3233 | player_unready_range_ob (player *pl, object *ob) |
3239 | player_unready_range_ob (player *pl, object *ob) |
3234 | { |
3240 | { |
3235 | if (pl->ob->current_weapon == ob) |
3241 | if (pl->ob->current_weapon == ob) |
3236 | pl->ob->current_weapon = 0; |
3242 | pl->ob->change_weapon (0); |
3237 | |
3243 | |
3238 | if (pl->combat_ob == ob) |
3244 | if (pl->combat_ob == ob) |
3239 | pl->combat_ob = 0; |
3245 | pl->combat_ob = 0; |
3240 | |
3246 | |
3241 | if (pl->ranged_ob == ob) |
3247 | if (pl->ranged_ob == ob) |