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 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 static void nullifyWeapons(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("Nullifying weapon {0} for {1}", weapon, critter); Co8.set_spell_flag(weapon, Co8SpellFlag.HezrouStench); weapon.SetInt(obj_f.weapon_pad_i_2, weapon.GetInt(obj_f.weapon_damage_dice)); weapon.SetInt(obj_f.weapon_damage_dice, 0); weapon.SetItemFlag(ItemFlag.NO_DROP); } } return; }
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("Antidote OnSpellEffect"); spell.duration = 600; if (Co8.find_spell_obj_with_flag(spell.caster, 12706, Co8SpellFlag.AnalyzeDweomer) == null) { var spell_obj = GameSystems.MapObject.CreateObject(12706, spell.caster.GetLocation()); Co8.set_spell_flag(spell_obj, Co8SpellFlag.AnalyzeDweomer); spell_obj.AddConditionToItem("Luck Poison Save Bonus", 5, 0); 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 void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Death Ward OnSpellEffect"); // Dar's level check no longer needed thanks to Spellslinger's dll fix // if spell.caster_class == 13: #added to check for proper paladin slot level (darmagon) // if spell.spell_level < 4: // spell.caster.float_mesfile_line('mes\\spell.mes', 16008) // return spell.duration = 10 * spell.casterLevel; var npc = spell.caster; // added so NPC's can pre-buff if (npc.type != ObjectType.pc && npc.GetLeader() == null && !GameSystems.Combat.IsCombatActive()) { spell.duration = 2000 * spell.casterLevel; } var target = spell.Targets[0]; if (Co8.find_spell_obj_with_flag(target.Object, SPELL_OBJ, Co8SpellFlag.DeathWard) == null) { var spell_obj = GameSystems.MapObject.CreateObject(SPELL_OBJ, target.Object.GetLocation()); spell_obj.SetItemFlag(ItemFlag.NO_DROP); spell_obj.SetItemFlag(ItemFlag.NO_LOOT); Co8.set_spell_flag(spell_obj, Co8SpellFlag.DeathWard); spell_obj.AddConditionToItem("Monster Energy Immunity", (int)DamageType.NegativeEnergy, 0); target.Object.GetItem(spell_obj); target.Object.AddCondition("sp-Death Ward", spell.spellId, spell.duration, 0); do_particles(target); // This is evil, but we need to remember who the spell was // cast on, and the target_list gets blown away. spell.caster = target.Object; } else { target.Object.FloatMesFileLine("mes/spell.mes", 16007); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); spell.EndSpell(); } }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Tensers Transformation OnSpellEffect"); spell.duration = 1 * spell.casterLevel; var dam = Dice.Parse("1d1"); dam = dam.WithCount(spell.casterLevel); spell.dc = 0; if (Co8.find_spell_obj_with_flag(spell.caster, 6400, Co8SpellFlag.TensersTransformation) == null) { var weapon = spell.caster.ItemWornAt(EquipSlot.WeaponPrimary); if (weapon != null) { Co8.set_spell_flag(weapon, Co8SpellFlag.TensersTransformation); weapon.SetInt(obj_f.weapon_type, 12); weapon.SetItemFlag(ItemFlag.NO_DROP); spell.dc = weapon.GetNameId(); // OKAY I am trying to avoid stuff like this but I need a variable, not otherwise used,and unique to this spell that I know will still be alive in OnEndSpellcast } var spell_obj = GameSystems.MapObject.CreateObject(6400, spell.caster.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); spell.caster.GetItem(spell_obj); spell.caster.AddCondition("sp-Divine Power", spell.spellId, spell.duration, 0); // to make base attack bonus equal caster level did not put on item in order that a spell marker would appear on casters icon spell.caster.Damage(null, DamageType.Force, dam, D20AttackPower.NORMAL); } else { spell.caster.FloatMesFileLine("mes/spell.mes", 16007); spell.EndSpell(); } }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Warp Wood OnSpellEffect"); var number_items = spell.casterLevel; var remove_list = new List <GameObject>(); var itemref = 0; foreach (var target_item in spell.Targets) { if (number_items > 0) { // First, check creatures for held wooden items if ((target_item.Object.type == ObjectType.pc) || (target_item.Object.type == ObjectType.npc)) { // Check for a wooden missile weapon and destroy that var item_affected = target_item.Object.ItemWornAt(EquipSlot.WeaponPrimary); if ((item_affected.GetInt(obj_f.weapon_ammo_type) < 2) && (number_items >= Warp_Size_by_Item_Size(item_affected))) { var FLAGS = item_affected.GetItemFlags(); // Only works on nonmagic wood, and the item gets its owner's Will save if ((item_affected.GetMaterial() == Material.wood) && (FLAGS & ItemFlag.IS_MAGICAL) == 0 && !(target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))) { target_item.Object.FloatMesFileLine("mes/combat.mes", 22); number_items = number_items - Warp_Size_by_Item_Size(item_affected); AttachParticles("Blight", target_item.Object); item_affected.Destroy(); } } // Check for a wooden melee weapon and warp that (-4 to attack rolls) item_affected = target_item.Object.ItemWornAt(EquipSlot.WeaponPrimary); if ((item_affected != null) && (number_items >= Warp_Size_by_Item_Size(item_affected))) { var FLAGS = item_affected.GetItemFlags(); // Only works on nonmagic wood, and the item gets its owner's Will save if ((item_affected.GetMaterial() == Material.wood) && (FLAGS & ItemFlag.IS_MAGICAL) == 0 && !(target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))) { if (!(Co8.is_spell_flag_set(item_affected, Co8SpellFlag.Summoned))) { item_affected.AddConditionToItem("To Hit Bonus", -4); Co8.set_spell_flag(item_affected, Co8SpellFlag.Summoned); AttachParticles("Blight", target_item.Object); target_item.Object.FloatMesFileLine("mes/combat.mes", 8); } number_items = number_items - Warp_Size_by_Item_Size(item_affected); } } } // Done with creature checks // Check for unattended weapons targeted and warp, unwarp, or destroy them else if ((target_item.Object.type == ObjectType.weapon)) { var item_affected = target_item.Object; var FLAGS = item_affected.GetItemFlags(); // Only works on nonmagical wooden items if ((item_affected.GetMaterial() == Material.wood) && (FLAGS & ItemFlag.IS_MAGICAL) == 0 && (number_items >= Warp_Size_by_Item_Size(item_affected))) { // Missile weapons are destroyed if ((item_affected.GetInt(obj_f.weapon_ammo_type) < 2)) { target_item.Object.FloatMesFileLine("mes/combat.mes", 22); AttachParticles("Blight", target_item.Object); number_items = number_items - Warp_Size_by_Item_Size(item_affected); item_affected.Destroy(); } // Melee weapons that are warped are replaced with an unwarped version else if ((Co8.is_spell_flag_set(item_affected, Co8SpellFlag.Summoned))) { var proto = item_affected.GetNameId(); var holder = GameSystems.MapObject.CreateObject(proto, item_affected.GetLocation()); number_items = number_items - Warp_Size_by_Item_Size(item_affected); item_affected.Destroy(); } else { // Melee weapons that are unwarped are warped (-4 to attack rolls) item_affected.AddConditionToItem("To Hit Bonus", -4); Co8.set_spell_flag(item_affected, Co8SpellFlag.Summoned); AttachParticles("Blight", target_item.Object); number_items = number_items - Warp_Size_by_Item_Size(item_affected); target_item.Object.FloatMesFileLine("mes/combat.mes", 8); } } number_items = number_items - Warp_Size_by_Item_Size(item_affected); } // Check for locked wooden chests, and unlock them else if ((target_item.Object.type == ObjectType.container)) { var item_affected = target_item.Object; if ((target_item.Object.GetMaterial() == Material.wood)) { if (((target_item.Object.GetContainerFlags() & ContainerFlag.LOCKED)) != 0 && (number_items >= Warp_Size_by_Item_Size(item_affected))) { target_item.Object.ClearContainerFlag(ContainerFlag.LOCKED); target_item.Object.FloatMesFileLine("mes/spell.mes", 30004); number_items = number_items - Warp_Size_by_Item_Size(item_affected); } } else { AttachParticles("Fizzle", target_item.Object); target_item.Object.FloatMesFileLine("mes/spell.mes", 30003); } } // Check for locked wooden doors, and unlock and open them else if ((target_item.Object.type == ObjectType.portal)) { var item_affected = target_item.Object; if ((target_item.Object.GetMaterial() == Material.wood)) { if (((target_item.Object.GetPortalFlags() & PortalFlag.LOCKED)) != 0 && (number_items >= Warp_Size_by_Item_Size(item_affected))) { target_item.Object.ClearPortalFlag(PortalFlag.LOCKED); target_item.Object.FloatMesFileLine("mes/spell.mes", 30004); if ((target_item.Object.GetPortalFlags() & PortalFlag.OPEN) == 0) { target_item.Object.TogglePortalOpen(); target_item.Object.FloatMesFileLine("mes/spell.mes", 30013); } number_items = number_items - Warp_Size_by_Item_Size(item_affected); } } else { AttachParticles("Fizzle", target_item.Object); target_item.Object.FloatMesFileLine("mes/spell.mes", 30003); } } else { AttachParticles("Fizzle", target_item.Object); target_item.Object.FloatMesFileLine("mes/spell.mes", 30003); } } remove_list.Add(target_item.Object); } spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Flaming Sphere OnSpellEffect"); var dam = Dice.D4; spell.duration = 1 * spell.casterLevel; var weapon_proto = 4143; var weapon_portrait = 4320; var monster_proto_id = 14629; var npc = spell.caster; if (npc.GetNameId() == 8036 || npc.GetNameId() == 14425) // faction 7 { monster_proto_id = 14621; } if (npc.GetNameId() == 14425 && npc.GetMap() == 5065) // faction 15 { monster_proto_id = 14604; } // create monster spell.SummonMonsters(true, monster_proto_id); GameObject monster_obj = null; var m_list = ObjList.ListCone(spell.caster, ObjectListFilter.OLC_CRITTERS, 200, -180, 360); foreach (var m in m_list) { if (m.GetNameId() == monster_proto_id && m.ItemWornAt(EquipSlot.WeaponPrimary) == null && m.GetLeader() == spell.caster && Co8.are_spell_flags_null(m)) { monster_obj = m; Co8.set_spell_flag(m, Co8SpellFlag.FlamingSphere); m.SetInt(obj_f.critter_description_unknown, 20356); } } m_list = ObjList.ListCone(monster_obj, ObjectListFilter.OLC_CRITTERS, 5, -180, 360); foreach (var m in m_list) { if (m != spell.caster && !Co8.is_spell_flag_set(m, Co8SpellFlag.FlamingSphere)) { if (!m.SavingThrow(spell.dc, SavingThrowType.Reflex, D20SavingThrowFlag.NONE, monster_obj)) { m.Damage(monster_obj, DamageType.Fire, dam, D20AttackPower.NORMAL); } else { m.FloatMesFileLine("mes/spell.mes", 30001); } } } monster_obj.AddCondition("Amulet of Mighty Fists", -20, -10); monster_obj.AddCondition("Monster Plant", 0, 0); monster_obj.SetInt(obj_f.critter_portrait, weapon_portrait); var hit_points = 10 * spell.casterLevel; hit_points = 25 + hit_points; monster_obj.SetBaseStat(Stat.hp_max, hit_points); monster_obj.ClearObjectFlag(ObjectFlag.CLICK_THROUGH); // monster_obj.npc_flag_set(ONF_NO_ATTACK) // add monster to follower list for spell_caster if (!spell.caster.HasMaxFollowers()) { spell.caster.RemoveAIFollower(monster_obj); spell.caster.AddFollower(monster_obj); monster_obj.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0); } // add monster to target list spell.ClearTargets(); spell.AddTarget( monster_obj, AttachParticles("sp-Fireball-proj", monster_obj) ); // add spell indicator to spell caster spell.caster.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0); Logger.Info("{0}", spell.Targets[0].Object); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Mordenkainens Sword OnSpellEffect"); spell.duration = 1 * spell.casterLevel; var hp_bonus = 25; var weapon_proto = 4143; var weapon_portrait = 7980; var monster_proto_id = 14629; var npc = spell.caster; if (npc.GetNameId() == 8036 || npc.GetNameId() == 14425) // faction 7 { monster_proto_id = 14621; spell.duration = 10; hp_bonus = 1000; } if (npc.GetNameId() == 14425 && npc.GetMap() == 5065) // faction 15 { monster_proto_id = 14604; } // determine focus var focus = 0; if ((spell.caster.type != ObjectType.pc) && (spell.caster.GetLeader() == null)) { // for NPCs not in game party focus = 1; } else { if (spell.caster.GetMoney() >= 25000) { focus = 1; } } // check for focus if (focus == 1) { // create monster spell.SummonMonsters(true, monster_proto_id); GameObject monster_obj = null; var m_list = ObjList.ListCone(spell.caster, ObjectListFilter.OLC_CRITTERS, 200, -180, 360); foreach (var m in m_list) { if (m.GetNameId() == monster_proto_id && m.ItemWornAt(EquipSlot.WeaponPrimary) == null && m.GetLeader() == spell.caster && Co8.are_spell_flags_null(m)) { monster_obj = m; Co8.set_spell_flag(m, Co8SpellFlag.MordenkainensSword); m.SetInt(obj_f.critter_description_unknown, 20355); monster_obj.ClearObjectFlag(ObjectFlag.CLICK_THROUGH); } } if (!Co8.is_in_party(spell.caster)) { monster_obj.ClearObjectFlag(ObjectFlag.INVULNERABLE); monster_obj.AddCondition("Monster Energy Immunity", "Force", 0); } monster_obj.AddCondition("Monster Plant", 0, 0); monster_obj.SetInt(obj_f.critter_portrait, weapon_portrait); var hit_points = 10 * spell.casterLevel; hit_points = hp_bonus + hit_points; monster_obj.SetBaseStat(Stat.hp_max, hit_points); // equip the tempman with the appropriate weapon var weapon_obj = GameSystems.MapObject.CreateObject(weapon_proto, monster_obj.GetLocation()); weapon_obj.SetInt(obj_f.weapon_damage_dice, 772); weapon_obj.SetInt(obj_f.weapon_attacktype, (int)DamageType.Force); weapon_obj.AddConditionToItem("Armor Bonus", -7, 0); var to_hit = spell.casterLevel + 3 - monster_obj.GetBaseStat(Stat.attack_bonus); if ((Stat)spell.spellClass == Stat.level_wizard) { to_hit = to_hit + spell.caster.GetStat(Stat.int_mod); } else { to_hit = to_hit + spell.caster.GetStat(Stat.cha_mod); } weapon_obj.AddConditionToItem("To Hit Bonus", to_hit, 0); weapon_obj.AddConditionToItem("Damage Bonus", 3, 0); monster_obj.GetItem(weapon_obj); weapon_obj.SetItemFlag(ItemFlag.NO_TRANSFER); monster_obj.WieldBestInAllSlots(); // add monster to follower list for spell_caster if (Co8.is_in_party(spell.caster)) { if (!spell.caster.HasMaxFollowers()) { spell.caster.RemoveAIFollower(monster_obj); spell.caster.AddFollower(monster_obj); monster_obj.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0); } } // add monster to target list spell.ClearTargets(); spell.AddTarget(monster_obj, AttachParticles("sp-Spell Resistance", monster_obj)); // add spell indicator to spell caster spell.caster.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0); } else { // no focus spell.caster.FloatMesFileLine("mes/spell.mes", 16009); } spell.EndSpell(); }