public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { while ((attachee.FindItemByName(8903) != null)) { attachee.FindItemByName(8903).Destroy(); } // if (attachee.d20_query(Q_Is_BreakFree_Possible)): # workaround no longer necessary! // create_item_in_inventory( 8903, attachee ) if ((Utilities.obj_percent_hp(attachee) < 75)) { GameObject found_pc = null; foreach (var pc in GameSystems.Party.PartyMembers) { if (pc.type == ObjectType.pc) { found_pc = pc; attachee.AIRemoveFromShitlist(pc); } } if (found_pc != null) { Co8.StopCombat(attachee, 1); found_pc.BeginDialog(attachee, 1); DetachScript(); return(SkipDefault); } } // Spiritual Weapon Shenanigens # CombatStandardRoutines.Spiritual_Weapon_Begone(attachee); return(RunDefault); }
public override void OnEndSpellCast(SpellPacketBody spell) { Logger.Info("Tensers Transformation OnEndSpellCast"); Co8.destroy_spell_obj_with_flag(spell.caster, 6400, Co8SpellFlag.TensersTransformation); var item_wielded = spell.caster.ItemWornAt(EquipSlot.WeaponPrimary); if ((item_wielded != null)) { if ((item_wielded.GetNameId() == spell.dc) && (Co8.is_spell_flag_set(item_wielded, Co8SpellFlag.TensersTransformation))) { var new_weapon = GameSystems.MapObject.CreateObject(spell.dc, spell.caster.GetLocation()); item_wielded.SetInt(obj_f.weapon_type, new_weapon.GetInt(obj_f.weapon_type)); Co8.unset_spell_flag(item_wielded, Co8SpellFlag.TensersTransformation); item_wielded.ClearItemFlag(ItemFlag.NO_DROP); new_weapon.Destroy(); } } else { if (spell.dc != 0) { var weapon = Co8.find_spell_obj_with_flag(spell.caster, spell.dc, Co8SpellFlag.TensersTransformation); if (weapon != null) // this shouldn't ever happen but better check { var new_weapon = GameSystems.MapObject.CreateObject(spell.dc, spell.caster.GetLocation()); weapon.SetInt(obj_f.weapon_type, new_weapon.GetInt(obj_f.weapon_type)); Co8.unset_spell_flag(weapon, Co8SpellFlag.TensersTransformation); weapon.ClearItemFlag(ItemFlag.NO_DROP); new_weapon.Destroy(); } } } }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Quench OnSpellEffect"); // duration is 1d4 hours if implementing 2nd part of quench spell.duration = 0; var target_item = spell.Targets[0]; var damage_dice = Dice.D6; damage_dice = damage_dice.WithCount(Math.Min(spell.casterLevel, 15)); target_item.ParticleSystem = AttachParticles("sp-Quench", target_item.Object); // only damages fire elementals (and flaming sphere Darmagon) if (Co8.is_spell_flag_set(target_item.Object, Co8SpellFlag.FlamingSphere)) { target_item.Object.Destroy(); } else { if ((target_item.Object.IsMonsterCategory(MonsterCategory.elemental)) && (target_item.Object.IsMonsterSubtype(MonsterSubtype.fire))) { // no save, full damage target_item.Object.DealSpellDamage(spell.caster, DamageType.Unspecified, damage_dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); spell.RemoveTarget(target_item.Object); } else { // allowing targeting of creatures? 2nd part of quench target_item.Object.FloatMesFileLine("mes/spell.mes", 31013); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Summon Fire Elemental OnSpellEffect"); spell.duration = 10; // get the proto_id for this monster var monster_proto_id = 14298; // create monster spell.SummonMonsters(true, monster_proto_id); // Gets handle on monster, and sets a flag so that it won't be mistaken for a new summoned monster var monster_obj = Co8.GetCritterHandle(spell, monster_proto_id); AttachParticles("Orb-Summon-Fire-Elemental", monster_obj); // add monster to follower list for spell_caster spell.caster.AddAIFollower(monster_obj); // add monster_obj to d20initiative, and set initiative to spell_caster's var caster_init_value = spell.caster.GetInitiative(); monster_obj.AddToInitiative(); monster_obj.SetInitiative(caster_init_value); UiSystems.Combat.Initiative.UpdateIfNeeded(); // monster should disappear when duration is over, apply "TIMED_DISAPPEAR" condition monster_obj.AddCondition("sp-Summoned", spell.spellId, spell.duration, 0); // add monster to target list spell.ClearTargets(); spell.AddTarget(monster_obj); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Mordenkainen's Faithful Hound OnSpellEffect"); spell.duration = 600 * spell.casterLevel; // get the proto_id for this monster (from radial menu) var monster_proto_id = 14278; // create monster // game.particles( 'sp-Mordenkainens Faithful Hound', spell.target_loc ) spell.SummonMonsters(true, monster_proto_id); var monster_obj = Co8.GetCritterHandle(spell, 14278); var hit_points = 6 * spell.casterLevel; hit_points = 25 + hit_points; monster_obj.SetBaseStat(Stat.hp_max, hit_points); // add monster to follower list for spell_caster spell.caster.AddAIFollower(monster_obj); // add monster_obj to d20initiative, and set initiative to spell_caster's var caster_init_value = spell.caster.GetInitiative(); monster_obj.AddToInitiative(); monster_obj.SetInitiative(caster_init_value); UiSystems.Combat.Initiative.UpdateIfNeeded(); // add monster to target list spell.ClearTargets(); spell.AddTarget(monster_obj, AttachParticles("sp-Mordenkainens Faithful Hound", spell.Targets[0].Object)); spell.Targets[0].Object = monster_obj; // add condition monster_obj.AddCondition("sp-Mordenkainens Faithful Hound", spell.spellId, spell.duration, 0); spell.EndSpell(); }
public static void endStench(GameObject caster, int spell_id) { var casterId = 1; if ((caster != null)) { casterId = Co8.getObjVarNibble(caster, STATE_VAR, CID); Logger.Info("Cleaning up and ending stench for {0} id={1}", caster, casterId); } else { Logger.Info("Caster is null now, trying default"); caster = SelectedPartyLeader; // just to get a location } foreach (var critter in ObjList.ListVicinity(caster.GetLocation(), ObjectListFilter.OLC_CRITTERS)) { if ((Co8.getObjVarNibble(critter, STATE_VAR, casterId) != STATE_UNPROCESSED)) { removeStenchEffect(casterId, spell_id, critter, STATE_UNPROCESSED, true); } if ((Co8.getObjVarNibble(critter, STATE_VAR, casterId) != STATE_NEUTRALISED)) { Co8.setObjVarNibble(critter, STATE_VAR, casterId, STATE_UNPROCESSED); } } return; }
// Give the critter an effect object with the appropriate effect. public static void applyStenchEffect(int casterId, int spell_id, GameObject critter, int status) { var stench_obj = getStenchObj(critter); if ((stench_obj != null)) { if ((status == STATE_NAUSEA)) { // Check current stench effect. var effectOwnerId = Co8.getObjVarNibble(stench_obj, EFFECT_VAR, CID); var effectStatus = Co8.getObjVarNibble(stench_obj, EFFECT_VAR, effectOwnerId); if ((effectStatus == STATE_SICKNESS)) { // Take ownership of effect since Nausea trumps Sickness. Logger.Info("caster {0} taking ownership of effect from caster {1} on {2}", casterId, effectOwnerId, critter); var effectVar = Co8.getObjVarDWord(stench_obj, EFFECT_VAR); stench_obj.Destroy(); stench_obj = createStenchObject(spell_id, critter, status); Co8.setObjVarDWord(stench_obj, EFFECT_VAR, effectVar); } } } else { stench_obj = createStenchObject(spell_id, critter, status); } // Set the status & id into the effect var. Co8.setObjVarNibble(stench_obj, EFFECT_VAR, CID, casterId); Co8.setObjVarNibble(stench_obj, EFFECT_VAR, casterId, status); return; }
public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { var leader = PartyLeader; Co8.StopCombat(attachee, 0); leader.BeginDialog(attachee, 4000); return(RunDefault); }
public static bool run_off(GameObject attachee, GameObject triggerer) { // loc = location_from_axis(427,406) // attachee.runoff(loc) attachee.RunOff(); Co8.Timed_Destroy(attachee, 5000); return(RunDefault); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((!GameSystems.Combat.IsCombatActive())) { Co8.StopCombat(attachee, 1); } return(RunDefault); }
public static bool run_off(GameObject attachee, GameObject triggerer) { // for pc in game.party: // attachee.ai_shitlist_remove( pc ) // attachee.reaction_set( pc, 50 ) attachee.RunOff(); Co8.Timed_Destroy(attachee, 5000); return(RunDefault); }
public override void OnSpellEffect(SpellPacketBody spell) { var check = Co8.check_for_protection_from_spells(spell.Targets, 0); Logger.Info("Mass Inflict Light Wounds OnSpellEffect"); var remove_list = new List <GameObject>(); var dice = Dice.D8; dice = dice.WithModifier(Math.Min(25, spell.casterLevel)); foreach (var target_item in spell.Targets) { AttachParticles("sp-Inflict Light Wounds", target_item.Object); // hurt enemies, heal undead if (target_item.Object.IsMonsterCategory(MonsterCategory.undead)) { // allow Fortitude saving throw for half if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw succesful, damage target, 1/2 damage target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); target_item.Object.HealFromSpell(spell.caster, dice, D20ActionType.CAST_SPELL, spell.spellId); } else { // saving throw unsuccesful, damage target, full damage target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); target_item.Object.HealFromSpell(spell.caster, dice, D20ActionType.CAST_SPELL, spell.spellId); } } else { // check saving throw, damage target if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); // saving throw succesful, damage target, 1/2 damage target_item.Object.DealReducedSpellDamage(spell.caster, DamageType.NegativeEnergy, dice, D20AttackPower.UNSPECIFIED, DAMAGE_REDUCTION_HALF, D20ActionType.CAST_SPELL, spell.spellId); } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // saving throw unsuccesful, damage target, full damage target_item.Object.DealSpellDamage(spell.caster, DamageType.NegativeEnergy, dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); } } remove_list.Add(target_item.Object); } spell.RemoveTargets(remove_list); if (check) { Co8.replace_protection_from_spells(); } spell.EndSpell(); }
public override void OnBeginRound(SpellPacketBody spell) { if (GameSystems.Combat.IsCombatActive()) { var time = 6000 * spell.casterLevel; Co8.Timed_Destroy(spell.Targets[0].Object, time); } Logger.Info("Mordenkainen's Faithful Hound OnBeginRound"); }
public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { if ((GetGlobalFlag(537))) { var leader = PartyLeader; Co8.StopCombat(attachee, 0); leader.BeginDialog(attachee, 400); } return(SkipDefault); }
public static bool check_for_tensers(GameObject target) { if (Co8.find_spell_obj_with_flag(target, 6400, Co8SpellFlag.TensersTransformation) != null) { Co8.destroy_spell_obj_with_flag(target, 6400, Co8SpellFlag.TensersTransformation); return(true); } else { return(false); } }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("ahobm OnSpellEffect"); var remove_list = new List <GameObject>(); spell.duration = 1; AttachParticles("sp-Bane", spell.caster); foreach (var target_item in spell.Targets) { var tar = target_item.Object; if ((tar.GetNameId() == 8064) || (tar.GetNameId() == 8042) || (tar.GetNameId() == 8043) || (tar.GetNameId() == 14455)) { remove_list.Add(tar); tar.FloatMesFileLine("mes/spell.mes", 20048); } else if (tar.IsMonsterCategory(MonsterCategory.plant)) { remove_list.Add(tar); tar.FloatMesFileLine("mes/spell.mes", 20049); } else if (tar.IsMonsterCategory(MonsterCategory.ooze)) { remove_list.Add(tar); tar.FloatMesFileLine("mes/spell.mes", 20049); } else if (tar.IsMonsterCategory(MonsterCategory.aberration)) { remove_list.Add(tar); tar.FloatMesFileLine("mes/spell.mes", 20049); } else if (tar.IsMonsterCategory(MonsterCategory.undead)) { remove_list.Add(tar); tar.FloatMesFileLine("mes/spell.mes", 20050); } else if (tar.GetNameId() == 14455) { remove_list.Add(tar); } else { tar.FloatMesFileLine("mes/spell.mes", 30002); tar.FloatMesFileLine("mes/spell.mes", 20047); tar.KillWithDeathEffect(); } } spell.RemoveTargets(remove_list); Co8.End_Spell(spell); spell.EndSpell(); }
public override bool OnDialog(GameObject attachee, GameObject triggerer) { Co8.get_Co8_options_from_ini(); if ((GetGlobalFlag(601))) { triggerer.BeginDialog(attachee, 20); } else { triggerer.BeginDialog(attachee, 1); } return(SkipDefault); }
public static void replace_tensers(GameObject target) { var spell_obj = GameSystems.MapObject.CreateObject(6400, target.GetLocation()); Co8.set_spell_flag(spell_obj, Co8SpellFlag.TensersTransformation); spell_obj.AddConditionToItem("sp-Feeblemind", 0, 0, 0); // yeah it works, you can put spell effects on items and they will affect the holder spell_obj.AddConditionToItem("Saving Throw Resistance Bonus", 0, 9); spell_obj.AddConditionToItem("Saving Throw Resistance Bonus", 1, 4); spell_obj.AddConditionToItem("Saving Throw Resistance Bonus", 2, 4); spell_obj.AddConditionToItem("Attribute Enhancement Bonus", 0, -2); // divine power gives too much strength bonus spell_obj.AddConditionToItem("Attribute Enhancement Bonus", 1, 4); spell_obj.AddConditionToItem("Attribute Enhancement Bonus", 2, 4); spell_obj.AddConditionToItem("Amulet of Natural Armor", 4, 0); target.GetItem(spell_obj); }
public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { if ((attachee.GetLeader() != null)) { return(SkipDefault); } else { Co8.StopCombat(attachee, 0); attachee.FloatLine(1000, triggerer); attachee.SetObjectFlag(ObjectFlag.OFF); } return(RunDefault); }
public static void removeStenchEffect(int casterId, int spell_id, GameObject critter, int status, bool unNullify) { var stench_obj = getStenchObj(critter); if ((stench_obj != null)) { Logger.Info("removing effect {0} for {1} by caster {2}", stench_obj, critter, casterId); Co8.setObjVarNibble(stench_obj, EFFECT_VAR, casterId, status); // Check current stench effect. var effectOwnerId = Co8.getObjVarNibble(stench_obj, EFFECT_VAR, CID); if ((casterId == effectOwnerId)) { // Pass ownership of effect to another stench. int s = 0; int otherId; for (otherId = BASECASTERID; otherId < 7; otherId++) { s = Co8.getObjVarNibble(stench_obj, EFFECT_VAR, otherId); if (s == STATE_NAUSEA || s == STATE_NAUSEA_HANGOVER) { break; // Nausea trumps Sickness. } } var effectVar = Co8.getObjVarDWord(stench_obj, EFFECT_VAR); stench_obj.Destroy(); if (s == STATE_NAUSEA || s == STATE_NAUSEA_HANGOVER || s == STATE_SICKNESS) { Logger.Info("caster {0} taking ownership of effect from caster {1} on {2}", otherId, casterId, critter); stench_obj = createStenchObject(spell_id, critter, s); Co8.setObjVarDWord(stench_obj, EFFECT_VAR, effectVar); Co8.setObjVarNibble(stench_obj, EFFECT_VAR, CID, otherId); } if (s != STATE_NAUSEA && s != STATE_NAUSEA_HANGOVER && unNullify) { reenableWeapons(critter); } } } else { reenableWeapons(critter); } return; }
public static void reenableWeapons(GameObject critter) { for (var num = 4000; num < 5000; num++) { var weapon = critter.FindItemByProto(num); if ((weapon != null && Co8.is_spell_flag_set(weapon, Co8SpellFlag.HezrouStench))) { Logger.Info("Enabling weapon {0} for {1}", weapon, critter); weapon.SetInt(obj_f.weapon_damage_dice, weapon.GetInt(obj_f.weapon_pad_i_2)); Co8.unset_spell_flag(weapon, Co8SpellFlag.HezrouStench); weapon.ClearItemFlag(ItemFlag.NO_DROP); } } return; }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Analyze Dweomer OnSpellEffect"); var remove_list = new List <GameObject>(); spell.duration = spell.casterLevel * 10; if (spell.Targets.Length == 1 && spell.Targets[0].Object == spell.caster) { } else { if (spell.caster.GetMoney() >= 150000) { foreach (var t in spell.Targets) { AttachParticles("sp-Identify", t.Object); t.Object.IdentifyAll(); } } else { spell.caster.FloatMesFileLine("mes/spell.mes", 16009); } } foreach (var target_item in spell.Targets) { remove_list.Add(target_item.Object); } spell.RemoveTargets(remove_list); if (Co8.find_spell_obj_with_flag(spell.caster, 6400, Co8SpellFlag.AnalyzeDweomer) == null) { var spell_obj = GameSystems.MapObject.CreateObject(6400, spell.caster.GetLocation()); Co8.set_spell_flag(spell_obj, Co8SpellFlag.AnalyzeDweomer); spell_obj.AddConditionToItem("Skill Circumstance Bonus", (int)SkillId.spellcraft, 20); spell.caster.GetItem(spell_obj); spell.ClearTargets(); spell.AddTarget(spell.caster); spell.caster.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0); } else { spell.caster.FloatMesFileLine("mes/spell.mes", 16007); spell.EndSpell(); } }
public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalFlag(372))) { attachee.SetObjectFlag(ObjectFlag.OFF); } else { if ((attachee.GetLeader() == null && !GameSystems.Combat.IsCombatActive())) { SetGlobalVar(721, 0); Co8.StopCombat(attachee, 1); } } return(RunDefault); }
public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { if ((GetGlobalVar(538) != 4)) { SetGlobalVar(538, GetGlobalVar(538) + 1); } if ((GetGlobalVar(538) == 3)) { var leader = PartyLeader; Co8.StopCombat(attachee, 0); leader.BeginDialog(attachee, 100); SetGlobalVar(538, 4); } return(RunDefault); }
public static void unNeutraliseStench(GameObject critter) { var curedCount = Co8.getObjVarNibble(critter, STATE_VAR, COUNTER); Logger.Info("Un-neutralising stench, curedCount={0}", curedCount); Co8.setObjVarNibble(critter, STATE_VAR, COUNTER, curedCount - 1); if ((curedCount <= 1)) { Logger.Info("Un-neutralising stench on: {0}", critter); for (var casterId = BASECASTERID; casterId < 7; casterId++) { Co8.setObjVarNibble(critter, STATE_VAR, casterId, STATE_UNPROCESSED); } } return; }
public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { if (((GetGlobalFlag(948)) && (GetGlobalFlag(949)) && (GetGlobalFlag(950)) && (GetGlobalFlag(951)) && (GetGlobalFlag(952)) && (GetGlobalFlag(953)) && (GetGlobalFlag(954)))) { foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC)) { Co8.StopCombat(attachee, 0); obj.BeginDialog(attachee, 20); return(RunDefault); } } else { return(SkipDefault); } return(RunDefault); }
public override bool OnStartCombat(GameObject attachee, GameObject triggerer) { if ((GetGlobalVar(704) == 8)) { foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC)) { Co8.StopCombat(attachee, 0); var wilfrick = Utilities.find_npc_near(attachee, 8703); attachee.TurnTowards(wilfrick); obj.BeginDialog(attachee, 1); SetGlobalVar(704, 9); return RunDefault; } } return RunDefault; }
public static GameObject getStenchObj(GameObject critter) { var it = 0; var stench_obj = critter.FindItemByName(OBJ_SPELL_STENCH); while ((stench_obj != null && !Co8.is_spell_flag_set(stench_obj, Co8SpellFlag.HezrouStench) && it < 217)) { stench_obj = critter.GetInventoryItem(it); it += 1; } if ((it >= 217)) { Logger.Info("Search for Stench Object a lot of times!"); } return(stench_obj); }
public static GameObject createStenchObject(int spell_id, GameObject critter, int status) { var stench_obj = GameSystems.MapObject.CreateObject(OBJ_SPELL_STENCH, critter.GetLocation()); stench_obj.SetItemFlag(ItemFlag.NO_DROP); stench_obj.SetItemFlag(ItemFlag.NO_LOOT); Co8.set_spell_flag(stench_obj, Co8SpellFlag.HezrouStench); if ((status == STATE_SICKNESS)) { Logger.Info("status: {0} applying sickness effect to {1} for {2}", status, stench_obj, critter); stench_obj.AddConditionToItem("sp-Unholy Blight", spell_id, STENCH_DURATION, 0); // Doesn't penalise saves - does flag char info. stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 0, -2); stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 1, -2); stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 2, -2); } else if ((status == STATE_NAUSEA)) { Logger.Info("status: {0} applying nausea effect to {1} for {2}", status, stench_obj, critter); // Reduce weapon dmg since not supposed to be able to attack when nauseated. nullifyWeapons(critter); // Apply simulated nausea effects to stench obj. var strength = critter.GetStat(Stat.strength); // No strength bonus. stench_obj.AddConditionToItem("Attribute Enhancement Bonus", 0, 11 - strength); stench_obj.AddConditionToItem("sp-Chaos Hammer", spell_id, STENCH_DURATION, 0); // Only get move action. (+2 AC, -2 attack & damage rolls, +2 saves [shoddy implementation]) stench_obj.AddConditionToItem("sp-Feeblemind", 0, 0, 0); // No casting. (-4 to saves for arcane spellcasters) if ((critter.GetStat(Stat.level_sorcerer) > 0 || critter.GetStat(Stat.level_bard) > 0 || critter.GetStat(Stat.level_wizard) > 0)) { stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 0, 2); stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 1, 2); stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 2, 2); // Counteract feeblemind penalties for arcane casters. } else { stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 0, -2); stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 1, -2); stench_obj.AddConditionToItem("Saving Throw Resistance Bonus", 2, -2); // Counteract hammer bonuses. } } critter.GetItem(stench_obj); AttachParticles("sp-Stinking Cloud Hit", critter); return(stench_obj); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Enslavement OnSpellEffect"); var npc = spell.caster; var target_item = spell.Targets[0]; if (!target_item.Object.IsFriendly(spell.caster) && target_item.Object.GetNameId() != 14455) { if ((target_item.Object.type == ObjectType.pc) || (target_item.Object.type == ObjectType.npc)) { if (!(spell.caster.HasMaxFollowers())) { spell.caster.AddFollower(target_item.Object); } else { spell.caster.AddAIFollower(target_item.Object); } // add target to initiative, just in case target_item.Object.AddToInitiative(); UiSystems.Combat.Initiative.UpdateIfNeeded(); } else { // not a person target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { // can't target friendlies AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } Co8.End_Spell(spell); spell.EndSpell(); }