//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); }
//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); } } } }
//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); } }
//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); }
//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(); } }
//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; }
//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 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); }
//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); }
//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); }
//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(); }