Esempio n. 1
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Fire Shield OnSpellEffect");
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        SpellDescriptor element_type; // DECL_PULL_UP
        string          partsys_type; // DECL_PULL_UP

        if (spell_arg == 1)
        {
            element_type = SpellDescriptor.COLD;

            partsys_type = "sp-Fire Shield-Cold";
        }
        else if (spell_arg == 2)
        {
            element_type = SpellDescriptor.FIRE;

            partsys_type = "sp-Fire Shield-Warm";
        }
        else
        {
            Logger.Error("Fire shield triggered with unknown spell arg: {0}", spell_arg);
            return;
        }

        spell.duration = 1 * spell.casterLevel;

        var target_item = spell.Targets[0];

        target_item.Object.AddCondition("sp-Fire Shield", spell.spellId, spell.duration, element_type);
        target_item.ParticleSystem = AttachParticles(partsys_type, target_item.Object);
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Giant Vermin OnSpellEffect");
        spell.duration = 10 * spell.casterLevel; // fixed - should be 1min/level
        // get the proto_id for this monster (from radial menu)
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 14089 && spell_arg != 14047 && spell_arg != 14417)
        {
            spell_arg = RandomRange(1, 3);
            if (spell_arg == 1)
            {
                spell_arg = 14089;
            }
            else if (spell_arg == 2)
            {
                spell_arg = 14047;
            }
            else if (spell_arg == 3)
            {
                spell_arg = 14417;
            }
        }

        // create monster, monster should be added to target_list
        spell.SummonMonsters(true, spell_arg);
        spell.EndSpell();
    }
Esempio n. 3
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Lesser Restoration OnSpellEffect");
        spell.duration = 0;

        var target_item = spell.Targets[0];

        var ability_type = (spell.GetMenuArg(RadialMenuParam.MinSetting) - 1);

        if (target_item.Object.IsFriendly(spell.caster))
        {
            target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
            target_item.ParticleSystem = AttachParticles("sp-Lesser Restoration", 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-Lesser Restoration", spell.spellId, spell.duration, ability_type);
            target_item.ParticleSystem = AttachParticles("sp-Lesser Restoration", target_item.Object);
        }
        else
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
            AttachParticles("Fizzle", target_item.Object);
        }

        spell.RemoveTarget(target_item.Object);
        spell.EndSpell();
    }
Esempio n. 4
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Remove Blindness/Deafness OnSpellEffect");
        spell.duration = 0;
        var target = spell.Targets[0];
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2)
        {
            spell_arg = 2;
        }

        AttachParticles("sp-Remove Blindness Deafness", target.Object);
        if (spell_arg == 1)
        {
            // apply remove blindness
            target.Object.AddCondition("sp-Remove Blindness", spell.spellId, spell.duration, 0);
        }
        else
        {
            // apply deafness
            target.Object.AddCondition("sp-Remove Deafness", spell.spellId, spell.duration, 0);
        }

        spell.RemoveTarget(target.Object);
        spell.EndSpell();
    }
Esempio n. 5
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Bestow Curse OnSpellEffect");
        spell.duration = 0;

        var target_item = spell.Targets[0];

        if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
        {
            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", 30002);
            target_item.ParticleSystem = AttachParticles("sp-Bestow Curse", target_item.Object);

            if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 1)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 0);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 2)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 1);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 3)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 2);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 4)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 3);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 5)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 4);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 6)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 5);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 7)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Rolls", spell.spellId, spell.duration, 6);
            }
            else if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 8)
            {
                target_item.Object.AddCondition("sp-Bestow Curse Actions", spell.spellId, spell.duration, 7);
            }
        }

        spell.EndSpell();
    }
Esempio n. 6
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Summon Monster III OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;

        var monster_proto_id = spell.GetMenuArg(RadialMenuParam.MinSetting);

        spell.SummonMonsters(true, monster_proto_id);
        spell.EndSpell();
    }
Esempio n. 7
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Protection From Elements OnSpellEffect");
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        SpellDescriptor element_type; // DECL_PULL_UP
        string          partsys_type; // DECL_PULL_UP

        if (spell_arg == 1)
        {
            element_type = SpellDescriptor.ACID;

            partsys_type = "sp-Protection From Elements-acid";
        }
        else if (spell_arg == 2)
        {
            element_type = SpellDescriptor.COLD;

            partsys_type = "sp-Protection From Elements-cold";
        }
        else if (spell_arg == 3)
        {
            element_type = SpellDescriptor.ELECTRICITY;

            partsys_type = "sp-Protection From Elements-electricity";
        }
        else if (spell_arg == 4)
        {
            element_type = SpellDescriptor.FIRE;

            partsys_type = "sp-Protection From Elements-fire";
        }
        else if (spell_arg == 5)
        {
            element_type = SpellDescriptor.SONIC;

            partsys_type = "sp-Protection From Elements-sonic";
        }
        else
        {
            Logger.Error("Protection from elements called with invalid spell arg {0}", spell_arg);
            return;
        }

        spell.duration = 100 * spell.casterLevel;

        var target_item = spell.Targets[0];

        target_item.Object.AddCondition("sp-Protection From Elements", spell.spellId, element_type, spell.duration);
        target_item.ParticleSystem = AttachParticles(partsys_type, target_item.Object);
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Endure Elements OnSpellEffect");
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        SpellDescriptor element_type; // DECL_PULL_UP
        string          partsys_type; // DECL_PULL_UP

        if (spell_arg == 1)
        {
            element_type = SpellDescriptor.ACID;

            partsys_type = "sp-Endure Elements-acid";
        }
        else if (spell_arg == 2)
        {
            element_type = SpellDescriptor.COLD;

            partsys_type = "sp-Endure Elements-cold";
        }
        else if (spell_arg == 3)
        {
            element_type = SpellDescriptor.ELECTRICITY;

            partsys_type = "sp-Endure Elements-water";
        }
        else if (spell_arg == 4)
        {
            element_type = SpellDescriptor.FIRE;

            partsys_type = "sp-Endure Elements-fire";
        }
        else if (spell_arg == 5)
        {
            element_type = SpellDescriptor.SONIC;

            partsys_type = "sp-Endure Elements-Sonic";
        }
        else
        {
            Logger.Error("Endure Elements triggered with unknown spell arg: {0}", spell_arg);
            return;
        }

        spell.duration = 14400;

        var target_item = spell.Targets[0];

        target_item.Object.AddCondition("sp-Endure Elements", spell.spellId, element_type, spell.duration);
        target_item.ParticleSystem = AttachParticles(partsys_type, target_item.Object);
    }
Esempio n. 9
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Remove Blindness/Deafness OnSpellEffect");
        spell.duration = 0;

        var target = spell.Targets[0];

        target.ParticleSystem = AttachParticles("sp-Remove Blindness Deafness", target.Object);

        if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 1)
        {
            target.Object.AddCondition("sp-Remove Blindness", spell.spellId, spell.duration, 0);
        }
        else
        {
            target.Object.AddCondition("sp-Remove Deafness", spell.spellId, spell.duration, 0);
        }

        spell.EndSpell();
    }
Esempio n. 10
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Restoration OnSpellEffect");
        spell.duration = 0;
        var target_item = spell.Targets[0];
        // get the ability type (from radial menu, -1 to offset index and D20Strength == 0)
        var ability_type = (spell.GetMenuArg(RadialMenuParam.MinSetting) - 1);

        // Solves Radial menu problem for Wands/NPCs
        if (ability_type != 0 && ability_type != 1 && ability_type != 2 && ability_type != 3 && ability_type != 4 && ability_type != 5)
        {
            ability_type = RandomRange(1, 6);
            ability_type = ability_type - 1;
        }

        Logger.Info("{0}", "Restoration Ability type: " + ability_type.ToString());
        if (target_item.Object.IsFriendly(spell.caster))
        {
            target_item.Object.AddCondition("sp-Restoration", spell.spellId, spell.duration, ability_type);
            target_item.ParticleSystem = AttachParticles("sp-Restoration", 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-Restoration", spell.spellId, spell.duration, ability_type);
            target_item.ParticleSystem = AttachParticles("sp-Restoration", 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();
    }
Esempio n. 11
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Blindness/Deafness OnSpellEffect");
        spell.duration = 14400;

        var target_item = spell.Targets[0];

        if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
        {
            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", 30002);
            if (spell.GetMenuArg(RadialMenuParam.MinSetting) == 1)
            {
                var return_val = target_item.Object.AddCondition("sp-Blindness", spell.spellId, spell.duration, 0);

                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Blindness-Deafness", target_item.Object);
                }
            }
            else
            {
                var return_val = target_item.Object.AddCondition("sp-Deafness", spell.spellId, spell.duration, 0);

                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Blindness-Deafness", target_item.Object);
                }
            }
        }

        spell.EndSpell();
    }
Esempio n. 12
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Contagion OnSpellEffect");
        spell.duration = 0;
        var target_item   = spell.Targets[0];
        var npc           = spell.caster;
        var disease_index = spell.GetMenuArg(RadialMenuParam.MinSetting);

        // Solves Radial menu problem for Wands/NPCs
        if (disease_index != 1 && disease_index != 2 && disease_index != 3 && disease_index != 4 && disease_index != 5 && disease_index != 6 && disease_index != 7)
        {
            disease_index = RandomRange(1, 7);
        }

        if (((target_item.Object.GetStat(Stat.level_paladin) >= 3) && (!target_item.Object.D20Query(D20DispatcherKey.QUE_IsFallenPaladin))) || target_item.Object.IsMonsterCategory(MonsterCategory.construct) || target_item.Object.IsMonsterCategory(MonsterCategory.undead))
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 32000);
            AttachParticles("Fizzle", target_item.Object);
        }
        else 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.obj.condition_add_with_args( 'sp-Contagion', spell.id, spell.duration, disease_index )
            // target_item.obj.condition_add_with_args( 'NSDiseased', 1, disease_index - 1, 0 )
            target_item.Object.AddCondition("Incubating_Disease", 1, diseases[disease_index], 0);
            target_item.ParticleSystem = AttachParticles("ef-MinoCloud", 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($"{SpellName} OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;
        // Solves Radial menu problem for Wands/NPCs
        var options = SummonMonsterTools.GetSpellOptions(SpellOptionsKey);
        var protoId = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (!options.Contains(protoId))
        {
            protoId = GameSystems.Random.PickRandom(options);
        }

        ModifySummonedProtoId(spell, ref protoId);

        // create monster, monster should be added to target_list
        spell.SummonMonsters(true, protoId);
        var target_item = spell.Targets[0];

        ScriptUtilities.AttachParticles(ParticleSystemId, target_item.Object);
        SummonMonsterTools.SummonMonster_Rectify_Initiative(spell, protoId); // Added by S.A. - sets iniative to caster's initiative -1, so that it gets to act in the same round
        spell.EndSpell();
    }
Esempio n. 14
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Contagion OnSpellEffect");
        spell.duration = 0;

        var target_item = spell.Targets[0];

        var disease_index = spell.GetMenuArg(RadialMenuParam.MinSetting);

        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.AddCondition("Incubating_Disease", 1, diseases[disease_index], 0);
            target_item.ParticleSystem = AttachParticles("sp-Contagion", target_item.Object);
        }
        else
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
            AttachParticles("Fizzle", target_item.Object);
        }

        spell.RemoveTarget(target_item.Object);
        spell.EndSpell();
    }
Esempio n. 15
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Animate Dead OnSpellEffect");
        spell.duration = 0;

        var target_item = spell.Targets[0];

        if ((target_item.Object.IsMonsterCategory(MonsterCategory.humanoid) || target_item.Object.IsMonsterCategory(MonsterCategory.fey) || target_item.Object.IsMonsterCategory(MonsterCategory.giant) || target_item.Object.IsMonsterCategory(MonsterCategory.monstrous_humanoid)))
        {
            target_item.Object.AddCondition("sp-Animate Dead", spell.spellId, spell.duration, spell.GetMenuArg(RadialMenuParam.MinSetting));
            target_item.ParticleSystem = AttachParticles("sp-Animate Dead", target_item.Object);
        }
        else
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30000);
            target_item.Object.FloatMesFileLine("mes/spell.mes", 31009);
            AttachParticles("Fizzle", target_item.Object);
        }

        spell.RemoveTarget(target_item.Object);
        spell.EndSpell();
    }
Esempio n. 16
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Command OnSpellEffect");
        spell.duration = 1;
        var target_item = spell.Targets[0];
        var npc         = spell.caster; // added so NPC's will choose valid targets

        // if npc.name == 14424 or npc.name = 8091:			##  added so NPC's will choose valid targets
        if (npc.type != ObjectType.pc && npc.GetLeader() == null)
        {
            if (!target_item.Object.IsMonsterCategory(MonsterCategory.animal) && (GameSystems.Stat.DispatchGetSizeCategory(target_item.Object) < SizeCategory.Large || target_item.Object.IsMonsterCategory(MonsterCategory.humanoid)) && !Utilities.critter_is_unconscious(target_item.Object) && !target_item.Object.D20Query(D20DispatcherKey.QUE_Prone))
            {
                npc = spell.caster;
            }
            else
            {
                SetGlobalFlag(811, false);
                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 5 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }

                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 10 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }

                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 15 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }

                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 20 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }

                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 25 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }

                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 30 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }

                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (obj.DistanceTo(npc) <= 100 && !Utilities.critter_is_unconscious(obj) && !obj.IsMonsterCategory(MonsterCategory.animal) && GameSystems.Stat.DispatchGetSizeCategory(obj) < SizeCategory.Large && !GetGlobalFlag(811) && !obj.D20Query(D20DispatcherKey.QUE_Prone))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }
            }
        }

        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2 && spell_arg != 3 && spell_arg != 4)
        {
            spell_arg = 2;
        }

        if (npc.type != ObjectType.pc && npc.GetLeader() == null)
        {
            spell_arg = 2;
        }

        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 || target_item.Object.IsMonsterCategory(MonsterCategory.humanoid)))
                    {
                        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);
                            if (npc.type != ObjectType.pc && npc.GetLeader() == null)
                            {
                                target_item.Object.AddCondition("sp-Command", spell.spellId, spell.duration, 2);
                            }
                            else
                            {
                                // else:			##  added so NPC's can cast Command
                                target_item.Object.AddCondition("sp-Command", spell.spellId, spell.duration, spell_arg);
                            }

                            target_item.ParticleSystem = AttachParticles("sp-Command", target_item.Object);
                        }
                        else
                        {
                            // add target to initiative, just in case
                            // target_item.obj.add_to_initiative()
                            // game.update_combat_ui()
                            // saving throw successful
                            target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                            AttachParticles("Fizzle", target_item.Object);
                            spell.RemoveTarget(target_item.Object);
                        }
                    }
                    else
                    {
                        // not medium sized or smaller
                        // Note: I've added an exception for humanoids (i.e. magically enlarged party members) -SA
                        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
                {
                    // a monster
                    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
            {
                // 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
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30003);
            AttachParticles("Fizzle", target_item.Object);
            spell.RemoveTarget(target_item.Object);
        }

        spell.EndSpell();
    }
Esempio n. 17
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Bestow Curse OnSpellEffect");
        spell.duration = 0;
        var target_item = spell.Targets[0];
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2 && spell_arg != 3 && spell_arg != 4 && spell_arg != 5 && spell_arg != 6 && spell_arg != 7 && spell_arg != 8)
        {
            spell_arg = RandomRange(1, 8);
        }

        var npc = spell.caster;

        if (npc.type != ObjectType.pc && npc.GetLeader() == null)
        {
            spell_arg = 8;
        }

        // allow Willpower 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
        {
            // saving throw unsuccessful
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
            target_item.ParticleSystem = AttachParticles("sp-Bestow Curse", target_item.Object);
            if (spell_arg == 1)
            {
                // print "str"
                // apply ability damage str
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 0);
            }
            else if (spell_arg == 2)
            {
                // apply ability damage dex
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 1);
            }
            else if (spell_arg == 3)
            {
                // apply ability damage con
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 2);
            }
            else if (spell_arg == 4)
            {
                // apply ability damage int
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 3);
            }
            else if (spell_arg == 5)
            {
                // apply ability damage wis
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 4);
            }
            else if (spell_arg == 6)
            {
                // apply ability damage cha
                target_item.Object.AddCondition("sp-Bestow Curse Ability", spell.spellId, spell.duration, 5);
            }
            else if (spell_arg == 7)
            {
                // apply curse rolls/checks
                target_item.Object.AddCondition("sp-Bestow Curse Rolls", spell.spellId, spell.duration, 6);
            }
            else if (spell_arg == 8)
            {
                // apply curse actions
                target_item.Object.AddCondition("sp-Bestow Curse Actions", spell.spellId, spell.duration, 7);
            }
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Resist Elements OnSpellEffect");
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        // Solves Radial menu problem for Wands/NPCs
        spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);
        if (spell_arg != 1 && spell_arg != 2 && spell_arg != 3 && spell_arg != 4 && spell_arg != 5)
        {
            spell_arg = RandomRange(1, 5);
        }

        var npc = spell.caster;

        if (npc.GetNameId() == 8047) // Alrrem
        {
            spell_arg = 4;
        }

        if (npc.GetNameId() == 8035) // added so NPC's can cast spell
        {
            spell_arg = 3;
        }

        if (npc.GetNameId() == 14336) // added so NPC's can cast spell
        {
            spell_arg = 4;
        }

        if (spell.Targets[0].Object.GetNameId() == 14195 || spell.Targets[0].Object.GetNameId() == 14224) // Oohlgrist or Aern; they already has a magic ring against fire
        {
            spell_arg = 2;
        }

        SpellDescriptor element_type;
        string          partsys_type;

        if (spell_arg == 1)
        {
            element_type = SpellDescriptor.ACID;
            partsys_type = "sp-Resist Elements-acid";
        }
        else if (spell_arg == 2)
        {
            element_type = SpellDescriptor.COLD;
            partsys_type = "sp-Resist Elements-cold";
        }
        else if (spell_arg == 3)
        {
            element_type = SpellDescriptor.ELECTRICITY;
            partsys_type = "sp-Resist Elements-water";
        }
        else if (spell_arg == 4)
        {
            element_type = SpellDescriptor.FIRE;
            partsys_type = "sp-Resist Elements-fire";
        }
        else if (spell_arg == 5)
        {
            element_type = SpellDescriptor.SONIC;
            partsys_type = "sp-Resist Elements-sonic";
        }
        else
        {
            Logger.Error("Resist Elements called with invalid spell arg: {0}", spell_arg);
            return;
        }

        spell.duration = 100 * spell.casterLevel;
        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_item = spell.Targets[0];

        if (target_item.Object.AddCondition("sp-Resist Elements", spell.spellId, element_type, spell.duration))
        {
            target_item.ParticleSystem = AttachParticles(partsys_type, target_item.Object);
        }
    }
Esempio n. 19
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Animate Dead OnSpellEffect");
        spell.duration = 0;
        var target_item = spell.Targets[0];
        var cast        = spell.caster;

        if (cast.GetNameId() == 8042)
        {
            foreach (var npc in ObjList.ListVicinity(cast.GetLocation(), ObjectListFilter.OLC_NPC))
            {
                if (!(GameSystems.Party.PartyMembers).Contains(npc))
                {
                    if (npc.GetStat(Stat.hp_current) <= -10)
                    {
                        target_item.Object = npc;
                        target_item.Object.AddCondition("sp-Animate Dead", spell.spellId, spell.duration, 3);
                        target_item.ParticleSystem = AttachParticles("sp-Iuz Making Zombies", target_item.Object);
                        var zombie = GameSystems.MapObject.CreateObject(14123, npc.GetLocation());
                    }
                }
            }
        }

        if (cast.GetNameId() == 14425)
        {
            SetGlobalFlag(811, false);
            foreach (var obj in ObjList.ListVicinity(cast.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                var curr = obj.GetStat(Stat.hp_current);
                if ((curr <= -10 && obj.DistanceTo(cast) <= 10 && !(GameSystems.Party.PartyMembers).Contains(obj) && !GetGlobalFlag(811)))
                {
                    if ((obj.IsMonsterCategory(MonsterCategory.humanoid) || obj.IsMonsterCategory(MonsterCategory.fey) || obj.IsMonsterCategory(MonsterCategory.giant) || obj.IsMonsterCategory(MonsterCategory.monstrous_humanoid)))
                    {
                        target_item.Object = obj;
                        SetGlobalFlag(811, true);
                    }
                }
            }
        }

        // debit money (?)
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2)
        {
            spell_arg = RandomRange(1, 2);
        }

        // make sure target is not already an undead
        if (target_item.Object.GetStat(Stat.hp_current) >= -9)
        {
            // not a animate-able
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30000);
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30016);
            AttachParticles("Fizzle", target_item.Object);
        }
        else if (target_item.Object.IsMonsterCategory(MonsterCategory.humanoid) || target_item.Object.IsMonsterCategory(MonsterCategory.fey) || target_item.Object.IsMonsterCategory(MonsterCategory.giant) || target_item.Object.IsMonsterCategory(MonsterCategory.monstrous_humanoid))
        {
            if (cast.GetNameId() != 8042 && cast.GetNameId() != 14425)
            {
                target_item.Object.AddCondition("sp-Animate Dead", spell.spellId, spell.duration, spell_arg);
                target_item.ParticleSystem = AttachParticles("sp-Animate Dead", target_item.Object);
            }

            if (cast.GetNameId() == 14425)
            {
                target_item.Object.AddCondition("sp-Animate Dead", spell.spellId, spell.duration, 3);
                target_item.ParticleSystem = AttachParticles("sp-Animate Dead", target_item.Object);
                var zombie = GameSystems.MapObject.CreateObject(14619, target_item.Object.GetLocation());
            }
        }
        else
        {
            // not a animate-able
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30000);
            target_item.Object.FloatMesFileLine("mes/spell.mes", 31009);
            AttachParticles("Fizzle", target_item.Object);
        }

        spell.RemoveTarget(target_item.Object);
        spell.EndSpell();
    }
