public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Zuggtmoy Summon Fungi OnSpellEffect");
        // this needs to be in every summon spell script!
        spell.duration = 1 * spell.casterLevel;
        // how many monsters will there be?
        var dice1        = Dice.D3;
        var num_summoned = dice1.Roll() + 1;
        // set the proto_id for basidirond
        var monster_proto_id = 14281;
        var i = 0;

        while (i < num_summoned)
        {
            // create monster, monster should be added to target_list
            spell.SummonMonsters(true, monster_proto_id);
            i = i + 1;
        }

        // how many monsters will there be?
        var dice2 = Dice.D3;

        num_summoned = dice2.Roll() + 1;
        // set the proto_id for basidirond
        monster_proto_id = 14284;
        var j = 0;

        while (j < num_summoned)
        {
            // create monster, monster should be added to target_list
            spell.SummonMonsters(true, monster_proto_id);
            j = j + 1;
        }

        // how many monsters will there be?
        var dice3 = Dice.D3;

        num_summoned = dice3.Roll() + 1;
        // set the proto_id for basidirond
        monster_proto_id = 14283;
        var k = 0;

        while (k < num_summoned)
        {
            // create monster, monster should be added to target_list
            spell.SummonMonsters(true, monster_proto_id);
            k = k + 1;
        }

        spell.EndSpell();
    }
Пример #2
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Zuggtmoy Summon Fungi OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;

        var dice1 = Dice.D3;

        var num_summoned = dice1.Roll() + 1;

        var monster_proto_id = 14281;

        var i = 0;

        while (i < num_summoned)
        {
            spell.SummonMonsters(true, monster_proto_id);
            i = i + 1;
        }

        var dice2 = Dice.D3;

        num_summoned = dice2.Roll() + 1;

        monster_proto_id = 14284;

        var j = 0;

        while (j < num_summoned)
        {
            spell.SummonMonsters(true, monster_proto_id);
            j = j + 1;
        }

        var dice3 = Dice.D3;

        num_summoned = dice3.Roll() + 1;

        monster_proto_id = 14283;

        var k = 0;

        while (k < num_summoned)
        {
            spell.SummonMonsters(true, monster_proto_id);
            k = k + 1;
        }

        spell.EndSpell();
    }
Пример #3
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("summon fungi OnSpellEffect");
        spell.duration = 5;

        var dice = Dice.D4;

        var proto = dice.Roll();

        int proto_id; // DECL_PULL_UP

        if (proto == 1)
        {
            proto_id = 14281;
        }
        else if (proto == 2)
        {
            proto_id = 14284;
        }
        else if (proto == 3)
        {
            proto_id = 14283;
        }
        else
        {
            proto_id = 14277;
        }

        spell.SummonMonsters(true, proto_id);
        spell.EndSpell();
    }
Пример #4
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("summon fungi OnSpellEffect");
        spell.duration = 5;
        // what fungi will we get?
        var dice  = Dice.D4;
        var proto = dice.Roll();
        // set the proto_id for this monster
        int proto_id;

        if (proto == 1)
        {
            proto_id = 14281;
        }
        else if (proto == 2)
        {
            proto_id = 14284;
        }
        else if (proto == 3)
        {
            proto_id = 14283;
        }
        else
        {
            proto_id = 14277;
        }

        // monster should disappear when duration is over, apply "TIMED_DISAPPEAR" condition
        // spell.target_list[0].condition_add_with_args( 'sp-Summoned', spell.id, spell.duration, 0 )
        // Think i am gonna let the creature be there indefinately
        spell.SummonMonsters(true, proto_id);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Mordenkainen's Faithful Hound OnSpellEffect");
        spell.duration = 600 * spell.casterLevel;
        // get the proto_id for this monster (from radial menu)
        var monster_proto_id = 14278;

        // create monster
        // game.particles( 'sp-Mordenkainens Faithful Hound', spell.target_loc )
        spell.SummonMonsters(true, monster_proto_id);
        var monster_obj = Co8.GetCritterHandle(spell, 14278);
        var hit_points  = 6 * spell.casterLevel;

        hit_points = 25 + hit_points;
        monster_obj.SetBaseStat(Stat.hp_max, hit_points);
        // 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();
        // add monster to target list
        spell.ClearTargets();
        spell.AddTarget(monster_obj, AttachParticles("sp-Mordenkainens Faithful Hound", spell.Targets[0].Object));
        spell.Targets[0].Object = monster_obj;
        // add condition
        monster_obj.AddCondition("sp-Mordenkainens Faithful Hound", spell.spellId, spell.duration, 0);
        spell.EndSpell();
    }
Пример #6
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();
    }
Пример #7
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("senshock summon elemental OnSpellEffect");
        spell.duration = 50;

        var dice = Dice.D4;

        var proto = dice.Roll();

        int proto_id; // DECL_PULL_UP

        if (proto == 1)
        {
            proto_id = 14292;
        }
        else if (proto == 2)
        {
            proto_id = 14296;
        }
        else if (proto == 3)
        {
            proto_id = 14298;
        }
        else
        {
            proto_id = 14302;
        }

        spell.SummonMonsters(true, proto_id);
        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();
    }
Пример #9
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Summon Monster III OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;

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

        spell.SummonMonsters(true, monster_proto_id);
        spell.EndSpell();
    }
Пример #10
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("summon lamia OnSpellEffect");
        spell.duration = 6;

        var proto_id = 14428;

        spell.SummonMonsters(true, proto_id);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        var selection = PlanarAllies.choose_allies(spell.caster, 3, 6, 1);

        spell.duration = 10 * spell.casterLevel;
        SpawnParticles("sp-Summon Monster III", spell.aoeCenter);
        spell.SummonMonsters(true, selection[0]);
        // There seems to be no provision for experience costs, so
        // this is the best we can do.
        spell.caster.AwardExperience(-100);
        spell.EndSpell();
    }
Пример #12
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("gate OnSpellEffect");
        spell.duration = 500;

        var dice1 = Dice.D100;

        var what_summoned = dice1.Roll();

        int monster_proto_id; // DECL_PULL_UP
        int num_monsters;     // DECL_PULL_UP

        if (what_summoned > 99)
        {
            monster_proto_id = 14286;

            num_monsters = 1;
        }
        else if (what_summoned > 75)
        {
            monster_proto_id = 14263;

            num_monsters = 1;
        }
        else if (what_summoned > 50)
        {
            monster_proto_id = 14259;

            var dice2 = Dice.D2;


            num_monsters = dice2.Roll();
        }
        else
        {
            monster_proto_id = 14258;

            var dice2 = Dice.D3;


            num_monsters = dice2.Roll();
        }

        var i = 0;

        while (i < num_monsters)
        {
            spell.SummonMonsters(true, monster_proto_id);
            i = i + 1;
        }

        spell.EndSpell();
    }
Пример #13
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("summon lamia OnSpellEffect");
        spell.duration = 6;
        // get the proto_id for this monster
        var proto_id = 14428;

        // create monster, monster should be added to target_list
        // monster should disappear when duration is over, apply "TIMED_DISAPPEAR" condition happens auto now...
        // just be sure to set the spell.duration
        spell.SummonMonsters(true, proto_id);
        spell.EndSpell();
    }
Пример #14
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        spell.duration = 10 * spell.casterLevel;
        var selection = PlanarAllies.choose_allies(spell.caster, 4, 12, 2);

        SpawnParticles("sp-Summon Monster IV", spell.aoeCenter);
        foreach (var n in selection)
        {
            spell.SummonMonsters(true, n);
        }

        spell.caster.AwardExperience(-250);
        spell.EndSpell();
    }
Пример #15
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("gate OnSpellEffect");
        // this needs to be in every summon spell script!
        spell.duration = 500;
        // What Demon will it be?
        var dice1         = Dice.D100;
        var what_summoned = dice1.Roll();
        int monster_proto_id;
        int num_monsters;

        if (what_summoned > 99)
        {
            // set the  proto_id for Balor
            monster_proto_id = 14286;
            num_monsters     = 1;
        }
        else if (what_summoned > 75)
        {
            // set the  proto_id for Glabrezu
            monster_proto_id = 14263;
            num_monsters     = 1;
        }
        else if (what_summoned > 50)
        {
            // set the  proto_id for Hezrou
            monster_proto_id = 14259;

            num_monsters = Dice.D2.Roll();
        }
        else
        {
            // set the  proto_id for Vrock
            monster_proto_id = 14258;

            num_monsters = Dice.D3.Roll();
        }

        var i = 0;

        while (i < num_monsters)
        {
            // create monster, monster should be added to target_list
            spell.SummonMonsters(true, monster_proto_id);
            i = i + 1;
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Summon Natures Ally II OnSpellEffect");
        spell.duration = 100;
        var roll = RandomRange(1, 100);
        int monster_proto_id;

        if (roll < 15)
        {
            monster_proto_id = 14050;
        }
        else if (roll < 30)
        {
            monster_proto_id = 14051;
        }
        else if (roll < 45)
        {
            monster_proto_id = 14053;
        }
        else if (roll < 60)
        {
            monster_proto_id = 14052;
        }
        else if (roll < 75)
        {
            monster_proto_id = 14047;
        }
        else if (roll < 90)
        {
            monster_proto_id = 14090;
        }
        else
        {
            monster_proto_id = 14375;
        }

        // special effects
        SpawnParticles("sp-Summon Natures Ally II", spell.aoeCenter);
        spell.SummonMonsters(true, monster_proto_id);
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Glabrezu Summon Quasits OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;

        var dice = Dice.D4;

        var num_quasits = dice.Roll();

        var quasit_proto_id = 14110;

        var i = 0;

        while (i < num_quasits)
        {
            spell.SummonMonsters(true, quasit_proto_id);
            i = i + 1;
        }

        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info($"{SpellName} OnSpellEffect");
        spell.duration = 1 * spell.casterLevel;
        // Solves Radial menu problem for Wands/NPCs
        var options = SummonMonsterTools.GetSpellOptions(SpellOptionsKey);
        var protoId = spell.GetMenuArg(RadialMenuParam.MinSetting);

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

        ModifySummonedProtoId(spell, ref protoId);

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

        ScriptUtilities.AttachParticles(ParticleSystemId, target_item.Object);
        SummonMonsterTools.SummonMonster_Rectify_Initiative(spell, protoId); // Added by S.A. - sets iniative to caster's initiative -1, so that it gets to act in the same round
        spell.EndSpell();
    }
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("senshock summon elemental OnSpellEffect");
        spell.duration = 50;
        // what elementals will we get?
        var dice  = Dice.D4;
        var proto = dice.Roll();
        // set the proto_id for this monster
        int proto_id;

        if (proto == 1)
        {
            // proto_id = 14292
            proto_id = 14624;
        }
        else if (proto == 2)
        {
            // proto_id = 14296
            proto_id = 14625;
        }
        else if (proto == 3)
        {
            // proto_id = 14298
            proto_id = 14626;
        }
        else
        {
            // proto_id = 14302
            proto_id = 14627;
        }

        // create monster, monster should be added to target_list
        // monster should disappear when duration is over, apply "TIMED_DISAPPEAR" condition happens auto now...
        // just be sure to set the spell.duration
        spell.SummonMonsters(true, proto_id);
        spell.EndSpell();
    }
    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();
    }
Пример #21
0
    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Glabrezu Summon Quasits OnSpellEffect");
        // this needs to be in every summon spell script!
        spell.duration = 1 * spell.casterLevel;
        // how many quasits will there be?
        var dice        = Dice.D4;
        var num_quasits = dice.Roll();
        // set the proto_id for this monster
        var quasit_proto_id = 14110;
        var npc             = spell.caster; // Vrock/Hezrou/Glabrezu Guardian can summon 1d10 Quasits

        if (npc.GetNameId() == 14360 || npc.GetNameId() == 14361 || npc.GetNameId() == 14359)
        {
            var dice2 = Dice.Parse("2d3");
            num_quasits = num_quasits + dice2.Roll();
        }

        // Balor Guardian
        if (npc.GetNameId() == 14358)
        {
            var chance = RandomRange(1, 100);
            if (chance <= 25) // Lots of Quasits
            {
                num_quasits = RandomRange(4, 10);
            }

            if (chance >= 26 && chance <= 50) // Lesser Glabrezu
            {
                num_quasits     = 1;
                quasit_proto_id = 14263;
            }

            if (chance >= 51 && chance <= 75) // Lesser Hezrou
            {
                num_quasits     = RandomRange(1, 3);
                quasit_proto_id = 14259;
            }

            if (chance >= 76 && chance <= 100) // Lesser Balor
            {
                num_quasits     = 1;
                quasit_proto_id = 14286;
            }
        }

        // Vrock Guardian has 25% chance to summon a lesser Vrock instead of Quasitz
        if (npc.GetNameId() == 14361 && RandomRange(1, 100) <= 25)
        {
            num_quasits     = 1;
            quasit_proto_id = 14258;
        }

        // Hezrou Guardian has 25% chance to summon a lesser Hezrou instead of Quasitz
        if (npc.GetNameId() == 14360) // and game.random_range(1,100) <= 25:
        {
            num_quasits     = 1;
            quasit_proto_id = 14259;
        }

        // Glabrezu Guardian has 25% chance to summon a lesser Vrock instead of Quasitz
        if (npc.GetNameId() == 14359 && RandomRange(1, 100) <= 25)
        {
            num_quasits     = 1;
            quasit_proto_id = 14258;
        }

        var i = 0;

        while (i < num_quasits)
        {
            // create monster, monster should be added to target_list
            spell.SummonMonsters(true, quasit_proto_id);
            i = i + 1;
        }

        // monster should disappear when duration is over, apply "TIMED_DISAPPEAR" condition
        // spell.target_list[0].condition_add_with_args( 'sp-Summoned', spell.id, spell.duration, 0 )
        // Think i am gonna let the creature be there indefinately
        spell.EndSpell();
    }
