public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Silence OnSpellEffect"); spell.duration = 100 * spell.casterLevel; if (spell.IsObjectSelected()) { var target_item = spell.Targets[0]; var spell_obj_partsys_id = AttachParticles("sp-Silence", target_item.Object); target_item.Object.AddCondition("sp-Silence", spell.spellId, spell.duration, 0, spell_obj_partsys_id); } else { var spell_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, spell.aoeCenter); var caster_init_value = spell.caster.GetInitiative(); spell_obj.InitD20Status(); spell_obj.SetInitiative(caster_init_value); var spell_obj_partsys_id = AttachParticles("sp-Silence", spell_obj); spell_obj.AddCondition("sp-Silence", spell.spellId, spell.duration, 0, spell_obj_partsys_id); } }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Silence OnSpellEffect"); var npc = spell.caster; // added so NPC's can use wand/potion/scroll if (npc.type != ObjectType.pc && npc.GetLeader() == null && spell.casterLevel <= 0) { spell.casterLevel = 8; } if (npc.GetNameId() == 14425 && GetGlobalVar(711) == 1) { spell.casterLevel = 6; spell.dc = 17; } spell.duration = 10 * spell.casterLevel; // test whether we targeted the ground or an object if (spell.IsObjectSelected()) { var target_item = spell.Targets[0]; // allow Will saving throw to negate if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } else { // put sp-Silence condition on target target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); var spell_obj_partsys_id = AttachParticles("sp-Silence", target_item.Object); target_item.Object.AddCondition("sp-Silence", spell.spellId, spell.duration, 0, spell_obj_partsys_id); } } else { // spawn one spell_object object GameObject spell_obj; if (npc.GetNameId() == 14425 && npc.GetMap() == 5065 && GetGlobalVar(711) == 1) { SetGlobalVar(711, 2); spell_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, new locXY(486, 495)); } else { spell_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, spell.aoeCenter); } // add to d20initiative var caster_init_value = spell.caster.GetInitiative(); spell_obj.InitD20Status(); spell_obj.SetInitiative(caster_init_value); // put sp-Silence condition on obj var spell_obj_partsys_id = AttachParticles("sp-Silence", spell_obj); spell_obj.AddCondition("sp-Silence", spell.spellId, spell.duration, 0, spell_obj_partsys_id); } }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Dispel Magic OnSpellEffect"); if (spell.IsObjectSelected()) { var target = spell.Targets[0]; if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.AddCondition("sp-Dispel Magic", spell.spellId, 0, 0); } else if ((target.Object.type == ObjectType.portal) || (target.Object.type == ObjectType.container)) { if ((target.Object.GetPortalFlags() & PortalFlag.MAGICALLY_HELD) != 0) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.ClearPortalFlag(PortalFlag.MAGICALLY_HELD); spell.RemoveTarget(target.Object); } } } else { SpawnParticles("sp-Dispel Magic - Area", spell.aoeCenter); foreach (var target in spell.Targets) { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.AddCondition("sp-Dispel Magic", spell.spellId, 0, 1); } else if ((target.Object.type == ObjectType.portal) || (target.Object.type == ObjectType.container)) { if ((target.Object.GetPortalFlags() & PortalFlag.MAGICALLY_HELD) != 0) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.ClearPortalFlag(PortalFlag.MAGICALLY_HELD); spell.RemoveTarget(target.Object); } } } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { // Lareth Special scripting in the Moathouse if (spell.caster.GetNameId() == 8002 && spell.caster.GetMap() == 5005) { GameObject player_cast_web_obj = null; GameObject player_cast_entangle_obj = null; foreach (var spell_obj in ObjList.ListVicinity(spell.caster.GetLocation(), ObjectListFilter.OLC_GENERIC)) { if (spell_obj.GetInt(obj_f.secretdoor_dc) == 531 + (1 << 15)) { player_cast_web_obj = spell_obj; } if (spell_obj.GetInt(obj_f.secretdoor_dc) == 153 + (1 << 15)) { player_cast_entangle_obj = spell_obj; } } LocAndOffsets locc_; if (player_cast_entangle_obj != null && player_cast_web_obj != null && player_cast_entangle_obj.DistanceTo(player_cast_web_obj) <= 18) { locc_ = AverageLocation(player_cast_entangle_obj.GetLocationFull(), player_cast_web_obj.GetLocationFull()); } else if (player_cast_web_obj != null) { locc_ = player_cast_web_obj.GetLocationFull(); } else if (player_cast_entangle_obj != null) { locc_ = player_cast_entangle_obj.GetLocationFull(); } else { locc_ = spell.caster.GetLocationFull(); } SpawnParticles("sp-Dispel Magic - Area", locc_); var dispel_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, locc_); dispel_obj.Move(locc_); foreach (var target in ObjList.ListVicinity(dispel_obj, ObjectListFilter.OLC_GENERIC)) { if (target.DistanceTo(dispel_obj) <= 20) { var partsys_id = AttachParticles("sp-Dispel Magic - Targeted", target); // aaa1 = game.party[0].damage( OBJ_HANDLE_NULL, 0, dice_new("1d3")) target.AddCondition("sp-Dispel Magic", spell.spellId, 0, 1); } } // game.party[0].damage( OBJ_HANDLE_NULL, 0, dice_new("1d4")) foreach (var target in ObjList.ListVicinity(dispel_obj, ObjectListFilter.OLC_NPC | ObjectListFilter.OLC_PC)) { if (target.DistanceTo(dispel_obj) <= 18) { if ((target.type == ObjectType.pc) || (target.type == ObjectType.npc) || (target.type == ObjectType.generic)) { var partsys_id = AttachParticles("sp-Dispel Magic - Targeted", target); target.AddCondition("sp-Dispel Magic", spell.spellId, 0, partsys_id); } } } dispel_obj.Destroy(); } // check if we are targetting an object or an area else if (spell.IsObjectSelected()) { var target = spell.Targets[0]; // support dispel on critters if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.AddCondition("sp-Dispel Magic", spell.spellId, 0, 0); } // support dispel on portals and containers else if ((target.Object.type == ObjectType.portal) || (target.Object.type == ObjectType.container)) { if ((target.Object.GetPortalFlags() & PortalFlag.MAGICALLY_HELD) != 0) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.ClearPortalFlag(PortalFlag.MAGICALLY_HELD); spell.RemoveTarget(target.Object); } } } else { // support dispel on these obj_types: weapon, ammo, armor, scroll // NO support for: money, food, key, written, generic, scenery, trap, bag // elif (target.obj.type == obj_t_weapon) or (target.obj.type == obj_t_ammo) or (target.obj.type == obj_t_armor) or (target.obj.type == obj_t_scroll): // print "[dispel magic] - items not supported yet!" // game.particles( 'Fizzle', target.obj ) // spell.target_list.remove_target( target.obj ) // draw area effect particles SpawnParticles("sp-Dispel Magic - Area", spell.aoeCenter); foreach (var target in spell.Targets) { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.AddCondition("sp-Dispel Magic", spell.spellId, 0, 1); } // support dispel on portals and containers else if ((target.Object.type == ObjectType.portal) || (target.Object.type == ObjectType.container)) { if ((target.Object.GetPortalFlags() & PortalFlag.MAGICALLY_HELD) != 0) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.ClearPortalFlag(PortalFlag.MAGICALLY_HELD); spell.RemoveTarget(target.Object); } } } } // support dispel on these obj_types: weapon, ammo, armor, scroll // NO support for: money, food, key, written, generic, scenery, trap, bag // elif (target.obj.type == obj_t_weapon) or (target.obj.type == obj_t_ammo) or (target.obj.type == obj_t_armor) or (target.obj.type == obj_t_scroll): // print "[dispel magic] - items not supported yet!" // game.particles( 'Fizzle', target.obj ) // spell.target_list.remove_target( target.obj ) spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { spell.casterLevel = Math.Min(20, spell.casterLevel); // check if we are targetting an object or an area if (spell.IsObjectSelected()) { var target = spell.Targets[0]; // support dispel on critters if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.AddCondition("sp-Dispel Magic", spell.spellId, 0, 0); } // support dispel on portals and containers else if ((target.Object.type == ObjectType.portal) || (target.Object.type == ObjectType.container)) { if ((target.Object.GetPortalFlags() & PortalFlag.MAGICALLY_HELD) != 0) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.ClearPortalFlag(PortalFlag.MAGICALLY_HELD); spell.RemoveTarget(target.Object); } } } else { // support dispel on these obj_types: weapon, ammo, armor, scroll // NO support for: money, food, key, written, generic, scenery, trap, bag // elif (target.obj.type == obj_t_weapon) or (target.obj.type == obj_t_ammo) or (target.obj.type == obj_t_armor) or (target.obj.type == obj_t_scroll): // print "[dispel magic] - items not supported yet!" // game.particles( 'Fizzle', target.obj ) // spell.target_list.remove_target( target.obj ) // draw area effect particles SpawnParticles("sp-Dispel Magic - Area", spell.aoeCenter); foreach (var target in spell.Targets) { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.AddCondition("sp-Dispel Magic", spell.spellId, 0, 1); } // support dispel on portals and containers else if ((target.Object.type == ObjectType.portal) || (target.Object.type == ObjectType.container)) { if ((target.Object.GetPortalFlags() & PortalFlag.MAGICALLY_HELD) != 0) { target.ParticleSystem = AttachParticles("sp-Dispel Magic - Targeted", target.Object); target.Object.ClearPortalFlag(PortalFlag.MAGICALLY_HELD); spell.RemoveTarget(target.Object); } } } } // support dispel on these obj_types: weapon, ammo, armor, scroll // NO support for: money, food, key, written, generic, scenery, trap, bag // elif (target.obj.type == obj_t_weapon) or (target.obj.type == obj_t_ammo) or (target.obj.type == obj_t_armor) or (target.obj.type == obj_t_scroll): // print "[dispel magic] - items not supported yet!" // game.particles( 'Fizzle', target.obj ) // spell.target_list.remove_target( target.obj ) spell.EndSpell(true); }