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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.211 by root, Fri Nov 6 13:31:47 2009 UTC vs.
Revision 1.212 by root, Sat Nov 7 18:30:05 2009 UTC

204 op->update_stats (); 204 op->update_stats ();
205 tmp->decrease (); 205 tmp->decrease ();
206 return 1; 206 return 1;
207 } 207 }
208 208
209 if (!(at = archetype::find (ARCH_DEPLETION))) 209 if (!(at = archetype::find (shstr_depletion)))
210 { 210 {
211 LOG (llevError, "Could not find archetype depletion\n"); 211 LOG (llevError, "Could not find archetype depletion\n");
212 return 0; 212 return 0;
213 } 213 }
214 214
231 } 231 }
232 232
233 /* improvement potion - only for players */ 233 /* improvement potion - only for players */
234 if (op->type == PLAYER && (tmp->attacktype & AT_GODPOWER)) 234 if (op->type == PLAYER && (tmp->attacktype & AT_GODPOWER))
235 { 235 {
236 for (i = 1; i < MIN (11, op->level); i++) 236 for (i = 1; i < min (11, op->level); i++)
237 { 237 {
238 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) 238 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))
239 { 239 {
240 if (op->contr->levhp[i] != 1) 240 if (op->contr->levhp[i] != 1)
241 { 241 {
276 } 276 }
277 } 277 }
278 } 278 }
279 279
280 /* Just makes checking easier */ 280 /* Just makes checking easier */
281 if (i < MIN (11, op->level)) 281 if (i < min (11, op->level))
282 got_one = 1; 282 got_one = 1;
283 283
284 if (!QUERY_FLAG (tmp, FLAG_CURSED) && !QUERY_FLAG (tmp, FLAG_DAMNED)) 284 if (!QUERY_FLAG (tmp, FLAG_CURSED) && !QUERY_FLAG (tmp, FLAG_DAMNED))
285 { 285 {
286 if (got_one) 286 if (got_one)
1353 trap->stats.maxsp = 2; 1353 trap->stats.maxsp = 2;
1354 1354
1355 /* Is this correct? From the docs, it doesn't look like it 1355 /* Is this correct? From the docs, it doesn't look like it
1356 * should be divided by trap->speed 1356 * should be divided by trap->speed
1357 */ 1357 */
1358 victim->speed_left = -FABS (trap->stats.maxsp * victim->speed / trap->speed); 1358 victim->speed_left = -fabs (trap->stats.maxsp * victim->speed / trap->speed);
1359 1359
1360 /* Just put in some sanity check. I think there is a bug in the 1360 /* Just put in some sanity check. I think there is a bug in the
1361 * above with some objects have zero speed, and thus the player 1361 * above with some objects have zero speed, and thus the player
1362 * getting permanently paralyzed. 1362 * getting permanently paralyzed.
1363 */ 1363 */
1404 * trigger this here and get hit by own missile - and will be own enemy. 1404 * trigger this here and get hit by own missile - and will be own enemy.
1405 * Victim then is his own enemy and will start to kill herself (this is 1405 * Victim then is his own enemy and will start to kill herself (this is
1406 * removed) but we have not synced victim and his missile. To avoid senseless 1406 * removed) but we have not synced victim and his missile. To avoid senseless
1407 * action, we avoid hits here 1407 * action, we avoid hits here
1408 */ 1408 */
1409 if ((QUERY_FLAG (victim, FLAG_ALIVE) && trap->speed) && trap->owner != victim) 1409 if ((QUERY_FLAG (victim, FLAG_ALIVE) && trap->has_active_speed ())
1410 && trap->owner != victim)
1410 hit_with_arrow (trap, victim); 1411 hit_with_arrow (trap, victim);
1411 break; 1412 break;
1412 1413
1413 case SPELL_EFFECT: 1414 case SPELL_EFFECT:
1414 apply_spell_effect (trap, victim); 1415 apply_spell_effect (trap, victim);
1852 * literacy rate very useful! -b.t. 1853 * literacy rate very useful! -b.t.
1853 */ 1854 */
1854 if (QUERY_FLAG (op, FLAG_CONFUSED)) 1855 if (QUERY_FLAG (op, FLAG_CONFUSED))
1855 { 1856 {
1856 op->failmsg ("In your confused state you flub the wording of the text!"); 1857 op->failmsg ("In your confused state you flub the wording of the text!");
1857 scroll_failure (op, 0 - random_roll (0, spell->level, op, PREFER_LOW), MAX (spell->stats.sp, spell->stats.grace)); 1858 scroll_failure (op, 0 - random_roll (0, spell->level, op, PREFER_LOW), max (spell->stats.sp, spell->stats.grace));
1858 } 1859 }
1859 else if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || 1860 else if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) ||
1860 (random_roll (0, 100, op, PREFER_LOW) - (5 * skop->level)) < learn_spell[spell->stats.grace ? op->stats.Wis : op->stats.Int]) 1861 (random_roll (0, 100, op, PREFER_LOW) - (5 * skop->level)) < learn_spell[spell->stats.grace ? op->stats.Wis : op->stats.Int])
1861 { 1862 {
1862 op->statusmsg ("You succeed in learning the spell!", NDI_GREEN); 1863 op->statusmsg ("You succeed in learning the spell!", NDI_GREEN);
2022 op->stats.hp += meal->stats.food / 50; 2023 op->stats.hp += meal->stats.food / 50;
2023 2024
2024 if (op->stats.hp > op->stats.maxhp) 2025 if (op->stats.hp > op->stats.maxhp)
2025 op->stats.hp = op->stats.maxhp; 2026 op->stats.hp = op->stats.maxhp;
2026 2027
2027 op->stats.food = MIN (999, op->stats.food + meal->stats.food); 2028 op->stats.food = min (999, op->stats.food + meal->stats.food);
2028 2029
2029 /*LOG(llevDebug, "-> player: %d, flesh: %d\n", op->level, meal->level); */ 2030 /*LOG(llevDebug, "-> player: %d, flesh: %d\n", op->level, meal->level); */
2030 2031
2031 /* on to the interesting part: chances for adding resistance */ 2032 /* on to the interesting part: chances for adding resistance */
2032 for (i = 0; i < NROFATTACKS; i++) 2033 for (i = 0; i < NROFATTACKS; i++)
2042 2043
2043 /* monster bonus increases with level, because high-level 2044 /* monster bonus increases with level, because high-level
2044 flesh is too rare */ 2045 flesh is too rare */
2045 mbonus = op->level * 20. / ((double) settings.max_level); 2046 mbonus = op->level * 20. / ((double) settings.max_level);
2046 2047
2047 chance = (((double) MIN (op->level + bonus, meal->level + bonus + mbonus)) * 100. / 2048 chance = (((double)min (op->level + bonus, meal->level + bonus + mbonus)) * 100. /
2048 ((double) settings.max_level)) - skin->resist[i]; 2049 ((double)settings.max_level)) - skin->resist[i];
2049 2050
2050 if (chance >= 0.) 2051 if (chance >= 0.)
2051 chance += 1.; 2052 chance += 1.;
2052 else 2053 else
2053 chance = (chance < -12) ? 0. : 1. / pow (2., -chance); 2054 chance = (chance < -12) ? 0. : 1. / pow (2., -chance);
2054 2055
2055 /* chance is proportional to amount of resistance (max. 50) */ 2056 /* chance is proportional to amount of resistance (max. 50) */
2056 chance *= ((double) (MIN (meal->resist[i], 50))) / 50.; 2057 chance *= ((double)(min (meal->resist[i], 50))) / 50.;
2057 2058
2058 /* doubled chance for resistance of ability-focus */ 2059 /* doubled chance for resistance of ability-focus */
2059 if (i == abil->stats.exp) 2060 if (i == abil->stats.exp)
2060 chance = MIN (100., chance * 2.); 2061 chance = min (100., chance * 2.);
2061 2062
2062 /* now make the throw and save all winners (Don't insert luck bonus here!) */ 2063 /* now make the throw and save all winners (Don't insert luck bonus here!) */
2063 if (rndm (10000) < (unsigned int) (chance * 100)) 2064 if (rndm (10000) < (unsigned int)(chance * 100))
2064 { 2065 {
2065 atnr_winner[winners] = i; 2066 atnr_winner[winners] = i;
2066 winners++; 2067 winners++;
2067 } 2068 }
2068 2069

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines