Exemplo n.º 1
0
        //spell 210
        public static async void RuneOfMagic(Players player)
        {
            float casting_time = SpellSystem.GetCastingTimeOfSpell(210);
            float duration     = 10f;


            if (!spells.StartCastingProcess(player, 210, casting_time, SpellSystem.GetEnergyCostofSpell(210), false, 0, 0, 0).Result)
            {
                return;
            }

            float _x = player.position_x;
            float _z = player.position_z;

            RuneOfMagicEffect(player, duration, _x, _z);


            string check_cond_strike_id = player.get_symb_for_IDs();

            player.set_condition_CS_type(210, check_cond_strike_id, _x, _z);

            for (float i = duration; i > 0; i++)
            {
                //wait 1 second
                await Task.Delay(1000);

                player.ActionForConditionByChekingIndex(ref i, 0, 210);
            }

            player.remove_condition_in_player(check_cond_strike_id);
            player.CastEndCS(_x, _z, check_cond_strike_id, 210);
        }
Exemplo n.º 2
0
        //spell 165
        public static async void SmokeBomb(Players player)
        {
            float duration = 5f;

            player.animation_id = 2;
            player.reset_animation_for_one();

            float _x = player.position_x;
            float _z = player.position_z;

            SmokeBombEffect(player, duration, _x, _z);

            string check_cond_strike_id = player.get_symb_for_IDs();

            player.set_condition_CS_type(165, check_cond_strike_id, _x, _z);

            for (float i = duration; i > 0; i++)
            {
                //wait 1 second
                await Task.Delay(1000);

                player.ActionForConditionByChekingIndex(ref i, 0, 165);
            }

            player.remove_condition_in_player(check_cond_strike_id);
            player.CastEndCS(_x, _z, check_cond_strike_id, 165);
        }
Exemplo n.º 3
0
        public static async void firebolt51(Players player, int energy_cost)
        {
            int   spell_id         = 51;
            float casting_time     = SpellSystem.GetCastingTimeOfSpell(51);
            float default_distance = SpellSystem.GetDistanceofApplyingSpell(51);


            if (!spells.StartCastingProcess(player, spell_id, casting_time, energy_cost, true, default_distance, -15, default_distance).Result)
            {
                return;
            }

            string check_cond_id2 = player.get_symb_for_IDs();

            player.animation_id = 5;
            player.reset_animation_for_one();
            float[]        magic_data       = new float[] { player.position_x, player.position_y, player.position_z, player.rotation_x, player.rotation_y, player.rotation_z };
            float          default_player_x = player.position_x;
            float          default_player_z = player.position_z;
            List <Players> result           = new List <Players>();

            for (float i = 0; i < 2; i += starter.TICKf)
            {
                functions.turn_to_enemy(player, 0.1f, default_distance, -15, default_distance);

                float curr_dist = functions.vector3_distance_unity(default_player_x, 0, default_player_z, magic_data[0], 0, magic_data[2]);
                if (curr_dist > default_distance)
                {
                    break;
                }

                functions.turn_object_to_enemy_indirect(player, ref magic_data, default_distance, -15, default_distance);
                functions.mover(ref magic_data, 0, 17, 1f, player.zone_type);

                player.set_condition_CS_type(51, check_cond_id2, magic_data[0], magic_data[2]);

                result = functions.get_all_nearest_enemy_inradius(magic_data[0], magic_data[2], player, 1);
                if (result.Count > 0)
                {
                    for (int u = 0; u < result.Count; u++)
                    {
                        if (result.Count > 0)
                        {
                            spells.make_direct_magic_damage_exact_enemy(player, result[u], 51, 0, 2, starter.standart_crit_koeff);
                        }
                    }

                    break;
                }

                if (magic_data[6] == 1)
                {
                    break;
                }
                await Task.Delay(starter.TICKi);
            }

            player.CastEndCS(magic_data[0], magic_data[2], check_cond_id2, 51);
            player.remove_condition_in_player(check_cond_id2);
        }