Esempio n. 20
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Greater Command OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 1 * spell.casterLevel;
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2 && spell_arg != 3 && spell_arg != 4)
        {
            spell_arg = 2;
        }

        var npc = spell.caster;

        if (npc.type != ObjectType.pc && npc.GetLeader() == null)
        {
            spell_arg = 2;
        }

        foreach (var target_item in spell.Targets)
        {
            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))
                            {
                                // saving throw unsuccessful
                                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                                target_item.Object.AddCondition("sp-Command", spell.spellId, spell.duration, spell_arg);
                                target_item.ParticleSystem = AttachParticles("sp-Command", target_item.Object);
                            }
                            else
                            {
                                // add target to initiative, just in case
                                // target_item.obj.add_to_initiative()
                                // game.update_combat_ui()
                                // saving throw successful
                                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                                AttachParticles("Fizzle", target_item.Object);
                                remove_list.Add(target_item.Object);
                            }
                        }
                        else
                        {
                            // not medium sized or smaller
                            target_item.Object.FloatMesFileLine("mes/spell.mes", 30000);
                            target_item.Object.FloatMesFileLine("mes/spell.mes", 31005);
                            AttachParticles("Fizzle", target_item.Object);
                            remove_list.Add(target_item.Object);
                        }
                    }
                    else
                    {
                        // a monster
                        target_item.Object.FloatMesFileLine("mes/spell.mes", 30000);
                        target_item.Object.FloatMesFileLine("mes/spell.mes", 31004);
                        AttachParticles("Fizzle", target_item.Object);
                        remove_list.Add(target_item.Object);
                    }
                }
                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);
                    remove_list.Add(target_item.Object);
                }
            }
            else
            {
                // can't target friendlies
                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Endure Elements OnSpellEffect");
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        // Solves Radial menu problem for Wands/NPCs
        if (spell_arg != 1 && spell_arg != 2 && spell_arg != 3 && spell_arg != 4 && spell_arg != 5)
        {
            spell_arg = RandomRange(1, 5);
        }

        var npc = spell.caster;

        if (npc.GetNameId() == 14332)
        {
            spell_arg = 4;
        }

        if (npc.GetNameId() == 14197 || npc.GetNameId() == 14198)
        {
            // Merrolan and Nalorrem
            spell_arg = 4;
        }

        if ((npc.GetNameId() == 14212 || npc.GetNameId() == 14211) && npc == spell.Targets[0].Object) // Tubal, Antonio casting endure elements on self
        {
            spell_arg = 4;
        }

        if ((npc.GetNameId() == 14212 || npc.GetNameId() == 14211) && npc != spell.Targets[0].Object) // Tubal, Antonio casting protection from cold on others
        {
            spell_arg = 2;
        }

        if (spell.Targets[0].Object.GetNameId() == 14195 || spell.Targets[0].Object.GetNameId() == 14224) // Oohlgrist or Aern; they already has a magic ring against fire
        {
            spell_arg = 2;
        }

        SpellDescriptor element_type;
        string          partsys_type;

        if (spell_arg == 1)
        {
            element_type = SpellDescriptor.ACID;
            partsys_type = "sp-Endure Elements-acid";
        }
        else if (spell_arg == 2)
        {
            element_type = SpellDescriptor.COLD;
            partsys_type = "sp-Endure Elements-cold";
        }
        else if (spell_arg == 3)
        {
            element_type = SpellDescriptor.ELECTRICITY;
            partsys_type = "sp-Endure Elements-water";
        }
        else if (spell_arg == 4)
        {
            element_type = SpellDescriptor.FIRE;
            partsys_type = "sp-Endure Elements-fire";
        }
        else if (spell_arg == 5)
        {
            element_type = SpellDescriptor.SONIC;
            partsys_type = "sp-Endure Elements-Sonic";
        }
        else
        {
            Logger.Error("Endure Elements cast with an unknown arg: {0}", spell_arg);
            return;
        }

        // 24 hours
        spell.duration = 14400;
        var target_item = spell.Targets[0];

        target_item.Object.AddCondition("sp-Endure Elements", spell.spellId, element_type, spell.duration);
        target_item.ParticleSystem = AttachParticles(partsys_type, target_item.Object);
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Blindness/Deafness OnSpellEffect");
        spell.duration = 14400;
        var target_item = spell.Targets[0];
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2)
        {
            spell_arg = RandomRange(1, 2);
        }

        var npc = spell.caster;

        if (npc.GetNameId() == 14609) // special for Zuggtmoy Priest
        {
            spell_arg = 2;
        }

        if (npc.type != ObjectType.pc && npc.GetLeader() == null)
        {
            if (!Utilities.critter_is_unconscious(target_item.Object) && !target_item.Object.D20Query(D20DispatcherKey.QUE_Prone) && (target_item.Object.GetStat(Stat.level_wizard) >= 3 || target_item.Object.GetStat(Stat.level_sorcerer) >= 3 || target_item.Object.GetStat(Stat.level_bard) >= 3))
            {
                npc = spell.caster;
            }
            else
            {
                foreach (var obj in PartyLeader.GetPartyMembers())
                {
                    if (!Utilities.critter_is_unconscious(obj) && !obj.D20Query(D20DispatcherKey.QUE_Prone) && (obj.GetStat(Stat.level_wizard) >= 3 || obj.GetStat(Stat.level_sorcerer) >= 3 || obj.GetStat(Stat.level_bard) >= 3))
                    {
                        target_item.Object = obj;
                    }
                }
            }
        }

        // allow Fortitude saving throw to negate
        if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, 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
        {
            // saving throw unsuccessful
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
            if (spell_arg == 1)
            {
                // apply blindness
                var return_val = target_item.Object.AddCondition("sp-Blindness", spell.spellId, spell.duration, 0);
                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Blindness-Deafness", target_item.Object);
                }
            }
            else
            {
                // apply deafness
                var return_val = target_item.Object.AddCondition("sp-Deafness", spell.spellId, spell.duration, 0);
                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Blindness-Deafness", target_item.Object);
                }
            }
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Lesser Restoration OnSpellEffect");
        spell.duration = 0;
        var target_item     = spell.Targets[0];
        var abilityRestored = 1;
        var oldAbility      = 0;
        // get the ability type (from radial menu, -1 to offset index and D20Strength == 0)
        var ability_type = (spell.GetMenuArg(RadialMenuParam.MinSetting) - 1);

        // Solves Radial menu problem for Wands/NPCs
        // if ability_type != 0 and ability_type != 1 and ability_type != 2 and ability_type != 3 and ability_type != 4 and ability_type != 5:
        // ability_type = game.random_range(1,6)
        // ability_type = ability_type - 1
        if (ability_type != 0 && ability_type != 1 && ability_type != 2 && ability_type != 3 && ability_type != 4 && ability_type != 5)
        {
            ability_type    = 0;
            abilityRestored = 0;
        }

        // If no ability_type was selected, then that means that the spell used an item.  In this case, rather than picking a random item,
        // we cycle through all abilities until we find one that is actually healed.
        if (target_item.Object.IsFriendly(spell.caster))
        {
            target_item.ParticleSystem = AttachParticles("sp-Lesser Restoration", target_item.Object);
            if (abilityRestored == 1)
            {
                target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
            }
            else
            {
                if (abilityRestored == 0)
                {
                    ability_type = 0;
                    oldAbility   = target_item.Object.GetStat(Stat.strength);
                    target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
                    if (target_item.Object.GetStat(Stat.strength) > oldAbility)
                    {
                        abilityRestored = 1;
                    }
                }

                if (abilityRestored == 0)
                {
                    ability_type = 1;
                    oldAbility   = target_item.Object.GetStat(Stat.dexterity);
                    target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
                    if (target_item.Object.GetStat(Stat.dexterity) > oldAbility)
                    {
                        abilityRestored = 1;
                    }
                }

                if (abilityRestored == 0)
                {
                    ability_type = 2;
                    oldAbility   = target_item.Object.GetStat(Stat.constitution);
                    target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
                    if (target_item.Object.GetStat(Stat.constitution) > oldAbility)
                    {
                        abilityRestored = 1;
                    }
                }

                if (abilityRestored == 0)
                {
                    ability_type = 3;
                    oldAbility   = target_item.Object.GetStat(Stat.intelligence);
                    target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
                    if (target_item.Object.GetStat(Stat.intelligence) > oldAbility)
                    {
                        abilityRestored = 1;
                    }
                }

                if (abilityRestored == 0)
                {
                    ability_type = 4;
                    oldAbility   = target_item.Object.GetStat(Stat.wisdom);
                    target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
                    if (target_item.Object.GetStat(Stat.wisdom) > oldAbility)
                    {
                        abilityRestored = 1;
                    }
                }

                if (abilityRestored == 0)
                {
                    ability_type = 5;
                    oldAbility   = target_item.Object.GetStat(Stat.charisma);
                    target_item.Object.AddCondition("sp-Lesser Restoration", spell.spellId, spell.duration, ability_type);
                    if (target_item.Object.GetStat(Stat.charisma) > oldAbility)
                    {
                        abilityRestored = 1;
                    }
                }
            }
        }
        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-Lesser Restoration", spell.spellId, spell.duration, ability_type);
            target_item.ParticleSystem = AttachParticles("sp-Lesser Restoration", 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();
    }
