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

Comparing deliantra/server/server/spell_util.C (file contents):
Revision 1.128 by root, Wed Nov 16 23:42:03 2016 UTC vs.
Revision 1.130 by root, Sat Sep 16 22:17:43 2017 UTC

362} 362}
363 363
364/* Returns true if it is ok to put spell *op on the space/may provided. 364/* Returns true if it is ok to put spell *op on the space/may provided.
365 * immune_stop is basically the attacktype of the spell (why 365 * immune_stop is basically the attacktype of the spell (why
366 * passed as a different value, not sure of). If immune_stop 366 * passed as a different value, not sure of). If immune_stop
367 * has the AT_MAGIC bit set, and there is a counterwall 367 * has the AT_MAGIC bit set, and there is a counterwall
368 * on the space, the object doesn't get placed. if immune stop 368 * on the space, the object doesn't get placed. if immune stop
369 * does not have AT_MAGIC, then counterwalls do not effect the spell. 369 * does not have AT_MAGIC, then counterwalls do not effect the spell.
370 */ 370 */
371int 371int
372ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop) 372ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop)
544 tmp = op; 544 tmp = op;
545 } 545 }
546 else 546 else
547 { 547 {
548 maptile *m = op->map; 548 maptile *m = op->map;
549 sint16 x = op->x + freearr_x[dir]; 549 sint16 x = op->x + DIRX (dir);
550 sint16 y = op->y + freearr_y[dir]; 550 sint16 y = op->y + DIRY (dir);
551 551
552 tmp = xy_normalise (m, x, y) 552 tmp = xy_normalise (m, x, y)
553 ? m->at (x, y).player () 553 ? m->at (x, y).player ()
554 : 0; 554 : 0;
555 } 555 }
586 if (exclude && exclude->type) 586 if (exclude && exclude->type)
587 owner_type = exclude->type; 587 owner_type = exclude->type;
588 588
589 for (i = rndm (1, 8); i < max; i++) 589 for (i = rndm (1, 8); i < max; i++)
590 { 590 {
591 nx = x + freearr_x[i]; 591 nx = x + DIRX (i);
592 ny = y + freearr_y[i]; 592 ny = y + DIRY (i);
593 mp = m; 593 mp = m;
594 mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny); 594 mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny);
595 if (mflags & (P_OUT_OF_MAP | P_BLOCKSVIEW)) 595 if (mflags & (P_OUT_OF_MAP | P_BLOCKSVIEW))
596 continue; 596 continue;
597 597
623 623
624 if ((at = archetype::find (monstername)) == NULL) 624 if ((at = archetype::find (monstername)) == NULL)
625 return; 625 return;
626 626
627 /* find a free square nearby 627 /* find a free square nearby
628 * first we check the closest square for free squares 628 * first we check the closest square for free squares
629 */ 629 */
630 630
631 dir = find_first_free_spot (at, op->map, op->x, op->y); 631 dir = find_first_free_spot (at, op->map, op->x, op->y);
632 if (dir != -1) 632 if (dir != -1)
633 { 633 {
636 */ 636 */
637 //TODO: use expand_tail + ... 637 //TODO: use expand_tail + ...
638 while (at != NULL) 638 while (at != NULL)
639 { 639 {
640 tmp = at->instance (); 640 tmp = at->instance ();
641 tmp->x = op->x + freearr_x[dir] + at->x; 641 tmp->x = op->x + DIRX (dir) + at->x;
642 tmp->y = op->y + freearr_y[dir] + at->y; 642 tmp->y = op->y + DIRY (dir) + at->y;
643 tmp->map = op->map; 643 tmp->map = op->map;
644 if (head) 644 if (head)
645 { 645 {
646 tmp->head = head; 646 tmp->head = head;
647 prev->more = tmp; 647 prev->more = tmp;
659 create_treasure (head->randomitems, head, GT_INVISIBLE, op->map->difficulty, 0); 659 create_treasure (head->randomitems, head, GT_INVISIBLE, op->map->difficulty, 0);
660 660
661 insert_ob_in_map (head, op->map, op, 0); 661 insert_ob_in_map (head, op->map, op, 0);
662 662
663 /* thought it'd be cool to insert a burnout, too. */ 663 /* thought it'd be cool to insert a burnout, too. */
664 op->map->insert (archetype::get (shstr_burnout), op->x + freearr_x[dir], op->y + freearr_y[dir], op); 664 op->map->insert (archetype::get (shstr_burnout), op->x + DIRX (dir), op->y + DIRY (dir), op);
665 } 665 }
666} 666}
667 667
668/* peterm: function which summons hostile monsters and 668/* peterm: function which summons hostile monsters and
669 * places them in nearby squares. 669 * places them in nearby squares.
720 { AT_PARALYZE, 9}, 720 { AT_PARALYZE, 9},
721 { AT_FEAR, 10}, 721 { AT_FEAR, 10},
722}; 722};
723 723
724/* shuffle_attack: peterm 724/* shuffle_attack: peterm
725 * This routine shuffles the attack of op to one of the 725 * This routine shuffles the attack of op to one of the
726 * ones in the list. It does this at random. It also 726 * ones in the list. It does this at random. It also
727 * chooses a face appropriate to the attack that is 727 * chooses a face appropriate to the attack that is
728 * being committed by that square at the moment. 728 * being committed by that square at the moment.
729 * right now it's being used by color spray and create pool of 729 * right now it's being used by color spray and create pool of
730 * chaos. 730 * chaos.
731 * This could really be a better implementation - the 731 * This could really be a better implementation - the
732 * faces and attacktypes above are hardcoded, which is never 732 * faces and attacktypes above are hardcoded, which is never
733 * good. The faces refer to faces in the animation sequence. 733 * good. The faces refer to faces in the animation sequence.
945 { 945 {
946 LOG (llevError, "cast_spell: null caster object passed\n"); 946 LOG (llevError, "cast_spell: null caster object passed\n");
947 return 0; 947 return 0;
948 } 948 }
949 949
950 /* if caster is a spell casting object, this normally shouldn't be 950 /* if caster is a spell casting object, this normally shouldn't be
951 * an issue, because they don't have any spellpaths set up. 951 * an issue, because they don't have any spellpaths set up.
952 */ 952 */
953 if (caster->path_denied & spell_ob->path_attuned && !caster->flag [FLAG_WIZCAST]) 953 if (caster->path_denied & spell_ob->path_attuned && !caster->flag [FLAG_WIZCAST])
954 { 954 {
955 op->failmsg ("That spell path is denied to you."); 955 op->failmsg ("That spell path is denied to you.");
957 } 957 }
958 958
959 object *skill = 0; 959 object *skill = 0;
960 960
961 /* if it is a player casting the spell, and they are really casting it 961 /* if it is a player casting the spell, and they are really casting it
962 * (vs it coming from a wand, scroll, or whatever else), do some 962 * (vs it coming from a wand, scroll, or whatever else), do some
963 * checks. We let monsters do special things - eg, they 963 * checks. We let monsters do special things - eg, they
964 * don't need the SKILL, BYpass level checks, etc. The monster function 964 * don't need the SKILL, BYpass level checks, etc. The monster function
965 * should take care of that. 965 * should take care of that.
966 * Remove the wiz check here and move it further down - some spells 966 * Remove the wiz check here and move it further down - some spells
967 * need to have the right skill pointer passed, so we need to 967 * need to have the right skill pointer passed, so we need to
999 } 999 }
1000 1000
1001 if (spell_ob->level > caster_level) 1001 if (spell_ob->level > caster_level)
1002 { 1002 {
1003 op->failmsgf ("You lack enough skill to cast that spell! " 1003 op->failmsgf ("You lack enough skill to cast that spell! "
1004 "H<Your effective cast level is %d%s, but level %d is required.>", 1004 "H<Your effective cast level is %d%s, but level %d is required.>",
1005 caster_level, msg, spell_ob->level); 1005 caster_level, msg, spell_ob->level);
1006 if (!op->is_wiz ()) 1006 if (!op->is_wiz ())
1007 return 0; 1007 return 0;
1008 } 1008 }
1009 } 1009 }
1105 1105
1106 // undo the flood protection from earlier 1106 // undo the flood protection from earlier
1107 op->speed_left += 4 * op->speed; // ~0.5s on failure 1107 op->speed_left += 4 * op->speed; // ~0.5s on failure
1108 1108
1109 /* Take into account how long it takes to cast the spell. 1109 /* Take into account how long it takes to cast the spell.
1110 * if the player is casting it, then we use the time in 1110 * if the player is casting it, then we use the time in
1111 * the spell object. If it is a spell object, have it 1111 * the spell object. If it is a spell object, have it
1112 * take two ticks. Things that cast spells on the players 1112 * take two ticks. Things that cast spells on the players
1113 * behalf (eg, altars, and whatever else) shouldn't cost 1113 * behalf (eg, altars, and whatever else) shouldn't cost
1114 * the player any time. 1114 * the player any time.
1115 * Ignore casting time for firewalls 1115 * Ignore casting time for firewalls

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines