Exemplo n.º 1
0
        public void bow_attack(Floor fl, ref ContentManager Secondary_cManager, gridCoordinate attack_location, int monsterID, int DoodadID)
        {
            Weapon Bow = null;
            if (main_hand != null && (main_hand.get_my_weapon_type() == Weapon.Type.Bow ||
                                     main_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
                Bow = main_hand;
            else if (off_hand != null && (off_hand.get_my_weapon_type() == Weapon.Type.Bow ||
                                          off_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
                Bow = off_hand;

            gridCoordinate opposition_coord = new gridCoordinate(-1, -1);
            if (monsterID != -1)
                opposition_coord = attack_location;
            else
                opposition_coord = fl.Doodad_by_index(DoodadID).get_g_coord();

            int cbow_xsplash = 0;
            int cbow_ysplash = 0;
            if (opposition_coord.x < my_grid_coord.x)
                cbow_xsplash = -1;
            else if (opposition_coord.x > my_grid_coord.x)
                cbow_xsplash = 1;

            if (opposition_coord.y < my_grid_coord.y)
                cbow_ysplash = -1;
            else if (opposition_coord.y > my_grid_coord.y)
                cbow_ysplash = 1;
            gridCoordinate splash_coord = new gridCoordinate(opposition_coord.x + cbow_xsplash, opposition_coord.y + cbow_ysplash);

            int base_min_dmg_to_monster = Bow.specific_damage_val(false);
            int base_max_dmg_to_monster = Bow.specific_damage_val(true);

            int max_dmg_to_monster = (int)base_max_dmg_to_monster;
            int min_dmg_to_monster = (int)base_min_dmg_to_monster;

            if (is_cbow_equipped() && my_character == Character.Falsael)
            {
                max_dmg_to_monster = (int)Math.Ceiling(base_max_dmg_to_monster * 1.2);
                min_dmg_to_monster = (int)Math.Ceiling(base_min_dmg_to_monster * 1.2);
            }

            if (Bow.get_my_weapon_type() == Weapon.Type.Bow)
            {
                Projectile prj = new Projectile(get_my_grid_C(), opposition_coord, Projectile.projectile_type.Arrow, ref Secondary_cManager, false, Scroll.Atk_Area_Type.singleTile);
                prj.attach_weapon(Bow);
                fl.create_new_projectile(prj);
            }
            else if(Bow.get_my_weapon_type() == Weapon.Type.Crossbow)
            {
                Projectile prj = new Projectile(get_my_grid_C(), opposition_coord, Projectile.projectile_type.Crossbow_Bolt, ref Secondary_cManager, false, Scroll.Atk_Area_Type.smallfixedAOE);
                List<gridCoordinate> crossbow_aoe = new List<gridCoordinate>();
                crossbow_aoe.Add(opposition_coord);
                crossbow_aoe.Add(splash_coord);
                prj.set_small_AOE_matrix(crossbow_aoe);
                prj.attach_weapon(Bow);
                fl.create_new_projectile(prj);
            }

            string attack_msg = "";
            if (monsterID != -1)
                attack_msg = "You attack the " + fl.badguy_by_monster_id(monsterID).my_name + " with your " + Bow.get_my_name() + "!";
            else
                attack_msg = "You attack the " + fl.Doodad_by_index(DoodadID).my_name() + " with your " + Bow.get_my_name() + "!";
            message_buffer.Add(attack_msg);

            total_sound += my_sound_value() + (my_sound_value() / 2);
            total_scent += my_scent_value();

            if (my_class == Chara_Class.Warrior)
            {
                c_energy += 6;
            }
        }