Exemplo n.º 4
0
        //spell52
        public static async void meteor(Players player)
        {
            //Players player = functions.GetPlayerData(table_id, mee);
            float  point_x       = player.position_x;
            float  point_z       = player.position_z;
            float  stun_duration = 2f;
            string cond_id       = player.get_symb_for_IDs();

            player.animation_id = 2;
            player.reset_animation_for_one();
            int spell_id = 52;

            for (float i = 0; i < 0.1f; i += starter.TICKf)
            {
                player.set_condition_CS_type(spell_id, cond_id, point_x, point_z);
                await Task.Delay(starter.TICKi);
            }
            await Task.Delay(1400);

            player.remove_condition_in_player(cond_id);
            //explosion============================================
            List <Players> result_p = functions.get_all_nearest_enemy_inradius(point_x, point_z, player, 3);

            List <string> conds_ids          = new List <string>();
            List <string> conds_ids_for_stun = new List <string>();

            for (int i = 0; i < result_p.Count; i++)
            {
                conds_ids.Add(player.get_symb_for_IDs());
                conds_ids_for_stun.Add(player.get_symb_for_IDs());
                spells.make_direct_magic_damage_exact_enemy(player, result_p[i], spell_id, 0, 2.5f, starter.standart_crit_koeff);
            }


            for (float i = stun_duration; i > 0; i -= starter.TICKf * 2)
            {
                for (int u = 0; u < result_p.Count; u++)
                {
                    result_p[u].make_stun(conds_ids_for_stun[u], i);
                    result_p[u].set_condition(CondType.co, spell_id, conds_ids[u], i);
                }

                await Task.Delay(starter.TICKi *2);
            }


            for (int i = 0; i < result_p.Count; i++)
            {
                result_p[i].remove_condition_in_player(conds_ids[i]);
                result_p[i].remove_condition_in_player(conds_ids_for_stun[i]);
                result_p[i].reset_animation_for_one();
                player.reset_animation_for_one();
            }

            player.CastEndCS(point_x, point_z, cond_id, spell_id);
        }
Exemplo n.º 5
0
        //spell 206 void zone
        public static async void frost_zone(Players player, float how_long, float groth_koeff, float radius, float power_koef)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(206);

            functions.turn_to_enemy(player, 0.1f, distance, 0, distance);
            Players aim = functions.get_one_nearest_enemy_inmelee(player, distance, 0, false);

            player.animation_id = 2;
            player.reset_animation_for_one();

            float coord_x, coord_z;

            if (aim == null)
            {
                coord_x = player.position_x;
                coord_z = player.position_z;
            }
            else
            {
                coord_x = aim.position_x;
                coord_z = aim.position_z;
            }

            string ID_for_cs = player.get_symb_for_IDs();

            player.set_condition_CS_type(206, ID_for_cs, coord_x, coord_z);

            float koef = power_koef;

            for (float u = how_long; u > 0; u -= 0.2f)
            {
                List <Players> aims = functions.get_all_nearest_enemy_inradius(coord_x, coord_z, player, radius);

                if (aims.Count > 0)
                {
                    //Console.WriteLine(player.spell_power / (4f * how_long) * koef / player.spell_power);
                    for (int i = 0; i < aims.Count; i++)
                    {
                        if (functions.assess_chance(20))
                        {
                            elementalist.freezing_slow(player, aims[i], 2f);
                        }
                        spells.make_direct_magic_damage_exact_enemy(player, aims[i], 206, 0, (player.Spell_power / (4f * how_long) * koef / player.Spell_power), 1.5f);
                    }
                }

                await Task.Delay(200);

                koef = koef + groth_koeff;
                player.ActionForConditionByChekingIndex(ref u, how_long, 206);
            }

            player.CastEndCS(coord_x, coord_z, ID_for_cs, 206);
        }
Exemplo n.º 6
0
        //spell 112
        public static async void PointOfForce(Players player)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(112);

            functions.turn_to_enemy(player, 0.1f, distance, 0, distance);
            float duration = 10f;

            player.animation_id = 2;
            player.reset_animation_for_one();

            float _x = player.position_x;
            float _z = player.position_z;

            Players enemy = functions.get_one_nearest_enemy_inmelee(player, distance - starter.def_hit_melee_dist, 0, false);

            if (enemy != null)
            {
                _x = enemy.position_x;
                _z = enemy.position_z;

                List <Players> all_enemies = functions.get_all_nearest_enemy_inradius(_x, _z, player, 3);

                if (all_enemies.Count > 0)
                {
                    for (int i = 0; i < all_enemies.Count; i++)
                    {
                        spells.make_direct_melee_damage_exact_enemy(player, all_enemies[i], 112, 0, 1, starter.standart_crit_koeff, 0);
                    }
                }
            }

            PointOfForceEffect(player, duration, _x, _z);

            string check_cond_strike_id = player.get_symb_for_IDs();

            player.set_condition_CS_type(112, check_cond_strike_id, _x, _z);

            for (float i = duration; i > 0; i++)
            {
                //wait 1 second
                await Task.Delay(1000);

                player.ActionForConditionByChekingIndex(ref i, 0, 112);
            }

            player.remove_condition_in_player(check_cond_strike_id);
            player.CastEndCS(_x, _z, check_cond_strike_id, 112);
        }
