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

Comparing deliantra/server/server/monster.C (file contents):
Revision 1.74 by root, Fri Nov 6 13:03:34 2009 UTC vs.
Revision 1.75 by root, Sat Nov 7 18:30:06 2009 UTC

1130 } 1130 }
1131 else if (wand->type == ROD || wand->type == HORN) 1131 else if (wand->type == ROD || wand->type == HORN)
1132 { 1132 {
1133 /* Found rod/horn, let's use it if possible */ 1133 /* Found rod/horn, let's use it if possible */
1134 at_least_one = 1; 1134 at_least_one = 1;
1135 if (wand->stats.hp < MAX (wand->inv->stats.sp, wand->inv->stats.grace)) 1135 if (wand->stats.hp < max (wand->inv->stats.sp, wand->inv->stats.grace))
1136 continue; 1136 continue;
1137 1137
1138 /* drain charge before casting spell - can be a case where the 1138 /* drain charge before casting spell - can be a case where the
1139 * spell destroys the monster, and rod, so if done after, results 1139 * spell destroys the monster, and rod, so if done after, results
1140 * in crash. 1140 * in crash.
1292 * 1292 *
1293 * Cast to sint32 before comparing to maxhp since otherwise an (sint16) 1293 * Cast to sint32 before comparing to maxhp since otherwise an (sint16)
1294 * overflow might produce monsters with negative hp. 1294 * overflow might produce monsters with negative hp.
1295 */ 1295 */
1296 1296
1297 op->last_heal += (int) ((float) (8 * op->stats.Con) / FABS (op->speed)); 1297 op->last_heal += (int) ((float) (8 * op->stats.Con) / fabs (op->speed));
1298 op->stats.hp = MIN ((sint32) op->stats.hp + op->last_heal / 32, op->stats.maxhp); /* causes Con/4 hp/tick */ 1298 op->stats.hp = min ((sint32) op->stats.hp + op->last_heal / 32, op->stats.maxhp); /* causes Con/4 hp/tick */
1299 op->last_heal %= 32; 1299 op->last_heal %= 32;
1300 1300
1301 /* So if the monster has gained enough HP that they are no longer afraid */ 1301 /* So if the monster has gained enough HP that they are no longer afraid */
1302 if (QUERY_FLAG (op, FLAG_RUN_AWAY) && op->stats.hp >= (signed short)(((float)op->run_away / 100.f) * (float)op->stats.maxhp)) 1302 if (QUERY_FLAG (op, FLAG_RUN_AWAY) && op->stats.hp >= (signed short)(((float)op->run_away / 100.f) * (float)op->stats.maxhp))
1303 CLEAR_FLAG (op, FLAG_RUN_AWAY); 1303 CLEAR_FLAG (op, FLAG_RUN_AWAY);
1316 * 1316 *
1317 * Cast to sint32 before comparing to maxhp since otherwise an (sint16) 1317 * Cast to sint32 before comparing to maxhp since otherwise an (sint16)
1318 * overflow might produce monsters with negative sp. 1318 * overflow might produce monsters with negative sp.
1319 */ 1319 */
1320 1320
1321 op->last_sp += (int) ((float) (8 * op->stats.Pow) / fabsf (op->speed)); 1321 op->last_sp += (int) ((float) (8 * op->stats.Pow) / fabs (op->speed));
1322 op->stats.sp = min (op->stats.sp + op->last_sp / 128, op->stats.maxsp); /* causes Pow/16 sp/tick */ 1322 op->stats.sp = min (op->stats.sp + op->last_sp / 128, op->stats.maxsp); /* causes Pow/16 sp/tick */
1323 op->last_sp %= 128; 1323 op->last_sp %= 128;
1324 } 1324 }
1325 1325
1326 /* this should probably get modified by many more values. 1326 /* this should probably get modified by many more values.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines