Beispiel #1
0
        //spell 205 curse of casting
        public static void cast_curse_of_casting(Players player, float how_long, int energy_cost)
        {
            player.animation_id = 2;
            player.reset_animation_for_one();

            float casting_time = SpellSystem.GetCastingTimeOfSpell(205);
            float distance     = SpellSystem.GetDistanceofApplyingSpell(205);
            int   spell_id     = 205;

            player.start_spell_in_process();



            if (!spells.StartCastingProcess(player, spell_id, casting_time, energy_cost, true, distance, 0, distance).Result)
            {
                return;
            }


            Players enemy = functions.get_one_nearest_enemy_inmelee(player, distance, -10, false);

            if (enemy != null)
            {
                curse_of_casting(player, enemy, how_long);
            }
        }
Beispiel #2
0
        //spell 105 power attack
        public static async void power_attack(Players player, int manacost)
        {
            //Players player = functions.GetPlayerData(table_id, me);

            if (!spells.StartCastingProcess(player, 105, SpellSystem.GetCastingTimeOfSpell(105), manacost, true, 2, -15, 2).Result)
            {
                return;
            }

            spells.make_splash_melee_damage(player, 105, 11, 2, starter.standart_crit_koeff, 0.3f, 0.5f, 0);
            await Task.Delay(300);

            List <Players> all_players = functions.get_all_nearest_enemy_inmelee(player, 0.5f, 0);

            if (all_players.Count > 0)
            {
                for (int i = 0; i < all_players.Count; i++)
                {
                    if (!spells.if_resisted_nonmagic(player, all_players[i]))
                    {
                        spells.fall_down_get_app(all_players[i], 10f);
                        spells.pooling_ver2(player, all_players[i], 15, 2, 0);
                    }
                }
            }
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public static int Main(String[] args)
        {
            //stopWatch.Start();

            data_config.Init_data_config();
            Thread.Sleep(2000);
            SpellSystem.SpellSystemInit();

            //Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~AITest001", "testing"));
            Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~session", "127.0.0.1"));
            Thread.Sleep(1000);
            //Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~Test22", "127.0.0.1"));
            //Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~AITestBOTS", "127.0.0.1"));
            Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~TestBots", "127.0.0.1"));
            //Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~AITest", "127.0.0.1"));
            //Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~AITestTEST", "127.0.0.1"));
            //Console.WriteLine(packet_analyzer.ProcessTCPPacket("0~2~passpass~AITestMage", "127.0.0.1"));
            Task.Run(() => ttt());
            //Task.Run(() => do_every_tick());
            //Task.Run(() => er());

            server.Server_init();

            Console.WriteLine("ready to exit...");
            Console.ReadKey();
            return(0);
        }
Beispiel #5
0
        //spell 215
        public static void Polymorphism(Players player)
        {
            int   spell_id         = 215;
            float casting_time     = SpellSystem.GetCastingTimeOfSpell(spell_id);
            float default_distance = SpellSystem.GetDistanceofApplyingSpell(spell_id);

            functions.turn_to_enemy(player, 0, default_distance, 0, default_distance);

            Players enemy = functions.get_one_nearest_enemy_inmelee(player, default_distance, 0, false);

            if (enemy == null)
            {
                return;
            }

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

            functions.turn_to_enemy(player, 0, default_distance, 0, default_distance);

            if (enemy == null)
            {
                enemy = functions.get_one_nearest_enemy_inmelee(player, default_distance, 0, false);
            }

            if (enemy == null)
            {
                return;
            }

            Polymorp(player, enemy, 5f);
        }
Beispiel #6
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);
        }
Beispiel #7
0
        private void SetCooldownsAfterExecSpell(int spell)
        {
            int numberForCase = GetSpellPositionIfAvailable(CurrentBotPlayer, spell);

            CoolDownsForSpells[numberForCase] = DateTime.Now.AddSeconds(SpellSystem.GetSpellCoolDownTime(spell));
            TimeForSpellsActing = DateTime.Now.AddSeconds(1);
        }
Beispiel #8
0
        //fire armor 61
        public static async void fire_armor(Players player, float how_long)
        {
            if (spells.isPositiveCondAllreadyHere(player, 61))
            {
                return;
            }

            float base_armor = 300f;

            player.Armor       += base_armor;
            player.animation_id = 2;
            player.reset_animation_for_one();

            string ID_cond = player.get_symb_for_IDs();

            for (float i = how_long; i > 0; i -= 0.2f)
            {
                try
                {
                    foreach (var searched_ID in player.conditions)
                    {
                        if (player.conditions[searched_ID.Key].GetDataForPacketSending().Contains("dt"))
                        {
                            int _spell = player.conditions[searched_ID.Key].GetCurrentSpellNumber();

                            if ((SpellSystem.GetSpellMainPurpose(_spell) == SpellMainPurpose.making_damage_close || SpellSystem.GetSpellMainPurpose(_spell) == SpellMainPurpose.making_damage_close_after_close_up) && SpellSystem.GetSpellCategory(_spell) == SpellTypeCategory.physical)
                            {
                                foreach (Players pl in starter.SessionsPool[player.Session_ID].LocalPlayersPool.Values)
                                {
                                    if (pl.conditions.ContainsKey(searched_ID.Key) && pl.player_id != player.player_id)
                                    {
                                        if (!pl.is_cond_here_by_type_and_spell(CondType.co, 57))
                                        {
                                            burning(player, pl);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(DateTime.Now + ": error in making somebody burning when strike fire armor - spell61" + ex);
                }



                player.set_condition(CondType.co, 61, ID_cond, i);

                await Task.Delay(200);

                player.ActionForConditionByChekingIndex(ref i, how_long, 61);
            }

            player.Armor -= base_armor;

            player.remove_condition_in_player(ID_cond);
        }
Beispiel #9
0
        //whirlwind 111
        public static async void Whirlwind(Players player)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(111);

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

            player.animation_id                   = 15;
            player.is_reset_any_button            = true;
            player.is_immune_to_movement_imparing = true;
            float duration = 1f;
            float init_x   = player.position_x;
            float init_z   = player.position_z;

            HashSet <Players> damagedEnemies = new HashSet <Players>();
            string            cond_id        = player.get_symb_for_IDs();

            for (float i = duration; i > 0; i -= starter.TICKf)
            {
                player.set_condition(CondType.co, 111, cond_id, i);

                if (functions.vector3_distance_unity(init_x, 0, init_z, player.position_x, 0, player.position_z) >= distance)
                {
                    break;
                }
                else
                {
                    //movement
                    float[] new_pos_rot = new float[] { player.position_x, 0, player.position_z, 0, player.rotation_y, 0 };
                    functions.mover(ref new_pos_rot, 0, 10, 1f, player.zone_type);
                    player.position_x = new_pos_rot[0];
                    player.position_y = new_pos_rot[1];
                    player.position_z = new_pos_rot[2];

                    //damage
                    List <Players> enemies = functions.get_all_nearest_enemy_inradius(player.position_x, player.position_z, player, 1.2f);

                    if (enemies.Count != 0)
                    {
                        for (int u = 0; u < enemies.Count; u++)
                        {
                            if (!damagedEnemies.Contains(enemies[u]))
                            {
                                spells.make_direct_melee_damage_exact_enemy(player, enemies[u], 111, 0, 1.5f, starter.standart_crit_koeff, 0);
                                damagedEnemies.Add(enemies[u]);
                            }
                        }
                    }
                }

                await Task.Delay(starter.TICKi);
            }

            player.remove_condition_in_player(cond_id);
            player.reset_animation_for_one();
            player.is_reset_any_button            = false;
            player.is_immune_to_movement_imparing = false;
        }
Beispiel #10
0
        //spell 108
        public static async void breakthrough(Players player)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(108);

            string cond_ID = player.get_symb_for_IDs();

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

            player.is_reset_any_button = true;

            float[] new_pos_rot = new float[] { player.position_x, 0, player.position_z, 0, player.rotation_y, 0 };

            List <Players> aims = new List <Players>();

            for (float i = 0.7f; i > 0; i -= starter.TICKf)
            {
                if (player.is_casting_stopped_by_spells())
                {
                    break;
                }

                player.set_condition(CondType.co, 108, cond_ID, i);
                functions.mover(ref new_pos_rot, 0, 12, 1f, player.zone_type);
                player.position_x = new_pos_rot[0];
                player.position_z = new_pos_rot[2];
                player.rotation_y = new_pos_rot[4];
                List <Players> pre_aims = functions.get_all_nearest_enemy_inradius(player.position_x, player.position_z, player, 0.75f);



                for (int ii = 0; ii < pre_aims.Count; ii++)
                {
                    if (!aims.Contains(pre_aims[ii]))
                    {
                        if (!spells.if_resisted_nonmagic(player, pre_aims[ii]))
                        {
                            spells.fall_down_get_app(pre_aims[ii], 0.5f);
                            spells.pooling_ver2(player, pre_aims[ii], 8, 1, 0);
                        }

                        aims.Add(pre_aims[ii]);
                    }
                }

                await Task.Delay(starter.TICKi);

                player.ActionForConditionByChekingIndex(ref i, 0.7f, 108);
            }

            player.is_reset_any_button = false;
            player.remove_condition_in_player(cond_ID);
            player.reset_animation_for_one();
        }
Beispiel #11
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);
        }
Beispiel #12
0
        //shield bash 4
        public static async void shield_bash(Players player, float stun_time, int energy_cost)
        {
            float cast_time = SpellSystem.GetCastingTimeOfSpell(4);

            if (!spells.StartCastingProcess(player, 4, cast_time, energy_cost, true, 1, 20, 2).Result)
            {
                return;
            }

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

            List <Players> all_needed_players = new List <Players>();

            all_needed_players = functions.get_all_nearest_enemy_inmelee(player, 1, 20);
            if (all_needed_players != null)
            {
                List <string> conds_ids      = new List <string>();
                List <string> conds_ids_stun = new List <string>();
                for (int ii = 0; ii < all_needed_players.Count; ii++)
                {
                    conds_ids.Add(functions.get_symb_for_IDs());
                    conds_ids_stun.Add(functions.get_symb_for_IDs());
                    if (ii == 0)
                    {
                        functions.turn_face_to_face(player, all_needed_players[ii]);
                    }
                    spells.make_splash_melee_damage(player, 4, 0, 2, starter.standart_crit_koeff, 0, 1, 20);
                }
                for (float i = stun_time; i > 0; i -= starter.TICKf * 2)
                {
                    for (int u = 0; u < all_needed_players.Count; u++)
                    {
                        all_needed_players[u].make_stun(conds_ids_stun[u], i);
                        all_needed_players[u].set_condition(CondType.co, 4, conds_ids[u], i);
                    }
                    await Task.Delay(starter.TICKi *2);
                }
                for (int u = 0; u < all_needed_players.Count; u++)
                {
                    all_needed_players[u].animation_id = 0;
                }
                for (int ii = 0; ii < all_needed_players.Count; ii++)
                {
                    all_needed_players[ii].remove_condition_in_player(conds_ids[ii]);
                    all_needed_players[ii].remove_condition_in_player(conds_ids_stun[ii]);
                }
            }
            else
            {
                player.reset_animation_for_one();
            }
        }
Beispiel #13
0
        //spell 204
        public static async void auto_heal(Players player, float how_long, float heal_amount, int energy_cost)
        {
            player.animation_id = 2;
            player.reset_animation_for_one();

            if (spells.isPositiveCondAllreadyHere(player, 204))
            {
                return;
            }

            player.is_immune_to_melee = true;

            float casting_time = SpellSystem.GetCastingTimeOfSpell(204);
            int   spell_id     = 204;


            if (!spells.StartCastingProcess(player, spell_id, casting_time, energy_cost, false, 0, 0, 0).Result)
            {
                return;
            }


            string                      check_cond_id2 = player.get_symb_for_IDs();
            HashSet <string>            ids            = new HashSet <string>();
            Dictionary <string, string> conds          = new Dictionary <string, string>();

            int stacks = 0;

            for (float i = how_long; i > 0; i -= starter.TICKf * 2)
            {
                player.set_condition(CondType.co, 204, check_cond_id2, i, stacks);

                if (player.is_cond_here_by_type(CondType.dt) && !ids.Contains(player.get_id_by_type(CondType.dt)))
                {
                    ids.Add(player.get_id_by_type(CondType.dt));
                    spells.healing(player, player, 204, heal_amount, 1, starter.standart_crit_koeff);
                    stacks++;
                }

                if (stacks > 5)
                {
                    break;
                }


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

                player.ActionForConditionByChekingIndex(ref i, how_long, 204);
            }

            player.remove_condition_in_player(check_cond_id2);
            player.is_immune_to_melee = false;
        }
Beispiel #14
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);
        }
Beispiel #15
0
        //spell 212
        public static void DrainEnergy(Players player)
        {
            float casting_time = SpellSystem.GetCastingTimeOfSpell(212);
            float distance     = SpellSystem.GetDistanceofApplyingSpell(212);

            if (!spells.StartCastingProcess(player, 212, casting_time, SpellSystem.GetEnergyCostofSpell(211), true, distance, 0, distance).Result)
            {
                return;
            }

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

            Players enemy = functions.get_one_nearest_enemy_inradius(player, distance, false);

            if (enemy == null)
            {
                return;
            }

            DrainEnergyEffect(player, enemy, 10f);
        }