Exemplo n.º 7
0
        // spell 68
        public static void storm(Players player)
        {
            float default_distance = SpellSystem.GetDistanceofApplyingSpell(68);

            List <Players> enemies = functions.get_all_nearest_enemy_inradius(player.position_x, player.position_z, player, default_distance);
            Dictionary <Players, float> EnemiesAssess = new Dictionary <Players, float>();

            if (enemies.Count > 0)
            {
                for (int i = 0; i < enemies.Count; i++)
                {
                    float koeff = functions.distance(player, enemies[i]);
                    koeff = koeff < 2 ? 1 : koeff;
                    EnemiesAssess.Add(enemies[i], default_distance / koeff);
                }
            }

            string cond_for_player  = player.get_symb_for_IDs();
            string cond_for_enemies = player.get_symb_for_IDs();

            player.set_condition_CS_type(68, cond_for_player, player.position_x, player.position_z);
            player.remove_condition_in_player(cond_for_player);
            player.CastEndCS(player.position_x, player.position_z, cond_for_player, 68);

            if (EnemiesAssess.Count > 0)
            {
                foreach (var items in EnemiesAssess.Keys)
                {
                    spells.make_direct_magic_damage_exact_enemy(player, items, 68, 0, 0.5f, starter.standart_crit_koeff);
                    float koeff = EnemiesAssess[items];

                    spells.pooling(items, player.position_x, player.position_z, 8 * koeff, -0.4f * koeff, 0);
                    items.set_condition(CondType.co, 68, cond_for_enemies, 0.1f);
                    items.remove_condition_in_player(cond_for_enemies);
                }
            }
        }
Exemplo n.º 8
0
        //spell 110 stunning LEAP
        public static async void stunning_leap(Players player1, float max_distance)
        {
            Players enemy = functions.get_one_nearest_enemy_inmelee(player1, max_distance - 2, -10, true);

            string check_cond_id = player1.get_symb_for_IDs();

            functions.turn_to_enemy(player1, 0.1f, max_distance, -10, max_distance);

            float time_for_stun = 5f;


            float start_x = player1.position_x;
            float start_z = player1.position_z;

            player1.animation_id = 16;
            player1.start_spell_in_process();
            player1.is_reset_any_button = true;

            string check_cond_strike_id = player1.get_symb_for_IDs();

            for (float i = 0.3f; i > 0; i -= starter.TICKf)
            {
                if (player1.is_casting_stopped_by_spells())
                {
                    player1.reset_animation_for_one();
                    player1.remove_condition_in_player(check_cond_id);
                    player1.stop_spell_in_process();
                    player1.is_reset_any_button = false;
                    return;
                }
                float distance = functions.vector3_distance_unity(player1.position_x, 0, player1.position_z, start_x, 0, start_z);
                if (distance >= max_distance)
                {
                    player1.reset_animation_for_one();
                    break;
                }

                player1.set_condition(CondType.co, 110, check_cond_id, i);
                enemy = functions.get_one_nearest_enemy_inmelee(player1, -1.5f, -10, true);

                if (enemy != null)
                {
                    player1.animation_id = 0;
                    break;
                }

                float[] new_pos_rot = new float[] { player1.position_x, 0, player1.position_z, 0, player1.rotation_y, 0 };
                functions.mover(ref new_pos_rot, 0, 18, 1.05f, player1.zone_type); // 20 1.2
                player1.position_x = new_pos_rot[0];
                player1.position_y = new_pos_rot[1];
                player1.position_z = new_pos_rot[2];


                await Task.Delay(starter.TICKi);
            }


            player1.set_condition_CS_type(110, check_cond_strike_id, player1.position_x, player1.position_z);
            player1.CastEndCS(player1.position_x, player1.position_z, check_cond_strike_id, 110);

            List <Players> enemies = functions.get_all_nearest_enemy_inradius(player1.position_x, player1.position_z, player1, 2);

            if (enemies.Count > 0)
            {
                for (int u = 0; u < enemies.Count; u++)
                {
                    MakeStun(enemies[u], time_for_stun, 110);
                    spells.make_direct_melee_damage_exact_enemy(player1, enemies[u], 110, 0, 1.5f, starter.standart_crit_koeff, 0);
                }
            }

            //await Task.Delay(500);

            player1.stop_spell_in_process();
            player1.reset_animation_for_one();
            player1.remove_condition_in_player(check_cond_id);
            player1.remove_condition_in_player(check_cond_strike_id);

            await Task.Delay(1000);

            player1.is_reset_any_button = false;
        }
