/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeInt(this.type); if (this.args != null) { int[][] argsT = this.args; stream.writeLen(argsT.Length); for (int argsVI = 0, argsVLen = argsT.Length; argsVI < argsVLen; ++argsVI) { int[] argsV = argsT[argsVI]; if (argsV != null) { int[] argsVT = argsV; stream.writeLen(argsVT.Length); for (int argsVVI = 0, argsVVLen = argsVT.Length; argsVVI < argsVVLen; ++argsVVI) { int argsVV = argsVT[argsVVI]; stream.writeInt(argsVV); } } else { nullObjError("argsV"); } } } else { nullObjError("args"); } stream.writeInt(this.seedType); if (this.showItems != null) { DIntData[] showItemsT = this.showItems; stream.writeLen(showItemsT.Length); for (int showItemsVI = 0, showItemsVLen = showItemsT.Length; showItemsVI < showItemsVLen; ++showItemsVI) { DIntData showItemsV = showItemsT[showItemsVI]; if (showItemsV != null) { showItemsV.writeBytesSimple(stream); } else { nullObjError("showItemsV"); } } } else { nullObjError("showItems"); } }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.vocation); if (this.currency != null) { DIntData[] currencyT = this.currency; stream.writeLen(currencyT.Length); for (int currencyVI = 0, currencyVLen = currencyT.Length; currencyVI < currencyVLen; ++currencyVI) { DIntData currencyV = currencyT[currencyVI]; if (currencyV != null) { currencyV.writeBytesSimple(stream); } else { nullObjError("currencyV"); } } } else { nullObjError("currency"); } }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeInt(this.modelID); if (this.parts != null) { DIntData[] partsT = this.parts; stream.writeLen(partsT.Length); for (int partsVI = 0, partsVLen = partsT.Length; partsVI < partsVLen; ++partsVI) { DIntData partsV = partsT[partsVI]; if (partsV != null) { partsV.writeBytesSimple(stream); } else { nullObjError("partsV"); } } } else { nullObjError("parts"); } stream.writeInt(this.proirity); }
//shield /** 护盾吸收伤害 */ public void onShieldDamage(int type, int value) { SList <DIntData> list = _shieldBuffDic.get(type); if (list != null) { while (!list.isEmpty()) { DIntData v = list.get(0); if (value < v.value) { v.value -= value; break; } else { value -= v.value; v.value = 0; //盾爆了就删除buff removeBuffByInstanceID(v.key); } } } }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is DamageOneData)) { return; } DamageOneData mData = (DamageOneData)data; this.instanceID = mData.instanceID; this.isHit = mData.isHit; this.isCrit = mData.isCrit; if (mData.damages != null) { if (this.damages != null) { this.damages.clear(); this.damages.ensureCapacity(mData.damages.size()); } else { this.damages = new SList <DIntData>(); } SList <DIntData> damagesT = this.damages; if (!mData.damages.isEmpty()) { DIntData[] damagesVValues = mData.damages.getValues(); for (int damagesVI = 0, damagesVLen = mData.damages.length(); damagesVI < damagesVLen; ++damagesVI) { DIntData damagesV = damagesVValues[damagesVI]; DIntData damagesU; if (damagesV != null) { damagesU = (DIntData)BytesControl.createData(DIntData.dataID); damagesU.copy(damagesV); } else { damagesU = null; nullObjError("damagesU"); } damagesT.add(damagesU); } } } else { this.damages = null; nullObjError("damages"); } this.isKilled = mData.isKilled; this.arg = mData.arg; }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeInt(this.itemID); stream.writeBoolean(this.isBind); if (this.dintArgs != null) { DIntData[] dintArgsT = this.dintArgs; stream.writeLen(dintArgsT.Length); for (int dintArgsVI = 0, dintArgsVLen = dintArgsT.Length; dintArgsVI < dintArgsVLen; ++dintArgsVI) { DIntData dintArgsV = dintArgsT[dintArgsVI]; if (dintArgsV != null) { dintArgsV.writeBytesSimple(stream); } else { nullObjError("dintArgsV"); } } } else { nullObjError("dintArgs"); } }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeShort(this.level); if (this.bringCDs != null) { int[] bringCDsT = this.bringCDs; stream.writeLen(bringCDsT.Length); for (int bringCDsVI = 0, bringCDsVLen = bringCDsT.Length; bringCDsVI < bringCDsVLen; ++bringCDsVI) { int bringCDsV = bringCDsT[bringCDsVI]; stream.writeInt(bringCDsV); } } else { nullObjError("bringCDs"); } if (this.cost != null) { DIntData[] costT = this.cost; stream.writeLen(costT.Length); for (int costVI = 0, costVLen = costT.Length; costVI < costVLen; ++costVI) { DIntData costV = costT[costVI]; if (costV != null) { costV.writeBytesSimple(stream); } else { nullObjError("costV"); } } } else { nullObjError("cost"); } stream.writeFloat(this.useDistance); stream.writeInt(this.useDistanceVar); stream.writeInt(this.singBarID); stream.writeInt(this.lastTime); stream.writeUTF(this.explain); }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); if (this.currency != null) { DIntData[] currencyT = this.currency; stream.writeLen(currencyT.Length); for (int currencyVI = 0, currencyVLen = currencyT.Length; currencyVI < currencyVLen; ++currencyVI) { DIntData currencyV = currencyT[currencyVI]; if (currencyV != null) { currencyV.writeBytesSimple(stream); } else { nullObjError("currencyV"); } } } else { nullObjError("currency"); } if (this.items != null) { DIntData[] itemsT = this.items; stream.writeLen(itemsT.Length); for (int itemsVI = 0, itemsVLen = itemsT.Length; itemsVI < itemsVLen; ++itemsVI) { DIntData itemsV = itemsT[itemsVI]; if (itemsV != null) { itemsV.writeBytesSimple(stream); } else { nullObjError("itemsV"); } } } else { nullObjError("items"); } }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); if (this.showParts != null) { DIntData[] showPartsT = this.showParts; stream.writeLen(showPartsT.Length); for (int showPartsVI = 0, showPartsVLen = showPartsT.Length; showPartsVI < showPartsVLen; ++showPartsVI) { DIntData showPartsV = showPartsT[showPartsVI]; if (showPartsV != null) { showPartsV.writeBytesSimple(stream); } else { nullObjError("showPartsV"); } } } else { nullObjError("showParts"); } stream.writeUTF(this.source); stream.writeFloat(this.collideRadius); if (this.defaultHitRect != null) { float[] defaultHitRectT = this.defaultHitRect; stream.writeLen(defaultHitRectT.Length); for (int defaultHitRectVI = 0, defaultHitRectVLen = defaultHitRectT.Length; defaultHitRectVI < defaultHitRectVLen; ++defaultHitRectVI) { float defaultHitRectV = defaultHitRectT[defaultHitRectVI]; stream.writeFloat(defaultHitRectV); } } else { nullObjError("defaultHitRect"); } stream.writeFloat(this.height); }
/// <summary> /// 写入字节流(完整版) /// </summary> protected override void toWriteBytesFull(BytesWriteStream stream) { stream.startWriteObj(); stream.writeInt(this.instanceID); stream.writeBoolean(this.isHit); stream.writeBoolean(this.isCrit); if (this.damages != null) { stream.writeLen(this.damages.size()); if (!this.damages.isEmpty()) { DIntData[] damagesVValues = this.damages.getValues(); for (int damagesVI = 0, damagesVLen = this.damages.length(); damagesVI < damagesVLen; ++damagesVI) { DIntData damagesV = damagesVValues[damagesVI]; if (damagesV != null) { damagesV.writeBytesFull(stream); } else { nullObjError("damagesV"); } } } } else { nullObjError("damages"); } stream.writeBoolean(this.isKilled); stream.writeInt(this.arg); stream.endWriteObj(); }
protected override void costOneSkill(DIntData data) { if (!_g18) { _m18 = instance.Type.GetMethod("costOneSkill", 1); _g18 = true; } if (_m18 != null && !_b18) { _b18 = true; _p1[0] = data; appdomain.Invoke(_m18, instance, _p1); _p1[0] = null; _b18 = false; } else { base.costOneSkill(data); } }
protected override bool checkOneSkillCostCondition(DIntData data) { if (!_g15) { _m15 = instance.Type.GetMethod("checkOneSkillCostCondition", 1); _g15 = true; } if (_m15 != null && !_b15) { _b15 = true; _p1[0] = data; bool re = (bool)appdomain.Invoke(_m15, instance, _p1); _p1[0] = null; _b15 = false; return(re); } else { return(base.checkOneSkillCostCondition(data)); } }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { DamageOneData mData = (DamageOneData)data; if (this.instanceID != mData.instanceID) { return(false); } if (this.isHit != mData.isHit) { return(false); } if (this.isCrit != mData.isCrit) { return(false); } if (mData.damages != null) { if (this.damages == null) { return(false); } if (this.damages.size() != mData.damages.size()) { return(false); } SList <DIntData> damagesT = this.damages; SList <DIntData> damagesR = mData.damages; int damagesLen = damagesT.size(); for (int damagesI = 0; damagesI < damagesLen; ++damagesI) { DIntData damagesU = damagesT.get(damagesI); DIntData damagesV = damagesR.get(damagesI); if (damagesV != null) { if (damagesU == null) { return(false); } if (!damagesU.dataEquals(damagesV)) { return(false); } } else { if (damagesU != null) { return(false); } } } } else { if (this.damages != null) { return(false); } } if (this.isKilled != mData.isKilled) { return(false); } if (this.arg != mData.arg) { return(false); } return(true); }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); this.id = stream.readInt(); this.name = stream.readUTF(); this.type = stream.readInt(); int tasksLen = stream.readLen(); if (this.tasks == null || this.tasks.Length != tasksLen) { this.tasks = new int[tasksLen]; } int[] tasksT = this.tasks; for (int tasksI = 0; tasksI < tasksLen; ++tasksI) { int tasksV; tasksV = stream.readInt(); tasksT[tasksI] = tasksV; } this.executeType = stream.readInt(); this.repeatType = stream.readInt(); this.questLine = (DIntData)stream.createData(DIntData.dataID); this.questLine.readBytesSimple(stream); this.cycleTime = stream.readUTF(); int preQuestsLen = stream.readLen(); if (this.preQuests == null || this.preQuests.Length != preQuestsLen) { this.preQuests = new int[preQuestsLen]; } int[] preQuestsT = this.preQuests; for (int preQuestsI = 0; preQuestsI < preQuestsLen; ++preQuestsI) { int preQuestsV; preQuestsV = stream.readInt(); preQuestsT[preQuestsI] = preQuestsV; } int acceptConditionsLen = stream.readLen(); if (this.acceptConditions == null || this.acceptConditions.Length != acceptConditionsLen) { this.acceptConditions = new int[acceptConditionsLen][]; } int[][] acceptConditionsT = this.acceptConditions; for (int acceptConditionsI = 0; acceptConditionsI < acceptConditionsLen; ++acceptConditionsI) { int[] acceptConditionsV; int acceptConditionsVLen = stream.readLen(); acceptConditionsV = new int[acceptConditionsVLen]; int[] acceptConditionsVT = acceptConditionsV; for (int acceptConditionsVI = 0; acceptConditionsVI < acceptConditionsVLen; ++acceptConditionsVI) { int acceptConditionsVV; acceptConditionsVV = stream.readInt(); acceptConditionsVT[acceptConditionsVI] = acceptConditionsVV; } acceptConditionsT[acceptConditionsI] = acceptConditionsV; } this.acceptType = stream.readInt(); this.acceptNPC = stream.readInt(); this.commitType = stream.readInt(); this.commitNPC = stream.readInt(); int questItemLen = stream.readLen(); if (this.questItem == null || this.questItem.Length != questItemLen) { this.questItem = new DIntData[questItemLen]; } DIntData[] questItemT = this.questItem; for (int questItemI = 0; questItemI < questItemLen; ++questItemI) { DIntData questItemV; questItemV = (DIntData)stream.createData(DIntData.dataID); questItemV.readBytesSimple(stream); questItemT[questItemI] = questItemV; } int completeActionsLen = stream.readLen(); if (this.completeActions == null || this.completeActions.Length != completeActionsLen) { this.completeActions = new int[completeActionsLen][]; } int[][] completeActionsT = this.completeActions; for (int completeActionsI = 0; completeActionsI < completeActionsLen; ++completeActionsI) { int[] completeActionsV; int completeActionsVLen = stream.readLen(); completeActionsV = new int[completeActionsVLen]; int[] completeActionsVT = completeActionsV; for (int completeActionsVI = 0; completeActionsVI < completeActionsVLen; ++completeActionsVI) { int completeActionsVV; completeActionsVV = stream.readInt(); completeActionsVT[completeActionsVI] = completeActionsVV; } completeActionsT[completeActionsI] = completeActionsV; } this.failTime = stream.readUTF(); this.canGiveUp = stream.readBoolean(); this.cantAcceptFailed = stream.readBoolean(); this.rewardID = stream.readInt(); this.explain = stream.readUTF(); this.isDeprecated = stream.readBoolean(); this.isKeyQuest = stream.readBoolean(); }
/// <summary> /// 转文本输出 /// </summary> protected override void toWriteDataString(DataWriter writer) { writer.writeTabs(); writer.sb.Append("instanceID"); writer.sb.Append(':'); writer.sb.Append(this.instanceID); writer.writeEnter(); writer.writeTabs(); writer.sb.Append("isHit"); writer.sb.Append(':'); writer.sb.Append(this.isHit); writer.writeEnter(); writer.writeTabs(); writer.sb.Append("isCrit"); writer.sb.Append(':'); writer.sb.Append(this.isCrit); writer.writeEnter(); writer.writeTabs(); writer.sb.Append("damages"); writer.sb.Append(':'); writer.sb.Append("List<DIntData>"); if (this.damages != null) { SList <DIntData> damagesT = this.damages; int damagesLen = damagesT.size(); writer.sb.Append('('); writer.sb.Append(damagesLen); writer.sb.Append(')'); writer.writeEnter(); writer.writeLeftBrace(); for (int damagesI = 0; damagesI < damagesLen; ++damagesI) { DIntData damagesV = damagesT.get(damagesI); writer.writeTabs(); writer.sb.Append(damagesI); writer.sb.Append(':'); if (damagesV != null) { damagesV.writeDataString(writer); } else { writer.sb.Append("DIntData=null"); } writer.writeEnter(); } writer.writeRightBrace(); } else { writer.sb.Append("=null"); } writer.writeEnter(); writer.writeTabs(); writer.sb.Append("isKilled"); writer.sb.Append(':'); writer.sb.Append(this.isKilled); writer.writeEnter(); writer.writeTabs(); writer.sb.Append("arg"); writer.sb.Append(':'); writer.sb.Append(this.arg); writer.writeEnter(); }
//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; } }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeShort(this.level); if (this.attributes != null) { DIntData[] attributesT = this.attributes; stream.writeLen(attributesT.Length); for (int attributesVI = 0, attributesVLen = attributesT.Length; attributesVI < attributesVLen; ++attributesVI) { DIntData attributesV = attributesT[attributesVI]; if (attributesV != null) { attributesV.writeBytesSimple(stream); } else { nullObjError("attributesV"); } } } else { nullObjError("attributes"); } if (this.skills != null) { DIntData[] skillsT = this.skills; stream.writeLen(skillsT.Length); for (int skillsVI = 0, skillsVLen = skillsT.Length; skillsVI < skillsVLen; ++skillsVI) { DIntData skillsV = skillsT[skillsVI]; if (skillsV != null) { skillsV.writeBytesSimple(stream); } else { nullObjError("skillsV"); } } } else { nullObjError("skills"); } if (this.buffs != null) { DIntData[] buffsT = this.buffs; stream.writeLen(buffsT.Length); for (int buffsVI = 0, buffsVLen = buffsT.Length; buffsVI < buffsVLen; ++buffsVI) { DIntData buffsV = buffsT[buffsVI]; if (buffsV != null) { buffsV.writeBytesSimple(stream); } else { nullObjError("buffsV"); } } } else { nullObjError("buffs"); } }
/// <summary> /// 创建技能数据 /// </summary> public static SkillData createByDInt(DIntData data) { return(create(data.key, data.value)); }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); if (this.currency != null) { DIntData[] currencyT = this.currency; stream.writeLen(currencyT.Length); for (int currencyVI = 0, currencyVLen = currencyT.Length; currencyVI < currencyVLen; ++currencyVI) { DIntData currencyV = currencyT[currencyVI]; if (currencyV != null) { currencyV.writeBytesSimple(stream); } else { nullObjError("currencyV"); } } } else { nullObjError("currency"); } if (this.currencyLevelFormula != null) { int[][] currencyLevelFormulaT = this.currencyLevelFormula; stream.writeLen(currencyLevelFormulaT.Length); for (int currencyLevelFormulaVI = 0, currencyLevelFormulaVLen = currencyLevelFormulaT.Length; currencyLevelFormulaVI < currencyLevelFormulaVLen; ++currencyLevelFormulaVI) { int[] currencyLevelFormulaV = currencyLevelFormulaT[currencyLevelFormulaVI]; if (currencyLevelFormulaV != null) { int[] currencyLevelFormulaVT = currencyLevelFormulaV; stream.writeLen(currencyLevelFormulaVT.Length); for (int currencyLevelFormulaVVI = 0, currencyLevelFormulaVVLen = currencyLevelFormulaVT.Length; currencyLevelFormulaVVI < currencyLevelFormulaVVLen; ++currencyLevelFormulaVVI) { int currencyLevelFormulaVV = currencyLevelFormulaVT[currencyLevelFormulaVVI]; stream.writeInt(currencyLevelFormulaVV); } } else { nullObjError("currencyLevelFormulaV"); } } } else { nullObjError("currencyLevelFormula"); } if (this.items != null) { DIntData[] itemsT = this.items; stream.writeLen(itemsT.Length); for (int itemsVI = 0, itemsVLen = itemsT.Length; itemsVI < itemsVLen; ++itemsVI) { DIntData itemsV = itemsT[itemsVI]; if (itemsV != null) { itemsV.writeBytesSimple(stream); } else { nullObjError("itemsV"); } } } else { nullObjError("items"); } stream.writeInt(this.randomListID); stream.writeLong(this.roleExp); if (this.roleExpLevelFormula != null) { int[] roleExpLevelFormulaT = this.roleExpLevelFormula; stream.writeLen(roleExpLevelFormulaT.Length); for (int roleExpLevelFormulaVI = 0, roleExpLevelFormulaVLen = roleExpLevelFormulaT.Length; roleExpLevelFormulaVI < roleExpLevelFormulaVLen; ++roleExpLevelFormulaVI) { int roleExpLevelFormulaV = roleExpLevelFormulaT[roleExpLevelFormulaVI]; stream.writeInt(roleExpLevelFormulaV); } } else { nullObjError("roleExpLevelFormula"); } stream.writeInt(this.needGrid); stream.writeBoolean(this.needLevelAdapter); }
/** 执行攻击数据 */ private void toExecuteAttack(AttackData data) { Unit from = _scene.getFightUnit(data.fromInstanceID); if (from == null) { return; } Unit attacker = from.fight.getAttackerUnit(); if (attacker == null) { return; } int attackerInstanceID = attacker.instanceID; SkillTargetData tData = data.targetData; AttackConfig config = data.config; AttackLevelConfig levelConfig = data.levelConfig; //主目标 Unit mTarget = _scene.getFightUnit(tData.targetInstanceID); SList <Unit> tempTargets = new SList <Unit>(); //构造目标组 toMakeTargets(tempTargets, from, attacker, mTarget, tData, config, levelConfig); Unit target; //TODO:攻击前动作组 //如果跳过伤害阶段 if (config.passDamage) { for (int i = 0, len = tempTargets.size(); i < len; ++i) { target = tempTargets[i]; //不可被攻击 if (target.fight.getStatusLogic().cantBeAttackTarget()) { continue; } //添加buff if (levelConfig.addBuffProbID > 0) { if (attacker.fight.randomProb(levelConfig.addBuffProbID)) { int adderInstanceID = attackerInstanceID == target.instanceID ? -1 :attackerInstanceID; foreach (DIntData v in levelConfig.addBuffs) { target.fight.getBuffLogic().addBuff(v.key, v.value, adderInstanceID); } } } //有子弹 if (levelConfig.bullet.key > 0) { from.fight.createAndExecuteBullet(levelConfig.bullet.key, levelConfig.bullet.value, tData); } } } else { doAttackMoment(AttackMomentType.AttackBeforeHit, @from, attacker, null, data, null); if (!tempTargets.isEmpty()) { SList <Unit> tempKilledUnits = null; SList <DamageOneData> damageDataList = new SList <DamageOneData>(); StatusDataLogic attackerStatus = attacker.fight.getStatusLogic(); AttributeDataLogic attackerAttribute = attacker.fight.getAttributeLogic(); BuffDataLogic attackerBuffLogic = attacker.fight.getBuffLogic(); StatusDataLogic targetStatus; AttributeDataLogic targetAttribute; bool momentHitted = false; for (int i = 0, len = tempTargets.size(); i < len; ++i) { target = tempTargets[i]; targetStatus = target.fight.getStatusLogic(); targetAttribute = target.fight.getAttributeLogic(); //不可被攻击 if (targetStatus.cantBeAttackTarget()) { continue; } //上次血量 int lastHp = targetAttribute.getHp(); DamageOneData damageOneData = new DamageOneData(); damageOneData.instanceID = target.instanceID; damageDataList.add(damageOneData); SList <DIntData> damageList = new SList <DIntData>(); damageOneData.damages = damageList; damageOneData.isHit = toCountIsHit(data, attacker, target); doAttackMoment(AttackMomentType.BeAttackBeforeHit, target, target, attacker, data, damageOneData); int realDamage = 0; if (damageOneData.isHit) { if (!momentHitted) { momentHitted = true; doAttackMoment(AttackMomentType.AttackOnHitAnyTarget, @from, attacker, target, data, damageOneData); } if (target == mTarget) { doAttackMoment(AttackMomentType.AttackBeforeDamageMainTarget, @from, attacker, target, data, damageOneData); } doAttackMoment(AttackMomentType.AttackBeforeDamageEachTarget, @from, attacker, target, data, damageOneData); doAttackMoment(AttackMomentType.BeAttackBeforeDamage, target, target, attacker, data, damageOneData); //添加buff if (levelConfig.addBuffProbID > 0) { if (attacker.fight.randomProb(levelConfig.addBuffProbID)) { int adderInstanceID = attackerInstanceID == target.instanceID ? -1 :attackerInstanceID; foreach (DIntData v in levelConfig.addBuffs) { target.fight.getBuffLogic().addBuff(v.key, v.value, adderInstanceID); } } } //有子弹 DIntData levelConfigBullet; if ((levelConfigBullet = levelConfig.bullet).key > 0) { from.fight.createAndExecuteBullet(levelConfigBullet.key, levelConfigBullet.value, tData); } bool isCrit = damageOneData.isCrit = toCountIsCrit(data, attacker, target); SkillVarConfig varConfig; int[] damages; int damageType; int damageValue; int attackValue; int damageVarIndex = 0; //伤害组 for (int j = 0, jLen = levelConfig.damages.Length; j < jLen; ++j) { varConfig = levelConfig.varConfigT[j]; damages = levelConfig.damages[j]; damageType = damages[0]; if (data.isRecorded) { attackValue = BaseGameUtils.calculateSkillVarValueForSelf(varConfig, data.selfAttackValues, damageVarIndex, target.fight.getDataLogic()); damageVarIndex += varConfig.args.Length; } else { attackValue = BaseGameUtils.calculateSkillVarValueFull(varConfig, attacker.fight.getDataLogic(), target.fight.getDataLogic()); } damageValue = toCalculateDamage(data, damageType, damages, attackValue, isCrit, attackerAttribute, targetAttribute, attacker, target); if (damageValue > 0) { if (needDamageHurt(damageType)) { int rd = 0; if (!targetStatus.isDamageImmun()) { rd = takeDamage(damageType, damageValue, targetAttribute, target); } if (Global.damageValueUseRealDamage) { damageValue = rd; } realDamage += rd; } //TODO:反伤类 damageList.add(DIntData.create(damageType, damageValue)); } } if (realDamage > 0) { _scene.method.onUnitTakeDamage(target, realDamage, attacker); } if (target == mTarget) { doAttackMoment(AttackMomentType.AttackAfterDamageMainTarget, @from, attacker, target, data, damageOneData); } doAttackMoment(AttackMomentType.AttackAfterDamageEachTarget, @from, attacker, target, data, damageOneData); doAttackMoment(AttackMomentType.BeAttackAfterDamage, target, target, attacker, data, damageOneData); //扣除buff次数 attackerBuffLogic.subBuffNumArr(BuffSubNumType.UseAttackFromGroup, config.groups); attackerBuffLogic.subBuffNumArr(BuffSubNumType.MakeDamage, levelConfig.damageTypesT); target.fight.getBuffLogic().subBuffNumArr(BuffSubNumType.BeDamage, levelConfig.damageTypesT); //血减到0 if (lastHp > 0 && targetAttribute.getAttribute(AttributeType.Hp) <= 0 && targetStatus.isAlive()) { if (tempKilledUnits == null) { tempKilledUnits = new SList <Unit>(); } tempKilledUnits.add(target); } } //受伤(客户端受伤即使realDamage为0也需要) target.fight.onDamage(from, attacker, config, damageOneData); } onAttackDamage(from, config, tData); //处理击杀 if (tempKilledUnits != null) { for (int i = 0, len = tempKilledUnits.size(); i < len; ++i) { //活着 if ((target = tempKilledUnits[i]).fight.isAlive()) { //被击杀时刻 doAttackMoment(AttackMomentType.BeforeBeKill, target, target, attacker, data, null); //可被伤害击杀 if (!target.fight.getStatusLogic().cantBeKillByDamage()) { target.fight.doDead(attacker, config.killType); } //击杀时刻 doAttackMoment(AttackMomentType.AfterKill, from, attacker, target, data, null); } } } } doAttackMoment(AttackMomentType.AttackAfterHit, from, attacker, null, data, null); } }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeShort(this.level); stream.writeInt(this.scope); if (this.scopeArgs != null) { float[] scopeArgsT = this.scopeArgs; stream.writeLen(scopeArgsT.Length); for (int scopeArgsVI = 0, scopeArgsVLen = scopeArgsT.Length; scopeArgsVI < scopeArgsVLen; ++scopeArgsVI) { float scopeArgsV = scopeArgsT[scopeArgsVI]; stream.writeFloat(scopeArgsV); } } else { nullObjError("scopeArgs"); } if (this.bullet != null) { this.bullet.writeBytesSimple(stream); } else { nullObjError("bullet"); } if (this.damages != null) { int[][] damagesT = this.damages; stream.writeLen(damagesT.Length); for (int damagesVI = 0, damagesVLen = damagesT.Length; damagesVI < damagesVLen; ++damagesVI) { int[] damagesV = damagesT[damagesVI]; if (damagesV != null) { int[] damagesVT = damagesV; stream.writeLen(damagesVT.Length); for (int damagesVVI = 0, damagesVVLen = damagesVT.Length; damagesVVI < damagesVVLen; ++damagesVVI) { int damagesVV = damagesVT[damagesVVI]; stream.writeInt(damagesVV); } } else { nullObjError("damagesV"); } } } else { nullObjError("damages"); } stream.writeInt(this.addBuffProbID); if (this.addBuffs != null) { DIntData[] addBuffsT = this.addBuffs; stream.writeLen(addBuffsT.Length); for (int addBuffsVI = 0, addBuffsVLen = addBuffsT.Length; addBuffsVI < addBuffsVLen; ++addBuffsVI) { DIntData addBuffsV = addBuffsT[addBuffsVI]; if (addBuffsV != null) { addBuffsV.writeBytesSimple(stream); } else { nullObjError("addBuffsV"); } } } else { nullObjError("addBuffs"); } if (this.momentActions != null) { int[][] momentActionsT = this.momentActions; stream.writeLen(momentActionsT.Length); for (int momentActionsVI = 0, momentActionsVLen = momentActionsT.Length; momentActionsVI < momentActionsVLen; ++momentActionsVI) { int[] momentActionsV = momentActionsT[momentActionsVI]; if (momentActionsV != null) { int[] momentActionsVT = momentActionsV; stream.writeLen(momentActionsVT.Length); for (int momentActionsVVI = 0, momentActionsVVLen = momentActionsVT.Length; momentActionsVVI < momentActionsVVLen; ++momentActionsVVI) { int momentActionsVV = momentActionsVT[momentActionsVVI]; stream.writeInt(momentActionsVV); } } else { nullObjError("momentActionsV"); } } } else { nullObjError("momentActions"); } stream.writeInt(this.spasticityValue); stream.writeInt(this.attackBlowForce); stream.writeInt(this.attackPushForce); stream.writeInt(this.attackLiePushForce); }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeUTF(this.name); stream.writeInt(this.type); stream.writeInt(this.secondType); stream.writeInt(this.singlePlusMax); stream.writeInt(this.totalPlusMax); stream.writeInt(this.itemLevel); stream.writeInt(this.limitLevel); if (this.limitVocations != null) { int[] limitVocationsT = this.limitVocations; stream.writeLen(limitVocationsT.Length); for (int limitVocationsVI = 0, limitVocationsVLen = limitVocationsT.Length; limitVocationsVI < limitVocationsVLen; ++limitVocationsVI) { int limitVocationsV = limitVocationsT[limitVocationsVI]; stream.writeInt(limitVocationsV); } } else { nullObjError("limitVocations"); } stream.writeBoolean(this.bindByGet); stream.writeBoolean(this.bindByUse); stream.writeBoolean(this.canTrade); stream.writeInt(this.sellPrice); stream.writeBoolean(this.needRedPoint); stream.writeInt(this.sortIndex); stream.writeUTF(this.icon); stream.writeInt(this.fieldItemModelID); stream.writeUTF(this.explain); stream.writeUTF(this.enableTime); stream.writeBoolean(this.isUnique); if (this.baseAttributes != null) { DIntData[] baseAttributesT = this.baseAttributes; stream.writeLen(baseAttributesT.Length); for (int baseAttributesVI = 0, baseAttributesVLen = baseAttributesT.Length; baseAttributesVI < baseAttributesVLen; ++baseAttributesVI) { DIntData baseAttributesV = baseAttributesT[baseAttributesVI]; if (baseAttributesV != null) { baseAttributesV.writeBytesSimple(stream); } else { nullObjError("baseAttributesV"); } } } else { nullObjError("baseAttributes"); } if (this.equipActions != null) { int[][] equipActionsT = this.equipActions; stream.writeLen(equipActionsT.Length); for (int equipActionsVI = 0, equipActionsVLen = equipActionsT.Length; equipActionsVI < equipActionsVLen; ++equipActionsVI) { int[] equipActionsV = equipActionsT[equipActionsVI]; if (equipActionsV != null) { int[] equipActionsVT = equipActionsV; stream.writeLen(equipActionsVT.Length); for (int equipActionsVVI = 0, equipActionsVVLen = equipActionsVT.Length; equipActionsVVI < equipActionsVVLen; ++equipActionsVVI) { int equipActionsVV = equipActionsVT[equipActionsVVI]; stream.writeInt(equipActionsVV); } } else { nullObjError("equipActionsV"); } } } else { nullObjError("equipActions"); } if (this.useConditions != null) { int[][] useConditionsT = this.useConditions; stream.writeLen(useConditionsT.Length); for (int useConditionsVI = 0, useConditionsVLen = useConditionsT.Length; useConditionsVI < useConditionsVLen; ++useConditionsVI) { int[] useConditionsV = useConditionsT[useConditionsVI]; if (useConditionsV != null) { int[] useConditionsVT = useConditionsV; stream.writeLen(useConditionsVT.Length); for (int useConditionsVVI = 0, useConditionsVVLen = useConditionsVT.Length; useConditionsVVI < useConditionsVVLen; ++useConditionsVVI) { int useConditionsVV = useConditionsVT[useConditionsVVI]; stream.writeInt(useConditionsVV); } } else { nullObjError("useConditionsV"); } } } else { nullObjError("useConditions"); } if (this.useActions != null) { int[][] useActionsT = this.useActions; stream.writeLen(useActionsT.Length); for (int useActionsVI = 0, useActionsVLen = useActionsT.Length; useActionsVI < useActionsVLen; ++useActionsVI) { int[] useActionsV = useActionsT[useActionsVI]; if (useActionsV != null) { int[] useActionsVT = useActionsV; stream.writeLen(useActionsVT.Length); for (int useActionsVVI = 0, useActionsVVLen = useActionsVT.Length; useActionsVVI < useActionsVVLen; ++useActionsVVI) { int useActionsVV = useActionsVT[useActionsVVI]; stream.writeInt(useActionsVV); } } else { nullObjError("useActionsV"); } } } else { nullObjError("useActions"); } stream.writeBoolean(this.passEnterBag); stream.writeBoolean(this.useCostItemNum); stream.writeInt(this.progressBarID); stream.writeInt(this.tradeDefaultPrice); stream.writeInt(this.tradePriceMin); stream.writeInt(this.tradePriceMax); }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeUTF(this.name); stream.writeInt(this.type); if (this.tasks != null) { int[] tasksT = this.tasks; stream.writeLen(tasksT.Length); for (int tasksVI = 0, tasksVLen = tasksT.Length; tasksVI < tasksVLen; ++tasksVI) { int tasksV = tasksT[tasksVI]; stream.writeInt(tasksV); } } else { nullObjError("tasks"); } stream.writeInt(this.executeType); stream.writeInt(this.repeatType); if (this.questLine != null) { this.questLine.writeBytesSimple(stream); } else { nullObjError("questLine"); } stream.writeUTF(this.cycleTime); if (this.preQuests != null) { int[] preQuestsT = this.preQuests; stream.writeLen(preQuestsT.Length); for (int preQuestsVI = 0, preQuestsVLen = preQuestsT.Length; preQuestsVI < preQuestsVLen; ++preQuestsVI) { int preQuestsV = preQuestsT[preQuestsVI]; stream.writeInt(preQuestsV); } } else { nullObjError("preQuests"); } if (this.acceptConditions != null) { int[][] acceptConditionsT = this.acceptConditions; stream.writeLen(acceptConditionsT.Length); for (int acceptConditionsVI = 0, acceptConditionsVLen = acceptConditionsT.Length; acceptConditionsVI < acceptConditionsVLen; ++acceptConditionsVI) { int[] acceptConditionsV = acceptConditionsT[acceptConditionsVI]; if (acceptConditionsV != null) { int[] acceptConditionsVT = acceptConditionsV; stream.writeLen(acceptConditionsVT.Length); for (int acceptConditionsVVI = 0, acceptConditionsVVLen = acceptConditionsVT.Length; acceptConditionsVVI < acceptConditionsVVLen; ++acceptConditionsVVI) { int acceptConditionsVV = acceptConditionsVT[acceptConditionsVVI]; stream.writeInt(acceptConditionsVV); } } else { nullObjError("acceptConditionsV"); } } } else { nullObjError("acceptConditions"); } stream.writeInt(this.acceptType); stream.writeInt(this.acceptNPC); stream.writeInt(this.commitType); stream.writeInt(this.commitNPC); if (this.questItem != null) { DIntData[] questItemT = this.questItem; stream.writeLen(questItemT.Length); for (int questItemVI = 0, questItemVLen = questItemT.Length; questItemVI < questItemVLen; ++questItemVI) { DIntData questItemV = questItemT[questItemVI]; if (questItemV != null) { questItemV.writeBytesSimple(stream); } else { nullObjError("questItemV"); } } } else { nullObjError("questItem"); } if (this.completeActions != null) { int[][] completeActionsT = this.completeActions; stream.writeLen(completeActionsT.Length); for (int completeActionsVI = 0, completeActionsVLen = completeActionsT.Length; completeActionsVI < completeActionsVLen; ++completeActionsVI) { int[] completeActionsV = completeActionsT[completeActionsVI]; if (completeActionsV != null) { int[] completeActionsVT = completeActionsV; stream.writeLen(completeActionsVT.Length); for (int completeActionsVVI = 0, completeActionsVVLen = completeActionsVT.Length; completeActionsVVI < completeActionsVVLen; ++completeActionsVVI) { int completeActionsVV = completeActionsVT[completeActionsVVI]; stream.writeInt(completeActionsVV); } } else { nullObjError("completeActionsV"); } } } else { nullObjError("completeActions"); } stream.writeUTF(this.failTime); stream.writeBoolean(this.canGiveUp); stream.writeBoolean(this.cantAcceptFailed); stream.writeInt(this.rewardID); stream.writeUTF(this.explain); stream.writeBoolean(this.isDeprecated); stream.writeBoolean(this.isKeyQuest); }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); this.id = stream.readInt(); this.level = stream.readShort(); this.scope = stream.readInt(); int scopeArgsLen = stream.readLen(); if (this.scopeArgs == null || this.scopeArgs.Length != scopeArgsLen) { this.scopeArgs = new float[scopeArgsLen]; } float[] scopeArgsT = this.scopeArgs; for (int scopeArgsI = 0; scopeArgsI < scopeArgsLen; ++scopeArgsI) { float scopeArgsV; scopeArgsV = stream.readFloat(); scopeArgsT[scopeArgsI] = scopeArgsV; } this.bullet = (DIntData)stream.createData(DIntData.dataID); this.bullet.readBytesSimple(stream); int damagesLen = stream.readLen(); if (this.damages == null || this.damages.Length != damagesLen) { this.damages = new int[damagesLen][]; } int[][] damagesT = this.damages; for (int damagesI = 0; damagesI < damagesLen; ++damagesI) { int[] damagesV; int damagesVLen = stream.readLen(); damagesV = new int[damagesVLen]; int[] damagesVT = damagesV; for (int damagesVI = 0; damagesVI < damagesVLen; ++damagesVI) { int damagesVV; damagesVV = stream.readInt(); damagesVT[damagesVI] = damagesVV; } damagesT[damagesI] = damagesV; } this.addBuffProbID = stream.readInt(); int addBuffsLen = stream.readLen(); if (this.addBuffs == null || this.addBuffs.Length != addBuffsLen) { this.addBuffs = new DIntData[addBuffsLen]; } DIntData[] addBuffsT = this.addBuffs; for (int addBuffsI = 0; addBuffsI < addBuffsLen; ++addBuffsI) { DIntData addBuffsV; addBuffsV = (DIntData)stream.createData(DIntData.dataID); addBuffsV.readBytesSimple(stream); addBuffsT[addBuffsI] = addBuffsV; } int momentActionsLen = stream.readLen(); if (this.momentActions == null || this.momentActions.Length != momentActionsLen) { this.momentActions = new int[momentActionsLen][]; } int[][] momentActionsT = this.momentActions; for (int momentActionsI = 0; momentActionsI < momentActionsLen; ++momentActionsI) { int[] momentActionsV; int momentActionsVLen = stream.readLen(); momentActionsV = new int[momentActionsVLen]; int[] momentActionsVT = momentActionsV; for (int momentActionsVI = 0; momentActionsVI < momentActionsVLen; ++momentActionsVI) { int momentActionsVV; momentActionsVV = stream.readInt(); momentActionsVT[momentActionsVI] = momentActionsVV; } momentActionsT[momentActionsI] = momentActionsV; } this.spasticityValue = stream.readInt(); this.attackBlowForce = stream.readInt(); this.attackPushForce = stream.readInt(); this.attackLiePushForce = stream.readInt(); }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeShort(this.level); stream.writeInt(this.costID); if (this.useRoleAttributes != null) { DIntData[] useRoleAttributesT = this.useRoleAttributes; stream.writeLen(useRoleAttributesT.Length); for (int useRoleAttributesVI = 0, useRoleAttributesVLen = useRoleAttributesT.Length; useRoleAttributesVI < useRoleAttributesVLen; ++useRoleAttributesVI) { DIntData useRoleAttributesV = useRoleAttributesT[useRoleAttributesVI]; if (useRoleAttributesV != null) { useRoleAttributesV.writeBytesSimple(stream); } else { nullObjError("useRoleAttributesV"); } } } else { nullObjError("useRoleAttributes"); } if (this.addRoleAttributes != null) { DIntData[] addRoleAttributesT = this.addRoleAttributes; stream.writeLen(addRoleAttributesT.Length); for (int addRoleAttributesVI = 0, addRoleAttributesVLen = addRoleAttributesT.Length; addRoleAttributesVI < addRoleAttributesVLen; ++addRoleAttributesVI) { DIntData addRoleAttributesV = addRoleAttributesT[addRoleAttributesVI]; if (addRoleAttributesV != null) { addRoleAttributesV.writeBytesSimple(stream); } else { nullObjError("addRoleAttributesV"); } } } else { nullObjError("addRoleAttributes"); } if (this.addActions != null) { int[][] addActionsT = this.addActions; stream.writeLen(addActionsT.Length); for (int addActionsVI = 0, addActionsVLen = addActionsT.Length; addActionsVI < addActionsVLen; ++addActionsVI) { int[] addActionsV = addActionsT[addActionsVI]; if (addActionsV != null) { int[] addActionsVT = addActionsV; stream.writeLen(addActionsVT.Length); for (int addActionsVVI = 0, addActionsVVLen = addActionsVT.Length; addActionsVVI < addActionsVVLen; ++addActionsVVI) { int addActionsVV = addActionsVT[addActionsVVI]; stream.writeInt(addActionsVV); } } else { nullObjError("addActionsV"); } } } else { nullObjError("addActions"); } stream.writeInt(this.buildTime); stream.writeInt(this.levelUpTime); }
/** 创建物品数据 */ public ItemData createItem(DIntData data) { return(createItem(data.key, data.value)); }
/// <summary> /// 写入字节流(简版) /// </summary> protected override void toWriteBytesSimple(BytesWriteStream stream) { base.toWriteBytesSimple(stream); stream.writeInt(this.id); stream.writeByte(this.step); if (this.attacks != null) { DIntData[] attacksT = this.attacks; stream.writeLen(attacksT.Length); for (int attacksVI = 0, attacksVLen = attacksT.Length; attacksVI < attacksVLen; ++attacksVI) { DIntData attacksV = attacksT[attacksVI]; if (attacksV != null) { attacksV.writeBytesSimple(stream); } else { nullObjError("attacksV"); } } } else { nullObjError("attacks"); } if (this.bullets != null) { DIntData[] bulletsT = this.bullets; stream.writeLen(bulletsT.Length); for (int bulletsVI = 0, bulletsVLen = bulletsT.Length; bulletsVI < bulletsVLen; ++bulletsVI) { DIntData bulletsV = bulletsT[bulletsVI]; if (bulletsV != null) { bulletsV.writeBytesSimple(stream); } else { nullObjError("bulletsV"); } } } else { nullObjError("bullets"); } stream.writeInt(this.time); if (this.switchType != null) { int[] switchTypeT = this.switchType; stream.writeLen(switchTypeT.Length); for (int switchTypeVI = 0, switchTypeVLen = switchTypeT.Length; switchTypeVI < switchTypeVLen; ++switchTypeVI) { int switchTypeV = switchTypeT[switchTypeVI]; stream.writeInt(switchTypeV); } } else { nullObjError("switchType"); } stream.writeInt(this.motionID); stream.writeBoolean(this.isStayAir); }