コード例 #1
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Flaming Sphere OnSpellEffect");
        var dam = Dice.D4;

        spell.duration = 1 * spell.casterLevel;
        var weapon_proto     = 4143;
        var weapon_portrait  = 4320;
        var monster_proto_id = 14629;
        var npc = spell.caster;

        if (npc.GetNameId() == 8036 || npc.GetNameId() == 14425) // faction 7
        {
            monster_proto_id = 14621;
        }

        if (npc.GetNameId() == 14425 && npc.GetMap() == 5065) // faction 15
        {
            monster_proto_id = 14604;
        }

        // create monster
        spell.SummonMonsters(true, monster_proto_id);
        GameObject monster_obj = null;
        var        m_list      = ObjList.ListCone(spell.caster, ObjectListFilter.OLC_CRITTERS, 200, -180, 360);

        foreach (var m in m_list)
        {
            if (m.GetNameId() == monster_proto_id && m.ItemWornAt(EquipSlot.WeaponPrimary) == null && m.GetLeader() == spell.caster && Co8.are_spell_flags_null(m))
            {
                monster_obj = m;
                Co8.set_spell_flag(m, Co8SpellFlag.FlamingSphere);
                m.SetInt(obj_f.critter_description_unknown, 20356);
            }
        }

        m_list = ObjList.ListCone(monster_obj, ObjectListFilter.OLC_CRITTERS, 5, -180, 360);
        foreach (var m in m_list)
        {
            if (m != spell.caster && !Co8.is_spell_flag_set(m, Co8SpellFlag.FlamingSphere))
            {
                if (!m.SavingThrow(spell.dc, SavingThrowType.Reflex, D20SavingThrowFlag.NONE, monster_obj))
                {
                    m.Damage(monster_obj, DamageType.Fire, dam, D20AttackPower.NORMAL);
                }
                else
                {
                    m.FloatMesFileLine("mes/spell.mes", 30001);
                }
            }
        }

        monster_obj.AddCondition("Amulet of Mighty Fists", -20, -10);
        monster_obj.AddCondition("Monster Plant", 0, 0);
        monster_obj.SetInt(obj_f.critter_portrait, weapon_portrait);
        var hit_points = 10 * spell.casterLevel;

        hit_points = 25 + hit_points;
        monster_obj.SetBaseStat(Stat.hp_max, hit_points);
        monster_obj.ClearObjectFlag(ObjectFlag.CLICK_THROUGH);
        // monster_obj.npc_flag_set(ONF_NO_ATTACK)
        // add monster to follower list for spell_caster
        if (!spell.caster.HasMaxFollowers())
        {
            spell.caster.RemoveAIFollower(monster_obj);
            spell.caster.AddFollower(monster_obj);
            monster_obj.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0);
        }

        // add monster to target list
        spell.ClearTargets();
        spell.AddTarget(
            monster_obj,
            AttachParticles("sp-Fireball-proj", monster_obj)
            );
        // add spell indicator to spell caster
        spell.caster.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0);
        Logger.Info("{0}", spell.Targets[0].Object);
        spell.EndSpell();
    }
コード例 #2
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Mordenkainens Sword OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;
        var hp_bonus         = 25;
        var weapon_proto     = 4143;
        var weapon_portrait  = 7980;
        var monster_proto_id = 14629;
        var npc = spell.caster;

        if (npc.GetNameId() == 8036 || npc.GetNameId() == 14425) // faction 7
        {
            monster_proto_id = 14621;
            spell.duration   = 10;
            hp_bonus         = 1000;
        }

        if (npc.GetNameId() == 14425 && npc.GetMap() == 5065) // faction 15
        {
            monster_proto_id = 14604;
        }

        // determine focus
        var focus = 0;

        if ((spell.caster.type != ObjectType.pc) && (spell.caster.GetLeader() == null))
        {
            // for NPCs not in game party
            focus = 1;
        }
        else
        {
            if (spell.caster.GetMoney() >= 25000)
            {
                focus = 1;
            }
        }

        // check for focus
        if (focus == 1)
        {
            // create monster
            spell.SummonMonsters(true, monster_proto_id);
            GameObject monster_obj = null;
            var        m_list      = ObjList.ListCone(spell.caster, ObjectListFilter.OLC_CRITTERS, 200, -180, 360);
            foreach (var m in m_list)
            {
                if (m.GetNameId() == monster_proto_id && m.ItemWornAt(EquipSlot.WeaponPrimary) == null && m.GetLeader() == spell.caster && Co8.are_spell_flags_null(m))
                {
                    monster_obj = m;
                    Co8.set_spell_flag(m, Co8SpellFlag.MordenkainensSword);
                    m.SetInt(obj_f.critter_description_unknown, 20355);
                    monster_obj.ClearObjectFlag(ObjectFlag.CLICK_THROUGH);
                }
            }

            if (!Co8.is_in_party(spell.caster))
            {
                monster_obj.ClearObjectFlag(ObjectFlag.INVULNERABLE);
                monster_obj.AddCondition("Monster Energy Immunity", "Force", 0);
            }

            monster_obj.AddCondition("Monster Plant", 0, 0);
            monster_obj.SetInt(obj_f.critter_portrait, weapon_portrait);
            var hit_points = 10 * spell.casterLevel;
            hit_points = hp_bonus + hit_points;
            monster_obj.SetBaseStat(Stat.hp_max, hit_points);
            // equip the tempman with the appropriate weapon
            var weapon_obj = GameSystems.MapObject.CreateObject(weapon_proto, monster_obj.GetLocation());
            weapon_obj.SetInt(obj_f.weapon_damage_dice, 772);
            weapon_obj.SetInt(obj_f.weapon_attacktype, (int)DamageType.Force);
            weapon_obj.AddConditionToItem("Armor Bonus", -7, 0);
            var to_hit = spell.casterLevel + 3 - monster_obj.GetBaseStat(Stat.attack_bonus);
            if ((Stat)spell.spellClass == Stat.level_wizard)
            {
                to_hit = to_hit + spell.caster.GetStat(Stat.int_mod);
            }
            else
            {
                to_hit = to_hit + spell.caster.GetStat(Stat.cha_mod);
            }

            weapon_obj.AddConditionToItem("To Hit Bonus", to_hit, 0);
            weapon_obj.AddConditionToItem("Damage Bonus", 3, 0);
            monster_obj.GetItem(weapon_obj);
            weapon_obj.SetItemFlag(ItemFlag.NO_TRANSFER);
            monster_obj.WieldBestInAllSlots();
            // add monster to follower list for spell_caster
            if (Co8.is_in_party(spell.caster))
            {
                if (!spell.caster.HasMaxFollowers())
                {
                    spell.caster.RemoveAIFollower(monster_obj);
                    spell.caster.AddFollower(monster_obj);
                    monster_obj.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0);
                }
            }

            // add monster to target list
            spell.ClearTargets();
            spell.AddTarget(monster_obj, AttachParticles("sp-Spell Resistance", monster_obj));
            // add spell indicator to spell caster
            spell.caster.AddCondition("sp-Endurance", spell.spellId, spell.duration, 0);
        }
        else
        {
            // no focus
            spell.caster.FloatMesFileLine("mes/spell.mes", 16009);
        }

        spell.EndSpell();
    }