Exemplo n.º 9
0
        //spell 106 throw axe
        public static async void throw_axe(Players player, float distance)
        {
            player.is_spell_in_process = true;
            player.is_reset_any_button = true;

            player.animation_id = 11;
            player.reset_animation_for_one();
            float time_to_fly_there = 2f;
            float time_to_fly_back  = 2f;

            functions.turn_to_enemy(player, 0.1f, distance, 0, distance);

            float[] axe_aim_coords = new float[2] {
                player.position_x, player.position_z
            };
            float [] axe_start_coords = new float[2] {
                player.position_x, player.position_z
            };
            float[] axe_current_coords = new float[2] {
                player.position_x, player.position_z
            };
            float rot_y = player.rotation_y;

            string ID_for_cs = player.get_symb_for_IDs();

            player.set_condition_CS_type(106, ID_for_cs, player.position_x, player.position_z);

            functions.projection(ref axe_aim_coords, player.position_x, player.position_z, player.rotation_y, distance, player.zone_type);

            await Task.Delay(350);

            player.is_reset_any_button = false;
            functions.turn_to_enemy(player, 0.1f, distance, 0, distance);

            List <Players> victims     = new List <Players>();
            List <Players> pre_victims = new List <Players>();

            float koef = 0;

            for (float i = time_to_fly_there; i > 0; i -= 0.2f)
            {
                functions.lerp(ref axe_current_coords, axe_start_coords[0], axe_start_coords[1], axe_aim_coords[0], axe_aim_coords[1], rot_y, koef * (1f / (time_to_fly_there / 0.2f)));


                player.set_condition_CS_type(106, ID_for_cs, axe_current_coords[0], axe_current_coords[1]);

                if (koef > 0)
                {
                    pre_victims = functions.get_all_nearest_enemy_inradius(axe_current_coords[0], axe_current_coords[1], player, 1.5f);
                    if (pre_victims.Count > 0)
                    {
                        for (int iii = 0; iii < pre_victims.Count; iii++)
                        {
                            if (!victims.Contains(pre_victims[iii]))
                            {
                                victims.Add(pre_victims[iii]);
                                spells.make_direct_melee_damage_exact_enemy(player, pre_victims[iii], 106, 0, 0.5f, starter.standart_crit_koeff, 0);
                                slow(pre_victims[iii], 0.4f, 3f);
                            }
                        }
                    }
                }


                await Task.Delay((int)(koef * 100 / (time_to_fly_there / 0.2f)));

                koef++;
            }
            axe_start_coords[0] = axe_current_coords[0];
            axe_start_coords[1] = axe_current_coords[1];
            victims.Clear();
            pre_victims.Clear();

            //========
            koef = 0;
            float[] axe_y = new float[6] {
                axe_current_coords[0], 0, axe_current_coords[1], 0, rot_y, 0
            };
            for (float i = time_to_fly_back; i > 0; i -= 0.2f)
            {
                functions.turn_object_to_exact_player(player, ref axe_y);
                functions.lerp(ref axe_current_coords, axe_start_coords[0], axe_start_coords[1], player.position_x, player.position_z, axe_y[4], koef * (1f / (time_to_fly_back / 0.2f)));

                axe_y[0] = axe_current_coords[0];
                axe_y[2] = axe_current_coords[1];


                player.set_condition_CS_type(106, ID_for_cs, axe_current_coords[0], axe_current_coords[1]);

                if (koef > 1f)
                {
                    pre_victims = functions.get_all_nearest_enemy_inradius(axe_current_coords[0], axe_current_coords[1], player, 0.5f);
                    if (pre_victims.Count > 0)
                    {
                        for (int iii = 0; iii < pre_victims.Count; iii++)
                        {
                            if (!victims.Contains(pre_victims[iii]))
                            {
                                victims.Add(pre_victims[iii]);
                                spells.make_direct_melee_damage_exact_enemy(player, pre_victims[iii], 106, 0, 0.5f, starter.standart_crit_koeff, 0);
                                slow(pre_victims[iii], 0.4f, 3f);
                            }
                        }
                    }
                }

                await Task.Delay((int)(((time_to_fly_back / 0.2f) - koef) * 10));

                koef++;
            }

            player.is_spell_in_process = false;
            player.CastEndCS(player.position_x, player.position_z, ID_for_cs, 106);
        }
