public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Neutralize Poison OnSpellEffect");
        if (spell.spellClass == 13) // added to check for proper paladin slot level (darmagon)
        {
            if (spell.spellKnownSlotLevel < 4)
            {
                spell.caster.FloatMesFileLine("mes/spell.mes", 16008);
                spell.EndSpell();
                return;
            }
        }

        if (spell.spellClass == 14)
        {
            if (spell.spellKnownSlotLevel < 3) // added to check for proper ranger slot level (darmagon)
            {
                spell.caster.FloatMesFileLine("mes/spell.mes", 16008);
                spell.EndSpell();
                return;
            }
        }

        spell.duration = 0;
        var target = spell.Targets[0];

        if (target.Object.IsFriendly(spell.caster))
        {
            // Neutralise any Hezrou Stench effects.
            Stench.neutraliseStench(target.Object, 600 * spell.casterLevel);
            target.Object.AddCondition("sp-Neutralize Poison", spell.spellId, spell.duration, 0);
            target.ParticleSystem = AttachParticles("sp-Neutralize Poison", target.Object);
        }
        else if (!target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
        {
            // saving throw unsuccesful
            target.Object.FloatMesFileLine("mes/spell.mes", 30002);
            // Neutralise any Hezrou Stench effects.
            Stench.neutraliseStench(target.Object, 600 * spell.casterLevel);
            target.Object.AddCondition("sp-Neutralize Poison", spell.spellId, spell.duration, 0);
            target.ParticleSystem = AttachParticles("sp-Neutralize Poison", target.Object);
        }
        else
        {
            // saving throw succesful
            target.Object.FloatMesFileLine("mes/spell.mes", 30001);
            AttachParticles("Fizzle", target.Object);
            spell.RemoveTarget(target.Object);
        }

        spell.EndSpell();
    }
Esempio n. 2
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Burning Hands OnSpellEffect");
        var remove_list = new List <GameObject>();

        var dam = Dice.D4;

        dam = dam.WithCount(Math.Min(5, spell.casterLevel));
        AttachParticles("sp-Burning Hands", spell.caster);
        foreach (var target_item in spell.Targets)
        {
            remove_list.Add(target_item.Object);
            if (target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Fire, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId))
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
            }
            else
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Lightning Bolt OnSpellEffect");
        var remove_list = new List <GameObject>();
        var damage_dice = Dice.D6;

        damage_dice = damage_dice.WithCount(Math.Min(1 * spell.casterLevel, 10));
        SpawnParticles("sp-Lightning Bolt", spell.aoeCenter);
        GameSystems.Vfx.LightningBolt(spell.caster, spell.aoeCenter);
        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, damage_dice, DamageType.Electricity, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId))
            {
                // saving throw successful
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
            }
            else
            {
                // saving throw unsuccessful
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
            }

            remove_list.Add(target_item.Object);
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 4
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Confusion OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 1 * spell.casterLevel;

        SpawnParticles("sp-Confusion", spell.aoeCenter);
        foreach (var target_item in spell.Targets)
        {
            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-Confusion", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("sp-Confusion-Hit", target_item.Object);
            }
            else
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 5
0
    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();
    }
Esempio n. 6
0
    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();
    }
Esempio n. 7
0
    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();
    }
Esempio n. 8
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. 9
0
    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();
    }
Esempio n. 10
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Frog Tongue OnSpellEffect");
        spell.duration = 0;

        var target_item = spell.Targets[0];

        if (GameSystems.Stat.DispatchGetSizeCategory(target_item.Object) > GameSystems.Stat.DispatchGetSizeCategory(spell.caster))
        {
            spell.duration = 1;
        }

        if (spell.caster.PerformTouchAttack(target_item.Object) == D20CAF.HIT)
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 21000);
            spell.caster.AddCondition("sp-Frog Tongue", spell.spellId, spell.duration, 0);
            target_item.ParticleSystem = AttachParticles("sp-Frog Tongue", target_item.Object);
        }
        else
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 21001);
            spell.caster.StartFrogGrapplePhase(FrogGrapplePhase.FailedLatch);
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30007);
            AttachParticles("Fizzle", target_item.Object);
            spell.RemoveTarget(target_item.Object);
        }

        spell.EndSpell();
    }
