当前位置: 首页>>代码示例>>C#>>正文


C# Floor.is_monster_here方法代码示例

本文整理汇总了C#中Floor.is_monster_here方法的典型用法代码示例。如果您正苦于以下问题:C# Floor.is_monster_here方法的具体用法?C# Floor.is_monster_here怎么用?C# Floor.is_monster_here使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Floor的用法示例。


在下文中一共展示了Floor.is_monster_here方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: whirlwind_attack

        public void whirlwind_attack(Floor fl, Weapon target_weapon)
        {
            bool rolled_max = false;

            List<gridCoordinate> target_coordinates = new List<gridCoordinate>();
            for (int x = my_grid_coord.x - 1; x <= my_grid_coord.x + 1; x++)
                for (int y = my_grid_coord.y - 1; y <= my_grid_coord.y + 1; y++)
                    if(!(x== my_grid_coord.x && y== my_grid_coord.y))
                        target_coordinates.Add(new gridCoordinate(x, y));

            int monster_ID = -1;
            int Doodad_ID = -1;
            for (int i = 0; i < target_coordinates.Count; i++)
            {
                double multiplier = 1.3;
                if (target_weapon.get_hand_count() == 2)
                    multiplier = 1.6;

                if (fl.is_monster_here(target_coordinates[i], out monster_ID))
                    attack_monster_in_grid(fl, target_weapon, monster_ID, target_coordinates[i], multiplier, out rolled_max);

                if (fl.is_destroyable_Doodad_here(target_coordinates[i], out Doodad_ID))
                    attack_Doodad_in_grid(fl, target_weapon, Doodad_ID, target_coordinates[i], multiplier, out rolled_max);

                if (fl.isWalkable(target_coordinates[i]))
                    fl.add_effect(target_weapon.get_my_damage_type(), target_coordinates[i]);
            }
            target_weapon.set_cooldown(standard_wpn_cooldown);

            if (my_class == Chara_Class.Warrior)
            {
                c_energy += 5 + rGen.Next(2);
                if (rolled_max)
                    c_energy++;
            }
        }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:36,代码来源:Player.cs

