ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/egoitem.C
(Generate patch)

Comparing deliantra/server/server/egoitem.C (file contents):
Revision 1.16 by root, Fri Mar 26 01:04:45 2010 UTC vs.
Revision 1.17 by root, Tue Jun 22 14:43:45 2010 UTC

36 36
37*/ 37*/
38int 38int
39apply_power_crystal (object *op, object *crystal) 39apply_power_crystal (object *op, object *crystal)
40{ 40{
41 int available_power; 41 int available_power = op->stats.sp - op->stats.maxsp;
42 int power_space; 42 int power_space = crystal->stats.maxsp - crystal->stats.sp;
43 int power_grab; 43 int power_grab;
44 44
45 available_power = op->stats.sp - op->stats.maxsp;
46 power_space = crystal->stats.maxsp - crystal->stats.sp;
47 power_grab = 0;
48
49 if (available_power >= 0 && power_space > 0) 45 if (available_power >= 0 && power_space > 0)
46 {
50 power_grab = min (power_space, 0.5 * op->stats.sp); 47 power_grab = min (power_space, 0.5 * op->stats.sp);
51 48 op->statusmsg (format ("The %s takes some of your mana.", query_name (crystal)));
49 }
52 if (available_power < 0 && crystal->stats.sp > 0) 50 else if (available_power < 0 && crystal->stats.sp > 0)
51 {
53 power_grab = -min (-available_power, crystal->stats.sp); 52 power_grab = -min (-available_power, crystal->stats.sp);
53 op->statusmsg (format ("Mana from the %s is entering your body.", query_name (crystal)));
54 }
55 else
56 {
57 power_grab = 0;
58 op->statusmsg (format ("You touch the %s, but nothing happens.", query_name (crystal)));
59 }
54 60
55 op->stats.sp -= power_grab; 61 op->stats.sp -= power_grab;
56 crystal->stats.sp += power_grab; 62 crystal->stats.sp += power_grab;
57 crystal->set_speed ((float) crystal->stats.sp / (float) crystal->stats.maxsp); 63 crystal->set_speed ((float) crystal->stats.sp / (float) crystal->stats.maxsp);
58 64

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines