コード例 #1
0
        /// <summary>
        /// Applies extra damage from a poisoned attack.
        /// </summary>
        /// <param name="srcIoid">the source of the damage</param>
        /// <param name="isSpellDamage">flag indicating whether the damage is from a spell</param>
        private void ApplyPoisonDamage(int srcIoid, bool isSpellDamage)
        {
            if (Interactive.Instance.HasIO(srcIoid))
            {
                BaseInteractiveObject poisonWeaponIO = null;
                BaseInteractiveObject sourceIO       = Interactive.Instance.GetIO(
                    srcIoid);
                if (sourceIO.HasIOFlag(IoGlobals.IO_01_PC))
                {
                    IOPcData player = sourceIO.PcData;
                    if (player.GetEquippedItem(EquipmentGlobals.EQUIP_SLOT_WEAPON) > 0 &&
                        Interactive.Instance.HasIO(player.GetEquippedItem(EquipmentGlobals.EQUIP_SLOT_WEAPON)))
                    {
                        poisonWeaponIO = Interactive.Instance.GetIO(player.GetEquippedItem(EquipmentGlobals.EQUIP_SLOT_WEAPON));

                        if (poisonWeaponIO != null &&
                            (poisonWeaponIO.PoisonLevel == 0 ||
                             poisonWeaponIO.PoisonCharges == 0) ||
                            isSpellDamage)
                        {
                            poisonWeaponIO = null;
                        }
                    }
                }
                else
                {
                    if (sourceIO.HasIOFlag(IoGlobals.IO_03_NPC))
                    {
                        poisonWeaponIO = sourceIO.NpcData.Weapon;
                        if (poisonWeaponIO != null &&
                            (poisonWeaponIO.PoisonLevel == 0 ||
                             poisonWeaponIO.PoisonCharges == 0))
                        {
                            poisonWeaponIO = null;
                        }
                    }
                }
                if (poisonWeaponIO == null)
                {
                    poisonWeaponIO = sourceIO;
                }
                if (poisonWeaponIO != null &&
                    poisonWeaponIO.PoisonLevel > 0 &&
                    poisonWeaponIO.PoisonCharges > 0)
                {
                    // TODO - apply poison damage

                    // reduce poison level on attacking weapon
                    if (poisonWeaponIO.PoisonCharges > 0)
                    {
                        poisonWeaponIO.PoisonCharges--;
                    }
                }
                sourceIO       = null;
                poisonWeaponIO = null;
            }
        }
コード例 #2
0
        /// <summary>
        /// Unequips the item from the targeted <see cref="BaseInteractiveObject"/>.
        /// </summary>
        /// <param name="target">the targeted <see cref="BaseInteractiveObject"/></param>
        /// <param name="isDestroyed">if true the item is destroyed afterwards</param>
        public virtual void UnEquip(BaseInteractiveObject target, bool isDestroyed)
        {
            if (target != null)
            {
                if (target.HasIOFlag(IoGlobals.IO_01_PC))
                {
                    int i = ProjectConstants.Instance.GetMaxEquipped() - 1;
                    for (; i >= 0; i--)
                    {
                        IOPcData player    = target.PcData;
                        int      itemRefId = player.GetEquippedItem(i);
                        if (itemRefId >= 0 &&
                            Interactive.Instance.HasIO(itemRefId) &&
                            Interactive.Instance.GetIO(
                                itemRefId).Equals(io))
                        {
                            // EERIE_LINKEDOBJ_UnLinkObjectFromObject(
                            // target->obj, tounequip->obj);
                            player.ReleaseEquipment(itemRefId);
                            // target->bbox1.x = 9999;
                            // target->bbox2.x = -9999;

                            if (!isDestroyed)
                            {
                                // if (DRAGINTER == null) {
                                // ARX_SOUND_PlayInterface(SND_INVSTD);
                                // Set_DragInter(tounequip);
                                // } else
                                if (!target.Inventory.CanBePutInInventory(io))
                                {
                                    target.Inventory.PutInFrontOfPlayer(io, true);
                                }
                            }
                            // send event from this item to target to unequip
                            Script.Instance.EventSender = io;
                            Script.Instance.SendIOScriptEvent(target, ScriptConsts.SM_007_EQUIPOUT, null, null);
                            // send event from target to this item to unequip
                            Script.Instance.EventSender = target;
                            Script.Instance.SendIOScriptEvent(io, ScriptConsts.SM_007_EQUIPOUT, null, null);
                        }
                    }
                    if (io.HasTypeFlag(EquipmentGlobals.OBJECT_TYPE_HELMET) ||
                        io.HasTypeFlag(EquipmentGlobals.OBJECT_TYPE_ARMOR) ||
                        io.HasTypeFlag(EquipmentGlobals.OBJECT_TYPE_LEGGINGS))
                    {
                        target.PcData.RecreatePlayerMesh();
                    }
                }
            }
        }