public override void OnEndSpellCast(SpellPacketBody spell)
    {
        Logger.Info("Tensers Transformation OnEndSpellCast");
        Co8.destroy_spell_obj_with_flag(spell.caster, 6400, Co8SpellFlag.TensersTransformation);
        var item_wielded = spell.caster.ItemWornAt(EquipSlot.WeaponPrimary);

        if ((item_wielded != null))
        {
            if ((item_wielded.GetNameId() == spell.dc) && (Co8.is_spell_flag_set(item_wielded, Co8SpellFlag.TensersTransformation)))
            {
                var new_weapon = GameSystems.MapObject.CreateObject(spell.dc, spell.caster.GetLocation());
                item_wielded.SetInt(obj_f.weapon_type, new_weapon.GetInt(obj_f.weapon_type));
                Co8.unset_spell_flag(item_wielded, Co8SpellFlag.TensersTransformation);
                item_wielded.ClearItemFlag(ItemFlag.NO_DROP);
                new_weapon.Destroy();
            }
        }
        else
        {
            if (spell.dc != 0)
            {
                var weapon = Co8.find_spell_obj_with_flag(spell.caster, spell.dc, Co8SpellFlag.TensersTransformation);
                if (weapon != null) // this shouldn't ever happen but better check
                {
                    var new_weapon = GameSystems.MapObject.CreateObject(spell.dc, spell.caster.GetLocation());
                    weapon.SetInt(obj_f.weapon_type, new_weapon.GetInt(obj_f.weapon_type));
                    Co8.unset_spell_flag(weapon, Co8SpellFlag.TensersTransformation);
                    weapon.ClearItemFlag(ItemFlag.NO_DROP);
                    new_weapon.Destroy();
                }
            }
        }
    }
예제 #2
0
    public static void reenableWeapons(GameObject critter)
    {
        for (var num = 4000; num < 5000; num++)
        {
            var weapon = critter.FindItemByProto(num);
            if ((weapon != null && Co8.is_spell_flag_set(weapon, Co8SpellFlag.HezrouStench)))
            {
                Logger.Info("Enabling weapon {0} for {1}", weapon, critter);
                weapon.SetInt(obj_f.weapon_damage_dice, weapon.GetInt(obj_f.weapon_pad_i_2));
                Co8.unset_spell_flag(weapon, Co8SpellFlag.HezrouStench);
                weapon.ClearItemFlag(ItemFlag.NO_DROP);
            }
        }

        return;
    }