… | |
… | |
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) / 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)) |
… | |
… | |
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) / fabs (op->speed)); |
1321 | op->last_sp += (int) ((float) (8 * op->stats.Pow) / 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. |