Example #1
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);
                    }
                }
            }
        }
    }
    /** 计算自身攻击值 */
    public void calculateSelfAttackValue(UnitFightDataLogic attackerLogic)
    {
        isRecorded = true;

        AttackLevelConfig levelConfig = AttackLevelConfig.get(key, value);

        int aLen = levelConfig.varNumT;

        if (selfAttackValues == null || selfAttackValues.Length < aLen)
        {
            selfAttackValues = new int[aLen];
        }

        int i = 0;

        int[] values = selfAttackValues;

        foreach (SkillVarConfig v in levelConfig.varConfigT)
        {
            foreach (int[] v2 in v.args)
            {
                values[i++] = BaseGameUtils.calculateOneSkillVarValue(v2, attackerLogic, null);
            }
        }
    }
Example #3
0
        public override int calculateSkillVar(int formulaType, int[][] args, UnitFightDataLogic self, UnitFightDataLogic target, int[] selfValues, int start)
        {
            if (!_g7)
            {
                _m7 = instance.Type.GetMethod("calculateSkillVar", 6);
                _g7 = true;
            }

            if (_m7 != null && !_b7)
            {
                _b7    = true;
                _p6[0] = formulaType;
                _p6[1] = args;
                _p6[2] = self;
                _p6[3] = target;
                _p6[4] = selfValues;
                _p6[5] = start;
                int re = (int)appdomain.Invoke(_m7, instance, _p6);
                _p6[0] = null;
                _p6[1] = null;
                _p6[2] = null;
                _p6[3] = null;
                _p6[4] = null;
                _p6[5] = null;
                _b7    = false;
                return(re);
            }
            else
            {
                return(base.calculateSkillVar(formulaType, args, self, target, selfValues, start));
            }
        }
Example #4
0
    /** 计算一个变量值 */
    public static int calculateOneSkillVarValue(int[] args, UnitFightDataLogic self, UnitFightDataLogic target)
    {
        int key;

        if ((key = args[0]) == SkillVarSourceType.ConstValue)
        {
            return(args[1]);
        }

        if (BaseC.constlist.skillVarSource_isTarget(key))
        {
            if (target == null)
            {
                return(0);
            }

            return(target.getSkillVarSourceValue(args, false));
        }
        else
        {
            if (self == null)
            {
                return(0);
            }

            return(self.getSkillVarSourceValue(args, true));
        }
    }
Example #5
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();
    }
Example #6
0
    private static float getOneSVarAddRatio(int[][] args, int index, UnitFightDataLogic self, UnitFightDataLogic target, int[] selfValues, int start)
    {
        int re = getOneSVar(args, index, self, target, selfValues, start);

        if (re == 0)
        {
            return(1f);
        }

        return((re + 1000f) / 1000f);
    }
Example #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();
    }
Example #8
0
    public override int getSkillVarValueT(int varID, int adderID)
    {
        if (_unit == null)
        {
            UnitFightDataLogic self = null;

            if (adderID == -1)
            {
                self = this;
            }

            return(BaseGameUtils.calculateSkillVarValueFull(varID, self, this));
        }

        return(base.getSkillVarValueT(varID, adderID));
    }
Example #9
0
    /** 添加单位 */
    public Unit addUnit(UnitData data)
    {
        //预处理
        //服务器驱动场景启用
        if (_config.instanceType != SceneInstanceType.ClientDriveSinglePlayerBattle)
        {
            //是自己的M单位
            if (data.identity is MUnitIdentityData && data.identity.playerID == GameC.player.role.playerID)
            {
                MUnitUseLogic useLogic = GameC.player.character.getMUnitUseLogic(data.getMUnitIdentity().mIndex);

                if (useLogic == null)
                {
                    Ctrl.throwError("不能找不到主单位的使用逻辑", data.getMUnitIdentity().mIndex);
                }

                //取主角的数据逻辑
                UnitFightDataLogic dataLogic = useLogic.getFightLogic();

                //先清空
                dataLogic.clear();
                //再重设数据
                dataLogic.setData(data.fight, data.avatar);

                data.fightDataLogic = dataLogic;
            }
        }


        //

        Unit unit = toAddUnit(data);

        if (unit != null)
        {
            toActiveUnit(unit);

            UnitSimpleData sData = _bindVisionUnits.get(data.instanceID);

            if (sData != null)
            {
                unit.makeSimpleUnitData(sData);
            }
        }

        return(unit);
    }
Example #10
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();
        }
    }
