//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); }
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); }
//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); } }
//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; }
//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(); }
//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); }
//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); }
//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); }
//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); } }
// 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); } } }
//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); } }
//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]; } } }
//spell 66 public static async void lightning_escape(Players player) { float distance = SpellSystem.GetDistanceofApplyingSpell(66); string cond_ID = player.get_symb_for_IDs(); player.Speed *= 2f; player.is_reset_movement_not_rotation = true; player.is_reset_spells_button = true; functions.turn_to_enemy(player, 0.1f, distance, 0, distance); player.is_immune_to_magic = true; player.is_immune_to_melee = true; List <Players> aims = new List <Players>(); for (float i = 1.1f; i > 0; i -= starter.TICKf * 2) { player.set_condition(CondType.co, 66, cond_ID, i); if (i < 0.9f) { if (player.is_reset_movement_not_rotation) { player.is_reset_movement_not_rotation = false; } 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_magic(player, pre_aims[ii])) { lightning_shock(player, pre_aims[ii]); } aims.Add(pre_aims[ii]); } } } /* * if (player.is_stop_all_condition_by_checking_index(66)) * { * break; * } */ await Task.Delay(starter.TICKi *2); player.ActionForConditionByChekingIndex(ref i, 1.1f, 66); } player.Speed /= 2f; player.is_reset_spells_button = false; player.remove_condition_in_player(cond_ID); player.is_immune_to_magic = false; player.is_immune_to_melee = false; }
//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); }
//spell53 - fire hands blow public static async void firehands(Players player) { //Players player = functions.GetPlayerData(table_id, mee); float how_long = 2; float distance = SpellSystem.GetDistanceofApplyingSpell(53); float temp_distance = 0; float[] temp_c = new float[2]; float cast_duration = SpellSystem.GetCastingTimeOfSpell(53); float damage_multiplier = 0.09f; Dictionary <Players, float> hit_players_process = new Dictionary <Players, float>(); functions.turn_to_enemy(player, 0.1f, distance, -15, distance); string check_cond_id_for_casting = player.get_symb_for_IDs(); string check_cond_id_for_spellcha = player.get_symb_for_IDs(); player.animation_id = 13; player.set_condition(CondType.co, 53, check_cond_id_for_spellcha, (how_long + 0.5f)); await Task.Delay(500); player.start_spell_in_process(); //int hit_counter = 0; List <Players> hit_players = new List <Players>(); for (float i = cast_duration; i > 0; i -= 0.250f) { functions.turn_to_enemy(player, 0.1f, distance - 1, -15, distance + 1); if (!player.is_casting_failed()) { player.animation_id = 13; player.set_condition(CondType.co, 53, check_cond_id_for_spellcha, i); player.set_condition(CondType.ca, 53, check_cond_id_for_casting, i); //distance check functions.projection(ref temp_c, player.position_x, player.position_z, player.rotation_y, distance, player.zone_type); temp_distance = functions.vector3_distance_unity(player.position_x, 0, player.position_z, temp_c[0], 0, temp_c[1]); //================= List <Players> all_players = functions.get_all_nearest_enemy_inmelee(player, (temp_distance - starter.def_hit_melee_small_dist), -10); if (all_players.Count > 0) { for (int u = 0; u < all_players.Count; u++) { if (hit_players_process.ContainsKey(all_players[u])) { hit_players_process[all_players[u]] += damage_multiplier; } else { hit_players_process.Add(all_players[u], damage_multiplier); } } foreach (Players _player in hit_players_process.Keys) { if (!all_players.Contains(_player)) { hit_players_process.Remove(_player); } } } else { hit_players_process.Clear(); } } else { player.remove_condition_in_player(check_cond_id_for_casting); player.remove_condition_in_player(check_cond_id_for_spellcha); player.stop_spell_in_process(); player.inform_of_cancel_casting(53, check_cond_id_for_casting); player.reset_animation_for_one(); return; } foreach (Players _player in hit_players_process.Keys) { spells.make_direct_magic_damage_exact_enemy(player, _player, 53, 0, hit_players_process[_player], starter.standart_crit_koeff); } //======================== await Task.Delay(250); player.ActionForConditionByChekingIndex(ref i, cast_duration, 53); } player.stop_spell_in_process(); player.remove_condition_in_player(check_cond_id_for_casting); player.remove_condition_in_player(check_cond_id_for_spellcha); player.reset_animation_for_one(); }
//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; } } }
//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); }
//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); }
//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); }
//lightning flow 65 public static async void lightning_flow(Players player, float how_long, int manacost_per_row) { manacost_per_row /= 5; float distance = SpellSystem.GetDistanceofApplyingSpell(65); float new_distance = 999; float base_damage_koef = 0.2f; functions.turn_to_enemy(player, 0.1f, distance, 0, distance); player.start_spell_in_process(); Players aim = functions.get_one_nearest_enemy_inmelee(player, distance, 0, false); string check_cond_id_for_casting = player.get_symb_for_IDs(); string check_cond_id_for_condition = player.get_symb_for_IDs(); string check_cond_id_for_AD = player.get_symb_for_IDs(); ConditionsPacket x; player.conditions.TryAdd(check_cond_id_for_AD, new ConditionsPacket(CondType.ad, 65)); for (float i = how_long; i > 0; i -= 0.2f) { player.conditions[check_cond_id_for_AD].ClearAdditionalData(); if (player.is_casting_failed()) { player.inform_of_cancel_casting(65, check_cond_id_for_casting); break; } functions.turn_to_enemy(player, 0.1f, distance, 0, distance); aim = functions.get_one_nearest_enemy_inmelee(player, distance, 0, false); player.set_condition(CondType.co, 65, check_cond_id_for_condition, i); player.set_condition(CondType.ca, 65, check_cond_id_for_casting, i); if (aim != null) { new_distance = functions.vector3_distance_unity(player.position_x, player.position_y, player.position_z, aim.position_x, aim.position_y, aim.position_z); player.animation_id = 3; player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(player.position_x.ToString("f1", CultureInfo.InvariantCulture)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(player.position_z.ToString("f1", CultureInfo.InvariantCulture)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aim.position_x.ToString("f1", CultureInfo.InvariantCulture)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aim.position_z.ToString("f1", CultureInfo.InvariantCulture)); } else { //wait_till_end++; new_distance = 999; player.inform_of_cancel_casting(65, check_cond_id_for_casting); player.reset_animation_for_one(); break; } if (new_distance <= (distance + starter.def_hit_melee_dist)) { int count = 0; List <Players> aims = functions.get_all_nearest_enemy_inradius(aim.position_x, aim.position_z, player, 3); if (aims.Count > 0) { if (aims.Contains(aim)) { aims.Remove(aim); } if (aims.Count == 1) { count = 1; player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aims[0].position_x.ToString("f1", CultureInfo.InvariantCulture)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aims[0].position_z.ToString("f1", CultureInfo.InvariantCulture)); spells.make_direct_magic_damage_exact_enemy(player, aims[0], 65, 0, base_damage_koef * 0.7f, starter.standart_crit_koeff); } else if (aims.Count > 1) { for (int u = 0; u < aims.Count; u++) { if (aims[u] != aim && count < 2) { if (count == 0) { player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aims[u].position_x.ToString("f1", CultureInfo.InvariantCulture)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aims[u].position_z.ToString("f1", CultureInfo.InvariantCulture)); spells.make_direct_magic_damage_exact_enemy(player, aims[u], 65, 0, base_damage_koef * 0.5f, starter.standart_crit_koeff); } else if (count == 1) { player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aims[u].position_x.ToString("f1", CultureInfo.InvariantCulture)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData(aims[u].position_z.ToString("f1", CultureInfo.InvariantCulture)); spells.make_direct_magic_damage_exact_enemy(player, aims[u], 65, 0, base_damage_koef * 0.2f, starter.standart_crit_koeff); } } count++; if (count == 2) { break; } } } } switch (count) { case 0: spells.make_direct_magic_damage_exact_enemy(player, aim, 65, 0, base_damage_koef, starter.standart_crit_koeff); break; case 1: spells.make_direct_magic_damage_exact_enemy(player, aim, 65, 0, base_damage_koef * 0.85f, starter.standart_crit_koeff); break; case 2: spells.make_direct_magic_damage_exact_enemy(player, aim, 65, 0, base_damage_koef * 0.75f, starter.standart_crit_koeff); break; } } else { player.inform_of_cancel_casting(65, check_cond_id_for_casting); player.reset_animation_for_one(); break; } //make damage if (manacost_per_row > player.Energy) { player.inform_of_cancel_casting(65, check_cond_id_for_casting); break; } else { player.minus_energy(manacost_per_row); } /* * if (player.is_stop_all_condition_by_checking_index(65)) * { * break; * } */ await Task.Delay(200); player.ActionForConditionByChekingIndex(ref i, how_long, 65); } player.stop_spell_in_process(); player.reset_animation_for_one(); player.remove_condition_in_player(check_cond_id_for_casting); player.remove_condition_in_player(check_cond_id_for_condition); player.conditions.TryRemove(check_cond_id_for_AD, out x); //player.conditions.TryAdd(check_cond_id_for_AD, ":ad=65=end,"); player.conditions.TryAdd(check_cond_id_for_AD, new ConditionsPacket(CondType.ad, 65)); player.conditions[check_cond_id_for_AD].AddDataToAdditionalData("end"); await Task.Delay(100); player.remove_condition_in_player(check_cond_id_for_AD); }
//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(); }
//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; }
//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); }