예제 #1
0
    /** 设置职位 */
    protected void doSetTitle(PlayerRoleGroupMemberData member, int title, bool needDispatch)
    {
        if (needDispatch)
        {
            evt.oldTitle = member.title;
        }

        _memberTitleCount.addValue(member.title, -1);
        if (member.title == RoleGroupTitleType.Leader)
        {
            _leader = null;
        }

        member.title = title;

        _memberTitleCount.addValue(member.title, 1);
        if (member.title == RoleGroupTitleType.Leader)
        {
            _leader = member;
        }

        if (needDispatch)
        {
            evt.newTitle = title;
            evt.groupID  = groupID;
            evt.targetID = member.playerID;

            me.dispatch(GameEventType.RemoveRoleGroupMember, evt);
        }
    }
예제 #2
0
 /** 添加造型更换 */
 public void addFacade(int facadeID)
 {
     if (_changeFacadeDic.addValue(facadeID, 1) == 1 && facadeID != _changeFacadeID)
     {
         if (_changeFacadeID == -1 || FacadeConfig.get(facadeID).proirity > FacadeConfig.get(_changeFacadeID).proirity)
         {
             setFacade(facadeID);
         }
     }
 }
예제 #3
0
    public override void afterReadData()
    {
        base.afterReadData();

        ItemData[] values;
        ItemData   v;

        for (int i = (values = _data.equips.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                _equipNumDic.addValue(v.id, 1);
            }
        }
    }
예제 #4
0
    /** 一秒十次 */
    public void onPiece(int delay)
    {
        IntObjectMap <CDData> cds;

        if ((cds = _cds).isEmpty())
        {
            return;
        }

        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        foreach (CDData data in _cds)
        {
            if ((data.timePass += delay) >= data.timeMax)
            {
                cds.remove(data.id);

                //移除对应组CD
                foreach (int gv in data.config.groups)
                {
                    groupCDCount.addValue(gv, -1);

                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);

                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }
    }
예제 #5
0
    public void setData(IntObjectMap <CDData> cds)
    {
        _cds = cds;

        if (cds != null && !cds.isEmpty())
        {
            IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
            IntIntMap             groupCDCount = _groupCDCount;

            CDData[] values = cds.getValues();
            CDData   data;

            for (int i = values.Length - 1; i >= 0; --i)
            {
                if ((data = values[i]) != null)
                {
                    int lastTime = data.getLastTime();

                    CDConfig config = data.config = CDConfig.get(data.id);

                    foreach (int v in config.groups)
                    {
                        groupCDCount.addValue(v, 1);

                        CDData oldMax = groupMaxCDs.get(v);

                        if (oldMax == null || oldMax.getLastTime() < lastTime)
                        {
                            groupMaxCDs.put(v, data);
                        }
                    }
                }
            }
        }
    }
예제 #6
0
    /** 添加CD组 */
    public void reAddCDs(IntObjectMap <CDData> dic, int dTime)
    {
        if (dic.isEmpty())
        {
            return;
        }

        IntObjectMap <CDData> cds = _cds;

        if (!cds.isEmpty())
        {
            Ctrl.throwError("这时cd组不应该有值");
        }

        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        CDData[] values = dic.getValues();
        CDData   v;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                v.config    = CDConfig.get(v.id);
                v.timePass += dTime;

                //依然有效
                if (v.timePass < v.timeMax)
                {
                    cds.put(v.id, v);

                    foreach (int gv in v.config.groups)
                    {
                        groupCDCount.addValue(gv, 1);

                        CDData oldMax = groupMaxCDs.get(gv);

                        if (oldMax == null || oldMax.getLastTime() < v.getLastTime())
                        {
                            groupMaxCDs.put(gv, v);
                        }

                        //新的
                        if (oldMax == null)
                        {
                            parent.onStartGroupCD(gv);
                        }
                    }
                }
            }
        }

        _parent.onCDChange();
    }
예제 #7
0
    /** 开始服务器CD组 */
    public void startCDsByServer(SList <CDData> list)
    {
        IntObjectMap <CDData> cds          = _cds;
        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        CDData   oldData;
        CDData   data;
        CDConfig config;

        foreach (CDData v in list)
        {
            config = CDConfig.get(v.id);

            if ((oldData = cds.get(v.id)) == null)
            {
                data        = v;
                data.config = config;

                cds.put(data.id, data);
            }
            else
            {
                data          = oldData;
                data.timePass = v.timePass;
                data.timeMax  = v.timeMax;
            }

            foreach (int gv in config.groups)
            {
                //计数加1
                if (oldData == null)
                {
                    groupCDCount.addValue(gv, 1);
                }

                CDData oldMax = groupMaxCDs.get(gv);

                if (oldMax == null || oldMax.getLastTime() < data.timeMax)
                {
                    groupMaxCDs.put(gv, data);
                }

                //新的
                if (oldMax == null)
                {
                    parent.onStartGroupCD(gv);
                }
            }
        }

        _parent.onCDChange();
    }
예제 #8
0
    /// <summary>
    /// 添加一组物品
    /// </summary>
    public bool addItems(SList <ItemData> list, int way)
    {
        _tempMap.clear();
        ItemData data;

        for (int i = list.size() - 1; i >= 0; --i)
        {
            _tempMap.addValue((data = list.get(i)).id, data.num);
        }

        if (toAddItems(list, way))
        {
            toLogTempMap(way);
            return(true);
        }
        else
        {
            _tempMap.clear();
            return(false);
        }
    }
예제 #9
0
    /** 根据keep移除cd组(不推送) */
    public void removeCDByKeep(int keepType)
    {
        IntObjectMap <CDData> cds          = _cds;
        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;
        int executeNum = 0;

        bool has = false;

        foreach (CDData data in cds)
        {
            //大于等于的移除
            if (data.config.keepType >= keepType)
            {
                has = true;
                cds.remove(data.id);

                //移除对应组CD
                foreach (int gv in data.config.groups)
                {
                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);
                        ++executeNum;
                    }

                    if (groupCDCount.addValue(gv, -1) <= 0)
                    {
                        --executeNum;
                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }

        if (has)
        {
            if (executeNum != 0)
            {
                reCountGroupCDMax();
            }

            _parent.onCDChange();
        }
    }
예제 #10
0
    /** 移除组cd */
    public void removeGroupCD(int groupID)
    {
        bool has = false;
        IntObjectMap <CDData> cds          = _cds;
        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;
        //FIXME:SMap
        int executeNum = 0;

        foreach (CDData data in cds)
        {
            if (data.config.hasGroup(groupID))
            {
                has = true;

                cds.remove(data.id);

                foreach (int gv in data.config.groups)
                {
                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);
                        ++executeNum;
                    }

                    if (groupCDCount.addValue(gv, -1) <= 0)
                    {
                        --executeNum;
                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }

        if (has)
        {
            if (executeNum != 0)
            {
                reCountGroupCDMax();
            }

            _parent.onCDChange();
        }
    }
예제 #11
0
    private void toAddEffect(EffectConfig config)
    {
        int num = _effectNumDic.addValue(config.id, 1);

        //超了
        if (config.plusMax > 0 && num > config.plusMax)
        {
            return;
        }

        UnitEffect effect = GameC.pool.unitEffectPool.getOne();

        effect.setConfig(config);
        effect.setScene(_scene);
        effect.bindUnit(_unit);

        _effectList.add(effect);

        //开始
        effect.init();
    }
예제 #12
0
    /** 重新构造辅助数据 */
    private void reMakeData()
    {
        _itemNums.clear();
        _dicByID.clear();

        foreach (var kv in _dic.entrySet())
        {
            ItemData v = kv.value;
            //绑定index
            v.index = kv.key;
            v.reloadConfig();

            getItemDicByIDAbs(v.id).put(v.index, v);

            _itemNums.addValue(v.id, v.num);
        }
    }
예제 #13
0
    //cd部分

    /** 增加组CD时间上限千分比 */
    public void addGroupTimeMaxPercent(int groupID, int value)
    {
        _groupCDChangePercents.addValue(groupID, value);
    }
예제 #14
0
    private CDData toStartOneCD(CDConfig config, int time)
    {
        int id = config.id;
        int groupChangePercent = 0;
        int groupChangeValue   = 0;

        //千分比和数值均累加
        foreach (int gv in config.groups)
        {
            groupChangePercent += _groupCDChangePercents.get(gv);
            groupChangeValue   += _groupCDChangeValues.get(gv);
        }

        int timeMax = (int)(time * ((1000f + groupChangePercent) / 1000f) + groupChangeValue);

        CDData data = null;

        if (timeMax > 0)
        {
            CDData oldData;

            if ((oldData = _cds.get(id)) == null)
            {
                data        = new CDData();
                data.id     = id;
                data.config = config;

                _cds.put(data.id, data);
            }
            else
            {
                data = oldData;
            }

            data.timePass = 0;
            data.timeMax  = timeMax;

            foreach (int gv in config.groups)
            {
                //计数加1
                if (oldData == null)
                {
                    _groupCDCount.addValue(gv, 1);
                }

                CDData oldMax = _groupMaxCDs.get(gv);

                if (oldMax == null || oldMax.getLastTime() < timeMax)
                {
                    _groupMaxCDs.put(gv, data);
                }

                //新的
                if (oldMax == null)
                {
                    _parent.onStartGroupCD(gv);
                }
            }
        }

        return(data);
    }
예제 #15
0
    //prob

    /** 添加技能几率 */
    public void addSkillProb(int probID, int value)
    {
        _skillProbChanges.addValue(probID, value);
    }
예제 #16
0
    //buff响应

    /** 执行单个动作 */
    protected virtual void doOneAction(BuffData data, int index, int[] args, bool isAdd, bool isFull)
    {
        bool isDriveAll = _parent.isDriveAll();

        switch (args[0])
        {
        case BuffActionType.AddStatus:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                _parent.status.addStatus(args[1]);
            }
            else
            {
                _parent.status.subStatus(args[1]);
            }
        }
        break;

        case BuffActionType.AddAttribute:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            _parent.attribute.addOneAttribute(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddAttributeVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                int value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);

                _parent.attribute.addOneAttribute(args[1], value);

                _attributeVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, value);
            }
            else
            {
                int value = _attributeVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                _parent.attribute.subOneAttribute(args[1], value);
            }
        }
        break;

        case BuffActionType.IntervalMakeAttack:
        {
            //不是客户端驱动战斗
//				if(!SceneDriveType.isClientDriveAttackHapen(CommonSetting.sceneDriveType))
//					return;

            //不是客户端驱动战斗
            if (!_parent.isSelfDriveAttackHapen())
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.adderInstanceID = data.adderInstanceID;
                mData.readFromConfig(args);

                mData.type = BuffIntervalActionType.Attack;

                Unit selfUnit = _parent.getUnit();

                UnitFightDataLogic attackerLogic = null;

                if (data.adderInstanceID == -1)
                {
                    attackerLogic = _parent;
                }
                else
                {
                    Unit attacker;

                    if (selfUnit != null && (attacker = selfUnit.getScene().getFightUnit(data.adderInstanceID)) != null)
                    {
                        attackerLogic = attacker.fight.getDataLogic();
                    }
                }

                //存在再添加
                if ((args.Length > 4 && args[4] > 0) && attackerLogic != null)
                {
                    mData.calculateSelfAttackValue(attackerLogic);
                }

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.AddGroupCDTimeMaxPercent:
        {
            if (!isDriveAll)
            {
                return;
            }

            _parent.cd.addGroupTimeMaxPercent(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddGroupCDTimeMaxValue:
        {
            if (!isDriveAll)
            {
                return;
            }

            _parent.cd.addGroupTimeMaxValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddSkillProb:
        {
            addSkillProb(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.ChangeFacade:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _parent.avatar.addFacade(args[1]);
            }
            else
            {
                _parent.avatar.removeFacade(args[1]);
            }
        }
        break;

        case BuffActionType.AddAvatarPart:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _parent.avatar.addPart(args[1], args[2]);
            }
            else
            {
                _parent.avatar.removePart(args[1], args[2]);
            }
        }
        break;

        case BuffActionType.AttackProbAction:
        {
            if (!isDriveAll)
            {
                return;
            }

            IntObjectMap <int[]> dic = _attackProbActions[args[1]];

            if (dic == null)
            {
                dic = new IntObjectMap <int[]>();
                _attackProbActions[args[1]] = dic;
            }

            if (isAdd)
            {
                dic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, args);
            }
            else
            {
                dic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);
            }
        }
        break;

        case BuffActionType.AddShield:
        case BuffActionType.AddShieldVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                Ctrl.throwError("不支持初始化添加护盾");
                return;
            }

            //盾同一个buff就存在一个,不然会互斥

            if (isAdd)
            {
                int value;

                if (args[0] == BuffActionType.AddShield)
                {
                    value = args[2];
                }
                else
                {
                    value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);
                }

                //盾值
                _parent.attribute.addOneAttribute(args[1], value);

                _shieldBuffDic.computeIfAbsent(args[1], k => new SList <DIntData>()).add(DIntData.create(data.instanceID, value));
            }
            else
            {
                SList <DIntData> list = _shieldBuffDic.get(args[1]);
                DIntData         v;
                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    if ((v = list.get(i)).key == data.instanceID)
                    {
                        //移除剩余盾值
                        if (v.value > 0)
                        {
                            _parent.attribute.subOneAttribute(args[1], v.value);
                        }

                        list.remove(i);
                        --len;
                        --i;
                    }
                }
            }
        }
        break;

        case BuffActionType.SkillReplace:
        {
            if (isAdd)
            {
                if (ShineSetting.openCheck)
                {
                    if (_skillReplaceDic.contains(args[1]))
                    {
                        Ctrl.throwError("目前,相同技能ID同时只支持一个替换技能");
                    }
                }

                _skillReplaceDic.put(args[1], args[2]);
            }
            else
            {
                _skillReplaceDic.remove(args[1]);
            }
        }
        break;

        case BuffActionType.SkillProbReplace:
        {
            SList <int[]> list = _skillProbReplaceDic.computeIfAbsent(args[1], k => new SList <int[]>());

            if (isAdd)
            {
                int[] a;

                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    a = list.get(i);

                    if (compareSkillProbArgs(args, a) <= 0)
                    {
                        list.insert(i, args);
                        return;
                    }
                }

                list.add(args);
            }
            else
            {
                int[] a;

                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    a = list.get(i);

                    if (args[2] == a[2] && args[3] == a[3])
                    {
                        list.remove(i);
                        break;
                    }
                }
            }
        }
        break;

        case BuffActionType.IntervalAddAttribute:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.type = BuffIntervalActionType.AddAttribute;
                mData.readFromConfig(args);

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.IntervalAddAttributeVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.type = BuffIntervalActionType.AddAttributeVar;
                mData.readFromConfig(args);

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.SkillLevelUp:
        {
            _skillLevelUpDic.addValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddBuffLastTime:
        {
            if (!isDriveAll)
            {
                return;
            }

            _buffLastTimeAddDic.addValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.BuffLevelUp:
        {
            if (!isDriveAll)
            {
                return;
            }

            int level = isAdd ? args[2] : -args[2];

            _buffLevelUpDic.addValue(args[1], level);

            //需要立即更新
            if (args.Length > 3 && args[3] > 0)
            {
                if (data.config.hasGroup(args[1]))
                {
                    Ctrl.throwError("不能影响自己所在组的buffLevel");
                    return;
                }

                refreshBuffLevelUp(args[1], level);
            }
        }
        break;

        case BuffActionType.AddAttributeRefreshVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            SkillVarConfig vConfig = SkillVarConfig.get(args[2]);

            foreach (int[] v in vConfig.args)
            {
                switch (v[0])
                {
                case SkillVarSourceType.SelfAttribute:
                case SkillVarSourceType.TargetAttribute:
                {
                    _addAttributeRefreshVarASet.addValue(v[1], isAdd ? 1 : -1);
                }
                break;

                case SkillVarSourceType.SelfCurrentAttributePercent:
                case SkillVarSourceType.TargetCurrentAttributePercent:
                case SkillVarSourceType.SelfCurrentAttributeLostPercent:
                case SkillVarSourceType.TargetCurrentAttributeLostPercent:
                {
                    //当前+max
                    _addAttributeRefreshVarASet.addValue(v[1], isAdd ? 1 : -1);
                    _addAttributeRefreshVarASet.addValue(AttributeControl.attribute.currentToMaxMap[v[1]], isAdd ? 1 : -1);
                }
                break;
                }
            }

            if (isAdd)
            {
                int value = _parent.getSkillVarValueT(vConfig.id, data.adderInstanceID);

                _parent.attribute.addOneAttribute(args[1], value);

                BuffAddAttributeRefreshVarData bData = new BuffAddAttributeRefreshVarData();
                bData.adderInstanceID = data.adderInstanceID;
                bData.varID           = vConfig.id;
                bData.type            = args[1];
                bData.value           = value;

                _attributeRefreshVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, bData);
            }
            else
            {
                BuffAddAttributeRefreshVarData bData = _attributeRefreshVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                _parent.attribute.subOneAttribute(args[1], bData.value);
            }
        }
        break;

        case BuffActionType.UseSkillProbAction:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _useSkillProbActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, args);
            }
            else
            {
                _useSkillProbActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);
            }
        }
        break;

        case BuffActionType.IgnoreBuffGroup:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            _ignoreBuffGroupDic.addValue(args[0], isAdd ? 1 : -1);

            if (isAdd)
            {
                removeBuffByGroup(args[0]);
            }
        }
        break;
        }
    }
예제 #17
0
    /** 结算添加结果 */
    protected void flushAdd(int way)
    {
        if (_flushing)
        {
            Ctrl.throwError("物品操作出现环");
            return;
        }

        _flushing = true;

        try
        {
            IntIntMap autoUseItems = null;

            if (!_operateRecordAddListForAutoUse.isEmpty())
            {
                autoUseItems = new IntIntMap();

                int[] values = _operateRecordAddListForAutoUse.getValues();

                int len = _operateRecordAddListForAutoUse.size();

                for (int i = 0; i < len; i += 2)
                {
                    // toUseItem(values[i],values[i+1],null);

                    autoUseItems.addValue(values[i], values[i + 1]);
                }

                _operateRecordAddListForAutoUse.clear();
            }

            IntObjectMap <ItemData> dic = null;

            if (!_operateRecordList.isEmpty())
            {
                int[] values = _operateRecordList.getValues();

                int index;
                int num;

                //单个,并且没有自动使用
                if (_operateRecordList.size() == 2)              // && autoUseItems==null
                {
                    index = values[0];
                    num   = values[1];
                    ItemData v = getItem(index);
                    v.canRelease = false;
                    v.index      = index;              //标记index

                    // //新增物品
                    // if(v.num==num)
                    // {
                    //  toSendAddOneItem(index,v,way);
                    // }
                    // else
                    // {
                    //  toSendAddOneItemNum(index,v.num,way);
                    // }

                    onItemAdd(index, v, num, way);
                }
                else
                {
                    dic = new IntObjectMap <ItemData>();

                    ItemData v;

                    int len = _operateRecordList.size();

                    for (int i = 0; i < len; i += 2)
                    {
                        index = values[i];
                        num   = values[i + 1];
                        v     = getItem(index);

                        v.canRelease = false;                  //清除回收标记
                        v.index      = index;                  //标记index

                        dic.put(index, v);

                        onItemAdd(index, v, num, way);
                    }

                    //推送下面
                }

                _operateRecordList.clear();

                onChanged();
            }

            // if(autoUseItems!=null || dic!=null)
            // {
            //  toSendAddItem(autoUseItems,dic,way);
            // }

            if (autoUseItems != null)
            {
                autoUseItems.forEach((k, v) => { toUseItem(k, v, null); });
            }
        }
        catch (Exception e)
        {
            Ctrl.errorLog(e);
        }


        _flushing = false;
    }