Пример #22
0
    // game.particles( "sp-conjuration-conjure", spell.caster )

    public override void OnSpellEffect(SpellPacketBody spell)
    {
        Logger.Info("Summon Familiar OnSpellEffect");
        spell.duration = 2147483647;
        var master = spell.caster;
        // get familiar inventory object handle
        var inv_proto = FindFamiliarProto(spell.caster, false);
        var familiar  = spell.caster.FindItemByProto(inv_proto);

        if ((get_ID(familiar) != 0))
        {
            return;
        }

        // get the proto_id for this familiar
        var familiar_proto_id = FindFamiliarProto(spell.caster, true);

        if ((familiar_proto_id == 0)) // not a recognized familiar type
        {
            return;
        }

        // creates random ID number
        var ID_number = RandomRange(1, 2147483647);

        ID_number = ID_number ^ RandomRange(1,
                                            2147483647); // xor with next "random" number in line, should be more random
        // create familiar
        spell.SummonMonsters(true, familiar_proto_id);
        // get familiar's handle
        var familiar_obj = Co8.GetCritterHandle(spell, familiar_proto_id);

        if ((familiar_obj == null)) // no new familiar present
        {
            return;
        }

        // summoning effect
        // game.particles( 'Orb-Summon-Air-Elemental', familiar_obj )
        // assigns familiar ownership
        set_ID(familiar_obj, ID_number);
        set_ID(familiar, ID_number);
        // game.particles( "sp-summon monster II", game.party[0] )
        // sets familiar's stat's and bonuses depending on it's masters level
        var master_level = GetLevel(spell.caster);
        var f_level      = ((master_level + 1) / 2);
        var f_hp         = ((spell.caster.GetStat(Stat.hp_max)) / 2); // familiar's hp = i/2 masters hp
        var base_hp      = familiar_obj.GetStat(Stat.hp_max);         // familiar's base hp from proto
        var prev_max_hp  =
            familiar.GetInt(obj_f
                            .item_pad_i_1); // familiar's max hp from last time summoned ( 0 if never summoned before)
        var prev_curr_hp =
            familiar.GetInt(obj_f
                            .item_pad_i_2); // familiar's current xp from last time stowed ( 0 if never summoed before)
        int new_hp;

        if ((base_hp <= f_hp)) // if 1/2 master's hp is greater than base hp from proto, will use 1/2 masters hp
        {
            new_hp = familiar_obj.SetBaseStat(Stat.hp_max, f_hp);
        }

        var curr_max_hp = familiar_obj.GetStat(Stat.hp_max); // familiar's max hp from current summons
        var hp_diff     =
            (curr_max_hp -
             prev_max_hp);      // difference between max hp from last time summoned and max hp now ( 0 if master has not gained a level since)

        if ((prev_max_hp != 0)) // has been summoned before
        {
            int hp_now;
            if ((hp_diff >= 1)) // adds gained hp if master has gained hp since last time summoned
            {
                hp_now = prev_curr_hp + hp_diff;
            }
            else
            {
                hp_now = prev_curr_hp;
            }

            var dam = Dice.Parse("1d1");
            dam = dam.WithCount(curr_max_hp - hp_now);
            if ((dam.Count >= 1))
            {
                familiar_obj.Damage(null, DamageType.Force, dam, D20AttackPower.NORMAL);
            }
        }

        // This next bit gives the familiar it's masters BAB.  The familiar should have a BAB (without the masters BAB) of zero, but since
        // the game engine doesn't allow for Weapon Finesse with natural attacks( which would let the familiar use their dexterity modifier
        // instead of the strength modifier), I fiddled with the  "to hit" in the protos to counteract the negative attack modifier do to
        // low strength and add the dexterity modifier. - Ceruleran the Blue ##
        var f_to_hit   = spell.caster.GetBaseStat(Stat.attack_bonus);
        var new_to_hit = familiar_obj.AddCondition("To Hit Bonus", f_to_hit, 0);
        var new_int    = familiar_obj.SetBaseStat(Stat.intelligence, (5 + f_level)); // familiar INT bonus

        familiar_obj.SetInt(obj_f.npc_ac_bonus, (f_level));                          // Natrual Armor bonus
        if ((master_level >= 11))
        {
            var spell_resistance =
                familiar_obj.AddCondition("Monster Spell Resistance", (5 + master_level), 0); // spell resistance
        }

        // familiar uses masters saving throw bonuses if they are higher than it's own.
        var fortitude_bonus = Fortitude(spell.caster);

        if ((fortitude_bonus >= 3))
        {
            familiar_obj.SetInt(obj_f.npc_save_fortitude_bonus, fortitude_bonus);
        }

        var reflex_bonus = Reflex(spell.caster);

        if ((reflex_bonus >= 3))
        {
            familiar_obj.SetInt(obj_f.npc_save_reflexes_bonus, reflex_bonus);
        }

        var will_bonus = Will(spell.caster);

        if ((will_bonus >= 1))
        {
            familiar_obj.SetInt(obj_f.npc_save_willpower_bonus, will_bonus);
        }

        // add familiar to follower list for spell_caster
        if (!(spell.caster.HasMaxFollowers()))
        {
            spell.caster.AddFollower(familiar_obj);
        }
        else
        {
            spell.caster.AddAIFollower(familiar_obj);
        }

        // add familiar_obj to d20initiative, and set initiative to spell_caster's
        var caster_init_value = spell.caster.GetInitiative();

        familiar_obj.AddToInitiative();
        familiar_obj.SetInitiative(caster_init_value);
        UiSystems.Combat.Initiative.UpdateIfNeeded();
        // familiar should disappear when duration is over, apply "TIMED_DISAPPEAR" condition
        // familiar_obj.condition_add_with_args( 'sp-Summoned', spell.id, spell.duration, 0 )
        // add familiar to target list
        spell.ClearTargets();
        spell.AddTarget(familiar_obj);
        spell.EndSpell();
    }
Пример #23
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();
    }