public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Charm Monster OnSpellEffect"); spell.duration = 600 * spell.casterLevel; var target_item = spell.Targets[0]; if (!target_item.Object.IsFriendly(spell.caster)) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); spell.caster.AddAIFollower(target_item.Object); target_item.Object.AddCondition("sp-Charm Monster", spell.spellId, spell.duration, GameSystems.Critter.GetHitDiceNum(target_item.Object)); target_item.ParticleSystem = AttachParticles("sp-Charm Monster", target_item.Object); target_item.Object.AddToInitiative(); UiSystems.Combat.Initiative.UpdateIfNeeded(); } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Hold Animal OnSpellEffect"); spell.duration = 1 * spell.casterLevel; var target = spell.Targets[0]; if (target.Object.IsMonsterCategory(MonsterCategory.animal)) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Hold Animal", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Hold Animal", target.Object); } } else { target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31002); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { var target = spell.Targets[0]; spell.duration = 14400 * spell.casterLevel; if (target.Object.IsFriendly(spell.caster)) { // can't dominate friendlies AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // success target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { // failure target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.ParticleSystem = AttachParticles("sp-Dominate Person", target.Object); target.Object.AddCondition("sp-Dominate Person", spell.spellId, spell.duration, 0); target.Object.AddToInitiative(); UiSystems.Combat.Initiative.UpdateIfNeeded(); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Infatuation OnSpellEffect"); foreach (var target_item in spell.Targets) { 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)) { 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); } } // can't target friendlies spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Daze OnSpellEffect"); spell.duration = 1; var target = spell.Targets[0]; if (!target.Object.IsMonsterCategory(MonsterCategory.animal)) { if (GameSystems.Stat.DispatchGetSizeCategory(target.Object) < SizeCategory.Large) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Daze", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Daze", target.Object); } } } else { spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Death Knell OnSpellEffect"); var target_item = spell.Targets[0]; spell.duration = 100 * GameSystems.Critter.GetHitDiceNum(target_item.Object); if (target_item.Object.GetStat(Stat.hp_current) < 0) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); spell.caster.FloatMesFileLine("mes/spell.mes", 20023); spell.caster.AddCondition("sp-Death Knell", spell.spellId, spell.duration, 2); target_item.Object.KillWithDeathEffect(); target_item.ParticleSystem = AttachParticles("sp-Death Knell", target_item.Object); } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 31006); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Quench OnSpellEffect"); 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); if ((target_item.Object.IsMonsterCategory(MonsterCategory.elemental)) && (target_item.Object.IsMonsterSubtype(MonsterSubtype.fire))) { target_item.Object.DealSpellDamage(spell.caster, DamageType.Magic, damage_dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); spell.RemoveTarget(target_item.Object); } else { 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("Command OnSpellEffect"); spell.duration = 1; var target_item = spell.Targets[0]; if (!target_item.Object.IsFriendly(spell.caster)) { if ((target_item.Object.type == ObjectType.pc) || (target_item.Object.type == ObjectType.npc)) { if (!target_item.Object.IsMonsterCategory(MonsterCategory.animal)) { if (GameSystems.Stat.DispatchGetSizeCategory(target_item.Object) < SizeCategory.Large) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); target_item.Object.AddCondition("sp-Command", spell.spellId, spell.duration, spell.GetMenuArg(RadialMenuParam.MinSetting)); target_item.ParticleSystem = AttachParticles("sp-Command", target_item.Object); } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31005); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31004); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { 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 { AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Flare OnSpellEffect"); spell.duration = 10; var target = spell.Targets[0]; if (!target.Object.D20Query(D20DispatcherKey.QUE_Critter_Is_Blinded)) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Flare", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Flare", target.Object); } } else { AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } spell.EndSpell(); }
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("Flare OnSpellEffect"); spell.duration = 10; var target = spell.Targets[0]; // sightless/blind creatures are unaffected if (!target.Object.D20Query(D20DispatcherKey.QUE_Critter_Is_Blinded)) { // allow Fortitude saving throw to negate if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { // saving throw unsuccessful target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Flare", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Flare", target.Object); } } else { // target is blind, unaffected AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Daze OnSpellEffect"); spell.duration = 1; var target = spell.Targets[0]; if (target.Object.IsMonsterCategory(MonsterCategory.humanoid)) { if (GameSystems.Critter.GetHitDiceNum(target.Object) < 5) { // allow Will saving throw to negate if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { // saving throw unsuccessful target.Object.FloatMesFileLine("mes/spell.mes", 30002); // HTN - apply condition DAZED target.Object.AddCondition("sp-Daze", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Daze", target.Object); } } } else { spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Feeblemind OnSpellEffect"); var target = spell.Targets[0]; if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); Logger.Info("obj={0}", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.FloatMesFileLine("mes/spell.mes", 20022); target.Object.AddCondition("sp-Feeblemind", spell.spellId, 0, 0); target.ParticleSystem = AttachParticles("sp-Feeblemind", target.Object); } } else { target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Daze Monster OnSpellEffect"); spell.duration = 1; var target = spell.Targets[0]; if (GameSystems.Critter.GetHitDiceNum(target.Object) < 7) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Daze", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Daze", target.Object); } } else { AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Reduce OnSpellEffect"); spell.duration = 10 * spell.casterLevel; var target_item = spell.Targets[0]; if (target_item.Object.IsFriendly(spell.caster)) { if ((target_item.Object.IsMonsterCategory(MonsterCategory.humanoid)) && (GameSystems.Stat.DispatchGetSizeCategory(target_item.Object) < SizeCategory.Large)) { var return_val = target_item.Object.AddCondition("sp-Reduce", spell.spellId, spell.duration, 0); if (return_val) { target_item.ParticleSystem = AttachParticles("sp-Reduce Person", target_item.Object); } } else { // not a humanoid target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31004); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { if ((target_item.Object.IsMonsterCategory(MonsterCategory.humanoid)) && (GameSystems.Stat.DispatchGetSizeCategory(target_item.Object) < SizeCategory.Large)) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccesful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); var return_val = target_item.Object.AddCondition("sp-Reduce", spell.spellId, spell.duration, 0); if (return_val) { target_item.ParticleSystem = AttachParticles("sp-Reduce Person", target_item.Object); } } else { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { // not a humanoid target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31004); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Dust of Disappearance OnSpellEffect"); var target = spell.Targets[0]; var dice = new Dice(2, 10, 0); spell.duration = dice.Roll(); Logger.Info("dust of disappearance, duration={0}", spell.duration); // check if target is friendly (willing target) if (target.Object.IsFriendly(spell.caster)) { // HTN - apply condition INVISIBLE if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.Object.AddCondition("sp-Dust of Disappearance", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Improved Invisibility", target.Object); } else { // invalid target target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } else { // HTN - apply condition INVISIBLE if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { // allow Will saving throw to negate if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { // saving throw unsuccessful target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Dust of Disappearance", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Improved Invisibility", target.Object); } } else { // invalid target target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Invisibility OnSpellEffect"); spell.duration = 10 * spell.casterLevel; var target = spell.Targets[0]; // check if target is friendly (willing target) if (target.Object.IsFriendly(spell.caster)) { // HTN - apply condition INVISIBLE if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.Object.AddCondition("sp-Invisibility", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Invisibility", target.Object); } else { // not a critter target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } else { // HTN - apply condition INVISIBLE if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { // allow Will saving throw to negate if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { // saving throw unsuccessful target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Invisibility", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Invisibility", target.Object); } } else { // not a critter target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Charm Monster OnSpellEffect"); spell.duration = 600 * spell.casterLevel; var target_item = spell.Targets[0]; var target_item_obj = target_item.Object; if (Co8Settings.CharmSpellDCModifier) { if (GameSystems.Combat.IsCombatActive()) { spell.dc = spell.dc - 5; // to reflect a bonus to the saving throw for casting charm in combat } } if ((!((GameSystems.Party.PartyMembers).Contains(spell.caster))) && (target_item.Object.type != ObjectType.pc) && ((GameSystems.Party.PartyMembers).Contains(target_item.Object))) { // NPC enemy is trying to charm an NPC from your party - this is bad because it effectively kills the NPC (is dismissed from party and becomes hostile, thus becoming unrecruitable unless you use dominate person/monster target_item_obj = Utilities.party_closest(spell.caster, mode_select: 0); // select nearest conscious PC instead, who isn't already charmed if (target_item_obj == null) { target_item_obj = target_item.Object; } } if (!target_item_obj.IsFriendly(spell.caster)) { if (!target_item_obj.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.CHARM, spell.caster, spell.spellId)) { // saving throw unsuccessful target_item_obj.FloatMesFileLine("mes/spell.mes", 30002); spell.caster.AddAIFollower(target_item_obj); target_item_obj.AddCondition("sp-Charm Monster", spell.spellId, spell.duration, GameSystems.Critter.GetHitDiceNum(target_item_obj)); target_item.ParticleSystem = AttachParticles("sp-Charm Monster", target_item_obj); // add target to initiative, just in case target_item_obj.AddToInitiative(); UiSystems.Combat.Initiative.UpdateIfNeeded(); } else { // saving throw successful target_item_obj.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item_obj); spell.RemoveTarget(target_item_obj); } } else { // can't target friendlies AttachParticles("Fizzle", target_item_obj); spell.RemoveTarget(target_item_obj); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Charm Person or Animal OnSpellEffect"); spell.duration = 600 * spell.casterLevel; var target_item = spell.Targets[0]; if (Co8Settings.CharmSpellDCModifier) { if (GameSystems.Combat.IsCombatActive()) { spell.dc = spell.dc - 5; // to reflect a bonus to the saving throw for casting charm in combat } } if (!target_item.Object.IsFriendly(spell.caster)) { if ((target_item.Object.IsMonsterCategory(MonsterCategory.animal))) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); spell.caster.AddAIFollower(target_item.Object); target_item.Object.AddCondition("sp-Charm Person or Animal", spell.spellId, spell.duration, GameSystems.Critter.GetHitDiceNum(target_item.Object)); target_item.ParticleSystem = AttachParticles("sp-Charm Person or Animal", target_item.Object); // add target to initiative, just in case target_item.Object.AddToInitiative(); UiSystems.Combat.Initiative.UpdateIfNeeded(); } else { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { // not an animal target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31002); 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); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Dust of Disappearance OnSpellEffect"); var target = spell.Targets[0]; var dice = new Dice(2, 10, 0); spell.duration = dice.Roll(); Logger.Info("dust of disappearance, duration={0}", spell.duration); if (target.Object.IsFriendly(spell.caster)) { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.Object.AddCondition("sp-Dust of Disappearance", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Improved Invisibility", target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } else { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Dust of Disappearance", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Improved Invisibility", target.Object); } } else { target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Reduce Animal OnSpellEffect"); spell.duration = 10 * spell.casterLevel; var target_item = spell.Targets[0]; if (target_item.Object.IsFriendly(spell.caster)) { if ((target_item.Object.IsMonsterCategory(MonsterCategory.animal))) { target_item.Object.AddCondition("sp-Reduce Animal", spell.spellId, spell.duration, 0); target_item.ParticleSystem = AttachParticles("sp-Reduce Animal", target_item.Object); } else { // not an animal target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31002); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { if ((target_item.Object.IsMonsterCategory(MonsterCategory.animal))) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccesful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); target_item.Object.AddCondition("sp-Reduce Animal", spell.spellId, spell.duration, 0); target_item.ParticleSystem = AttachParticles("sp-Reduce Animal", target_item.Object); } else { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { // not an animal target_item.Object.FloatMesFileLine("mes/spell.mes", 30000); target_item.Object.FloatMesFileLine("mes/spell.mes", 31002); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } spell.EndSpell(); }
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) { Logger.Info("Invisibility OnSpellEffect"); spell.duration = 10 * spell.casterLevel; var target = spell.Targets[0]; if (target.Object.IsFriendly(spell.caster)) { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { target.Object.AddCondition("sp-Invisibility", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Invisibility", target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } else { if ((target.Object.type == ObjectType.pc) || (target.Object.type == ObjectType.npc)) { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Invisibility", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Invisibility", target.Object); } } else { target.Object.FloatMesFileLine("mes/spell.mes", 30000); target.Object.FloatMesFileLine("mes/spell.mes", 31001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Protection From Arrows OnSpellEffect"); var damage_max = 10 * Math.Min(10, spell.casterLevel); spell.duration = 600 * spell.casterLevel; var target = spell.Targets[0]; if (target.Object.IsFriendly(spell.caster)) { target.Object.AddCondition("sp-Protection From Arrows", spell.spellId, spell.duration, damage_max); target.ParticleSystem = AttachParticles("sp-Protection From Arrows", target.Object); } else if (!target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccessful target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Protection From Arrows", spell.spellId, spell.duration, damage_max); target.ParticleSystem = AttachParticles("sp-Protection From Arrows", target.Object); } else { // saving throw successful target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } spell.EndSpell(); }
public override void OnEndProjectile(SpellPacketBody spell, GameObject projectile, int index_of_target) { Logger.Info("Ray of Frost OnEndProjectile"); var damage_dice = Dice.D3; spell.duration = 0; EndProjectileParticles(projectile); var target_item = spell.Targets[0]; var return_val = spell.caster.PerformTouchAttack(target_item.Object); if ((return_val & D20CAF.HIT) != D20CAF.NONE) { // hit AttachParticles("sp-Ray of Frost-Hit", target_item.Object); target_item.Object.DealSpellDamage(spell.caster, DamageType.Cold, damage_dice, D20AttackPower.UNSPECIFIED, 100, D20ActionType.CAST_SPELL, spell.spellId, return_val, index_of_target); } else { // missed target_item.Object.FloatMesFileLine("mes/spell.mes", 30007); AttachParticles("Fizzle", target_item.Object); } spell.RemoveTarget(target_item.Object); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Lesser Vigor OnSpellEffect"); spell.duration = 10 + Math.Min(25, spell.casterLevel); var target = spell.Targets[0]; // Use any spell effect with a duration that you will not be using while under // the effects of vigor target.Object.AddCondition("sp-Barkskin", spell.spellId, spell.duration, 0); target.ParticleSystem = AttachParticles("sp-Cure Minor Wounds", target.Object); var dice = Dice.Parse("1d1"); dice = dice.WithModifier(3); target.Object.Heal(null, dice); target.Object.HealSubdual(null, dice); var heal_count = 1; var heal_tick_time = 999; if ((!GameSystems.Combat.IsCombatActive())) { heal_tick_time = 6000; } while ((heal_count < spell.duration)) { StartTimer((heal_count * heal_tick_time), () => heal_tick_greater_vigor(target.Object, dice)); heal_count = heal_count + 1; } spell.RemoveTarget(target.Object); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Protection From Undead OnSpellEffect"); spell.duration = 10 * spell.casterLevel; var target_item = spell.Targets[0]; if (target_item.Object.IsFriendly(spell.caster)) { target_item.Object.AddCondition("sp-Protection From Monster", spell.spellId, spell.duration, 2); target_item.ParticleSystem = AttachParticles("sp-Protection From Undead", target_item.Object); } else if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); target_item.Object.AddCondition("sp-Protection From Monster", spell.spellId, spell.duration, 2); target_item.ParticleSystem = AttachParticles("sp-Protection From Undead", target_item.Object); } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Blight OnSpellEffect"); 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-Blight", target_item.Object); if (target_item.Object.IsMonsterCategory(MonsterCategory.plant)) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); target_item.Object.DealSpellDamage(spell.caster, DamageType.Magic, damage_dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); target_item.Object.DealReducedSpellDamage(spell.caster, DamageType.Magic, damage_dice, D20AttackPower.UNSPECIFIED, DAMAGE_REDUCTION_HALF, D20ActionType.CAST_SPELL, spell.spellId); } } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 31012); AttachParticles("Fizzle", target_item.Object); } spell.RemoveTarget(target_item.Object); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Owl's Wisdom OnSpellEffect"); spell.duration = 10 * spell.casterLevel; var target_item = spell.Targets[0]; var str_amount = 4; 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; } if (target_item.Object.IsFriendly(spell.caster)) { target_item.Object.AddCondition("sp-Owls Wisdom", spell.spellId, spell.duration, str_amount); target_item.ParticleSystem = AttachParticles("sp-Owls Wisdom", target_item.Object); } else if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccesful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); target_item.Object.AddCondition("sp-Owls Wisdom", spell.spellId, spell.duration, str_amount); target_item.ParticleSystem = AttachParticles("sp-Owls Wisdom", target_item.Object); } else { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Mage Armor OnSpellEffect"); var armor_bonus = 4; spell.duration = 600 * spell.casterLevel; var target = spell.Targets[0]; if (target.Object.IsFriendly(spell.caster)) { target.Object.AddCondition("sp-Mage Armor", spell.spellId, spell.duration, armor_bonus); target.ParticleSystem = AttachParticles("sp-Mage Armor", target.Object); } else { if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); spell.RemoveTarget(target.Object); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); target.Object.AddCondition("sp-Mage Armor", spell.spellId, spell.duration, armor_bonus); target.ParticleSystem = AttachParticles("sp-Mage Armor", target.Object); } } spell.EndSpell(); }