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 (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 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 |
… | |
… | |
262 | /* Rather than having a whole bunch of if (flag) new_draw.. else new_draw, |
262 | /* Rather than having a whole bunch of if (flag) new_draw.. else new_draw, |
263 | * make this macro to clean those up. Not usuable outside change_abil |
263 | * make this macro to clean those up. Not usuable outside change_abil |
264 | * function since some of the values passed to new_draw_info are hardcoded. |
264 | * function since some of the values passed to new_draw_info are hardcoded. |
265 | */ |
265 | */ |
266 | #define DIFF_MSG(flag, msg1, msg2) \ |
266 | #define DIFF_MSG(flag, msg1, msg2) \ |
267 | new_draw_info(NDI_UNIQUE, 0, op, (flag>0)?msg1:msg2); |
267 | new_draw_info (NDI_UNIQUE, 0, op, (flag > 0) ? msg1 : msg2); |
268 | |
268 | |
269 | /* return 1 if we sucessfully changed a stat, 0 if nothing was changed. */ |
269 | /* return 1 if we sucessfully changed a stat, 0 if nothing was changed. */ |
270 | |
270 | |
271 | /* flag is set to 1 if we are applying the object, -1 if we are removing |
271 | /* flag is set to 1 if we are applying the object, -1 if we are removing |
272 | * the object. |
272 | * the object. |
… | |
… | |
415 | (op->move_type & MOVE_FLY_LOW ? "You fly lower in the air" : "You float down to the ground.")); |
415 | (op->move_type & MOVE_FLY_LOW ? "You fly lower in the air" : "You float down to the ground.")); |
416 | } |
416 | } |
417 | |
417 | |
418 | if (tmp->move_type & MOVE_SWIM) |
418 | if (tmp->move_type & MOVE_SWIM) |
419 | DIFF_MSG (flag, "You feel ready for a swim", "You no longer feel like swimming"); |
419 | DIFF_MSG (flag, "You feel ready for a swim", "You no longer feel like swimming"); |
420 | |
|
|
421 | /* Changing move status may mean you are affected by things you weren't before */ |
|
|
422 | check_move_on (op, op); |
|
|
423 | } |
420 | } |
424 | |
421 | |
425 | /* becoming UNDEAD... a special treatment for this flag. Only those not |
422 | /* becoming UNDEAD... a special treatment for this flag. Only those not |
426 | * originally undead may change their status |
423 | * originally undead may change their status |
427 | */ |
424 | */ |
… | |
… | |
764 | int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS]; |
761 | int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS]; |
765 | object *grace_obj = NULL, *mana_obj = NULL, *tmp; |
762 | object *grace_obj = NULL, *mana_obj = NULL, *tmp; |
766 | float old_speed = speed; |
763 | float old_speed = speed; |
767 | int stat_sum [NUM_STATS]; |
764 | int stat_sum [NUM_STATS]; |
768 | |
765 | |
|
|
766 | MoveType move_type; // we use change_move_type to change it, so use a local copy |
|
|
767 | |
769 | /* First task is to clear all the values back to their original values */ |
768 | /* First task is to clear all the values back to their original values */ |
770 | if (type == PLAYER) |
769 | if (type == PLAYER) |
771 | { |
770 | { |
772 | contr->delayed_update = false; |
771 | contr->delayed_update = false; |
773 | |
772 | |
… | |
… | |
1400 | */ |
1399 | */ |
1401 | if (move_type == 0) |
1400 | if (move_type == 0) |
1402 | move_type = MOVE_WALK; |
1401 | move_type = MOVE_WALK; |
1403 | else if (move_type & (MOVE_FLY_LOW | MOVE_FLY_HIGH)) |
1402 | else if (move_type & (MOVE_FLY_LOW | MOVE_FLY_HIGH)) |
1404 | move_type &= ~MOVE_WALK; |
1403 | move_type &= ~MOVE_WALK; |
|
|
1404 | |
|
|
1405 | // now apply the new move_type |
|
|
1406 | if (this->move_type != move_type) |
|
|
1407 | change_move_type (move_type); |
1405 | |
1408 | |
1406 | /* It is quite possible that a player's spell costing might have changed, |
1409 | /* It is quite possible that a player's spell costing might have changed, |
1407 | * so we will check that now. |
1410 | * so we will check that now. |
1408 | */ |
1411 | */ |
1409 | if (is_player ()) |
1412 | if (is_player ()) |