Esempio n. 1
0
        public override void Update_Monster(Player pl, Floor fl)
        {
            heal_near_altar(fl);

            detect_player(pl, fl);

            has_moved = false;
            if (!stunned)
            {
                if (can_see_player)
                {
                    last_seen_player_loc = pl.get_my_grid_C();

                    if (sequence_cooldown == 0)
                    {
                        if (!bite_available && !volley_available)
                        {
                            bite_available = true;
                            volley_available = true;
                            bite_stage = 0;
                            volley_stage = 0;
                        }

                        if (bite_available && volley_available)
                        {
                            if (rGen.Next(2) == 0)
                            {
                                current_sequence = attack_sequence.Biting;
                                bite_available = false;
                            }
                            else
                            {
                                current_sequence = attack_sequence.Volley;
                                volley_available = false;
                            }
                            sequence_cooldown = 4;
                        }
                        else
                        {
                            if (!bite_available)
                            {
                                current_sequence = attack_sequence.Volley;
                                volley_available = false;
                            }
                            else
                            {
                                current_sequence = attack_sequence.Biting;
                                bite_available = false;
                            }
                            sequence_cooldown = 4;
                        }
                    }

                    switch (current_sequence)
                    {
                        case attack_sequence.None:
                            if(is_player_within(pl, 1))
                            {
                                fl.addmsg("The Boneyard slashes at you!");
                                Attack dmg = dealDamage();
                                fl.add_effect(dmg_type, pl.get_my_grid_C());
                                pl.take_damage(dmg, fl, "");
                                sequence_cooldown--;
                            }
                            else
                            {
                                advance_towards_single_point(pl.get_my_grid_C(), pl, fl, 1, corporeal);
                                if (!has_moved)
                                    fire_singletarget_bonespear(fl, pl.get_my_grid_C());
                                else
                                    sequence_cooldown--;
                            }
                            break;
                        case attack_sequence.Biting:
                            switch (bite_stage)
                            {
                                case 0:
                                    my_Texture = bitey_texture;
                                    fl.add_new_popup("Roars!", Popup.popup_msg_type.Alert, my_center_coordinate(), false, false);
                                    bloodspray(fl, pl);
                                    bite_stage++;
                                    break;
                                case 1:
                                    bite_alert(fl);
                                    bite_stage++;
                                    break;
                                case 2:
                                    //Bite goes off
                                    execute_bite(fl, pl);
                                    bite_stage = 0;
                                    my_Texture = normal_texture;
                                    current_sequence = attack_sequence.None;
                                    break;
                            }
                            break;
                        case attack_sequence.Volley:
                            switch (volley_stage)
                            {
                                case 0:
                                    //target player
                                    target_bonespear(fl, pl.get_my_grid_C(), true);
                                    fl.add_specific_effect(Floor.specific_effect.Warning_Bracket, pl.get_my_grid_C());
                                    volley_stage++;
                                    break;
                                case 1:
                                    //shoot spear
                                    fire_bonespear(fl, true);
                                    //target player
                                    target_bonespear(fl, pl.get_my_grid_C(), true);
                                    volley_stage++;
                                    break;
                                case 2:
                                    //shoot spear
                                    fire_bonespear(fl, true);
                                    //target player
                                    target_bonespear(fl, pl.get_my_grid_C(), true);
                                    volley_stage++;
                                    break;
                                case 3:
                                    //shoot spear
                                    fire_bonespear(fl, true);
                                    volley_stage = 0;
                                    current_sequence = attack_sequence.None;
                                    break;
                            }
                            break;
                    }
                }
                else if (!can_see_player && have_i_seen_player)
                {
                    advance_towards_single_point(last_seen_player_loc, pl, fl, 0, corporeal);
                    if (occupies_tile(last_seen_player_loc))
                    {
                        last_seen_player_loc = my_grid_coords[0];
                        have_i_seen_player = false;
                    }
                }
                else if (!can_see_player && !have_i_seen_player && heard_something)
                {
                    //If the boneyard has LOS to the sound's origin, fire bone spears at it repeatedly - the AOE kind.
                    //Otherwise, simply move to the sound.
                    if(last_path_to_sound.Count > 0 && can_i_see_point(fl, last_path_to_sound[0]))
                    {
                        switch(blind_volley_stage)
                        {
                            case 0:
                                break;
                            case 1:
                                break;
                        }
                    }
                    else
                    {
                        follow_path_to_sound(fl, pl);
                    }
                }
            }

            base.Update_Monster(pl, fl);
        }
