/** 设置数据 */ public void setData(IntIntMap values) { _attributesDataDic = values; if (values != null && !values.isEmpty()) { int[] attributes = _attributes; int[] lastDispatches = _lastDispatch; bool[] needDispatchSet = _info.needDispatchSet; values.forEach((k, v) => { attributes[k] = v; int currentID; if ((currentID = _info.maxToCurrentMap[k]) > 0) { _currentMaxCache[_info.currentToIndex[currentID]] = v; } if (needDispatchSet[k]) { lastDispatches[k] = v; } }); _dispatchDirty = false; if (CommonSetting.isClientDriveLogic) { countNeedIncrease(); } } }
/** 是否有物品位置 */ public bool hasItemPlace(SList <ItemData> list) { if (list.size() == 1) { return(hasItemPlace(list.get(0))); } _tempDic.clear(); ItemData[] values = list.getValues(); ItemData data; for (int i = 0, len = list.size(); i < len; ++i) { data = values[i]; if (!ensureNum(data.num)) { _tempDic.clear(); return(false); } //有必要 if (ItemConfig.get(data.id).totalPlusMax > 0) { _tempDic.put(data.id, data.num); } } if (!_tempDic.isEmpty()) { ItemConfig config; foreach (var kv in _tempDic.entrySet()) { config = ItemConfig.get(kv.key); //超出总上限 if ((getItemNum(kv.key) + kv.value) > config.totalPlusMax) { return(false); } } } return(hasFreeGrid(list.size())); }
//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(); }