Beispiel #16
0
        //spell 208 break cast
        public static void break_casting(Players player)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(208);

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

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

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

            if (aim == null)
            {
                return;
            }

            if (aim.is_cond_here_by_type(CondType.ca))
            {
                aim.make_broken_casting();
                spells.make_direct_magic_damage_exact_enemy(player, aim, 208, 0, 1f, 2f);
            }
        }
Beispiel #17
0
        //invizibility 157 and 174
        public static async void from_inviz_to_viz(Players player)
        {
            player.is_invisible = false;
            string check_cond_strike_id = player.get_symb_for_IDs();
            float  cooldown             = SpellSystem.GetSpellCoolDownTime(174);

            player.set_condition(CondType.co, 157, check_cond_strike_id, 0);

            player.remove_condition_in_player(player.get_id_by_type_and_spell(CondType.co, 153));
            player.remove_condition_in_player(check_cond_strike_id);

            string id_cond_stop_invis = player.get_symb_for_IDs();

            for (float i = cooldown; i > 0; i--)
            {
                player.set_condition(CondType.co, 174, id_cond_stop_invis, i);
                await Task.Delay(1000);

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

            player.remove_condition_in_player(id_cond_stop_invis);
        }
Beispiel #18
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);
                }
            }
        }
Beispiel #19
0
        //spell 9 RAM charge
        public static async void ram(Players me)
        {
            //Players me = functions.GetPlayerData(table_id, mee);

            float distance = SpellSystem.GetDistanceofApplyingSpell(9);
            float start_x  = me.position_x;
            float start_z  = me.position_z;

            me.is_reset_any_button = true;
            string check_cond_id = me.get_symb_for_IDs();

            functions.turn_to_enemy(me, 0.1f, distance, -15, distance);

            for (float i = 0.5f; i > 0; i -= starter.TICKf)
            {
                if (!me.is_casting_stopped_by_spells())
                {
                    functions.turn_to_enemy(me, 0.1f, distance, -15, distance);
                    float curr_dist = functions.vector3_distance_unity(start_x, 0, start_z, me.position_x, 0, me.position_z);

                    if (curr_dist >= distance)
                    {
                        me.remove_condition_in_player(check_cond_id);
                        me.is_reset_any_button = false;
                        me.reset_animation_for_one();
                        return;
                    }
                    else
                    {
                        float[] res = new float[] { me.position_x, 0, me.position_z, 0, me.rotation_y, 0 };
                        functions.mover(ref res, 0, 20, 1, me.zone_type);
                        me.position_x   = res[0];
                        me.position_z   = res[2];
                        me.animation_id = 101;
                    }

                    me.set_condition(CondType.co, 9, check_cond_id, i);
                    Players enemy = functions.get_one_nearest_enemy_inmelee(me, -1.5f, -10, true);
                    if (enemy != null)
                    {
                        me.reset_animation_for_one();

                        if (!spells.if_resisted_nonmagic(me, enemy))
                        {
                            me.animation_id = 9;
                            await Task.Delay(200);

                            spells.make_direct_melee_damage(me, 9, 0, 1, 2, 0);
                            spells.fall_down_get_app(enemy, 0.5f);
                            me.remove_condition_in_player(check_cond_id);
                            me.reset_animation_for_one();
                            await Task.Delay(700);

                            me.is_reset_any_button = false;

                            return;
                        }
                        else
                        {
                            me.remove_condition_in_player(check_cond_id);
                            me.is_reset_any_button = false;
                            me.animation_id        = 0;

                            me.inform_of_cancel_casting(9, check_cond_id);
                            break;
                        }
                    }
                }
                else
                {
                    me.inform_of_cancel_casting(9, check_cond_id);
                    me.remove_condition_in_player(check_cond_id);
                    me.is_reset_any_button = false;
                    me.reset_animation_for_one();
                    return;
                }

                await Task.Delay(starter.TICKi);
            }

            me.remove_condition_in_player(check_cond_id);

            me.reset_animation_for_one();

            me.is_reset_any_button = false;
        }