Esempio n. 2
0
        public void execute_bite(Floor fl, Player pl)
        {
            int pl_x_dir = 0;
            int pl_y_dir = 0;

            gridCoordinate top_left = my_grid_coords[0];
            gridCoordinate bottom_right = my_grid_coords[3];

            int pl_x_c = pl.get_my_grid_C().x;
            int pl_y_c = pl.get_my_grid_C().y;

            //Determine X direction
            if (pl_x_c > top_left.x && pl_x_c > bottom_right.x)
                pl_x_dir = 1;
            else if (pl_x_c < top_left.x && pl_x_c < bottom_right.x)
                pl_x_dir = -1;

            //Determine Y direction
            if (pl_y_c > top_left.y && pl_y_c > bottom_right.y)
                pl_y_dir = 1;
            else if (pl_y_c < top_left.y && pl_y_c < bottom_right.y)
                pl_y_dir = -1;

            int target_index = -1;
            for (int i = 0; i < movement_indexes.Count; i++)
            {
                if (movement_indexes[i][0] == pl_x_dir && movement_indexes[i][1] == pl_y_dir)
                    target_index = i;
            }

            List<gridCoordinate> biting_coords = new List<gridCoordinate>();
            for (int i = 0; i < my_grid_coords.Count; i++)
                biting_coords.Add(new gridCoordinate(my_grid_coords[i].x + (pl_x_dir*2),
                                                     my_grid_coords[i].y + (pl_y_dir*2)));

            fl.add_specific_effect(Floor.specific_effect.Big_Bite, biting_coords[0]);
            for(int i = 0; i < my_grid_coords.Count; i++)
                if (biting_coords[i].x == pl.get_my_grid_C().x && biting_coords[i].y == pl.get_my_grid_C().y)
                {
                    List<string> bparts = new List<string>();
                    if (rGen.Next(2) == 0)
                    {
                        bparts.Add("RLeg");
                        bparts.Add("RArm");
                    }
                    else
                    {
                        bparts.Add("LArm");
                        bparts.Add("LLeg");
                    }

                    fl.addmsg("The boneyard's jaws snap shut, and your bones snap with it!");
                    pl.take_damage(new Attack(Attack.Damage.Crushing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[0]);
                    pl.take_damage(new Attack(Attack.Damage.Slashing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[0]);
                    pl.take_damage(new Attack(Attack.Damage.Crushing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[1]);
                    pl.take_damage(new Attack(Attack.Damage.Slashing, rGen.Next(bite_min_damage, bite_max_damage + 1), break_armor: true), fl, bparts[1]);
                    fl.addmsg("You start bleeding profusely from the attack!");
                    pl.add_single_statusEffect(new StatusEffect(Scroll.Status_Type.Hemorrhage, 5, true, 0, 0, false));
                }
        }
Esempio n. 3
0
        public void bloodspray(Floor fl, Player pl)
        {
            int pl_x_dir = 0;
            int pl_y_dir = 0;

            gridCoordinate top_left = my_grid_coords[0];
            gridCoordinate bottom_right = my_grid_coords[3];

            int pl_x_c = pl.get_my_grid_C().x;
            int pl_y_c = pl.get_my_grid_C().y;

            //Determine X direction
            if (pl_x_c > top_left.x && pl_x_c > bottom_right.x)
                pl_x_dir = 1;
            else if (pl_x_c < top_left.x && pl_x_c < bottom_right.x)
                pl_x_dir = -1;

            //Determine Y direction
            if (pl_y_c > top_left.y && pl_y_c > bottom_right.y)
                pl_y_dir = 1;
            else if (pl_y_c < top_left.y && pl_y_c < bottom_right.y)
                pl_y_dir = -1;

            List<gridCoordinate> potential_spray_targets = new List<gridCoordinate>();
            List<gridCoordinate> blood_spray_targets = new List<gridCoordinate>();

            if (pl_x_dir == 0)
            {
                int y_coord = top_left.y;
                if (pl_y_dir > 0)
                    y_coord = bottom_right.y;

                for (int x = top_left.x - 1; x <= bottom_right.x + 1; x++)
                    for (int y = y_coord + (pl_y_dir * 2); y != y_coord + (pl_y_dir * 4); y += pl_y_dir)
                        potential_spray_targets.Add(new gridCoordinate(x, y));
            }
            else if (pl_y_dir == 0)
            {
                int x_coord = top_left.x;
                if (pl_x_dir > 0)
                    x_coord = bottom_right.x;

                for (int x = x_coord + (pl_x_dir * 2); x != x_coord + (pl_x_dir * 4); x += pl_x_dir)
                    for (int y = top_left.y - 1; y <= bottom_right.y + 1; y++)
                        potential_spray_targets.Add(new gridCoordinate(x, y));
            }
            else
            {
                for(int i = 0; i < my_grid_coords.Count; i++)
                    potential_spray_targets.Add(new gridCoordinate(my_grid_coords[i].x + (pl_x_dir*3),
                                                                   my_grid_coords[i].y + (pl_y_dir*3)));

                int upper_x = 0;
                int lower_x = 0;
                if (pl_x_dir == 1)
                {
                    upper_x = 0;
                    lower_x = 2;
                }
                else if (pl_x_dir == -1)
                {
                    upper_x = 1;
                    lower_x = 3;
                }

                int left_y = 0;
                int right_y = 0;
                if (pl_y_dir == 1)
                {
                    left_y = 0;
                    right_y = 1;
                }
                else if (pl_y_dir == -1)
                {
                    left_y = 2;
                    right_y = 3;
                }

                //The above code gives us a 2x2 zone. For this, we want to extend the zone by one
                //x tile and y tile in the opposite direction of where the player is relative to the boneyard
                //That's why the above code picks out the 2 coordinates from the x axis and y axis, because
                potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[upper_x].x + (pl_x_dir*-1),
                                                                   potential_spray_targets[upper_x].y));
                potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[lower_x].x + (pl_x_dir*-1),
                                                               potential_spray_targets[lower_x].y));
                potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[left_y].x,
                                                                   potential_spray_targets[left_y].y + (pl_y_dir*-1)));
                potential_spray_targets.Add(new gridCoordinate(potential_spray_targets[right_y].x,
                                                               potential_spray_targets[right_y].y + (pl_y_dir*-1)));
            }

            int potential_targets = 3;
            //for (int i = 0; i < potential_spray_targets.Count; i++)
                //fl.set_tile_aura(potential_spray_targets[i], Tile.Aura.SmellTarget);
            for (int i = 0; i < potential_targets; i++)
            {
                bool found_valid_target = false;
                while (!found_valid_target && potential_spray_targets.Count > 0)
                {
                    int chosen_coord = rGen.Next(potential_spray_targets.Count);
                    if (can_i_see_point(fl, potential_spray_targets[chosen_coord]))
                    {
                        blood_spray_targets.Add(potential_spray_targets[chosen_coord]);
                        found_valid_target = true;
                    }
                    potential_spray_targets.RemoveAt(chosen_coord);
                }
            }

            for (int i = 0; i < blood_spray_targets.Count; i++)
            {
                Projectile bspray = new Projectile(randomly_chosen_personal_coord(), blood_spray_targets[i],
                                                   Projectile.projectile_type.Bloody_AcidCloud, ref cont,
                                                   true, Scroll.Atk_Area_Type.cloudAOE, true);
                bspray.set_damage_type(blood_spray_dmgtyp);
                bspray.set_damage_range(blood_spray_mindmg, blood_spray_maxdmg);
                bspray.set_special_anim(Projectile.special_anim.BloodAcid);
                bspray.set_AOE_size(1);
                fl.create_new_projectile(bspray);
            }
        }
