//构建攻击行为 private void createAbiltyAttack(BattleSkillMsg msg, ErlArray array) { //攻击者 id string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); // 技能sid编号 string str2 = array.Value [1].getValueString(); msg.skillSID = StringKit.toInt(str2); // 技能编号 string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); //erlArray 被攻击者 编号可以是多个 ErlArray arr4 = array.Value [3] as ErlArray; int[] strarr = new int[arr4.Value.Length]; //生成被攻击者编号数组 for (int m = 0; m < strarr.Length; m++) { strarr [m] = StringKit.toInt(arr4.Value [m].getValueString()); } msg.targets = strarr; }
//替换buffer private void createBufferReplace(BattleSkillMsg msg, ErlArray array) { //被替换buffer者 string str1 = array.Value [0].getValueString(); int[] arrInt1 = new int[1] { StringKit.toInt(str1) }; msg.targets = arrInt1; //旧技能sid string str2 = array.Value [1].getValueString(); msg.oldSkillSID = StringKit.toInt(str2); //旧技能id string str3 = array.Value [2].getValueString(); msg.oldSkillID = StringKit.toInt(str3); //替换后的buffer sid string str4 = array.Value [3].getValueString(); msg.skillSID = StringKit.toInt(str4); //替换后的buffer id string str5 = array.Value [4].getValueString(); msg.skillID = StringKit.toInt(str5); }
//构建改变属性 private void createAttrChange(BattleDataErlang battleData, BattleSkillMsg msg, ErlArray array) { //被改变者id string str1 = array.Value [0].getValueString(); int[] arrInt1 = new int[1] { StringKit.toInt(str1) }; msg.targets = arrInt1; //改变的具体属性 数字代替 string str2 = array.Value [1].getValueString(); msg.valueType = StringKit.toInt(str2); //具体数值 string str3 = array.Value [2].getValueString(); msg.damage = StringKit.toInt(str3); if (msg.valueType == 1) { BattleHpInfo info = null; if (battleData.hpMap.ContainsKey(msg.targets [0])) { info = battleData.hpMap [msg.targets [0]]; } else { info = new BattleHpInfo(); battleData.hpMap.Add(msg.targets [0], info); } info.hp += msg.damage; } }
//构建合击参与者 private void createParticipant(BattleSkillMsg msg, ErlArray array) { int[] strarr = new int[array.Value.Length]; //生成被攻击者编号数组 for (int m = 0; m < strarr.Length; m++) { strarr [m] = StringKit.toInt(array.Value [m].getValueString()); } msg.targets = strarr; }
private void addCard(BattleSkillMsg msg, ErlArray array) { TeamInfoPlayer card = new TeamInfoPlayer(); if (array.Value [0] is ErlArray) //剧情npc { string str1 = (array.Value [0] as ErlArray).Value [0].getValueString(); //camp 阵营 card.camp = StringKit.toInt(str1); } else { //替补 string str1 = array.Value [0].getValueString(); //camp 阵营 card.camp = StringKit.toInt(str1); } string str2 = array.Value [1].getValueString(); //sid 模板 card.sid = StringKit.toInt(str2); string str3 = array.Value [2].getValueString(); //id 唯一标示 card.id = StringKit.toInt(str3); string strUid = array.Value [3].getValueString(); //uid 卡片唯一id 可能为空 card.uid = strUid; string str4 = array.Value [4].getValueString(); //hp card.hp = StringKit.toInt(str4); string str5 = array.Value [5].getValueString(); //maxhp int card.maxHp = StringKit.toInt(str5); string str6 = array.Value [6].getValueString(); //master 拥有者名字 card.master = str6; string str7 = array.Value [7].getValueString(); //embattle 阵位 编号 card.embattle = StringKit.toInt(str7); card.evoLevel = BattleManager.battleData.getCardEvoLevel(card.uid); //卡片进化等级 card.isAlternate = true; msg.card = card; if (card.camp == TeamInfo.OWN_CAMP) { BattleManager.battleData.playerTeamInfo.addTeamInfoSub(card); } else { BattleManager.battleData.enemyTeamInfo.addTeamInfoSub(card); } msg.skillSID = SkillSampleManager.SID_ADD_CARD; }
//构建合击 TOGERTHER_ATTACK private void createTogertherAttack(BattleSkillMsg msg, ErlArray array) { //攻击者 string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); //被攻击者 string str2 = array.Value [1].getValueString(); int[] arrInt2 = new int[1] { StringKit.toInt(str2) }; msg.targets = arrInt2; }
//buffer生效 BUFFER_ABILITY private void createBufferAbility(BattleSkillMsg msg, ErlArray array) { //buffer生效者 string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); //buffer技能编号sid string str2 = array.Value [1].getValueString(); msg.skillID = StringKit.toInt(str2); //buffer技能编号id string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); }
//构建移除buffer private void createBufferRemove(BattleSkillMsg msg, ErlArray array) { //被移除buffer者 string str1 = array.Value [0].getValueString(); int[] arrInt1 = new int[1] { StringKit.toInt(str1) }; msg.targets = arrInt1; //被移除技能编号sid string str2 = array.Value [1].getValueString(); msg.skillSID = StringKit.toInt(str2); //被移除技能编号id string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); }
//构建添加buffer private void createBufferAdd(BattleSkillMsg msg, ErlArray array) { //技能释放者 string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); //技能编号sid string str2 = array.Value [1].getValueString(); msg.skillSID = StringKit.toInt(str2); //技能编号id string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); //buff影响效果 if (!(array.Value [3] is ErlNullList)) //控制型buffer无效果 { ErlList list = array.Value [3] as ErlList; if (list.Value.Length > 0) { BuffEffectType[] effects = new BuffEffectType[list.Value.Length]; for (int i = 0; i < list.Value.Length; i++) { ErlArray arr = list.Value [i] as ErlArray; string str41 = (arr.Value [0] as ErlAtom).Value; int effect = StringKit.toInt(arr.Value [1].getValueString()); BuffEffectType eff = new BuffEffectType(); eff.type = str41; eff.effect = effect; effects [i] = eff; } msg.effects = effects; } } //被添加buffer者 string str5 = array.Value [4].getValueString(); int[] arrInt4 = new int[1] { StringKit.toInt(str5) }; msg.targets = arrInt4; }
//构建连击 private void createDoubleAttack(BattleSkillMsg msg, ErlArray array) { //攻击者 string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); //技能编号sid string str2 = array.Value [1].getValueString(); msg.skillSID = StringKit.toInt(str2); //技能编号id string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); //被攻击者 string str4 = array.Value [3].getValueString(); int[] arrInt4 = new int[1] { StringKit.toInt(str4) }; msg.targets = arrInt4; }
//构建反击 private void createRebound(BattleSkillMsg msg, ErlArray array) { //反击者id string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); //反击技能sid string str2 = array.Value [1].getValueString(); msg.skillSID = StringKit.toInt(str2); //反击技能id string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); //被反击者id string str4 = array.Value [3].getValueString(); int[] arrInt4 = new int[1] { StringKit.toInt(str4) }; msg.targets = arrInt4; }
//构建援护 private void createIntervene(BattleSkillMsg msg, ErlArray array) { //援护者id string str1 = array.Value [0].getValueString(); msg.userID = StringKit.toInt(str1); //援护技能sid string str2 = array.Value [1].getValueString(); msg.skillSID = StringKit.toInt(str2); //援护技能id string str3 = array.Value [2].getValueString(); msg.skillID = StringKit.toInt(str3); //援护对象id string str4 = array.Value [3].getValueString(); int [] arrStr4 = new int[] { StringKit.toInt(str4) }; msg.targets = arrStr4; //本次攻击者id string str5 = array.Value [4].getValueString(); msg.trigger = StringKit.toInt(str5); }
public void init(BattleSkillMsg skillmsg, List <CharacterData> _target, CharacterData _user, CharacterData _trigger, SkillCtrl EditSkill) { if (skillmsg.skillSID == 0) { Debug.LogError("error skillSid"); } this.skillmsg = skillmsg; targets = _target; user = _user; trigger = _trigger; serverData = SkillManager.Instance.CreateSkillData(skillmsg.skillID, skillmsg.skillSID); if (serverData == null) { Debug.LogError("lost skill:" + skillmsg.skillSID); } buffs = new List <BuffCtrl> (); if (serverData.sample.getType() == SkillType.fixAOE || serverData.sample.getType() == SkillType.MeleeAOE || serverData.sample.getType() == SkillType.MeleeJumpAOE || serverData.sample.getType() == SkillType.MeleeChargeAOE || serverData.sample.getType() == SkillType.bulletMultipleAOE) { position = user.parentTeam.TeamHitPoint.position; } else if (targets != null && targets.Count >= 1) { if (serverData.sample.getAttackNum() > 1 && serverData.sample.getType() == SkillType.Melee) { //近战细分攻击,坐标有偏移 if (_user.camp == TeamInfo.OWN_CAMP) { position = targets [0].orgPosition + new Vector3(0, 0.1f, -0.3f); } else { position = targets [0].orgPosition + new Vector3(0, 0.1f, 0.3f); } } else { position = targets [0].orgPosition + new Vector3(0, 0.1f, 0); } } if (serverData.sample.getType() == SkillType.HelpOther) { //确认援护位置 position = BattleManager.Instance.getOffset(targets [0].orgPosition, targets [0].parentTeam.isGamePlayerTeam); //修改攻击者的攻击位置 EditSkill.position = BattleManager.Instance.getOffset(position, user.parentTeam.isGamePlayerTeam); //修改攻击者的目标 EditSkill.targets [0] = user; if (EditSkill != null) { triggerSkill = EditSkill; } } if (serverData.sample.getType() == SkillType.FightBack || serverData.sample.getType() == SkillType.FightBackAfterHelp) { //确认攻击位置 position = BattleManager.Instance.getOffset(targets [0].orgPosition, targets [0].parentTeam.isGamePlayerTeam); if (EditSkill != null) { triggerSkill = EditSkill; } } if (serverData.sample.getType() == SkillType.MedicalAfterHelp) { if (EditSkill != null) { triggerSkill = EditSkill; } } if (serverData.sample.getType() == SkillType.BuffCheck) { } if (serverData.sample.getType() == SkillType.AddCard) { //产生新的出来 if (skillmsg.card.camp == TeamInfo.OWN_CAMP) { serverData.changeRole = BattleCharacterManager.Instance.CreateBattleCharacterData(skillmsg.card, BattleManager.Instance.playerTeam, BattleManager.battleData.battleType); } else { serverData.changeRole = BattleCharacterManager.Instance.CreateBattleCharacterData(skillmsg.card, BattleManager.Instance.enemyTeam, BattleManager.battleData.battleType); } BattleManager.Instance.addCardToActionCharacters(serverData.changeRole); } if (serverData.sample.getType() == SkillType.DelNPC) { } if (serverData.sample.getType() == SkillType.GroupCombine) { //如果EditSkill为空,则取消这次技能加载 if (EditSkill == null) { return; } //如果EditSkill不空,则是participant,修改上个技能目标 if (EditSkill != null) { triggerSkill = EditSkill; } // triggerSkill.skillData .dataBase= _data; triggerSkill.targets = _target; triggerSkill.user = _user; triggerSkill.trigger = _trigger; } }
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]); } } } }
//特效退出战斗 private void createEffectExit(BattleSkillMsg msg, ErlType type) { msg.skillSID = SkillSampleManager.SID_EFFECT_EXIT; msg.exitEffectId = StringKit.toInt(type.getValueString()); }
//对话 private void createTalk(BattleSkillMsg msg, ErlType type) { msg.skillSID = SkillSampleManager.SID_TALK; msg.plotSID = StringKit.toInt(type.getValueString()); }
//npc退场 private void createDelNPC(BattleSkillMsg msg) { msg.skillSID = SkillSampleManager.SID_DEL_NPC; }
//npc出场 private void createAddNPC(BattleSkillMsg msg) { msg.skillSID = SkillSampleManager.SID_ADD_NPC; }
public bool isFinalSkill = false; //是否是终结技[用于处理战斗减速效果] public void init(BattleSkillMsg skillmsg, List <CharacterData> _target, CharacterData _user) { init(skillmsg, _target, _user, null, null); }
//检查buff 用的技能初始化 public void init(BattleSkillMsg skillmsg) { changes = skillmsg.changes; init(skillmsg, null, null, null, null); }
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 BattleSkillErlang() { skillMsg = new BattleSkillMsg(); }