… | |
… | |
394 | { |
394 | { |
395 | if (!xy_normalise (m, x, y)) |
395 | if (!xy_normalise (m, x, y)) |
396 | return 0; |
396 | return 0; |
397 | |
397 | |
398 | mapspace &ms = m->at (x, y); |
398 | mapspace &ms = m->at (x, y); |
|
|
399 | ms.update (); |
399 | |
400 | |
400 | if (OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
401 | if (OB_TYPE_MOVE_BLOCK (op, ms.move_block)) |
401 | return 0; |
402 | return 0; |
402 | |
403 | |
403 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
404 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
… | |
… | |
476 | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
477 | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
477 | { |
478 | { |
478 | if (!spell->other_arch) |
479 | if (!spell->other_arch) |
479 | return 0; |
480 | return 0; |
480 | |
481 | |
481 | mapxy pos (op->map, x, y);//TODO, should not pass x, y |
|
|
482 | |
|
|
483 | pos.move (dir ? dir : rndm (1, 8)); |
|
|
484 | |
|
|
485 | if (!pos.normalise ()) |
|
|
486 | return 0; |
|
|
487 | |
|
|
488 | object *tmp = spell->other_arch->instance (); |
482 | object *tmp = spell->other_arch->instance (); |
489 | |
483 | |
490 | if (!tmp) |
484 | if (!tmp) |
491 | return 0; |
485 | return 0; |
492 | |
|
|
493 | if (pos.ms ().blocks (tmp)) |
|
|
494 | { |
|
|
495 | new_draw_info (NDI_UNIQUE, 0, op, "You can't cast this spell on top of a wall!\n"); |
|
|
496 | tmp->destroy (); |
|
|
497 | return 0; |
|
|
498 | } |
|
|
499 | |
486 | |
500 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
487 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
501 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
488 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
502 | /* code in time.c uses food for some things, duration for others */ |
489 | /* code in time.c uses food for some things, duration for others */ |
503 | tmp->stats.food = tmp->duration; |
490 | tmp->stats.food = tmp->duration; |
504 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
491 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
505 | tmp->attacktype = spell->attacktype; |
492 | tmp->attacktype = spell->attacktype; |
506 | tmp->x = x; |
|
|
507 | tmp->y = y; |
|
|
508 | tmp->direction = dir; |
493 | tmp->direction = dir; |
509 | tmp->set_owner (op); |
494 | tmp->set_owner (op); |
510 | tmp->level = caster_level (caster, spell); |
495 | tmp->level = caster_level (caster, spell); |
511 | set_spell_skill (op, caster, spell, tmp); |
496 | set_spell_skill (op, caster, spell, tmp); |
512 | |
497 | |
… | |
… | |
1450 | check_bullet (op); |
1435 | check_bullet (op); |
1451 | return; |
1436 | return; |
1452 | } |
1437 | } |
1453 | } |
1438 | } |
1454 | |
1439 | |
1455 | /* This is called by move_apply. Basically, if someone |
1440 | /* This is called by move_apply. Basically, if someone |
1456 | * moves onto a spell effect and the walk_on or fly_on flags |
1441 | * moves onto a spell effect and the walk_on or fly_on flags |
1457 | * are set, this is called. This should only be called for |
1442 | * are set, this is called. This should only be called for |
1458 | * objects of the appropraite type. |
1443 | * objects of the appropriate type. |
1459 | */ |
1444 | */ |
1460 | void |
1445 | void |
1461 | apply_spell_effect (object *spell, object *victim) |
1446 | apply_spell_effect (object *spell, object *victim) |
1462 | { |
1447 | { |
1463 | switch (spell->subtype) |
1448 | switch (spell->subtype) |