Exemplo n.º 10
0
        //spell 214
        public static async void ChangePlaces(Players player)
        {
            int   spell_id         = 214;
            float casting_time     = SpellSystem.GetCastingTimeOfSpell(spell_id);
            float default_distance = SpellSystem.GetDistanceofApplyingSpell(spell_id);



            if (!spells.StartCastingProcess(player, spell_id, casting_time, SpellSystem.GetEnergyCostofSpell(spell_id), true, default_distance, -10, default_distance).Result)
            {
                return;
            }

            string check_cond_id2 = player.get_symb_for_IDs();

            float[]        magic_data       = new float[] { player.position_x, player.position_y, player.position_z, player.rotation_x, player.rotation_y, player.rotation_z };
            float          default_player_x = player.position_x;
            float          default_player_z = player.position_z;
            List <Players> result           = new List <Players>();

            for (float i = 0; i < 2; i += starter.TICKf)
            {
                functions.turn_to_enemy(player, 0, default_distance, -10, default_distance);

                float curr_dist = functions.vector3_distance_unity(default_player_x, 0, default_player_z, magic_data[0], 0, magic_data[2]);

                if (curr_dist > default_distance)
                {
                    player.CastEndCS(magic_data[0], magic_data[2], check_cond_id2, spell_id);
                    break;
                }

                functions.turn_object_to_enemy_indirect(player, ref magic_data, default_distance, -15, default_distance);
                functions.mover(ref magic_data, 0, 17, 1f, player.zone_type);

                player.set_condition_CS_type(spell_id, check_cond_id2, magic_data[0], magic_data[2]);

                result = functions.get_all_nearest_players_inradius(magic_data[0], magic_data[2], player, 1);
                if (result.Count > 0)
                {
                    bool isOK = false;

                    for (int iu = 0; iu < result.Count; iu++)
                    {
                        if (result[iu] != player)
                        {
                            ChangePlacesOneAnother(player, result[iu]);
                            isOK = true;
                            break;
                        }
                    }

                    if (isOK)
                    {
                        player.CastEndCS(magic_data[0], magic_data[2], check_cond_id2, spell_id);
                        break;
                    }
                }

                if (magic_data[6] == 1)
                {
                    break;
                }
                await Task.Delay(starter.TICKi);
            }
            player.remove_condition_in_player(check_cond_id2);
        }
Exemplo n.º 11
0
        //spell 202
        public static async void black_hole(Players player, float how_long)
        {
            //Players player = functions.GetPlayerData(table_id, mee);
            float distance   = SpellSystem.GetDistanceofApplyingSpell(202);
            float init_force = 20;
            float init_speed = 1;

            string check_cond_id  = player.get_symb_for_IDs();
            string check_cond_id2 = player.get_symb_for_IDs();

            player.animation_id = 2;
            player.reset_animation_for_one();
            float new_x = player.position_x;
            float new_z = player.position_z;

            player.set_condition_CS_type(202, check_cond_id, new_x, new_z);
            player.remove_condition_in_player(check_cond_id);
            List <Players> result = new List <Players>();

            for (float i = how_long; i > 0; i -= starter.TICKf * 2)
            {
                result = functions.get_all_nearest_enemy_inradius(new_x, new_z, player, distance);

                if (result.Count > 0)
                {
                    for (int u = 0; u < result.Count; u++)
                    {
                        if (result[u].is_immune_to_movement_imparing)
                        {
                            continue;
                        }

                        result[u].position_x = new_x;
                        result[u].position_z = new_z;

                        result[u].set_condition(CondType.co, 202, check_cond_id2, i);
                        init_force = 20;
                        init_speed = 1;

                        for (int uu = 0; uu < 2; uu++)
                        {
                            float checker = functions.vector3_distance_unity(new_x, 0, new_z, result[u].position_x, 0, result[u].position_z);
                            if ((checker / distance) <= 0.4)
                            {
                                float koef = checker / (distance * 0.4f);
                                init_force = init_force * koef;
                                init_speed = init_speed * koef;
                            }
                            else
                            {
                                init_force = 20;
                                init_speed = 1;
                            }
                            spells.pooling(result[u], new_x, new_z, init_force, init_speed, 0);
                        }
                    }
                }

                await Task.Delay(starter.TICKi *2);
            }

            player.CastEndCS(-990, -990, check_cond_id, 202);

            for (int i = 0; i < result.Count; i++)
            {
                result[i].remove_condition_in_player(check_cond_id2);
            }

            player.remove_condition_in_player(check_cond_id);
        }