/*
 * Town logic flow for generation of arena -KMW-
 */
static void battle_gen(void)
{
    int y, x, i;
    int qy = 0;
    int qx = 0;

    /* Start with solid walls */
    for (y = 0; y < MAX_HGT; y++)
    {
        for (x = 0; x < MAX_WID; x++)
        {
            /* Create "solid" perma-wall */
            place_solid_perm_bold(y, x);

            /* Illuminate and memorize the walls */
            cave[y][x].info |= (CAVE_GLOW | CAVE_MARK);
        }
    }

    /* Then place some floors */
    for (y = qy + 1; y < qy + SCREEN_HGT - 1; y++)
    {
        for (x = qx + 1; x < qx + SCREEN_WID - 1; x++)
        {
            /* Create empty floor */
            cave[y][x].feat = feat_floor;
        }
    }

    build_battle();

    for(i=0;i<4;i++)
    {
        place_monster_aux(0, py + 8 + (i/2)*4, px - 2 + (i%2)*4, battle_mon[i],
                  (PM_NO_KAGE | PM_NO_PET));
        set_friendly(&m_list[cave[py+8+(i/2)*4][px-2+(i%2)*4].m_idx]);
    }
    for(i = 1; i < m_max; i++)
    {
        monster_type *m_ptr = &m_list[i];

        if (!m_ptr->r_idx) continue;

        /* Hack -- Detect monster */
        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);

        /* Update the monster */
        update_mon(i, FALSE);
    }
}
Example #2
0
/****************************************************************
 * Spells
 ****************************************************************/
static void _kiss_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Kiss");
        break;
    case SPELL_DESC:
        var_set_string(res, "Attempt to charm an adjacent monster.");
        break;
    case SPELL_COST_EXTRA:
        var_set_int(res, p_ptr->lev * 2);
        break;
    case SPELL_CAST:
    {
        int y, x, dir = 0, m_idx;
        var_set_bool(res, FALSE);
        if (!get_rep_dir2(&dir)) return;
        if (dir == 5) return;

        y = py + ddy[dir];
        x = px + ddx[dir];

        m_idx = cave[y][x].m_idx;
        if (m_idx)
        {
            monster_type *m_ptr = &m_list[m_idx];
            monster_race *r_ptr = &r_info[m_ptr->r_idx];
            char desc[MAX_NLEN];
            monster_desc(desc, m_ptr, 0);
            if ((r_ptr->flags1 & RF1_UNIQUE) || mon_save_p(m_ptr->r_idx, A_CHR))
            {
                set_monster_csleep(m_idx, 0);
                if (is_hostile(m_ptr))
                {
                    switch (randint1(10))
                    {
                    case 1:
                        msg_format("%^s says 'Impudent Strumpet!'", desc);
                        break;
                    case 2:
                        msg_format("%^s says 'Ewwww! Gross!!'", desc);
                        break;
                    case 3:
                        msg_format("%^s says 'You ain't my type!'", desc);
                        break;
                    default:
                        msg_format("%^s resists your charms.", desc);
                    }

                    if (allow_ticked_off(r_ptr))
                    {
                        m_ptr->anger_ct++;
                    }

                }
                else
                    msg_format("%^s ignores you.", desc);
            }
            else
            {
                if (is_pet(m_ptr))
                    msg_format("%^s slobbers on you affectionately.", desc);
                else if (is_friendly(m_ptr))
                {
                    set_pet(m_ptr);
                    msg_format("%^s is charmed!", desc);
                }
                else
                {
                    set_friendly(m_ptr);
                    msg_format("%^s suddenly becomes friendly.", desc);
                }
            }
            var_set_bool(res, TRUE);
        }
        else
        {
            msg_print("There is no monster.");
        }
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}