Esempio n. 11
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Delay Poison OnSpellEffect");
        spell.duration = 600 * spell.casterLevel;
        var target_item = spell.Targets[0];

        if (target_item.Object.IsFriendly(spell.caster))
        {
            // Neutralise any Hezrou Stench effects.
            Stench.neutraliseStench(target_item.Object, spell.duration);
            target_item.Object.AddCondition("sp-Delay Poison", spell.spellId, spell.duration, 0);
            target_item.ParticleSystem = AttachParticles("sp-Delay Poison", 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);
                // Neutralise any Hezrou Stench effects.
                Stench.neutraliseStench(target_item.Object, spell.duration);
                target_item.Object.AddCondition("sp-Delay Poison", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("sp-Delay Poison", 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. 12
0
    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();
    }
Esempio n. 13
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Gust of Wind OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 1;
        AttachParticles("sp-Gust of Wind", spell.caster);
        foreach (var target_item in spell.Targets)
        {
            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-Gust of Wind", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("sp-Gust of Wind", target_item.Object);
            }
            else
            {
                // saving throw successful
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 14
0
    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();
    }
Esempio n. 15
0
    // spell.spell_end( spell.id, 1 )# do not end the spell, else the effect countdown is interrupted

    public override void OnBeginRound(SpellPacketBody spell)
    {
        // Crappy workaround to end the spell (otherwise it never ends...)
        // Note: OnBeginRound gets called num_of_images times each round, because sp-Mirror Image duplicates the target num_of_images times (to store the particle FX)
        // Thus we check the game time to prevent decrementing the duration multiple times
        var cur_time = CurrentTimeSeconds;

        if ((mislead_spell_list).ContainsKey(spell.spellId))
        {
            var entry      = mislead_spell_list[spell.spellId];
            var entry_time = entry.Item2;
            if (cur_time > entry_time)
            {
                entry.Item2  = cur_time;
                entry.Item1 -= 1;
                // mislead_spell_list[spell.id] = entry
                Logger.Info("{0}", "Mislead OnBeginRound, duration: " + entry.Item1.ToString() + ", ID: " + spell.spellId.ToString());
                if (entry.Item1 <= 0)
                {
                    spell.EndSpell(true);
                }
            }

            mislead_spell_list[spell.spellId] = entry;
        }
        else
        {
            Logger.Info("{0}", "Mislead OnBeginRound, duration: " + spell.duration.ToString() + ", ID: " + spell.spellId.ToString());
            mislead_spell_list[spell.spellId] = (spell.duration - 1, cur_time);
        }
    }
Esempio n. 16
0
    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();
    }
Esempio n. 17
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Mass Cats Grace OnSpellEffect");
        var dex_amount = 4;

        spell.duration = 10 * spell.casterLevel;
        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.IsFriendly(spell.caster))
            {
                target_item.Object.AddCondition("sp-Cats Grace", spell.spellId, spell.duration, dex_amount);
                target_item.ParticleSystem = AttachParticles("sp-Cats Grace", 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-Cats Grace", spell.spellId, spell.duration, dex_amount);
                target_item.ParticleSystem = AttachParticles("sp-Cats Grace", target_item.Object);
            }
            else
            {
                // saving throw successful
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                AttachParticles("Fizzle", target_item.Object);
            }
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Finger of Death OnSpellEffect");
        var damage_dice = Dice.Parse("3d6");

        damage_dice = damage_dice.WithModifier(Math.Min(25, spell.casterLevel));
        var target = spell.Targets[0];

        AttachParticles("sp-Slay Living", target.Object);
        // damage target
        if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
        {
            target.Object.FloatMesFileLine("mes/spell.mes", 30001);
            // saving throw succesful, damage target
            target.Object.DealSpellDamage(spell.caster, DamageType.Unspecified, damage_dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
        }
        else
        {
            target.Object.FloatMesFileLine("mes/spell.mes", 30002);
            // saving throw unsuccesful, kill target
            // So you'll get awarded XP for the kill
            if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target.Object)))
            {
                target.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1"));
            }

            target.Object.KillWithDeathEffect();
        }

        spell.RemoveTarget(target.Object);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Neutralize Poison OnSpellEffect");
        spell.duration = 0;

        var target = spell.Targets[0];

        if (target.Object.IsFriendly(spell.caster))
        {
            target.Object.AddCondition("sp-Neutralize Poison", spell.spellId, spell.duration, 0);
            target.ParticleSystem = AttachParticles("sp-Neutralize Poison", target.Object);
        }
        else if (!target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
        {
            target.Object.FloatMesFileLine("mes/spell.mes", 30002);
            target.Object.AddCondition("sp-Neutralize Poison", spell.spellId, spell.duration, 0);
            target.ParticleSystem = AttachParticles("sp-Neutralize Poison", target.Object);
        }
        else
        {
            target.Object.FloatMesFileLine("mes/spell.mes", 30001);
            AttachParticles("Fizzle", target.Object);
            spell.RemoveTarget(target.Object);
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Power Word Kill OnSpellEffect");
        var target = spell.Targets[0];

        // If target has over 100 hit points, spell fails
        if (target.Object.GetStat(Stat.hp_current) > 100)
        {
            target.Object.FloatMesFileLine("mes/spell.mes", 32000);
            AttachParticles("Fizzle", target.Object);
        }
        else
        {
            // Otherwise, the target dies. Simple.
            // So you'll get awarded XP for the kill
            if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target.Object)))
            {
                target.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1"));
            }

            target.Object.KillWithDeathEffect();
        }

        spell.RemoveTarget(target.Object);
        spell.EndSpell();
    }
Esempio n. 21
0
    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();
    }
Esempio n. 22
0
    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. 23
0
    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();
    }
Esempio n. 24
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Bless OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 10 * spell.casterLevel;
        // game.particles( 'sp-Bless', spell.target_loc_off_x, spell.target_loc_off_y, spell.target_loc_off_z )
        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.IsFriendly(spell.caster))
            {
                var return_val = target_item.Object.AddCondition("sp-Bless", spell.spellId, spell.duration, 0);
                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Bless", target_item.Object);
                }
            }
            else
            {
                remove_list.Add(target_item.Object);
            }
        }

        spell.RemoveTargets(remove_list);
        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 OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Summon Fire Elemental OnSpellEffect");
        spell.duration = 10;
        // get the proto_id for this monster
        var monster_proto_id = 14298;

        // create monster
        spell.SummonMonsters(true, monster_proto_id);
        // Gets handle on monster, and sets a flag so that it won't be mistaken for a new summoned monster
        var monster_obj = Co8.GetCritterHandle(spell, monster_proto_id);

        AttachParticles("Orb-Summon-Fire-Elemental", monster_obj);
        // add monster to follower list for spell_caster
        spell.caster.AddAIFollower(monster_obj);
        // add monster_obj to d20initiative, and set initiative to spell_caster's
        var caster_init_value = spell.caster.GetInitiative();

        monster_obj.AddToInitiative();
        monster_obj.SetInitiative(caster_init_value);
        UiSystems.Combat.Initiative.UpdateIfNeeded();
        // monster should disappear when duration is over, apply "TIMED_DISAPPEAR" condition
        monster_obj.AddCondition("sp-Summoned", spell.spellId, spell.duration, 0);
        // add monster to target list
        spell.ClearTargets();
        spell.AddTarget(monster_obj);
        spell.EndSpell();
    }
Esempio n. 27
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Heat Metal OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 7;

        foreach (var target_item in spell.Targets)
        {
            var armor_obj = target_item.Object.ItemWornAt(EquipSlot.Armor);

            if ((armor_obj != null) && (armor_obj.GetMaterial() == Material.metal))
            {
                var return_val = target_item.Object.AddCondition("sp-Heat Metal", spell.spellId, spell.duration, 0);

                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Heat Metal", target_item.Object);
                }
            }
            else
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 31010);
                remove_list.Add(target_item.Object);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 28
0
    public override void OnEndProjectile(SpellPacketBody spell, GameObject projectile, int index_of_target)
    {
        Logger.Info("Ray of Enfeeblement OnEndProjectile");
        var dice = Dice.D6;

        var dam_amount = dice.Roll();

        dam_amount += (spell.casterLevel / 2);
        Logger.Info("amount={0}", dam_amount);
        spell.duration = 10 * spell.casterLevel;

        EndProjectileParticles(projectile);
        var target_item = spell.Targets[0];

        if (spell.caster.PerformTouchAttack(target_item.Object) != 0)
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 20022, TextFloaterColor.Red);
            target_item.Object.AddCondition("sp-Ray of Enfeeblement", spell.spellId, spell.duration, dam_amount);
            target_item.ParticleSystem = AttachParticles("sp-Ray of Enfeeblement-Hit", target_item.Object);
        }
        else
        {
            target_item.Object.FloatMesFileLine("mes/spell.mes", 30007);
            AttachParticles("Fizzle", target_item.Object);
            spell.RemoveTarget(target_item.Object);
        }

        spell.EndSpell();
    }
Esempio n. 29
0
    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();
    }
Esempio n. 30
0
    public override void OnEndProjectile(SpellPacketBody spell, GameObject projectile, int index_of_target)
    {
        Logger.Info("Fireball OnEndProjectile");
        var remove_list = new List <GameObject>();

        spell.duration = 0;

        var dam = Dice.D6;

        dam = dam.WithCount(Math.Min(10, spell.casterLevel));
        EndProjectileParticles(projectile);
        SpawnParticles("sp-Fireball-Hit", spell.aoeCenter);
        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Fire, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId))
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
            }
            else
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
            }

            remove_list.Add(target_item.Object);
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }