Пример #1
0
        internal void SetOwner(Ability9 ability, Unit9 owner)
        {
            if (!ability.IsItem)
            {
                ability.SetOwner(owner);
                return;
            }

            var item          = ability.BaseItem;
            var itemPurchaser = item.Purchaser?.Hero;

            if (item.Shareability == Shareability.Full || owner.IsIllusion || itemPurchaser?.IsValid != true || owner.Owner?.IsValid != true ||
                (this.canUseOwnerItems.Contains(owner.Name) && itemPurchaser.Handle == owner.Owner.Handle))
            {
                ability.SetOwner(owner);
            }
            else
            {
                ability.SetOwner(EntityManager9.AddUnit(itemPurchaser));
            }

            this.UpdateItemState(ability);
        }
        // Token: 0x06000390 RID: 912 RVA: 0x0001BD80 File Offset: 0x00019F80
        internal void SetOwner(Ability9 ability, Unit9 owner)
        {
            if (!ability.IsItem)
            {
                ability.SetOwner(owner);
                return;
            }
            Item   baseItem  = ability.BaseItem;
            Player purchaser = baseItem.Purchaser;
            Hero   hero      = (purchaser != null) ? purchaser.Hero : null;

            if (baseItem.Shareability != Shareability.Full && !owner.IsIllusion && hero != null && hero.IsValid)
            {
                Unit9 owner2 = owner.Owner;
                if (owner2 != null && owner2.IsValid && (!this.canUseOwnerItems.Contains(owner.Name) || hero.Handle != owner.Owner.Handle))
                {
                    ability.SetOwner(EntityManager9.AddUnit(hero));
                    goto IL_A0;
                }
            }
            ability.SetOwner(owner);
IL_A0:
            AbilityMonitor.UpdateItemState(ability);
        }