Example #11
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();
        }
    }
Example #12
0
    private static int getOneSVar(int[][] args, int index, UnitFightDataLogic self, UnitFightDataLogic target, int[] selfValues, int start)
    {
        int[] arr = args[index];

        if (arr[0] == SkillVarSourceType.ConstValue)
        {
            return(arr[1]);
        }

        bool isTarget;

        if ((isTarget = BaseC.constlist.skillVarSource_isTarget(arr[0])) || selfValues == null)
        {
            if (isTarget)
            {
                if (target == null)
                {
                    return(0);
                }

                return(target.getSkillVarSourceValue(arr, false));
            }
            else
            {
                if (self == null)
                {
                    return(0);
                }

                return(self.getSkillVarSourceValue(arr, true));
            }
        }
        else
        {
            return(selfValues[start + index]);
        }
    }
Example #13
0
    /** 计算属性公式 */
    public virtual int calculateSkillVar(int formulaType, int[][] args, UnitFightDataLogic self, UnitFightDataLogic target, int[] selfValues, int start)
    {
        switch (formulaType)
        {
        case SkillVarFormulaType.Single:
        {
            return(getOneSVar(args, 0, self, target, selfValues, start));
        }

        case SkillVarFormulaType.Normal2:
        {
            return((int)(getOneSVar(args, 0, self, target, selfValues, start) *
                         getOneSVarAddRatio(args, 1, self, target, selfValues, start)));
        }

        case SkillVarFormulaType.Normal3:
        {
            return((int)(getOneSVar(args, 0, self, target, selfValues, start) *
                         getOneSVarAddRatio(args, 1, self, target, selfValues, start) +
                         getOneSVar(args, 2, self, target, selfValues, start)));
        }

        case SkillVarFormulaType.Normal4:
        {
            return((int)((getOneSVar(args, 0, self, target, selfValues, start) *
                          getOneSVarAddRatio(args, 1, self, target, selfValues, start) +
                          getOneSVar(args, 2, self, target, selfValues, start)) *
                         getOneSVarAddRatio(args, 3, self, target, selfValues, start)));
        }

        case SkillVarFormulaType.TwoPlus:
        {
            return(getOneSVar(args, 0, self, target, selfValues, start) +
                   getOneSVar(args, 1, self, target, selfValues, start));
        }

        case SkillVarFormulaType.ThreePlus:
        {
            return(getOneSVar(args, 0, self, target, selfValues, start) +
                   getOneSVar(args, 1, self, target, selfValues, start) +
                   getOneSVar(args, 2, self, target, selfValues, start));
        }

        case SkillVarFormulaType.FourPlus:
        {
            return(getOneSVar(args, 0, self, target, selfValues, start) +
                   getOneSVar(args, 1, self, target, selfValues, start) +
                   getOneSVar(args, 2, self, target, selfValues, start) +
                   getOneSVar(args, 3, self, target, selfValues, start));
        }

        case SkillVarFormulaType.FivePlus:
        {
            return(getOneSVar(args, 0, self, target, selfValues, start) +
                   getOneSVar(args, 1, self, target, selfValues, start) +
                   getOneSVar(args, 2, self, target, selfValues, start) +
                   getOneSVar(args, 3, self, target, selfValues, start) +
                   getOneSVar(args, 4, self, target, selfValues, start));
        }
        }

        return(0);
    }
Example #14
0
 public void setParent(UnitFightDataLogic parent)
 {
     _parent = parent;
     setInfo(AttributeControl.attribute);
 }
Example #15
0
 /** 计算技能变量值(完整) */
 public static int calculateSkillVarValueForSelf(SkillVarConfig config, int[] selfValues, int start, UnitFightDataLogic target)
 {
     return(BaseC.logic.calculateSkillVar(config.formulaType, config.args, null, target, selfValues, start));
 }
Example #16
0
 /** 计算技能变量值(完整) */
 public static int calculateSkillVarValueFull(SkillVarConfig config, UnitFightDataLogic self, UnitFightDataLogic target)
 {
     return(BaseC.logic.calculateSkillVar(config.formulaType, config.args, self, target, null, 0));
 }
Example #17
0
 /** 计算技能变量值(完整) */
 public static int calculateSkillVarValueFull(int varID, UnitFightDataLogic self, UnitFightDataLogic target)
 {
     return(calculateSkillVarValueFull(SkillVarConfig.get(varID), self, target));
 }
