public void createFight(BattleDataErlang battleData, ErlNullList el, int frame) { BattleClipErlang battleClip = new BattleClipErlang(); battleClip.frame = frame; battleData.battleClip.Add(battleClip); }
//构建胜利者 private void createWinner(BattleDataErlang battleData, ErlList el, int frame) { //[{"1",1}] BattleClipErlang battleClip = new BattleClipErlang(); battleClip.frame = frame; battleData.battleClip.Add(battleClip); battleClip.isWinnerClip = true; battleData.winnerID = StringKit.toInt((el.Value [0] as ErlArray).Value [1].getValueString()); }
private void createRoundBuffer(BattleDataErlang battleData, ErlList el, int frame) { // 处理回合开始buffer // [{"15",{9,27003,34}}, // {"5",{9,1,-258}}, // {"15",{15,27003,33}}, // {"5",{15,1,-266}}, // {"14",{15,27003,33}}] //建立每一个战斗回合 BattleClipErlang battleClip = new BattleClipErlang(); battleClip.frame = frame; battleData.battleClip.Add(battleClip); //建立每个战斗条目 BattleInfoErlang battleInfo = new BattleInfoErlang(); battleClip.battleInfo.Add(battleInfo); BattleSkillErlang skillerlang = new BattleSkillErlang(); battleInfo.battleSkill.Add(skillerlang); BattleSkillMsg msg = new BattleSkillMsg(); skillerlang.skillMsg = msg; msg.operationType = BUFFER_CHECK; List <BuffAttrChange> bcs = new List <BuffAttrChange> (); BuffAttrChange bc; List <BattleAttrChange> acs; BattleAttrChange ac; ErlArray ea1; ErlArray ea2; string type; //类型 int length = el.Value.Length; for (int i = 0; i < length; i++) { ea1 = el.Value [i] as ErlArray; type = (ea1.Value [0] as ErlString).Value; if (type == BUFFER_ABILITY) //buffer生效 { bc = new BuffAttrChange(); ea2 = ea1.Value [1] as ErlArray; bc.operationType = type; bc.skillSID = StringKit.toInt(ea2.Value [1].getValueString()); // MonoBase. print("bc.skillID "+bc.skillID ); bc.skillID = StringKit.toInt(ea2.Value [2].getValueString()); acs = new List <BattleAttrChange> (); //装在效果 do { ea1 = el.Value [++i] as ErlArray; ea2 = ea1.Value [1] as ErlArray; ac = new BattleAttrChange(); ac.damageType = StringKit.toInt(ea2.Value [1].getValueString()); ac.damage = StringKit.toInt(ea2.Value [2].getValueString()); //BattleDataErlang battleDate=BattleManager.battleData; BattleHpInfo info = null; if (battleData.hpMap.ContainsKey(StringKit.toInt(ea2.Value [0].getValueString()))) { info = battleData.hpMap [StringKit.toInt(ea2.Value [0].getValueString())]; } else { info = new BattleHpInfo(); battleData.hpMap.Add(StringKit.toInt(ea2.Value [0].getValueString()), info); } info.hp += ac.damage; acs.Add(ac); } while(i < length - 1 && ((el.Value[i + 1] as ErlArray).Value[0] as ErlString).Value != BUFFER_ABILITY && ((el.Value[i + 1] as ErlArray).Value[0] as ErlString).Value != BUFFER_REMOVE); bc.changes = acs.ToArray(); bcs.Add(bc); } else if (type == BUFFER_REMOVE) //移除buffer { bc = new BuffAttrChange(); ea2 = ea1.Value [1] as ErlArray; bc.operationType = type; bc.skillSID = StringKit.toInt(ea2.Value [1].getValueString()); bc.skillID = StringKit.toInt(ea2.Value [2].getValueString()); bcs.Add(bc); } else { } } msg.changes = bcs.ToArray(); }
public void createFight(BattleDataErlang battleData, ErlList el, int frame) { BattleClipErlang battleClip = new BattleClipErlang(); battleClip.frame = frame; battleData.battleClip.Add(battleClip); //建立每个战斗条目 BattleInfoErlang battleInfo; ErlList el2; BattleSkillErlang skillerlang; BattleSkillMsg msg; for (int i = 0; i < el.Value.Length; i++) { battleInfo = new BattleInfoErlang(); battleClip.battleInfo.Add(battleInfo); el2 = el.Value [i] as ErlList; //erllist需要倒转顺序 Array.Reverse(el2.Value); for (int j = 0; j < el2.Value.Length; j++) { skillerlang = new BattleSkillErlang(); battleInfo.battleSkill.Add(skillerlang); msg = new BattleSkillMsg(); skillerlang.skillMsg = msg; //建立条目中的战斗技能 if (el2.Value [j] is ErlArray) { ErlArray arr = el2.Value [j] as ErlArray; //单个战斗回合具体信息 // MonoBehaviour.print ("report[" + i + "][" + j + "][" + k + "] is ErlArray length = " + arr.Value.Length); //得到当前战斗回合指令 string command = (arr.Value [0] as ErlString).Value; msg.operationType = command; //MonoBehaviour.print ("===command=====" + command); //攻击行为 xxx 使用技能 对 xxx if (command == ABILITY_ATTACK) { ErlArray arr2 = arr.Value [1] as ErlArray; createAbiltyAttack(msg, arr2); } //援护 xxx 使用 aaa援护技能 对 xxx2 本次攻击者 xxx3 else if (command == INTERVENE) { ErlArray arr2 = arr.Value [1] as ErlArray; createIntervene(msg, arr2); } //改变属性 xxx 的 aaa属性 改变 bbb else if (command == ATTR_CHANGE) { ErlArray arr2 = arr.Value [1] as ErlArray; createAttrChange(battleData, msg, arr2); } //反击 xxx 使用 aaa 对 xxx2 else if (command == REBOUND) { ErlArray arr2 = arr.Value [1] as ErlArray; createRebound(msg, arr2); } //急救 xxx 使用 aaa 对 xxx2 else if (command == FIRSTAID) { ErlArray arr2 = arr.Value [1] as ErlArray; createFirstaid(msg, arr2); } //参与者 合击参与者 else if (command == PARTICIPANT) { //erlArray 被攻击者 编号可以是多个 ErlArray arr2 = arr.Value [1] as ErlArray; createParticipant(msg, arr2); } //合击 xxx对xxx合击 else if (command == TOGERTHER_ATTACK) { ErlArray arr2 = arr.Value [1] as ErlArray; createTogertherAttack(msg, arr2); } //连击 xxx使用技能 aaa 对 xxx else if (command == DOUBLE_ATTACK) { ErlArray arr2 = arr.Value [1] as ErlArray; createDoubleAttack(msg, arr2); } //添加buffer xxx使用技能aaa 对xxx else if (command == BUFFER_ADD) { ErlArray arr2 = arr.Value [1] as ErlArray; createBufferAdd(msg, arr2); } //移除buffer xxx技能aaa 被移除 else if (command == BUFFER_REMOVE) { ErlArray arr2 = arr.Value [1] as ErlArray; createBufferRemove(msg, arr2); } //替换buffer xxx的aaa buffer 替换成 bbb buffer else if (command == BUFFER_REPLACE) { ErlArray arr2 = arr.Value [1] as ErlArray; createBufferReplace(msg, arr2); } //buffer生效 xxx的aaa buffer 生效 else if (command == BUFFER_ABILITY) { ErlArray arr2 = arr.Value [1] as ErlArray; createBufferAbility(msg, arr2); } //剧情NPC登场 else if (command == ADD_PLOT_NPC) { createAddNPC(msg); } //剧情NPC退场 else if (command == DEL_PLOT_NPC) { createDelNPC(msg); } //对话 else if (command == PLOT_TALK) { createTalk(msg, arr.Value [1]); } else if (command == EFFECT_EXIT) { createEffectExit(msg, arr.Value [1]); } else if (command == FIGHTER_INFO) { ErlArray arr2 = arr.Value [1] as ErlArray; addCard(msg, arr2); } else { //MonoBehaviour.print ("======unused ============ command = " + command); } } else { //这里如果信息结构不是ErlArray 可能是结构有所改动 //MonoBehaviour.print ("error report[" + i + "][" + j + "][" + k + "] is not ErlArray type=" + el2.Value [k]); } } } }