Beispiel #20
0
        //pistol shot 156
        public static async void pistol_shot(Players player)
        {
            float shot_distance   = SpellSystem.GetDistanceofApplyingSpell(156);
            float time_for_aiming = 2f;

            string check_cond_id        = player.get_symb_for_IDs();
            string check_immob_id       = player.get_symb_for_IDs();
            string check_cond_strike_id = player.get_symb_for_IDs();

            player.start_spell_in_process();
            bool isShooted = false;

            float[] bullet_pos_for_assess = new float[2];

            for (float i = time_for_aiming; i > 0; i -= starter.TICKf * 2)
            {
                if (!player.is_casting_stopped_by_spells())
                {
                    player.make_immob(check_immob_id, i);

                    player.set_condition(CondType.ca, 156, check_cond_id, i);
                    functions.turn_to_enemy(player, 0.1f, shot_distance, -10, shot_distance);

                    if (i > 0.5f)
                    {
                        player.animation_id = 20; //raise gun
                    }
                    else
                    {
                        player.animation_id = 21; //make shot

                        if (!isShooted)
                        {
                            isShooted = true;
                            float pos_x = player.position_x;
                            float pos_z = player.position_z;
                            float rot_y = player.rotation_y;

                            List <Players> candidates = player.GetAllPlayersInList();

                            for (int c = 0; c < candidates.Count; c++)
                            {
                                if (candidates[c].player_id == player.player_id || candidates[c].team_id == player.team_id)
                                {
                                    candidates.Remove(candidates[c]);
                                }
                            }


                            bool isFound = false;
                            for (float d = 0; d < shot_distance; d += 0.2f)
                            {
                                functions.projection(ref bullet_pos_for_assess, pos_x, pos_z, rot_y, d, player.zone_type);

                                for (int c = 0; c < candidates.Count; c++)
                                {
                                    if (functions.vector3_distance_unity(bullet_pos_for_assess[0], 0, bullet_pos_for_assess[1], candidates[c].position_x, 0, candidates[c].position_z) < 0.25f)
                                    {
                                        spells.melee_damage(player, candidates[c], 156, 7, starter.standart_crit_koeff + 0.5f);

                                        player.set_condition_CS_type(156, check_cond_strike_id, candidates[c].position_x, candidates[c].position_z);

                                        player.remove_condition_in_player(check_cond_strike_id);

                                        isFound = true;
                                        break;
                                    }
                                }

                                if (isFound)
                                {
                                    break;
                                }
                            }

                            if (!isFound)
                            {
                                player.set_condition_CS_type(156, check_cond_strike_id, bullet_pos_for_assess[0], bullet_pos_for_assess[1]);

                                player.remove_condition_in_player(check_cond_strike_id);
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
                else
                {
                    player.inform_of_cancel_casting(156, check_cond_id);
                    break;
                }

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

                player.ActionForConditionByChekingIndex(ref i, time_for_aiming, 156);
            }

            await Task.Delay(400);

            player.remove_condition_in_player(check_cond_id);

            player.remove_condition_in_player(check_immob_id);
            player.stop_spell_in_process();


            player.reset_animation_for_one();
        }
Beispiel #21
0
        //spell 209
        public static async void cast_confusion(Players player, float confusion_time)
        {
            float casting_time = SpellSystem.GetCastingTimeOfSpell(209);
            float distance     = SpellSystem.GetDistanceofApplyingSpell(209);

            player.start_spell_in_process();

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

            if (!spells.StartCastingProcess(player, 209, casting_time, SpellSystem.GetEnergyCostofSpell(209), true, distance, 0, distance).Result)
            {
                return;
            }

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

            if (aim == null)
            {
                return;
            }

            string cond_id_conf = player.get_symb_for_IDs();

            float[] new_pos_rot = new float[] { aim.position_x, 0, aim.position_z, 0, aim.rotation_y, 0 };

            float dist = functions.vector3_distance_unity(player.position_x, 0, player.position_z, aim.position_x, 0, aim.position_z);

            if (dist <= 10)
            {
                spells.pooling_ver2(player, aim, (20 - dist), 15f / (1f + dist), 0);
            }
            await Task.Delay(50);

            aim.Speed *= 0.6f;

            if (spells.isNegativeMagicCondAllreadyHere(player, aim, 209))
            {
                return;
            }

            for (float i = confusion_time; i > 0; i -= starter.TICKf * 2)
            {
                aim.set_condition(CondType.co, 209, cond_id_conf, i);

                new_pos_rot = new float[] { aim.position_x, 0, aim.position_z, 0, aim.rotation_y, 0 };

                Random rnd  = new Random();
                Random rnd2 = new Random();
                switch (rnd2.Next(0, 6))
                {
                case 0:
                    new_pos_rot[4] = rnd.Next(0, 180);
                    functions.mover(ref new_pos_rot, 0, rnd2.Next(2, 6), 1.1f, aim.zone_type);
                    break;

                case 1:
                    new_pos_rot[4] = rnd.Next(-180, 0);
                    functions.mover(ref new_pos_rot, 0, rnd2.Next(2, 6), 1.1f, aim.zone_type);
                    break;

                case 2:
                    new_pos_rot[4] = rnd.Next(-90, 90);
                    functions.mover(ref new_pos_rot, 0, rnd2.Next(2, 6), 1.1f, aim.zone_type);
                    break;

                case 3:
                    functions.mover(ref new_pos_rot, 0, -5, 1.3f, aim.zone_type);
                    break;

                case 4:
                    functions.mover(ref new_pos_rot, 0, -5, 1.1f, aim.zone_type);
                    break;

                case 5:
                    functions.mover(ref new_pos_rot, 0, -5, 1.1f, aim.zone_type);
                    break;
                }



                aim.position_x = new_pos_rot[0];
                aim.position_z = new_pos_rot[2];
                aim.rotation_y = new_pos_rot[4];

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

                aim.ActionForConditionByChekingIndex(ref i, confusion_time, 209);
            }

            aim.Speed /= 0.6f;
            aim.remove_condition_in_player(cond_id_conf);
        }
Beispiel #22
0
        //spell 158
        public static async void Poison_Any_init(Players player, int spell_id)
        {
            //casting
            if (!spells.StartCastingProcess(player, spell_id, SpellSystem.GetCastingTimeOfSpell(spell_id), SpellSystem.GetEnergyCostofSpell(spell_id), false, 0, 0, 0).Result)
            {
                return;
            }

            if (spells.isPositiveCondAllreadyHere(player, spell_id))
            {
                return;
            }

            List <int> PoisonSpells = new List <int> {
                156, 167, 168, 169, 170, 171
            };
            List <int> PoisonInitSpells = new List <int> {
                158, 159, 160, 161, 162
            };

            //remove any existing poison buff before aaplying new
            try
            {
                foreach (ConditionsPacket keys in player.conditions.Values)
                {
                    int currentSpellNumber = keys.GetCurrentSpellNumber();
                    if (PoisonInitSpells.Contains(currentSpellNumber))
                    {
                        player.remove_condition_in_player(player.get_id_by_type_and_spell(CondType.co, currentSpellNumber));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }



            //animation for poison adding
            //player.animation_id = 2;
            //player.reset_animation_for_one();

            HashSet <string> usedIDs = new HashSet <string>();

            float time = 10f;

            string condID = player.get_symb_for_IDs();

            for (float i = time; i > 0; i -= starter.TICKf * 2)
            {
                player.set_condition(CondType.co, spell_id, condID, i);

                try
                {
                    foreach (string _keys in player.conditions.Keys)
                    {
                        if (player.conditions[_keys].isContainsCondType(CondType.dg) && player.conditions[_keys].GetDamageOrHealApplied() > 0 && !usedIDs.Contains(_keys) && !PoisonSpells.Contains(player.conditions[_keys].GetCurrentSpellNumber()))
                        {
                            Players enemy = player.get_another_player_by_id_in_conds(_keys, player.Session_ID);

                            if (enemy == null)
                            {
                                continue;
                            }

                            usedIDs.Add(_keys);

                            Console.WriteLine(_keys);

                            switch (spell_id)
                            {
                            case 158:
                                Apply_Poison_Slow(player, enemy);
                                break;

                            case 159:
                                Apply_Poison_Antiheal(player, enemy);
                                break;

                            case 160:
                                Apply_Poison_MeltArmor(player, enemy);
                                break;

                            case 161:
                                spells.make_direct_melee_damage_exact_enemy(player, enemy, 170, 0, 0.3f, starter.standart_crit_koeff + 0.5f, 0);
                                break;

                            case 162:
                                Apply_Poison_Antimagic(player, enemy);
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

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

                player.ActionForConditionByChekingIndex(ref i, time, spell_id);
            }

            player.remove_condition_in_player(condID);
        }
Beispiel #23
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);
        }
Beispiel #24
0
        //spell 164
        public static async void Escape(Players player)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(164);

            //animation for jump back
            //player.animation_id = 2;
            //player.reset_animation_for_one();
            player.is_reset_any_button = true;

            player.add_stop_to_spec_conditions(1);

            float init_x = player.position_x;
            float init_z = player.position_z;

            for (float i = 0.3f; i > 0; i -= starter.TICKf)
            {
                Console.WriteLine(functions.vector3_distance_unity(init_x, 0, init_z, player.position_x, 0, player.position_z));
                if (functions.vector3_distance_unity(init_x, 0, init_z, player.position_x, 0, player.position_z) >= distance)
                {
                    break;
                }
                float[] newPosition = new float[6] {
                    player.position_x, 0, player.position_z, 0, player.rotation_y, 0
                };

                functions.mover(ref newPosition, 0, -14, 1f, player.zone_type);
                player.position_x = newPosition[0];
                player.position_z = newPosition[2];

                await Task.Delay(starter.TICKi);
            }

            invizibility(player);

            player.is_reset_any_button = false;
            player.stop_spell_in_process();

            player.remove_stop_to_spec_conditions(1);

            string condID = player.get_symb_for_IDs();

            for (float i = 10; i > 0; i -= 0.25f)
            {
                player.set_condition(CondType.co, 164, condID, i);
                await Task.Delay(250);

                player.ActionForConditionByChekingIndex(ref i, 0, 164);

                if (!player.is_invisible)
                {
                    break;
                }
            }

            player.remove_condition_in_player(condID);

            if (player.is_invisible)
            {
                from_inviz_to_viz(player);
            }
        }
Beispiel #25
0
        //spell 166
        public static async void SmokeBombEffect(Players player, float duration, float x, float z)
        {
            Dictionary <Players, string> _buffedPlayersOnline    = new Dictionary <Players, string>();
            Dictionary <Players, float>  _personalKoeffForDodge  = new Dictionary <Players, float>();
            Dictionary <Players, float>  _personalKoeffForResist = new Dictionary <Players, float>();
            const float BOOST = 50f;


            for (float i = duration; i > 0; i -= starter.TICKf * 2)
            {
                List <Players> _players = functions.get_all_nearest_players_inradius(x, z, player, SpellSystem.GetDistanceofApplyingSpell(166));

                if (_players.Count > 0)
                {
                    for (int u = 0; u < _players.Count; u++)
                    {
                        if (!_buffedPlayersOnline.ContainsKey(_players[u]) && player.team_id == _players[u].team_id)
                        {
                            string cond_id = player.get_symb_for_IDs();
                            _players[u].set_condition(CondType.co, 166, cond_id, 9999);
                            _buffedPlayersOnline.Add(_players[u], cond_id);

                            float koeffordodge  = BOOST / _players[u].Dodge;
                            float koefforresist = BOOST / _players[u].Magic_resistance;

                            _players[u].Dodge            *= koeffordodge;
                            _players[u].Magic_resistance *= koefforresist;

                            _personalKoeffForDodge.Add(_players[u], koeffordodge);
                            _personalKoeffForResist.Add(_players[u], koefforresist);
                        }
                        else if (!_buffedPlayersOnline.ContainsKey(_players[u]) && player.team_id != _players[u].team_id)
                        {
                            string cond_id = player.get_symb_for_IDs();
                            _players[u].set_condition(CondType.co, 166, cond_id, 9999);
                            _buffedPlayersOnline.Add(_players[u], cond_id);

                            float koeffordodge  = BOOST * _players[u].Dodge;
                            float koefforresist = BOOST * _players[u].Magic_resistance;

                            _players[u].Dodge            /= koeffordodge;
                            _players[u].Magic_resistance /= koefforresist;

                            _personalKoeffForDodge.Add(_players[u], koeffordodge);
                            _personalKoeffForResist.Add(_players[u], koefforresist);
                        }
                    }
                }
                else
                {
                    foreach (var _existingPlayers in _buffedPlayersOnline.Keys)
                    {
                        if (_existingPlayers.team_id == player.team_id)
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Dodge            /= _personalKoeffForDodge[_existingPlayers];
                            _existingPlayers.Magic_resistance /= _personalKoeffForResist[_existingPlayers];
                        }
                        else
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Dodge            *= _personalKoeffForDodge[_existingPlayers];
                            _existingPlayers.Magic_resistance *= _personalKoeffForResist[_existingPlayers];
                        }
                    }
                    _buffedPlayersOnline.Clear();
                    _personalKoeffForDodge.Clear();
                    _personalKoeffForResist.Clear();
                }

                foreach (var _existingPlayers in _buffedPlayersOnline.Keys)
                {
                    if (!_players.Contains(_existingPlayers))
                    {
                        if (_existingPlayers.team_id == player.team_id)
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Dodge            /= _personalKoeffForDodge[_existingPlayers];
                            _existingPlayers.Magic_resistance /= _personalKoeffForResist[_existingPlayers];
                        }
                        else
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Dodge            *= _personalKoeffForDodge[_existingPlayers];
                            _existingPlayers.Magic_resistance *= _personalKoeffForResist[_existingPlayers];
                        }

                        _buffedPlayersOnline.Remove(_existingPlayers);
                        _personalKoeffForDodge.Remove(_existingPlayers);
                        _personalKoeffForResist.Remove(_existingPlayers);
                    }
                }

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

                player.ActionForConditionByChekingIndex(ref i, duration, 166);
            }

            //end
            foreach (var _existingPlayers in _buffedPlayersOnline.Keys)
            {
                if (_existingPlayers.team_id == player.team_id)
                {
                    _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                    _existingPlayers.Dodge            /= _personalKoeffForDodge[_existingPlayers];
                    _existingPlayers.Magic_resistance /= _personalKoeffForResist[_existingPlayers];
                }
                else
                {
                    _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                    _existingPlayers.Dodge            *= _personalKoeffForDodge[_existingPlayers];
                    _existingPlayers.Magic_resistance *= _personalKoeffForResist[_existingPlayers];
                }
            }
        }
Beispiel #26
0
        //spell 163
        public static async void SuddenStrike(Players player)
        {
            float distance = SpellSystem.GetDistanceofApplyingSpell(163);

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

            player.is_reset_any_button = true;
            player.start_spell_in_process();
            string condID   = player.get_symb_for_IDs();
            bool   isBefore = false;

            float init_x = player.position_x;
            float init_z = player.position_z;


            for (float i = 0.3f; i > 0; i -= starter.TICKf)
            {
                Console.WriteLine(functions.vector3_distance_unity(init_x, 0, init_z, player.position_x, 0, player.position_z));
                if (functions.vector3_distance_unity(init_x, 0, init_z, player.position_x, 0, player.position_z) >= distance)
                {
                    break;
                }

                float[] newPosition = new float[6] {
                    player.position_x, 0, player.position_z, 0, player.rotation_y, 0
                };

                functions.mover(ref newPosition, 0, 20, 1.1f, player.zone_type);
                player.position_x = newPosition[0];
                player.position_z = newPosition[2];

                await Task.Delay(starter.TICKi);

                Players enemy = functions.get_one_nearest_enemy_inmelee(player, 0, 0, false);

                if (enemy != null)
                {
                    spells.make_direct_melee_damage_exact_enemy(player, enemy, 163, 6, 1, starter.standart_crit_koeff, 0);
                    isBefore = true;
                    break;
                }
            }

            if (!isBefore)
            {
                Players enemy = functions.get_one_nearest_enemy_inmelee(player, 0, 0, false);

                if (enemy != null)
                {
                    spells.make_direct_melee_damage_exact_enemy(player, enemy, 163, 6, 1, starter.standart_crit_koeff, 0);
                }
                else
                {
                    player.animation_id = 6;
                    player.reset_animation_for_one();
                }
            }

            await Task.Delay(1000);

            player.is_reset_any_button = false;
            player.stop_spell_in_process();
            player.remove_condition_in_player(condID);
        }
Beispiel #27
0
        public static void SpellSystemInit()
        {
            //GameSpells.Add(new SpellSystem(0,0,0,0,0,0,0)); // none spell

            // spell NUMB, MANA COST, PL Type,     PURPOSE, CONTINUE, CATEGORY, EFFECT,      DISTANCE, CASTIME, COOLDOWN

            GameSpells[0] = new SpellSystem(0, 0, 0, 0, 0, 0, 0, 0f, 0f, 0);

            //warrior:
            GameSpells[1]  = new SpellSystem(1, 10, 1, 1, 1, 1, 0, 0f, 0f, 0);  // 1 - simple hit
            GameSpells[2]  = new SpellSystem(2, 10, 1, 1, 2, 1, 0, 0f, 0f, 0);  // 2 - rend bleeding
            GameSpells[3]  = new SpellSystem(3, 10, 1, 5, 1, 6, 0, 0f, 0f, 0);  // 3 - add health
            GameSpells[4]  = new SpellSystem(4, 10, 1, 1, 1, 1, 1, 3f, 1f, 10); // 4 shield bush and stun
            GameSpells[5]  = new SpellSystem(5, 10, 1, 9, 2, 1, 0, 0f, 0f, 0);  // 5 shield ON
            GameSpells[6]  = new SpellSystem(6, 10, 1, 1, 1, 1, 0, 0f, 0, 0);   // 6 series of hits
            GameSpells[7]  = new SpellSystem(7, 10, 1, 1, 2, 1, 0, 0f, 0, 0);   // 7 bleeding higher
            GameSpells[8]  = new SpellSystem(8, 10, 1, 1, 2, 1, 4, 0f, 0, 0);   // 8 bleeding and slower
            GameSpells[9]  = new SpellSystem(9, 10, 1, 2, 1, 1, 2, 6.5f, 0, 0); // 9 ram fast closer
            GameSpells[10] = new SpellSystem(10, 10, 1, 9, 1, 5, 0, 0f, 0, 0);  // 10 solid armor prot ulti
            GameSpells[11] = new SpellSystem(11, 10, 1, 1, 1, 1, 0, 0f, 0, 0);  // 11 wide hit
            GameSpells[12] = new SpellSystem(12, 10, 1, 1, 1, 1, 0, 0f, 0, 0);  // 12 complex hit
            GameSpells[13] = new SpellSystem(13, 10, 1, 2, 1, 1, 5, 0f, 0, 0);  // 13 swift attack
            GameSpells[14] = new SpellSystem(14, 10, 1, 2, 1, 1, 5, 0f, 0, 0);  // 14 surrounded
            GameSpells[15] = new SpellSystem(15, 10, 1, 2, 1, 1, 5, 0f, 0, 0);  // 15 strong will

            // spell NUMB, MANA COST, PL Type,     PURPOSE, CONTINUE, CATEGORY, EFFECT,      DISTANCE, CASTIME, COOLDOWN

            //elementalist
            GameSpells[51] = new SpellSystem(51, 10, 2, 3, 1, 2, 0, 10f, 2f, 0);   // 51 - firebolt
            GameSpells[52] = new SpellSystem(52, 10, 2, 3, 1, 2, 1, 1.5f, 0, 5);   // 52 meteor
            GameSpells[53] = new SpellSystem(53, 10, 2, 3, 2, 2, 0, 4.5f, 2, 3);   // 53 pillar of fire from hands
            GameSpells[54] = new SpellSystem(54, 10, 2, 10, 0, 2, 5, 0, 0, 3);     // 54 fire steps
            GameSpells[55] = new SpellSystem(55, 10, 2, 3, 1, 3, 3, 4f, 0, 10);    // 55 frost trap
            GameSpells[56] = new SpellSystem(56, 10, 2, 3, 1, 3, 4, 10f, 1.5f, 0); // 56 frost bolt
            GameSpells[57] = new SpellSystem(57, 10, 2, 6, 2, 2, 0, 0, 0, 0);      // 57 ignition state
            GameSpells[58] = new SpellSystem(58, 10, 2, 6, 2, 3, 0, 0, 0, 0);      // 58 freezed to a place
            GameSpells[59] = new SpellSystem(59, 10, 2, 6, 2, 3, 0, 0, 0, 0);      // 59 slowed by freezing
            GameSpells[60] = new SpellSystem(60, 10, 2, 8, 2, 3, 0, 0, 0, 0);      // 60 frost armor
            GameSpells[61] = new SpellSystem(61, 10, 2, 8, 2, 2, 0, 0, 0, 0);      // 61 fire armor
            GameSpells[62] = new SpellSystem(62, 10, 2, 8, 2, 4, 0, 0, 0, 0);      // 62 air armor
            GameSpells[63] = new SpellSystem(63, 10, 2, 8, 2, 5, 0, 0, 0, 0);      // 63 earth armor
            GameSpells[64] = new SpellSystem(64, 10, 2, 6, 2, 3, 6, 0, 0, 0);      // 64 frozen complitely
            GameSpells[65] = new SpellSystem(65, 10, 2, 3, 2, 4, 0, 5f, 0, 0);     // 65 lightning flow
            GameSpells[66] = new SpellSystem(66, 10, 2, 2, 1, 4, 5, 0, 0, 0);      // 66 lightning escape
            GameSpells[67] = new SpellSystem(67, 10, 2, 6, 1, 4, 0, 0, 0, 0);      // 67 lightning shock
            GameSpells[68] = new SpellSystem(68, 10, 2, 3, 1, 4, 5, 5f, 0, 0);     // 68 storm

            // spell NUMB, MANA COST, PL Type,     PURPOSE, CONTINUE, CATEGORY, EFFECT,      DISTANCE, CASTIME, COOLDOWN

            //barbarian
            GameSpells[101] = new SpellSystem(101, 10, 3, 1, 1, 1, 0, 0, 0, 0);     // 101 - swing
            GameSpells[102] = new SpellSystem(102, 10, 3, 3, 1, 1, 0, 0, 0, 0);     // 102 - hurricane
            GameSpells[103] = new SpellSystem(103, 10, 3, 1, 1, 1, 7, 10, 0, 0);    // 103 - heroic leap
            GameSpells[104] = new SpellSystem(104, 10, 3, 8, 2, 1, 0, 0, 0, 0);     // 104 - preparation
            GameSpells[105] = new SpellSystem(105, 10, 3, 1, 1, 1, 2, 0.5f, 1, 0);  // 105 - power strike
            GameSpells[106] = new SpellSystem(106, 10, 3, 3, 1, 1, 4, 10, 0, 0);    // 106 - throw axe
            GameSpells[107] = new SpellSystem(107, 10, 3, 6, 1, 1, 4, 0, 0, 0);     // 107 - enslower
            GameSpells[108] = new SpellSystem(108, 10, 3, 2, 1, 1, 2, 10, 0, 0);    // 108 - breakthrough
            GameSpells[109] = new SpellSystem(109, 10, 3, 1, 1, 1, 9, 0, 0, 0);     // 109 - armor crack
            GameSpells[110] = new SpellSystem(110, 10, 3, 1, 1, 1, 7, 10, 0, 0);    // 110 - stunning leap
            GameSpells[111] = new SpellSystem(111, 10, 3, 3, 1, 1, 0, 5, 0, 0);     // 111 - whirlwind
            GameSpells[112] = new SpellSystem(112, 10, 3, 3, 1, 1, 0, 10, 0, 0);    // 112 - point of force
            GameSpells[113] = new SpellSystem(113, 10, 3, 10, 2, 1, 10, 3, 0, 0);   // 113 point of force aura
            GameSpells[114] = new SpellSystem(114, 10, 3, 10, 2, 1, 9, 0, 0, 0);    // 114 - armor crack effect

            // spell NUMB, MANA COST, PL Type,     PURPOSE, CONTINUE, CATEGORY, EFFECT,      DISTANCE, CASTIME, COOLDOWN

            //rogue
            GameSpells[151] = new SpellSystem(151, 10, 4, 1, 1, 1, 0, 0, 0, 0);   // 151 - fast strike
            GameSpells[152] = new SpellSystem(152, 10, 4, 1, 1, 1, 0, 0, 0, 0);   // 152 - backstub
            GameSpells[153] = new SpellSystem(153, 10, 4, 4, 2, 0, 0, 0, 0, 0);   // 153 - invisibility
            GameSpells[154] = new SpellSystem(154, 10, 4, 1, 2, 1, 0, 0, 0, 0);   // 154 - butchery
            GameSpells[155] = new SpellSystem(155, 10, 4, 6, 2, 1, 4, 10, 0, 0);  // 155 - step back
            GameSpells[156] = new SpellSystem(156, 10, 4, 3, 1, 1, 0, 10, 0, 0);  // 156 - pistol shot
            GameSpells[157] = new SpellSystem(157, 10, 4, 4, 2, 0, 0, 0, 0, 0);   // 157 - back from invis
            GameSpells[158] = new SpellSystem(158, 10, 4, 4, 2, 0, 8, 0, 1, 0);   // 158 apply poison: slow
            GameSpells[159] = new SpellSystem(159, 10, 4, 4, 2, 0, 8, 0, 1, 0);   // 159 apply poison: antihealing
            GameSpells[160] = new SpellSystem(160, 10, 4, 4, 2, 0, 8, 0, 1, 0);   // 160 apply poison: melt armor
            GameSpells[161] = new SpellSystem(161, 10, 4, 4, 2, 0, 8, 0, 1, 0);   // 161 apply poison: damage
            GameSpells[162] = new SpellSystem(162, 10, 4, 4, 2, 0, 8, 0, 1, 0);   // 162 apply poison: antimagic
            GameSpells[163] = new SpellSystem(163, 10, 4, 2, 1, 1, 0, 10, 0, 0);  // 163 sudden strike
            GameSpells[164] = new SpellSystem(164, 10, 4, 9, 1, 0, 8, 5, 0, 0);   // 164 escape
            GameSpells[165] = new SpellSystem(165, 10, 4, 8, 1, 0, 8, 0, 0, 0);   // 165 smoke bomb
            GameSpells[166] = new SpellSystem(166, 10, 4, 10, 2, 0, 8, 3, 0, 0);  // 166 smoke effect
            GameSpells[167] = new SpellSystem(167, 10, 4, 6, 2, 0, 9, 0, 0, 0);   // 167 poison: slow
            GameSpells[168] = new SpellSystem(168, 10, 4, 6, 2, 0, 9, 0, 0, 0);   // 168 poison: antihealing
            GameSpells[169] = new SpellSystem(169, 10, 4, 6, 2, 0, 9, 0, 0, 0);   // 169 poison: melt armor
            GameSpells[170] = new SpellSystem(170, 10, 4, 6, 2, 0, 9, 0, 0, 0);   // 170 poison: damage
            GameSpells[171] = new SpellSystem(171, 10, 4, 6, 2, 0, 9, 0, 0, 0);   // 171 poison: antimagic
            GameSpells[172] = new SpellSystem(172, 10, 4, 1, 1, 1, 3, 0, 0, 0);   // 172 Paralyzing Hit
            GameSpells[173] = new SpellSystem(173, 10, 4, 6, 2, 0, 3, 0, 0, 0);   // 173 Paralysis
            GameSpells[174] = new SpellSystem(174, 10, 4, 6, 2, 0, 9, 0, 0, 5);   // 174 invisibilty unabled


            // spell NUMB, MANA COST, PL Type,     PURPOSE, CONTINUE, CATEGORY, EFFECT,      DISTANCE, CASTIME, COOLDOWN

            //wizard
            GameSpells[201] = new SpellSystem(201, 10, 5, 3, 1, 2, 0, 10, 2, 0);    // 201 fire beam
            GameSpells[202] = new SpellSystem(202, 10, 5, 7, 2, 0, 3, 3, 0, 0);     // 202 black hole
            GameSpells[203] = new SpellSystem(203, 10, 5, 4, 1, 0, 0, 0, 0, 0);     // 203 answer_attack_shield
            GameSpells[204] = new SpellSystem(204, 10, 5, 11, 2, 6, 0, 0, 1, 0);    // 204 autoheal
            GameSpells[205] = new SpellSystem(205, 10, 5, 6, 2, 0, 7, 10, 0, 0);    // 205 curse of casting
            GameSpells[206] = new SpellSystem(206, 10, 5, 3, 2, 3, 4, 10, 0, 0);    // 206 frost zone
            GameSpells[207] = new SpellSystem(207, 10, 5, 4, 2, 0, 5, 10, 0, 0);    // 207 beacon
            GameSpells[208] = new SpellSystem(208, 10, 5, 6, 1, 0, 7, 10, 0, 0);    // 208 breaking cast
            GameSpells[209] = new SpellSystem(209, 10, 5, 6, 2, 0, 4, 10, 0, 0);    // 209 confusion
            GameSpells[210] = new SpellSystem(210, 10, 5, 7, 1, 0, 8, 0, 1, 0);     // 210 rune of magic
            GameSpells[211] = new SpellSystem(211, 10, 5, 10, 2, 0, 8, 3, 0, 0);    // 211 rune of magic effect
            GameSpells[212] = new SpellSystem(212, 10, 5, 6, 0, 0, 9, 10, 2, 0);    // 212 drain energy
            GameSpells[213] = new SpellSystem(213, 10, 5, 6, 2, 0, 9, 0, 0, 0);     // 213 drain energy effect
            GameSpells[214] = new SpellSystem(214, 10, 5, 10, 1, 0, 0, 10, 2, 0);   // 214 change places
            GameSpells[215] = new SpellSystem(215, 10, 5, 6, 1, 0, 0, 10, 2, 0);    // 215 polymorph
            GameSpells[216] = new SpellSystem(216, 10, 5, 10, 2, 0, 1, 0, 0, 0);    // 216 polymorph eff


            //additional spells and effects
            GameSpells[997] = new SpellSystem(997, 10, 0, 1, 0, 0, 0, 0, 0, 0); // 997 lightning shock
        }
Beispiel #28
0
        //spell 201
        public static async void fire_beam(Players player, int energy_cost, float how_long)
        {
            player.is_spell_in_process = true;
            float casting_time = SpellSystem.GetCastingTimeOfSpell(201);
            float dist         = SpellSystem.GetDistanceofApplyingSpell(201);

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



            string check_cond_id1    = player.get_symb_for_IDs();
            float  damage_multiplier = 0.05f;
            int    stack             = 0;

            List <Players> all_enemies = new List <Players>();
            Dictionary <Players, float> enemies_to_hit = new Dictionary <Players, float>();

            for (float u = how_long; u > 0; u -= starter.TICKf * 2)
            {
                if (player.is_casting_failed())
                {
                    player.set_condition(CondType.co, 201, check_cond_id1, 0);
                    player.inform_of_cancel_casting(201, check_cond_id1);
                    player.reset_animation_for_one();
                    player.remove_condition_in_player(check_cond_id1);

                    return;
                }
                functions.turn_to_enemy(player, 0.1f, dist - 1, -15, dist + 1);
                player.animation_id = 13;
                float   default_player_x     = player.position_x;
                float   default_player_z     = player.position_z;
                float   default_player_rot_y = player.rotation_y;
                float[] x = new float[] { 0, 0 };
                functions.projection(ref x, default_player_x, default_player_z, default_player_rot_y, dist, player.zone_type);
                float new_x = x[0];
                float new_z = x[1];

                player.set_condition(CondType.co, 201, check_cond_id1, u);


                all_enemies.Clear();
                for (float i = 0; i < (dist - 0.5f); i += 0.5f)
                {
                    float[] xx = new float[] { 0, 0 };
                    functions.lerp(ref xx, default_player_x, default_player_z, x[0], x[1], default_player_rot_y, (i / (dist - 1.01f)));
                    new_x = xx[0];
                    new_z = xx[1];

                    List <Players> result = functions.get_all_nearest_enemy_inradius(new_x, new_z, player, 0.4f);
                    if (result.Count > 0)
                    {
                        for (int uu = 0; uu < result.Count; uu++)
                        {
                            if (!all_enemies.Contains(result[uu]))
                            {
                                all_enemies.Add(result[uu]);
                            }
                        }
                    }
                }


                if (all_enemies.Count > 0)
                {
                    for (int uu = 0; uu < all_enemies.Count; uu++)
                    {
                        if (enemies_to_hit.ContainsKey(all_enemies[uu]))
                        {
                            enemies_to_hit[all_enemies[uu]] += damage_multiplier;
                        }
                        else
                        {
                            enemies_to_hit.Add(all_enemies[uu], damage_multiplier);
                        }
                    }

                    foreach (Players _player in enemies_to_hit.Keys)
                    {
                        if (!all_enemies.Contains(_player))
                        {
                            enemies_to_hit.Remove(_player);
                        }
                    }
                }
                else
                {
                    enemies_to_hit.Clear();
                }

                stack++;

                if (stack == 5)
                {
                    stack = 0;

                    foreach (Players _player in enemies_to_hit.Keys)
                    {
                        spells.make_direct_magic_damage_exact_enemy(player, _player, 109, 0, enemies_to_hit[_player], starter.standart_crit_koeff);
                    }
                }


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

                player.ActionForConditionByChekingIndex(ref u, how_long, 109);
            }

            player.reset_animation_for_one();
            player.remove_condition_in_player(check_cond_id1);
        }
Beispiel #29
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);
        }
Beispiel #30
0
        //spell 113
        public static async void PointOfForceEffect(Players player, float duration, float x, float z)
        {
            Dictionary <Players, string> _buffedPlayersOnline = new Dictionary <Players, string>();
            const float ENSLOW  = 0.7f;
            const float POWERUP = 1.2f;

            for (float i = duration; i > 0; i -= starter.TICKf * 2)
            {
                List <Players> _players = functions.get_all_nearest_players_inradius(x, z, player, SpellSystem.GetDistanceofApplyingSpell(113));

                if (_players.Count > 0)
                {
                    for (int u = 0; u < _players.Count; u++)
                    {
                        if (!_buffedPlayersOnline.ContainsKey(_players[u]) && player.team_id == _players[u].team_id)
                        {
                            string cond_id = player.get_symb_for_IDs();
                            _players[u].set_condition(CondType.co, 113, cond_id, 9999);
                            _buffedPlayersOnline.Add(_players[u], cond_id);

                            _players[u].Hit_power *= POWERUP;
                        }
                        else if (!_buffedPlayersOnline.ContainsKey(_players[u]) && player.team_id != _players[u].team_id)
                        {
                            string cond_id = player.get_symb_for_IDs();
                            _players[u].set_condition(CondType.co, 113, cond_id, 9999);
                            _buffedPlayersOnline.Add(_players[u], cond_id);

                            _players[u].Speed *= ENSLOW;
                        }
                    }
                }
                else
                {
                    foreach (var _existingPlayers in _buffedPlayersOnline.Keys)
                    {
                        if (_existingPlayers.team_id == player.team_id)
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Hit_power /= POWERUP;
                        }
                        else
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Speed /= ENSLOW;
                        }
                    }
                    _buffedPlayersOnline.Clear();
                }

                foreach (var _existingPlayers in _buffedPlayersOnline.Keys)
                {
                    if (!_players.Contains(_existingPlayers))
                    {
                        if (_existingPlayers.team_id == player.team_id)
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Hit_power /= POWERUP;
                        }
                        else
                        {
                            _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                            _existingPlayers.Speed /= ENSLOW;
                        }

                        _buffedPlayersOnline.Remove(_existingPlayers);
                    }
                }

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

                player.ActionForConditionByChekingIndex(ref i, duration, 113);
            }

            //end
            foreach (var _existingPlayers in _buffedPlayersOnline.Keys)
            {
                if (_existingPlayers.team_id == player.team_id)
                {
                    _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                    _existingPlayers.Hit_power /= POWERUP;
                }
                else
                {
                    _existingPlayers.remove_condition_in_player(_buffedPlayersOnline[_existingPlayers]);
                    _existingPlayers.Speed /= ENSLOW;
                }
            }
        }