Exemplo n.º 1
0
    private void InitBuff(int id)
    {
        if (CardId == id)
        {
            return;
        }
        CardId = id;
        BattleBuffTableSetting buff = BattleBuffTableSettings.Get(id);

        icon.Load(buff.IconID);
        labName.text   = I18N.Get(buff.Name);
        describle.text = I18N.Get(buff.Desc);
        spSpending.gameObject.SetActive(false);
    }
Exemplo n.º 2
0
        public override void Excute()
        {
            Debug.LogError((owner.IsMe ? "[我]" : "[怪]") + "添加了一个buff-> " + actionArg +
                           "[L:" + actionArg2 + "][T:" + BattleBuffTableSettings.Get(actionArg).Time + "]");
            //buff已经存在的标识
            bool added = false;

            for (int i = 0; i < owner.Data.BuffList.Count; i++)
            {
                BattleBuffData buff = owner.Data.BuffList[i];
                if (actionArg == buff.BuffId)
                {
                    added = true;
                    //刷新buff时间,不叠加
                    BattleBuffTableSetting buffData = BattleBuffTableSettings.Get(buff.BuffId);
                    if (buffData.IsOverlay)
                    {
                        buff.Layer = Mathf.Max(buff.Layer + buffData.DefaultLayer, buffData.MaxLayer);
                    }
                    //有持续时间的
                    if (buff.Time >= 0)
                    {
                        //buff.Time = Mathf.Max(buff.Time + buffData.Time, buffData.MaxLayer);
                        buff.Time = buff.Time + buffData.Time;
                    }
                    break;
                }
            }
            if (added == false)
            {
                BattleBuffData buffData = null;
                if (userdata != null && (userdata is BattleBuffData))
                {
                    //转移buff
                    BattleBuffData sourceBuff = (userdata as BattleBuffData);
                    buffData = new BattleBuffData(actionArg, sourceBuff.Time, sourceBuff.Layer, sourceData, owner, owner);
                }
                else
                {
                    //新增buff
                    buffData = new BattleBuffData(actionArg, 0, actionArg2, sourceData, owner, owner);
                }
                owner.Data.BuffList.Add(buffData);
                //UI用独立的buff数据,和血量什么的一样
                battleMgr.AddUIAction(new UIAction.UIAddBuff(buffData));
                //battleMgr.AddUIAction(new UIAction.UIAddBuff(new BattleBuffData(actionArg, actionArg2, sourceData, owner, owner)));
            }
        }
Exemplo n.º 3
0
    public BattleBuffData(int buffId, int time, int layer, BattleEffectItemData cardData, BattlePlayer owner, BattlePlayer target)
    {
        BuffId = buffId;

        Data = BattleBuffTableSettings.Get(buffId);

        if (Data == null)
        {
            Debug.LogError("BuffId: " + buffId + " not exist!");
            return;
        }
        Time     = time == 0 ? Data.Time : time;
        Layer    = layer == 0 ? Data.DefaultLayer : layer;
        CardData = cardData;
        Owner    = owner;
        Target   = target;
        ItemType = BattleEffectItemType.Buff;
    }