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