Example #18
0
    public virtual void init()
    {
        (attackDataPool = new ObjectPool <AttackData>(() => { return(new AttackData()); })).setEnable(CommonSetting.sceneLogicUsePool);

        (_fightDataLogicPool = new ObjectPool <UnitFightDataLogic>(() =>
        {
            UnitFightDataLogic logic = GameC.factory.createUnitFightDataLogic();
            logic.construct();
            return(logic);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        _unitPoolDic = new ObjectPool <Unit> [UnitType.size];

        for (int i = 0; i < UnitType.size; ++i)
        {
            (_unitPoolDic[i] = createUnitPool(i)).setEnable(CommonSetting.sceneLogicUsePool);
        }

        (bulletPool = new ObjectPool <Bullet>(() =>
        {
            Bullet bullet = GameC.factory.createBullet();
            bullet.construct();
            return(bullet);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        (unitEffectPool = new ObjectPool <UnitEffect>(() =>
        {
            UnitEffect effect = GameC.factory.createUnitEffect();
            effect.construct();
            return(effect);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        (rolePool = new ObjectPool <Role>(() =>
        {
            Role role = GameC.factory.createRole();
            role.construct();
            return(role);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        buffDataPool.setEnable(CommonSetting.sceneLogicUsePool);
        buffIntervalActionDataPool.setEnable(CommonSetting.sceneLogicUsePool);

        //logic
        _itemDataPool = new ObjectPool <ItemData> [ItemType.size];

        for (int i = 0; i < _itemDataPool.Length; ++i)
        {
            (_itemDataPool[i] = createItemDataPool(i)).setEnable(CommonSetting.logicUsePool);
        }

        TaskTypeConfig typeConfig;

        _taskDataPool = new ObjectPool <TaskData> [QuestType.size];
        (_taskDataPool[0] = createTaskDataPool(0)).setEnable(CommonSetting.logicUsePool);

        for (int i = 0; i < _taskDataPool.Length; ++i)
        {
            if ((typeConfig = TaskTypeConfig.get(i)) != null && typeConfig.needCustomTask)
            {
                (_taskDataPool[i] = createTaskDataPool(i)).setEnable(CommonSetting.logicUsePool);
            }
        }

        petUseLogicPool.setEnable(CommonSetting.logicUsePool);
    }
Example #19
0
 public void setParent(UnitFightDataLogic parent)
 {
     _parent = parent;
 }
Example #20
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;
        }
    }
Example #21
0
 /** 回收战斗数据逻辑(非主角自身数据使用) */
 public void releaseUnitFightDataLogic(UnitFightDataLogic logic)
 {
     _fightDataLogicPool.back(logic);
 }
Example #22
0
    private Unit toAddUnit(UnitData data)
    {
        if (data.instanceID <= 0)
        {
            Ctrl.throwError("单位流水ID未赋值", data.identity.type);
            return(null);
        }

        if (ShineSetting.openCheck)
        {
            if (_units.contains(data.instanceID))
            {
                Ctrl.throwError("单位已存在");
                return(null);
            }
        }

        bool canFight = BaseC.constlist.unit_canFight(data.identity.type) && !isSimple();

        if (canFight)
        {
            //没绑数据逻辑
            if (data.fightDataLogic == null)
            {
                UnitFightDataLogic dataLogic = GameC.pool.createUnitFightDataLogic();
                //主控标记
                dataLogic.isSelfControl = data.getFightIdentity().controlPlayerID == GameC.player.role.playerID;

                dataLogic.setData(data.fight, data.avatar);
                data.fightDataLogic = dataLogic;
            }
        }

        Unit unit = toCreateUnitByData(data);

        //双绑
        unit.setUnitData(data);
        unit.setScene(this);

        if (canFight)
        {
            data.fightDataLogic.setUnit(unit);
        }

        _units.put(data.instanceID, unit);

        //战斗单位
        if (canFight)
        {
            _fightUnits.put(data.instanceID, unit);
        }

        //是角色
        if (unit.isCharacter())
        {
            CharacterIdentityData iData = (CharacterIdentityData)data.identity;

            if (_config.instanceType == SceneInstanceType.FiniteBattleWithFrameSync)
            {
                _charactersByIndex.put(iData.syncIndex, unit);
            }

            _characters.put(iData.playerID, unit);
        }

        return(unit);
    }
Example #23
0
 /** 从另一个数据逻辑上复制数据(非数据的其他内容) */
 public void copyFrom(UnitFightDataLogic logic)
 {
 }