Esempio n. 1
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();
    }
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();
    }
Esempio n. 3
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. 4
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();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Crushing Despair OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 10 * spell.casterLevel;
        AttachParticles("sp-Emotion", spell.caster);
        foreach (var target_item in spell.Targets)
        {
            // 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);
                remove_list.Add(target_item.Object);
            }
            else
            {
                // saving throw unsuccessful
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                // apply despair
                var return_val = target_item.Object.AddCondition("sp-Emotion Despair", spell.spellId, spell.duration, 0);
                if (return_val)
                {
                    target_item.ParticleSystem = AttachParticles("sp-Emotion-Despair-Hit", target_item.Object);
                }
            }
        }

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

        var damage_dice = Dice.Parse("2d6");

        var duration_dice = Dice.Parse("2d6");

        spell.duration = duration_dice.Roll();

        AttachParticles("sp-Shout", spell.caster);
        foreach (var target_item in spell.Targets)
        {
            if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
            {
                target_item.Object.DealSpellDamage(spell.caster, DamageType.Magic, damage_dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
                target_item.Object.AddCondition("sp-Shout", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("sp-Shout-Hit", target_item.Object);
            }
            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);
                target_item.ParticleSystem = AttachParticles("sp-Shout-Hit", target_item.Object);

                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 7
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. 8
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Vrock Screech OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 1;

        spell.dc = 17;

        AttachParticles("Mon-Vrock-Screech", spell.caster);
        foreach (var target_item in spell.Targets)
        {
            Logger.Info("target={0}", target_item.Object);
            if (!target_item.Object.SavingThrow(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster))
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                target_item.Object.FloatMesFileLine("mes/spell.mes", 20021);
                target_item.Object.AddCondition("sp-Vrock Screech", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("Mon-Vrock-Screech-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. 9
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("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. 11
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Heal OnSpellEffect");
        var remove_list      = new List <GameObject>();
        var has_tensers_list = new List <GameObject>();
        var is_tensers       = false;

        foreach (var target in spell.Targets)
        {
            is_tensers = check_for_tensers(target.Object);
            AttachParticles("sp-Heal", target.Object);
            remove_list.Add(target.Object);
            // check if target is undead
            if (target.Object.IsMonsterCategory(MonsterCategory.undead))
            {
                // Harm target
                target.Object.AddCondition("sp-Harm", spell.spellId, spell.duration, 0);
            }
            else
            {
                // Heal undead
                target.Object.AddCondition("sp-Heal", spell.spellId, spell.duration, 0);
            }

            if (is_tensers)
            {
                replace_tensers(target.Object);
                is_tensers = false;
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 12
0
    public override void OnBeginSpellCast(SpellPacketBody spell)
    {
        Logger.Info("Color Spray OnBeginSpellCast");
        Logger.Info("spell.target_list={0}", spell.Targets);
        Logger.Info("spell.caster={0} caster.level= {1}", spell.caster, spell.casterLevel);
        AttachParticles("sp-evocation-conjure", spell.caster);
        var dice = Dice.D6;

        var num_targets_affected = dice.Roll();

        Logger.Info("num_of_targets_affected={0}", num_targets_affected);
        spell.SortTargets(TargetListOrder.DistFromCaster, TargetListOrderDirection.Ascending);
        Logger.Info("target_list sorted by dist from [{0}] (closest to farthest): {1}", spell.caster, spell.Targets);
        if (spell.Targets.Length > num_targets_affected)
        {
            var remove_list = new List <GameObject>();

            var index = 0;

            foreach (var target_item in spell.Targets)
            {
                if (index >= num_targets_affected)
                {
                    remove_list.Add(target_item.Object);
                }

                index = index + 1;
            }

            spell.RemoveTargets(remove_list);
        }

        Logger.Info("target_list after pruning: {0}", spell.Targets);
    }
Esempio n. 13
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Mandragora OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 1 * spell.casterLevel;
        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-Confusion", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("sp-Confusion Lesser", target_item.Object);
                // spell.target_list.remove_target( target_item.obj )
                remove_list.Add(target_item.Object);
            }
            else
            {
                // saving throw successful
                target_item.Object.AddCondition("sp-True Seeing", spell.spellId, spell.duration, 0);
                target_item.ParticleSystem = AttachParticles("sp-True Seeing", target_item.Object);
            }
        }

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

        spell.duration = 0;
        var dam = Dice.D8;

        SpawnParticles("sp-Sound Burst", spell.aoeCenter);
        foreach (var target_item in spell.Targets)
        {
            target_item.Object.DealSpellDamage(spell.caster, DamageType.Sonic, dam, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
            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);
                remove_list.Add(target_item.Object);
            }
            else
            {
                // saving throw unsuccessful
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                target_item.Object.AddCondition("sp-Sound Burst", spell.spellId, 1, 0);
            }
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 15
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        var check = Co8.check_for_protection_from_spells(spell.Targets, 0);

        Logger.Info("Mass Inflict Light Wounds OnSpellEffect");
        var remove_list = new List <GameObject>();
        var dice        = Dice.D8;

        dice = dice.WithModifier(Math.Min(25, spell.casterLevel));
        foreach (var target_item in spell.Targets)
        {
            AttachParticles("sp-Inflict Light Wounds", target_item.Object);
            // hurt enemies, heal undead
            if (target_item.Object.IsMonsterCategory(MonsterCategory.undead))
            {
                // allow Fortitude saving throw for half
                if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
                {
                    // saving throw succesful, damage target, 1/2 damage
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                    target_item.Object.HealFromSpell(spell.caster, dice, D20ActionType.CAST_SPELL, spell.spellId);
                }
                else
                {
                    // saving throw unsuccesful, damage target, full damage
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                    target_item.Object.HealFromSpell(spell.caster, dice, D20ActionType.CAST_SPELL, spell.spellId);
                }
            }
            else
            {
                // check saving throw, damage target
                if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
                {
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30001);
                    // saving throw succesful, damage target, 1/2 damage
                    target_item.Object.DealReducedSpellDamage(spell.caster, DamageType.NegativeEnergy, dice, D20AttackPower.UNSPECIFIED, DAMAGE_REDUCTION_HALF, D20ActionType.CAST_SPELL, spell.spellId);
                }
                else
                {
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                    // saving throw unsuccesful, damage target, full damage
                    target_item.Object.DealSpellDamage(spell.caster, DamageType.NegativeEnergy, dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
                }
            }

            remove_list.Add(target_item.Object);
        }

        spell.RemoveTargets(remove_list);
        if (check)
        {
            Co8.replace_protection_from_spells();
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Potion of Haste OnSpellEffect");
        var remove_list = new List <GameObject>();

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

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

        Logger.Info("spell.duration = {0}", spell.duration);
        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.IsFriendly(spell.caster))
            {
                var return_val = target_item.Object.AddCondition("sp-Haste", spell.spellId, spell.duration, 1);
                target_item.ParticleSystem = AttachParticles("sp-Haste", target_item.Object);
                // dont allow multiple adds (WIP! - until intgame select prevents MULTI (same target)
                if (!return_val)
                {
                    remove_list.Add(target_item.Object);
                }
            }
            else
            {
                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);
                    var return_val = target_item.Object.AddCondition("sp-Potion of Haste", spell.spellId, spell.duration, 1);
                    target_item.ParticleSystem = AttachParticles("sp-Haste", target_item.Object);
                    // dont allow multiple adds (WIP! - until intgame select prevents MULTI (same target)
                    if (!return_val)
                    {
                        remove_list.Add(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. 17
0
    public override void OnEndProjectile(SpellPacketBody spell, GameObject projectile, int index_of_target)
    {
        Logger.Info("Spore No More OnEndProjectile");
        var remove_list = new List <GameObject>();

        spell.duration = 0;
        var dam = Dice.D6;

        dam = dam.WithCount(3);
        var npc = spell.caster;

        if (npc.type != ObjectType.pc && npc.GetLeader() == null && npc.GetInt(obj_f.npc_pad_i_5) >= 1000)
        {
            var xyx = npc.GetInt(obj_f.npc_pad_i_5) - 1000;
            var loc = GameSystems.Party.GetPartyGroupMemberN(xyx).GetLocation();
            EndProjectileParticles(projectile);
        }
        else
        {
            // game.particles( 'sp-Fireball-Hit', loc )
            EndProjectileParticles(projectile);
        }

        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.IsMonsterCategory(MonsterCategory.plant))
            {
                if ((target_item.Object.DistanceTo(spell.Targets[0].Object) <= 10))
                {
                    dam = dam.WithCount(3);
                    target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.NegativeEnergy, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
                    AttachParticles("sp-Blight", target_item.Object);
                }
                else
                {
                    dam = dam.WithCount(2);
                    target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.NegativeEnergy, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
                    AttachParticles("sp-Blight", target_item.Object);
                }
            }
            else
            {
                dam = dam.WithCount(1);
                target_item.Object.FloatMesFileLine("mes/spell.mes", 31012);
                AttachParticles("Fizzle", target_item.Object);
                target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Acid, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
            }

            remove_list.Add(target_item.Object);
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 18
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Wail of the Banshee OnSpellEffect");
        var remove_list     = new List <GameObject>();
        var banshee_targets = spell.casterLevel;

        AttachParticles("sp-Shout", spell.caster);
        SpawnParticles("sp-Dispel Magic - Area", spell.aoeCenter);
        foreach (var target_item in spell.Targets)
        {
            if (banshee_targets > 0)
            {
                // make sure target is alive
                if (target_item.Object.IsMonsterCategory(MonsterCategory.construct) || target_item.Object.IsMonsterCategory(MonsterCategory.undead))
                {
                    // not alive
                    AttachParticles("Fizzle", target_item.Object);
                }
                else
                {
                    // 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);
                    }
                    else
                    {
                        // saving throw unsuccessful
                        target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                        // kill target
                        AttachParticles("sp-Shout-Hit", target_item.Object);
                        AttachParticles("sp-Death Knell-Target", target_item.Object);
                        // So you'll get awarded XP for the kill
                        if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object)))
                        {
                            target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1"));
                        }

                        target_item.Object.Kill();
                    }

                    banshee_targets = banshee_targets - 1;
                }
            }

            remove_list.Add(target_item.Object);
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 19
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Horrid Wilting OnSpellEffect");
        var remove_list = new List <GameObject>();
        var dam         = Dice.D6;

        dam = dam.WithCount(Math.Min(20, spell.casterLevel));
        var plant_dam = Dice.D8;

        plant_dam = plant_dam.WithCount(Math.Min(20, spell.casterLevel));
        foreach (var target_item in spell.Targets)
        {
            AttachParticles("sp-Blight", target_item.Object);
            // Plants and water elementals take 1d8 damage per caster level, save for half
            if ((target_item.Object.IsMonsterCategory(MonsterCategory.plant)) || ((target_item.Object.IsMonsterCategory(MonsterCategory.elemental)) && (target_item.Object.IsMonsterSubtype(MonsterSubtype.water))))
            {
                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);
                    target_item.Object.DealReducedSpellDamage(spell.caster, DamageType.Unspecified, plant_dam, D20AttackPower.UNSPECIFIED, DAMAGE_REDUCTION_HALF, D20ActionType.CAST_SPELL, spell.spellId);
                }
                else
                {
                    // saving throw unsuccessful
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                    target_item.Object.DealSpellDamage(spell.caster, DamageType.Unspecified, plant_dam, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
                }
            }
            else
            {
                // Everybody else takes 1d6 damage per caster level, save for half
                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);
                    target_item.Object.DealReducedSpellDamage(spell.caster, DamageType.Unspecified, dam, D20AttackPower.UNSPECIFIED, DAMAGE_REDUCTION_HALF, D20ActionType.CAST_SPELL, spell.spellId);
                }
                else
                {
                    // saving throw unsuccessful
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                    target_item.Object.DealSpellDamage(spell.caster, DamageType.Unspecified, dam, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId);
                }
            }

            remove_list.Add(target_item.Object);
        }

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

        spell.duration = 1;
        AttachParticles("sp-Bane", spell.caster);
        foreach (var target_item in spell.Targets)
        {
            var tar = target_item.Object;
            if ((tar.GetNameId() == 8064) || (tar.GetNameId() == 8042) || (tar.GetNameId() == 8043) || (tar.GetNameId() == 14455))
            {
                remove_list.Add(tar);
                tar.FloatMesFileLine("mes/spell.mes", 20048);
            }
            else if (tar.IsMonsterCategory(MonsterCategory.plant))
            {
                remove_list.Add(tar);
                tar.FloatMesFileLine("mes/spell.mes", 20049);
            }
            else if (tar.IsMonsterCategory(MonsterCategory.ooze))
            {
                remove_list.Add(tar);
                tar.FloatMesFileLine("mes/spell.mes", 20049);
            }
            else if (tar.IsMonsterCategory(MonsterCategory.aberration))
            {
                remove_list.Add(tar);
                tar.FloatMesFileLine("mes/spell.mes", 20049);
            }
            else if (tar.IsMonsterCategory(MonsterCategory.undead))
            {
                remove_list.Add(tar);
                tar.FloatMesFileLine("mes/spell.mes", 20050);
            }
            else if (tar.GetNameId() == 14455)
            {
                remove_list.Add(tar);
            }
            else
            {
                tar.FloatMesFileLine("mes/spell.mes", 30002);
                tar.FloatMesFileLine("mes/spell.mes", 20047);
                tar.KillWithDeathEffect();
            }
        }

        spell.RemoveTargets(remove_list);
        Co8.End_Spell(spell);
        spell.EndSpell();
    }
Esempio n. 21
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Chain Lightning OnSpellEffect");
        var remove_list         = new List <GameObject>();
        var primary_damage_dice = Dice.D6;

        primary_damage_dice = primary_damage_dice.WithCount(Math.Min(1 * spell.casterLevel, 20));
        var secondary_damage_dice = Dice.D6;

        secondary_damage_dice = secondary_damage_dice.WithCount(Math.Min(1 * (spell.casterLevel / 2), 20));
        SpawnParticles("sp-Chain Lightning", spell.aoeCenter);
        GameSystems.Vfx.ChainLightning(spell.caster, spell.Targets.Select(t => t.Object));
        var i = 0;

        foreach (var target_item in spell.Targets)
        {
            if ((i == 0))
            {
                i = 1;
                if (target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, primary_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);
                }
            }
            else
            {
                if (target_item.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, secondary_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. 22
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Animal Growth OnSpellEffect");
        // Dar's check for ranger caster level no longer needed thanks to Spellslinger's dll hack
        // if spell.caster_class == 14:
        // if spell.spell_level < 4:#added to check for proper ranger slot level (darmagon)
        // spell.caster.float_mesfile_line('mes\\spell.mes', 16008)
        // spell.spell_end(spell.id)
        // return
        var remove_list = new List <GameObject>();

        spell.duration = 10 * spell.casterLevel;
        foreach (var target_item in spell.Targets)
        {
            if ((target_item.Object.IsMonsterCategory(MonsterCategory.animal)))
            {
                if (target_item.Object.IsFriendly(spell.caster))
                {
                    target_item.Object.AddCondition("sp-Animal Growth", spell.spellId, spell.duration, 0);
                    target_item.ParticleSystem = AttachParticles("sp-Animal Growth", target_item.Object);
                }
                else if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId))
                {
                    // saving throw unsuccessful
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                    target_item.Object.AddCondition("sp-Animal Growth", spell.spellId, spell.duration, 0);
                    target_item.ParticleSystem = AttachParticles("sp-Animal Growth", 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);
                }
            }
            else
            {
                // not an animal
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30000);
                target_item.Object.FloatMesFileLine("mes/spell.mes", 31002);
                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

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

        spell.duration = 7;
        var soundfizzle = 0;

        foreach (var target_item in spell.Targets)
        {
            var(xx, yy) = target_item.Object.GetLocation();
            if (target_item.Object.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
                target_item.Object.FloatMesFileLine("mes/skill_ui.mes", 2000, TextFloaterColor.Red);
                AttachParticles("swirled gas", target_item.Object);
                soundfizzle = 1;
                remove_list.Add(target_item.Object);
            }
            else
            {
                var armor_obj = target_item.Object.ItemWornAt(EquipSlot.Armor);
                if ((armor_obj != null) && (armor_obj.GetMaterial() == Material.metal))
                {
                    // wearing metal armor
                    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
                {
                    // no metal armor
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 31010);
                    remove_list.Add(target_item.Object);
                }
            }
        }

        if (soundfizzle == 1)
        {
            Sound(7581, 1);
            Sound(7581, 1);
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Remove Paralysis OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 0;
        foreach (var target_item in spell.Targets)
        {
            AttachParticles("sp-Remove Paralysis", target_item.Object);
            target_item.ParticleSystem = AttachParticles("sp-Remove Paralysis", target_item.Object);
            target_item.Object.AddCondition("sp-Remove Paralysis", spell.spellId, spell.duration, 0);
        }

        spell.RemoveTargets(remove_list);
        spell.EndSpell();
    }
Esempio n. 25
0
    public override void OnEndProjectile(SpellPacketBody spell, GameObject projectile, int index_of_target)
    {
        Logger.Info("Snowball Swarm OnEndProjectile");
        var remove_list = new List <GameObject>();

        spell.duration = 0;
        var dam = Dice.D6;

        // calculate dice rolled
        if ((spell.casterLevel >= 3) && (spell.casterLevel <= 4))
        {
            dam = dam.WithCount(2);
        }
        else if ((spell.casterLevel >= 5) && (spell.casterLevel <= 6))
        {
            dam = dam.WithCount(3);
        }
        else if ((spell.casterLevel >= 7) && (spell.casterLevel <= 8))
        {
            dam = dam.WithCount(4);
        }
        else if ((spell.casterLevel >= 9) && (spell.casterLevel <= 20))
        {
            dam = dam.WithCount(5);
        }

        EndProjectileParticles(projectile);
        SpawnParticles("sp-Snowball Swarm-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.Cold, 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. 26
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Frozen Breath OnSpellEffect");
        var remove_list = new List <GameObject>();
        var dam         = Dice.D6;

        dam = dam.WithCount(spell.spellKnownSlotLevel);
        if (dam.Count > 6)
        {
            dam = dam.WithCount(6);
        }

        AttachParticles("sp-Cone of Cold", spell.caster);
        var npc = spell.caster;

        spell.dc = spell.dc + 5;
        if (npc.GetNameId() == 14999) // Old White Dragon
        {
            dam      = dam.WithCount(8);
            spell.dc = 27;
        }

        // range = 25 + 5 * int(spell.caster_level/2)
        var range       = 60;
        var target_list = ObjList.ListCone(spell.caster, ObjectListFilter.OLC_CRITTERS, range, -30, 60);

        foreach (var obj in target_list)
        {
            if (obj == spell.caster)
            {
                continue;
            }
            if (obj.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Cold, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId))
            {
                // saving throw successful
                obj.FloatMesFileLine("mes/spell.mes", 30001);
            }
            else
            {
                // saving throw unsuccessful
                obj.FloatMesFileLine("mes/spell.mes", 30002);
            }
        }

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

        spell.duration = 1 * spell.casterLevel;
        foreach (var target_item in spell.Targets)
        {
            // check if target is undead
            if (target_item.Object.IsMonsterCategory(MonsterCategory.undead))
            {
                // intelligent undead get a will save
                if (target_item.Object.GetStat(Stat.intelligence) > 0)
                {
                    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-Halt Undead", spell.spellId, spell.duration, 0);
                        target_item.ParticleSystem = AttachParticles("sp-Halt Undead", 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);
                    }
                }
                else
                {
                    // no saving throw
                    target_item.Object.AddCondition("sp-Halt Undead", spell.spellId, spell.duration, 0);
                    target_item.ParticleSystem = AttachParticles("sp-Halt Undead", target_item.Object);
                }
            }
            else
            {
                // not an undead
                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

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

        spell.duration = spell.casterLevel * 10;
        if (spell.Targets.Length == 1 && spell.Targets[0].Object == spell.caster)
        {
        }
        else
        {
            if (spell.caster.GetMoney() >= 150000)
            {
                foreach (var t in spell.Targets)
                {
                    AttachParticles("sp-Identify", t.Object);
                    t.Object.IdentifyAll();
                }
            }
            else
            {
                spell.caster.FloatMesFileLine("mes/spell.mes", 16009);
            }
        }

        foreach (var target_item in spell.Targets)
        {
            remove_list.Add(target_item.Object);
        }

        spell.RemoveTargets(remove_list);
        if (Co8.find_spell_obj_with_flag(spell.caster, 6400, Co8SpellFlag.AnalyzeDweomer) == null)
        {
            var spell_obj = GameSystems.MapObject.CreateObject(6400, spell.caster.GetLocation());
            Co8.set_spell_flag(spell_obj, Co8SpellFlag.AnalyzeDweomer);
            spell_obj.AddConditionToItem("Skill Circumstance Bonus", (int)SkillId.spellcraft, 20);
            spell.caster.GetItem(spell_obj);
            spell.ClearTargets();
            spell.AddTarget(spell.caster);
            spell.caster.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0);
        }
        else
        {
            spell.caster.FloatMesFileLine("mes/spell.mes", 16007);
            spell.EndSpell();
        }
    }
Esempio n. 29
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Potion of Haste OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = 1 * spell.casterLevel;

        Logger.Info("spell.duration = {0}", spell.duration);
        foreach (var target_item in spell.Targets)
        {
            if (target_item.Object.IsFriendly(spell.caster))
            {
                var return_val = target_item.Object.AddCondition("sp-Haste", spell.spellId, spell.duration, 1);

                target_item.ParticleSystem = AttachParticles("sp-Haste", target_item.Object);

                if (!return_val)
                {
                    remove_list.Add(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);
                    var return_val = target_item.Object.AddCondition("sp-Potion of Haste", spell.spellId, spell.duration, 1);

                    target_item.ParticleSystem = AttachParticles("sp-Haste", target_item.Object);

                    if (!return_val)
                    {
                        remove_list.Add(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. 30
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Scare OnSpellEffect");
        var remove_list = new List <GameObject>();

        spell.duration = spell.casterLevel;
        foreach (var target_item in spell.Targets)
        {
            // check for vermin
            if (target_item.Object.IsMonsterCategory(MonsterCategory.vermin))
            {
                target_item.Object.FloatMesFileLine("mes/spell.mes", 30019);
                target_item.Object.FloatMesFileLine("mes/bonus.mes", 319);
                remove_list.Add(target_item.Object);
            }
            // check target HD
            else if ((GameSystems.Critter.GetHitDiceNum(target_item.Object) < 6))
            {
                // allow Will 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);
                    // target is SHAKEN
                    target_item.Object.AddCondition("sp-Cause Fear", spell.spellId, 1, 1);
                    target_item.ParticleSystem = AttachParticles("sp-Scare", target_item.Object);
                }
                else
                {
                    // saving throw unsuccessful
                    target_item.Object.FloatMesFileLine("mes/spell.mes", 30002);
                    // target is FRIGHTENED
                    target_item.Object.AddCondition("sp-Cause Fear", spell.spellId, spell.duration, 0);
                    target_item.ParticleSystem = AttachParticles("sp-Scare", target_item.Object);
                }
            }
            else
            {
                // target HD is 6 or more
                AttachParticles("Fizzle", target_item.Object);
                remove_list.Add(target_item.Object);
            }
        }

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