Esempio n. 4
0
        public List<Item> retrieve_random_items(Permanent_ITypes iTyp, Player pl, int number, int c_floor)
        {
            BaseItemDC[] raw_items = new BaseItemDC[0];
            List<BaseItemDC> selected_items = new List<BaseItemDC>();
            List<BaseItemDC> teaser_items = new List<BaseItemDC>();
            List<Item> fetched_items = new List<Item>();

            switch (iTyp)
            {
                case Permanent_ITypes.Armor:
                    raw_items = cManager.Load<ArmorDC[]>("XmlData/Items/armors");
                    break;
                case Permanent_ITypes.Weapon:
                    raw_items = cManager.Load<WeaponDC[]>("XmlData/Items/weapons");
                    break;
                case Permanent_ITypes.Scroll:
                    raw_items = cManager.Load<ScrollDC[]>("XmlData/Items/scrolls");
                    break;
            }

            int playerGold = pl.get_my_gold();
            int tiers_available = calc_tier(playerGold);
            if (iTyp == Permanent_ITypes.Scroll)
                tiers_available = calc_scroll_tier(playerGold);
            int teaser_tier = calc_tier(pl.get_my_lifetime_gold());
            string pl_chclass = pl.my_class_as_string();

            for (int i = 0; i < raw_items.Count(); i++)
            {
                string[] available_for = raw_items[i].ValidClasses.Split(' ');
                bool valid_class = false;
                for(int cl = 0; cl < available_for.Count(); cl++)
                    if(String.Compare(available_for[cl], pl_chclass) == 0)
                        valid_class = true;

                if (valid_class && (raw_items[i].ItemTier == tiers_available ||
                                   raw_items[i].ItemTier == tiers_available - 1) &&
                                   (raw_items[i].Cost <= playerGold ||
                                    raw_items[i].Cost == 250) &&
                                   c_floor > raw_items[i].FloorsRequired)
                    selected_items.Add(raw_items[i]);

                if (valid_class && raw_items[i].ItemTier == teaser_tier)
                    teaser_items.Add(raw_items[i]);
            }

            while (fetched_items.Count < number - 1 && selected_items.Count > 0)
            {
                int selected_index = rGen.Next(selected_items.Count);
                add_dataclass_to_final_list(selected_items[selected_index], ref fetched_items);
                //Remove them from the list afterwards.
                selected_items.RemoveAt(selected_index);
            }

            int teaser_item = rGen.Next(2);
            if (teaser_item == 0 && teaser_items.Count() > 0 && tiers_available != teaser_tier)
            {
                int teaser_index = rGen.Next(teaser_items.Count());
                add_dataclass_to_final_list(teaser_items[teaser_index], ref fetched_items);
            }
            else
            {
                if (selected_items.Count > 0)
                {
                    int selected_index = rGen.Next(selected_items.Count);
                    add_dataclass_to_final_list(selected_items[selected_index], ref fetched_items);
                }
            }

            return fetched_items;
        }
Esempio n. 5
0
        public List<Item> retrieve_random_consumables(Player pl, int number)
        {
            PotionDC[] raw_potion_data = cManager.Load<PotionDC[]>("XmlData/Items/potions");
            List<PotionDC> selected_potion_data = new List<PotionDC>();

            List<Item> fetched_list = new List<Item>();

            int tiers_available = 0;
            int playerGold = pl.get_my_gold();

            if (playerGold < 500)
                tiers_available = 1;
            else
                tiers_available = 2;

            string pl_chclass = pl.my_class_as_string();
            for (int i = 0; i < raw_potion_data.Count(); i++)
            {
                string[] available_for = raw_potion_data[i].ValidClasses.Split(' ');
                bool valid_class = false;
                for (int cl = 0; cl < available_for.Count(); cl++)
                    if (String.Compare(pl_chclass, available_for[cl]) == 0)
                        valid_class = true;

                if(valid_class && (raw_potion_data[i].ItemTier == tiers_available ||
                                   raw_potion_data[i].ItemTier == tiers_available-1) &&
                                   (raw_potion_data[i].Cost <= playerGold ||
                                    raw_potion_data[i].Cost == 500))
                    selected_potion_data.Add(raw_potion_data[i]);
            }

            while ((fetched_list.Count) < number && selected_potion_data.Count > 0)
            {
                int selected_p_index = rGen.Next(selected_potion_data.Count);
                bool duplicate_type = false;
                //Check to see if it's a duplicate type first.
                for (int j = 0; j < fetched_list.Count; j++)
                {
                    if (fetched_list[j] is Potion)
                    {
                        Potion p = (Potion)fetched_list[j];
                        string rpdType = selected_potion_data[selected_p_index].PotionType;
                        switch (p.get_type())
                        {
                            case Potion.Potion_Type.Health:
                                duplicate_type = String.Compare(rpdType, "Health") == 0;
                                break;
                            case Potion.Potion_Type.Repair:
                                duplicate_type = String.Compare(rpdType, "Repair") == 0;
                                break;
                        }
                    }
                }
                //If it is not a duplicate type, add the potion intialized from the data
                //to fectched item list.
                //regardless, the potion is removed from selected raw data.
                if (!duplicate_type)
                    fetched_list.Add(process_pDC(selected_potion_data[selected_p_index]));

                selected_potion_data.RemoveAt(selected_p_index);
            }

            //Raw potion data 0 should be minor Health Potion. it's the first one
            //in the list. This guarantees that if no other health potion is present you
            //At least get a minor one. Toss the player a bone.
            bool health_potion_present = false;
            for (int i = 0; i < fetched_list.Count; i++)
                if (fetched_list[i] is Potion)
                {
                    Potion p = (Potion)fetched_list[i];
                    if (p.get_type() == Potion.Potion_Type.Health)
                        health_potion_present = true;
                }

            if (!health_potion_present)
            {
                int MPID = raw_potion_data[0].IDNumber;
                int MPC = raw_potion_data[0].Cost;
                string MPN = raw_potion_data[0].Name;
                string MPI = raw_potion_data[0].Icon;
                int MPP = raw_potion_data[0].PotionPotency;
                int MPCo = raw_potion_data[0].PotionCode;
                fetched_list.Add(new Potion(MPID, MPC, MPN, MPI, Potion.Potion_Type.Health, MPP, MPCo));
            }

            bool bonus_quan = false;
            while (!bonus_quan)
            {
                int item_index = rGen.Next(fetched_list.Count);
                if (fetched_list[item_index] is Potion)
                {
                    Potion p = (Potion)fetched_list[item_index];
                    p.adjust_quantity(1);
                    bonus_quan = true;
                }
            }

            return fetched_list;
        }
Esempio n. 6
0
        //This will return appropriate shop prompts based on metrics
        //passed in the function.
        public List<string> get_prompt(Player.Character chara, string section)
        {
            ShopPromptDC[] all_prompts = new ShopPromptDC[0];
            List<ShopPromptDC> possible_prompts = new List<ShopPromptDC>();
            string path = "XmlData/Prompts/";
            switch (chara)
            {
                case Player.Character.Falsael:
                    path += "falsael_prompts";
                    break;
                case Player.Character.Halephon:
                    path += "halephon_prompts";
                    break;
                case Player.Character.Petaer:
                    path += "petaer_prompts";
                    break;
                case Player.Character.Ziktofel:
                    path += "ziktofel_prompts";
                    break;
            }
            all_prompts = cManager.Load<ShopPromptDC[]>(path);

            for (int i = 0; i < all_prompts.Count(); i++)
            {
                if (String.Compare(all_prompts[i].Shop_Section, section) == 0)
                    possible_prompts.Add(all_prompts[i]);
            }

            int chosen_prompt = rGen.Next(possible_prompts.Count);
            if (possible_prompts.Count > 0)
                return possible_prompts[chosen_prompt].Prompt_Text;
            else
                return new List<string>();
        }