示例2: charge_attack

        public void charge_attack(Floor fl, Weapon lance, gridCoordinate charge_coordinate, int monsterID, int DoodadID)
        {
            bool attacked_Doodad = false;
            bool rolled_max = false;
            gridCoordinate my_original_position = new gridCoordinate(my_grid_coord);
            Weapon c_lance = lance;

            VisionRay attack_ray = null;
            if(fl.badguy_by_monster_id(monsterID) == null)
            {
                attack_ray = new VisionRay(my_grid_coord, fl.Doodad_by_index(DoodadID).get_g_coord());
            }
            else
                attack_ray = new VisionRay(my_grid_coord, charge_coordinate);

            gridCoordinate monster_coord = new gridCoordinate(-1, -1);
            gridCoordinate Doodad_coord = new gridCoordinate(-1, -1);

            bool done = false;
            while (!done)
            {
                int old_xPosition = (int)attack_ray.my_current_position.X / 32;
                int old_yPosition = (int)attack_ray.my_current_position.Y / 32;
                gridCoordinate previous_ray_position = new gridCoordinate(old_xPosition, old_yPosition);

                attack_ray.update();

                int new_xPosition = (int)attack_ray.my_current_position.X / 32;
                int new_yPosition = (int)attack_ray.my_current_position.Y / 32;
                gridCoordinate next_ray_position = new gridCoordinate(new_xPosition, new_yPosition);

                int mon_ID;
                int dood_ID;
                fl.is_monster_here(next_ray_position, out mon_ID);
                fl.is_destroyable_Doodad_here(next_ray_position, out dood_ID);
                if (mon_ID == monsterID && monsterID > -1)
                {
                    monster_coord = new gridCoordinate(charge_coordinate);
                    teleport(previous_ray_position);
                    attack_monster_in_grid(fl, lance, monsterID, charge_coordinate, 1.0, out rolled_max, true);
                    done = true;
                }

                if (dood_ID == DoodadID && DoodadID > -1)
                {
                    attacked_Doodad = true;
                    Doodad_coord = new gridCoordinate(fl.Doodad_by_index(DoodadID).get_g_coord());
                    teleport(previous_ray_position);
                    attack_Doodad_in_grid(fl, lance, DoodadID, fl.Doodad_by_index(DoodadID).get_g_coord(), 1.0, out rolled_max, true);
                    done = true;
                }
            }

            gridCoordinate opposition_coord = new gridCoordinate(-1, -1);
            if (attacked_Doodad)
                opposition_coord = Doodad_coord;
            else
                opposition_coord = monster_coord;

            if (!is_spot_free(fl, my_grid_coord))
            {
                int xdif = my_original_position.x - opposition_coord.x;
                int ydif = my_original_position.y - opposition_coord.y;

                int whocares = -1;
                if (fl.is_monster_here(my_grid_coord, out whocares) || fl.is_destroyable_Doodad_here(my_grid_coord, out whocares))
                {
                    if (xdif == 0)
                        if (my_original_position.x < my_grid_coord.x)
                            my_grid_coord.x--;
                        else
                            my_grid_coord.x++;

                    if (ydif == 0)
                        if (my_original_position.y < my_grid_coord.y)
                            my_grid_coord.y--;
                        else
                            my_grid_coord.y++;

                }
                else if (!fl.is_monster_here(my_grid_coord, out whocares) && !fl.isWalkable(my_grid_coord))
                {
                    int xshift = 0;
                    int yshift = 0;

                    if (xdif < 0)
                        xshift = -1;
                    else
                        xshift = 1;

                    if (ydif < 0)
                        yshift = -1;
                    else
                        yshift = 1;

                    gridCoordinate x_shifted = new gridCoordinate(my_grid_coord.x + xshift, my_grid_coord.y);
                    gridCoordinate y_shifted = new gridCoordinate(my_grid_coord.x, my_grid_coord.y + yshift);
                    bool x_ok = fl.isWalkable(x_shifted);
                    bool y_ok = fl.isWalkable(y_shifted);

//.........这里部分代码省略.........
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:101,代码来源:Player.cs

示例3: set_ranged_attack_aura

        public void set_ranged_attack_aura(Floor fl, gridCoordinate pl_gc, Scroll s, RACursor r1)
        {
            int bow_range = 0;
            if (s == null)
            {
                if (main_hand != null && (main_hand.get_my_weapon_type() == Weapon.Type.Bow ||
                                          main_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
                    bow_range = main_hand.get_my_range();
                else
                    bow_range = off_hand.get_my_range();
            }
            else
                bow_range = s.get_range();

            List<gridCoordinate> endpoints = new List<gridCoordinate>();
            if ((is_bow_equipped() && !is_cbow_equipped()) || s != null)
            {
                endpoints = calculate_endpoints(pl_gc, bow_range);
            }
            else
            {
                endpoints.Add(new gridCoordinate(pl_gc.x, pl_gc.y + bow_range));
                endpoints.Add(new gridCoordinate(pl_gc.x, pl_gc.y - bow_range));
                endpoints.Add(new gridCoordinate(pl_gc.x + bow_range, pl_gc.y));
                endpoints.Add(new gridCoordinate(pl_gc.x - bow_range, pl_gc.y));
            }
            List<VisionRay> range_rays = new List<VisionRay>();

            for (int i = 0; i < endpoints.Count; i++)
            {
                range_rays.Add(new VisionRay(pl_gc, endpoints[i]));
            }
            endpoints.Clear();

            int monsterID = -1;
            while (range_rays.Count > 0)
            {
                for (int i = 0; i < range_rays.Count; i++)
                {
                    bool remove = false;
                    int whoCares = -1;

                    range_rays[i].update();
                    gridCoordinate current_ray_position = new gridCoordinate((int)range_rays[i].my_current_position.X / 32, (int)range_rays[i].my_current_position.Y / 32);
                    int x_difference = positive_difference(pl_gc.x, current_ray_position.x);
                    int y_difference = positive_difference(pl_gc.y, current_ray_position.y);

                    if (!fl.is_tile_opaque(current_ray_position) && (x_difference > 1 || y_difference > 1))
                            fl.set_tile_aura(current_ray_position, Tile.Aura.Attack);

                    if (fl.is_tile_opaque(current_ray_position) ||
                        fl.is_los_blocking_Doodad_here(current_ray_position))
                    {
                        remove = true;
                        if(s != null && s.spell_destroys_walls())
                            fl.set_tile_aura(current_ray_position, Tile.Aura.Attack);
                    }

                    if ((main_hand != null && main_hand.get_my_weapon_type() == Weapon.Type.Crossbow) ||
                        (off_hand != null && off_hand.get_my_weapon_type() == Weapon.Type.Crossbow))
                        if (fl.is_monster_here(current_ray_position, out monsterID) ||
                            fl.is_destroyable_Doodad_here(current_ray_position, out whoCares))
                            remove = true;

                    if (range_rays[i].is_at_end() || remove)
                        range_rays.RemoveAt(i);
                }
            }

            range_rays.Clear();
            if (s != null && s.get_aoe_size() > 1)
            {
                int aoe_range = s.get_aoe_size() / 2;
                endpoints = calculate_endpoints(r1.my_grid_coord, aoe_range);
                bool destroys_walls = s.spell_destroys_walls();

                for (int i = 0; i < endpoints.Count; i++)
                {
                    range_rays.Add(new VisionRay(r1.my_grid_coord, endpoints[i]));
                }
                while (range_rays.Count > 0)
                {
                    for (int i = 0; i < range_rays.Count; i++)
                    {
                        bool remove = false;

                        range_rays[i].update();
                        gridCoordinate current_ray_position = new gridCoordinate((int)range_rays[i].my_current_position.X / 32, (int)range_rays[i].my_current_position.Y / 32);

                        if (!fl.is_tile_opaque(current_ray_position))
                            if (fl.aura_of_specific_tile(current_ray_position) == Tile.Aura.Attack)
                                fl.set_tile_aura(current_ray_position, Tile.Aura.AtkAndAOE);
                            else if(fl.aura_of_specific_tile(current_ray_position) != Tile.Aura.AtkAndAOE &&
                                    fl.aura_of_specific_tile(current_ray_position) != Tile.Aura.Attack)
                                fl.set_tile_aura(current_ray_position, Tile.Aura.AOE_Range);

                        if (fl.is_tile_opaque(current_ray_position) && !destroys_walls)
                            remove = true;

                        if (range_rays[i].is_at_end() || remove)
//.........这里部分代码省略.........
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:101,代码来源:Player.cs

示例4: set_charge_attack_aura

        public void set_charge_attack_aura(Floor fl, int lanceID, gridCoordinate pl_gc)
        {
            Weapon c_lance = null;
            for (int i = 0; i < inventory.Count; i++)
            {
                if (inventory[i].get_my_IDno() == lanceID)
                    c_lance = (Weapon)inventory[i];
            }
            int lance_range = c_lance.get_my_range();

            List<gridCoordinate> endPoints = calculate_endpoints(pl_gc, lance_range);
            List<VisionRay> charge_rays = new List<VisionRay>();

            for (int i = 0; i < endPoints.Count; i++)
            {
               charge_rays.Add(new VisionRay(pl_gc, endPoints[i]));
            }

            int monsterID = -1;
            while (charge_rays.Count > 0)
            {
                for (int i = 0; i < charge_rays.Count; i++)
                {
                    bool remove = false;
                    int whoCares = -1;
                    charge_rays[i].update();
                    gridCoordinate current_ray_position = new gridCoordinate((int)charge_rays[i].my_current_position.X / 32, (int)charge_rays[i].my_current_position.Y / 32);
                    int x_difference = positive_difference(pl_gc.x, current_ray_position.x);
                    int y_difference = positive_difference(pl_gc.y, current_ray_position.y);

                    if (fl.isWalkable(current_ray_position) && (x_difference > 1 || y_difference > 1))
                        fl.set_tile_aura(current_ray_position, Tile.Aura.Attack);

                    if (!fl.isWalkable(current_ray_position) && (x_difference > 1 || y_difference > 1) &&
                        fl.is_destroyable_Doodad_here(current_ray_position, out whoCares))
                        fl.set_tile_aura(current_ray_position, Tile.Aura.Attack);

                    if (!fl.isWalkable(current_ray_position) || fl.is_monster_here(current_ray_position, out monsterID))
                        remove = true;

                    if (charge_rays[i].is_at_end() || remove)
                        charge_rays.RemoveAt(i);
                }
            }
        }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:45,代码来源:Player.cs

示例5: move

        public void move(gridCoordinate.direction dir, Floor fl)
        {
            int MonsterID = -1;
            Doodad target_doodad = null;
            bool opened_door = false;
            gridCoordinate test_coord = new gridCoordinate(my_grid_coord);
            test_coord.shift_direction(dir);

            if (is_spot_free(fl, test_coord))
            {
                my_grid_coord = test_coord;
                reset_my_drawing_position();
            }
            else
            {
                int DoodadID = -1;
                //Check for monsters / doodads first.
                fl.is_monster_here(test_coord, out MonsterID);
                if (fl.is_impassible_doodad_here(test_coord, out DoodadID))
                    target_doodad = fl.Doodad_by_index(DoodadID);
                //Check to see if there's a door there. If there is, attempt to open it.
                fl.open_door_here(test_coord, out opened_door);
            }

            if (MonsterID != -1)
                melee_attack(fl, my_grid_coord, test_coord);

            if (target_doodad != null)
            {
                switch (target_doodad.get_my_doodad_type())
                {
                    case Doodad.Doodad_Type.Door:
                        fl.open_door_here(test_coord, out opened_door);
                        if (!opened_door)
                            melee_attack(fl, my_grid_coord, test_coord);
                        break;
                    case Doodad.Doodad_Type.TreasureBox:
                        if (!target_doodad.is_chest_open())
                            target_doodad.open_chest(fl);
                        else
                            if (target_doodad.chest_contains_stuff())
                                target_doodad.loot_chest(fl, this);
                        break;
                    default:
                        melee_attack(fl, my_grid_coord, test_coord);
                        break;
                }
            }
            //after moving, loot the current tile, and set sound / smell values.
            loot(fl);
            total_sound = my_sound_value();
            total_scent = my_scent_value();
        }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:53,代码来源:Player.cs

示例6: melee_attack

        public void melee_attack(Floor fl, gridCoordinate pl_gc, gridCoordinate monster_gc)
        {
            List<gridCoordinate> squares_to_attack_mh = new List<gridCoordinate>();
            List<gridCoordinate> squares_to_attack_oh = new List<gridCoordinate>();
            List<gridCoordinate> squares_to_attack_both = new List<gridCoordinate>();

            bool attack_hit = false;
            bool rolled_max = false;
            bool max_dmg_bonus = false;

            //Monster GC is the origin - set up all patterns from there.
            if (main_hand != null)
            {
                switch (main_hand.get_my_weapon_type())
                {
                    case Weapon.Type.Sword:
                    case Weapon.Type.Mace:
                    case Weapon.Type.Dagger:
                        squares_to_attack_mh.Add(new gridCoordinate(monster_gc));
                        break;
                    case Weapon.Type.Spear:
                    case Weapon.Type.Staff:
                        squares_to_attack_mh = return_spear_patterns(pl_gc, monster_gc, squares_to_attack_mh, fl, true);
                        break;
                    //Axe!
                    case Weapon.Type.Axe:
                        squares_to_attack_mh = return_axe_patterns(pl_gc, monster_gc, squares_to_attack_mh, fl);
                        break;
                    case Weapon.Type.Lance:
                        squares_to_attack_mh.Add(new gridCoordinate(monster_gc));
                        break;
                    //Shields add no square
                }
            }

            if (off_hand != null && off_hand != main_hand)
            {
                switch (off_hand.get_my_weapon_type())
                {
                    case Weapon.Type.Sword:
                    case Weapon.Type.Mace:
                    case Weapon.Type.Dagger:
                        squares_to_attack_oh.Add(new gridCoordinate(monster_gc));
                        break;
                    case Weapon.Type.Spear:
                    case Weapon.Type.Staff:
                        squares_to_attack_oh = return_spear_patterns(pl_gc, monster_gc, squares_to_attack_oh, fl, false);
                        break;
                    case Weapon.Type.Axe:
                        squares_to_attack_oh = return_axe_patterns(pl_gc, monster_gc, squares_to_attack_oh, fl);
                        break;
                    case Weapon.Type.Lance:
                        squares_to_attack_oh.Add(new gridCoordinate(monster_gc));
                        break;
                    //Shields add no square
                }
            }

            //if both weapons are null...
            if (main_hand == null && off_hand == null)
            {
                squares_to_attack_mh.Add(new gridCoordinate(monster_gc));
            }

            //then we go through both lists.
            for (int i = 0; i < squares_to_attack_mh.Count; i++)
            {
                int c_monsterID;
                int c_DoodadID;

                if (fl.is_monster_here(squares_to_attack_mh[i], out c_monsterID))
                {
                    attack_monster_in_grid(fl, main_hand, c_monsterID, squares_to_attack_mh[i], 1.0, out rolled_max);
                    attack_hit = true;
                    if (rolled_max)
                        max_dmg_bonus = true;
                }

                if (fl.is_destroyable_Doodad_here(squares_to_attack_mh[i], out c_DoodadID))
                {
                    attack_Doodad_in_grid(fl, main_hand, c_DoodadID, squares_to_attack_mh[i], 1.0, out rolled_max);
                    attack_hit = true;
                    if (rolled_max)
                        max_dmg_bonus = true;
                }

                if (main_hand != null)
                    fl.add_effect(main_hand.get_my_damage_type(), squares_to_attack_mh[i]);
                else
                    fl.add_effect(Attack.Damage.Crushing, squares_to_attack_mh[i]);
            }

            for (int i = 0; i < squares_to_attack_oh.Count; i++)
            {
                int c_monsterID;
                int c_DoodadID;

                if (fl.is_monster_here(squares_to_attack_oh[i], out c_monsterID))
                {
                    attack_monster_in_grid(fl, off_hand, c_monsterID, squares_to_attack_oh[i], 1.0, out rolled_max);
//.........这里部分代码省略.........
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:101,代码来源:Player.cs

示例7: is_spot_free

 //Bool returns - gets whether there's a monster on your current grid coordinate.
 //Or whether the spot is free, or if you're alive, OR if that spot is an exit.
 //Green text. Function here.
 public bool is_spot_free(Floor fl, gridCoordinate test_coord)
 {
     int whoCares;
     return (fl.isWalkable(test_coord) && !fl.is_monster_here(test_coord, out whoCares));
 }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:8,代码来源:Player.cs


注:本文中的Floor.is_monster_here方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。