• R/O
  • SSH
  • HTTPS

jsporkhack: コミット


コミットメタ情報

リビジョン40 (tree)
日時2009-11-07 20:41:35
作者dplusplus

ログメッセージ

本家#480
Change covetous monster behavior -- when pursuing you, follow in slightly random

shorter jumps, no more than about 6-7 squares. This allows the player to possib
ly
teleport himself or the enemy away from him, and removes the "constantly underfo
ot"
feature -- as well as allowing the player to occasionally use a ranged weapon or

two.

Does not affect flee-to-stairs or healing behavior; and if player doesn't use so
me sort
of 'fast movement' feature, will also likely not allow player to escape.

Will clear other monsters out of the way. (mnearto() flag set TRUE).

変更サマリ

差分

--- JSporkHack/trunk/src/wizard.c (revision 39)
+++ JSporkHack/trunk/src/wizard.c (revision 40)
@@ -350,71 +350,109 @@
350350
351351 switch (strat) {
352352 case STRAT_HEAL: /* hide and recover */
353- /* if wounded, hole up on or near the stairs (to block them) */
354- /* unless, of course, there are no stairs (e.g. endlevel) */
355- mtmp->mavenge = 1; /* covetous monsters attack while fleeing */
356- if (In_W_tower(mtmp->mx, mtmp->my, &u.uz) ||
357- (mtmp->iswiz && !xupstair && !mon_has_amulet(mtmp))) {
358- if (!rn2(3 + mtmp->mhp/10)) (void) rloc(mtmp, FALSE);
359- } else if (xupstair &&
360- (mtmp->mx != xupstair || mtmp->my != yupstair)) {
361- (void) mnearto(mtmp, xupstair, yupstair, TRUE);
362- }
363- /* if you're not around, cast healing spells */
364- if (distu(mtmp->mx,mtmp->my) > 64)
365- if(mtmp->mhp <= mtmp->mhpmax - 8) {
366- mtmp->mhp += rnd(8);
367- return(1);
368- }
369- /* fall through :-) */
353+ /* if wounded, hole up on or near the stairs (to block them) */
354+ /* unless, of course, there are no stairs (e.g. endlevel) */
355+ mtmp->mavenge = 1; /* covetous monsters attack while fleeing */
356+ if (In_W_tower(mtmp->mx, mtmp->my, &u.uz) ||
357+ (mtmp->iswiz && !xupstair && !mon_has_amulet(mtmp))) {
358+ if (!rn2(3 + mtmp->mhp/10)) (void) rloc(mtmp, FALSE);
359+ } else if (xupstair &&
360+ (mtmp->mx != xupstair || mtmp->my != yupstair)) {
361+ (void) mnearto(mtmp, xupstair, yupstair, TRUE);
362+ }
363+ /* if you're not around, cast healing spells */
364+ if (distu(mtmp->mx,mtmp->my) > 64)
365+ if(mtmp->mhp <= mtmp->mhpmax - 8) {
366+ mtmp->mhp += rnd(8);
367+ return(1);
368+ }
369+ /* fall through :-) */
370370
371371 case STRAT_NONE: /* harrass */
372- if (!rn2(!mtmp->mflee ? 5 : 33)) mnexto(mtmp);
373- return(0);
372+ {
373+ xchar tx = STRAT_GOALX(strat),
374+ ty = STRAT_GOALY(strat),
375+ dx = 0,
376+ dy = 0,
377+ stx = tx,
378+ sty = ty;
374379
380+ /* If we're close enough, pounce */
381+ if (distu(mtmp->mx, mtmp->my) <= 7) {
382+ mnexto(mtmp);
383+ } else {
384+ /* figure out what direction the player's in */
385+ dx = sgn(u.ux - mtmp->mx);
386+ dy = sgn(u.uy - mtmp->my);
387+
388+ /* since we're not close enough -- use short jumps to change that */
389+ stx = mtmp->mx + ((rn2(3) + 4)*dx);
390+ sty = mtmp->my + ((rn2(3) + 3)*dy);
391+ mnearto(mtmp,stx,sty,TRUE);
392+ }
393+
394+ return(0);
395+ }
396+
375397 default: /* kill, maim, pillage! */
376398 {
377- long where = (strat & STRAT_STRATMASK);
378- xchar tx = STRAT_GOALX(strat),
379- ty = STRAT_GOALY(strat);
380- int targ = strat & STRAT_GOAL;
381- struct obj *otmp;
399+ long where = (strat & STRAT_STRATMASK);
400+ xchar tx = STRAT_GOALX(strat),
401+ ty = STRAT_GOALY(strat),
402+ dx = 0,
403+ dy = 0,
404+ stx = tx,
405+ sty = ty;
406+ int targ = strat & STRAT_GOAL;
407+ struct obj *otmp;
382408
383- if(!targ) { /* simply wants you to close */
384- return(0);
385- }
386- if((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
387- /* player is standing on it (or has it) */
388- mnexto(mtmp);
389- return(0);
390- }
391- if(where == STRAT_GROUND) {
392- if(!MON_AT(tx, ty) || (mtmp->mx == tx && mtmp->my == ty)) {
393- /* teleport to it and pick it up */
394- rloc_to(mtmp, tx, ty); /* clean old pos */
409+ if(!targ) { /* simply wants you to close */
410+ return(0);
411+ }
395412
396- if ((otmp = on_ground(which_arti(targ))) != 0) {
397- if (cansee(mtmp->mx, mtmp->my))
398-/*JP
399- pline("%s picks up %s.",
400-*/
401- pline("%sは%sを拾った.",
402- Monnam(mtmp),
403- (distu(mtmp->mx, mtmp->my) <= 5) ?
404- doname(otmp) : distant_name(otmp, doname));
405- obj_extract_self(otmp);
406- (void) mpickobj(mtmp, otmp);
407- return(1);
408- } else return(0);
409- } else {
410- /* a monster is standing on it - cause some trouble */
411- if (!rn2(5)) mnexto(mtmp);
412- return(0);
413- }
414- } else { /* a monster has it - 'port beside it. */
415- (void) mnearto(mtmp, tx, ty, FALSE);
416- return(0);
417- }
413+
414+ /* player is standing on it (or has it) */
415+ if ((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
416+ /* If we're close enough, pounce */
417+ if (distu(mtmp->mx, mtmp->my) <= 7) {
418+ mnexto(mtmp);
419+ } else {
420+ /* figure out what direction the player's in */
421+ dx = sgn(u.ux - mtmp->mx);
422+ dy = sgn(u.uy - mtmp->my);
423+
424+ /* since we're not close enough -- use short jumps to change that */
425+ stx = mtmp->mx + ((rn2(3) + 4)*dx);
426+ sty = mtmp->my + ((rn2(3) + 3)*dy);
427+ mnearto(mtmp,stx,sty,TRUE);
428+ }
429+ return(0);
430+ }
431+
432+ if(where == STRAT_GROUND) {
433+ if(!MON_AT(tx, ty) || (mtmp->mx == tx && mtmp->my == ty)) {
434+ /* teleport to it and pick it up */
435+ rloc_to(mtmp, tx, ty); /* clean old pos */
436+
437+ if ((otmp = on_ground(which_arti(targ))) != 0) {
438+ if (cansee(mtmp->mx, mtmp->my))
439+ pline("%sは%sを拾った.",
440+ Monnam(mtmp),
441+ (distu(mtmp->mx, mtmp->my) <= 5) ?
442+ doname(otmp) : distant_name(otmp, doname));
443+ obj_extract_self(otmp);
444+ (void) mpickobj(mtmp, otmp);
445+ return(1);
446+ } else return(0);
447+ } else {
448+ /* a monster is standing on it - cause some trouble */
449+ if (!rn2(5)) mnexto(mtmp);
450+ return(0);
451+ }
452+ } else { /* a monster has it - 'port beside it. */
453+ (void) mnearto(mtmp, tx, ty, FALSE);
454+ return(0);
455+ }
418456 }
419457 }
420458 /*NOTREACHED*/
旧リポジトリブラウザで表示