adding summoning cooldown and removing room-dependent logic
authorfluffymormegil <mpread@chiark.greenend.org.uk>
Fri, 16 Mar 2012 22:19:16 +0000 (22:19 +0000)
committerfluffymormegil <mpread@chiark.greenend.org.uk>
Fri, 16 Mar 2012 22:19:16 +0000 (22:19 +0000)
bmagic.c

index 0e3b994..fba3c47 100644 (file)
--- a/bmagic.c
+++ b/bmagic.c
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-#include "dunbash.h"
+#include "cavechop.h"
 #include "bmagic.h"
 #include "monsters.h"
 #include "combat.h"
@@ -79,7 +79,7 @@ int use_black_magic(int mon)
     int cansee;
     int range;
     compute_directions(u.y, u.x, mptr->y, mptr->x, &dy, &dx, &sy, &sx, &meleerange, &oncardinal);
-    cansee = inyourroom(mptr->y, mptr->x) || meleerange;
+    cansee = mon_visible(mon);
     if ((dy * sy) >= (dx * sx))
     {
        range = dy * sy;
@@ -146,7 +146,7 @@ int use_black_magic(int mon)
        {
            if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 4))
            {
-               to_cast = !zero_die(3) ? MS_TELEPORT_ESCAPE : MS_TELEPORT_AND_SUMMON;
+               to_cast = ((mptr->next_summon < game_tick) || !zero_die(3)) ? MS_TELEPORT_ESCAPE : MS_TELEPORT_AND_SUMMON;
            }
            else if (meleerange)
            {
@@ -373,6 +373,7 @@ int use_black_magic(int mon)
        break;
 
     case MS_TELEPORT_AND_SUMMON:
+        mptr->next_summon = game_tick + 1000;
        /* Do the summoning... */
        print_mon_name(mon, 3);
        print_msg(" calls for help...\n");