Esempio n. 24
0
    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();
    }
Esempio n. 25
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Fire Shield OnSpellEffect");
        // Solves Radial menu problem for Wands/NPCs
        var spell_arg = spell.GetMenuArg(RadialMenuParam.MinSetting);

        if (spell_arg != 1 && spell_arg != 2)
        {
            spell_arg = RandomRange(1, 2);
        }

        SpellDescriptor element_type;
        string          partsys_type;

        if (spell_arg == 1)
        {
            element_type = SpellDescriptor.COLD;
            partsys_type = "sp-Fire Shield-Cold";
        }
        else if (spell_arg == 2)
        {
            element_type = SpellDescriptor.FIRE;
            partsys_type = "sp-Fire Shield-Warm";
        }
        else
        {
            Logger.Error("Fire shield cast with an unknown spell arg: {0}", spell_arg);
            return;
        }

        spell.duration = 1 * spell.casterLevel;
        var npc = spell.caster; // added so NPC's can use wand/potion/scroll

        if (npc.type != ObjectType.pc && npc.GetLeader() == null && spell.duration <= 0)
        {
            spell.duration    = 10;
            spell.casterLevel = 10;
        }

        var target_item = spell.Targets[0];

        var(xx, yy) = target_item.Object.GetLocation();
        if (SelectedPartyLeader.GetMap() == 5067 && (xx >= 521 && xx <= 555) && (yy >= 560 && yy <= 610))
        {
            // Water Temple Pool Enchantment prevents fire spells from working inside the chamber, according to the module -SA
            AttachParticles("swirled gas", target_item.Object);
            target_item.Object.FloatMesFileLine("mes/skill_ui.mes", 2000, TextFloaterColor.Red);
            Sound(7581, 1);
            Sound(7581, 1);
        }
        else
        {
            (xx, yy) = spell.caster.GetLocation();
            if (SelectedPartyLeader.GetMap() == 5067 && (xx >= 521 && xx <= 555) && (yy >= 560 && yy <= 610))
            {
                AttachParticles("swirled gas", spell.caster);
                spell.caster.FloatMesFileLine("mes/skill_ui.mes", 2000, TextFloaterColor.Red);
                Sound(7581, 1);
                Sound(7581, 1);
            }
            else
            {
                target_item.Object.AddCondition("sp-Fire Shield", spell.spellId, spell.duration, element_type);
                target_item.ParticleSystem = AttachParticles(partsys_type, target_item.Object);
            }
        }
    }