예제 #18
0
    //hit

    /** 打击每帧 */
    protected void bulletHitFrame()
    {
        if (_config.attackID <= 0)
        {
            return;
        }

        //自己不能控制伤害
        if (!_unit.isSelfDriveAttackHapen())
        {
            return;
        }

        //不该走到这里
        if (BaseC.constlist.bulletCast_isSimpleBullet(_levelConfig.castType))
        {
            return;
        }

        SList <Unit> tempUnitList;

        getFrameHittedUnits(tempUnitList = _tempUnitList);

        if (tempUnitList.isEmpty())
        {
            return;
        }

        //是否可吸收
        bool canAbsorb = !_config.cantAbsorb;

        int eachHitMax      = _levelConfig.eachHitNum;
        int maxInfluenceNum = _levelConfig.maxInfluenceNum;

        IntIntMap hitTargetNums = _hitTargetNums;

        foreach (Unit unit in tempUnitList)
        {
            int instanceID = unit.instanceID;

            //打击次数内
            if (eachHitMax == 0 || hitTargetNums.get(instanceID) < eachHitMax)
            {
                //吸收子弹
                if (canAbsorb && unit.fight.getStatusLogic().getStatus(StatusType.AbsorbBullet))
                {
                    bulletOverInitiative();
                    return;
                }

                if (_hitEnabled)
                {
                    AttackData aData = _unit.fight.createAttackData(_config.attackID, _data.level, SkillTargetData.createByTargetUnit(instanceID));

                    aData.isBulletFirstHit = hitTargetNums.isEmpty();

                    hitTargetNums.addValue(instanceID, 1);

                    _scene.fight.executeAndReleaseAttack(aData);

                    //到达上限了
                    if (maxInfluenceNum > 0 && hitTargetNums.size() >= maxInfluenceNum)
                    {
                        _hitEnabled = false;

                        if (!_config.keepAtMaxHit)
                        {
                            bulletOverInitiative();
                        }

                        return;
                    }
                }
            }
        }

        _tempUnitList.clear();
    }
예제 #19
0
 /** 增加组CD时间上限值 */
 public void addGroupTimeMaxValue(int groupID, int value)
 {
     _groupCDChangeValues.addValue(groupID, value);
 }