/// <summary> /// 技能释放能被自身状态打断. /// </summary> /// <returns><c>true</c>, if status inter rupt was seled, <c>false</c> otherwise.</returns> /// <param name="skill">Skill.</param> public bool SeleStatusInterRupt(SoldierSkill skill) { for (int i = 0; i < m_RoleStatus.Count; i++) { StatusM Data = m_RoleStatus[i]; if (Data == null) { continue; } if (Data.m_selfRuptType == SelfStatusInterrupt.None) { continue; } if (Data.m_selfRuptType == SelfStatusInterrupt.MagicRupt && skill.m_attacktype == (int)AttackType.Magic) { return(true); } else if (Data.m_selfRuptType == SelfStatusInterrupt.PhyRupt && skill.m_attacktype == (int)AttackType.Physical) { return(true); } } return(false); }
void DoSkill1028(MapGrid pos, SoldierSkill skill) { if (pos == null) { return; } GameObject posgo = m_LifePrent.GetSkin().ProPerty.HelpPoint.GetVauleByKey(HelpPointName.FirePos); Transform fireplace = posgo.transform; if (fireplace != null) { string bulletname = "1003051"; GameObject go = GameObjectLoader.LoadPath("effect/prefab/", bulletname, BattleEnvironmentM.GetLifeMBornNode(true)); go.transform.position = fireplace.position; if (m_LifePrent.WalkDir == WalkDir.WALKRIGHT) { go.transform.localScale = new Vector3(-go.transform.localScale.x, go.transform.localScale.y, go.transform.localScale.z); } Bullet bullet = go.AddComponent <Bullet>(); if (bullet != null) { Bullet.BulletType t = Bullet.BulletType.bomb1028; Vector3 vpos = pos.pos; vpos.y = go.transform.localPosition.y; bullet.SetInfo(vpos, m_DoAttack, 10f, m_LifePrent.WalkDir, t, skill); } } }
public void SetNewSkill(SoldierInfo curInfo, SoldierInfo preInfo) { int CurSmallQuality = ConfigM.GetSmallQuality(curInfo.Quality); int CurBigQuality = ConfigM.GetBigQuality(curInfo.Quality); int PreSmallQuality = ConfigM.GetSmallQuality(preInfo.Quality); int PreBigQuality = ConfigM.GetBigQuality(preInfo.Quality); if (CurSmallQuality == 0 && CurBigQuality > PreBigQuality) { MyHead.GoShowNewSkill.SetActive(true); int skillIndex = ConfigM.GetEnableSkill(curInfo.Quality); SoldierSkill info = curInfo.m_Skill.GetSkill(skillIndex); if (info != null) { MyHead.GoShowNewSkill.SetActive(true); NGUIUtil.Set2DSprite(MyHead.Spr2DSkillIcon, "Textures/skill/", info.m_type.ToString()); MyHead.LblSkillDes.text = info.m_description1; } else { MyHead.GoShowNewSkill.SetActive(false); } } else { MyHead.GoShowNewSkill.SetActive(false); } }
public void SetInfo(Vector3 dest, DoAttackFun fun, float speed, WalkDir dir, BulletType t, SoldierSkill skill, bool isPlaySound = true) { m_dir = dir; m_Skill = false; m_skillinfo = skill; m_Start = transform.localPosition; m_Start.z = -0.5f; m_Destination = dest; m_Destination.z = -0.5f; //m_Destination.y = m_Start.y; m_fun = fun; m_Speed = speed; m_Duration = Mathf.Abs(transform.localPosition.x - m_Destination.x) / speed; m_type = t; //effect = SkillEffects._instance.LoadEffect("effect/prefab/", "1002011",transform.position,0.5f); if (isPlaySound) { SoundPlay.Play("fireGun", false, false); } m_info = m_skillinfo.m_skilleffectinfo; /*if (t == BulletType.Grenade || t == BulletType.Snowball|| t == BulletType.Poison || t == BulletType.ling) * { * //m_Destination.y -= 1f; * myBezier = new Bezier( m_Start, new Vector3(0,-3,0), new Vector3(0,-3,0), m_Destination ); * } * * if (t == BulletType.Grenade || t == BulletType.Snowball|| t == BulletType.Poison ) * { * //m_Destination.y -= 1f; * myBezier = new Bezier( m_Start, new Vector3(0,-3,0), new Vector3(0,-3,0), m_Destination ); * } * if (t == BulletType.ling) * { * //m_Destination.y -= 1f; * m_Destination.y = m_Start.y; * myBezier = new Bezier( m_Start, new Vector3(0,-2,0), new Vector3(0,-2,0), m_Destination ); * }*/ if (skill.m_type == 1005) { float dis = m_Destination.x - m_Start.x; Vector3 pos = m_Destination; pos.x = m_Start.x + dis * 0.7f; myBezier = new Bezier(m_Start, new Vector3(0, -m_info.m_locus, 0), new Vector3(0, -m_info.m_locus, 0), pos); Vector3 pos1 = pos; pos1.x += dis * 0.2f; myBezier1 = new Bezier(pos, new Vector3(0, -m_info.m_locus * 0.4f, 0), new Vector3(0, -m_info.m_locus * 0.4f, 0), pos1); myBezier2 = new Bezier(pos1, new Vector3(0, -m_info.m_locus * 0.2f, 0), new Vector3(0, -m_info.m_locus * 0.2f, 0), m_Destination); } else { myBezier = new Bezier(m_Start, new Vector3(0, -m_info.m_locus, 0), new Vector3(0, -m_info.m_locus, 0), m_Destination); } //Debug.Log("bullet:" + transform.localPosition + "," +m_Destination + "," + m_Speed + "," + m_Duration + ","+Mathf.Abs(transform.localPosition.x - m_Destination.x)); }
public List <Life> GetBuildSkillTarget() { List <Life> RoleList = new List <Life>(); LifeMCamp camp = GetSkillCamp(m_skill, m_Parent); SoldierSkill skill = m_skill as SoldierSkill; if ((skill.m_damagetargettype & (int)TargetType.Soldier) == (int)TargetType.Soldier) { List <Life> lr = new List <Life>(); CM.SearchLifeMListInBoat(ref lr, LifeMType.SOLDIER, camp); foreach (Role r in lr) { if (CheckCanAttack(r.CurrentAction) && CheckRangeAttackTarget(r, m_Parent.GetMapGrid(), skill.m_sort, skill.m_range, WalkDir.WALKSTOP)) { RoleList.Add(r); } } } if ((skill.m_damagetargettype & (int)TargetType.Pet) == (int)TargetType.Pet) { List <Life> lp = new List <Life>(); CM.SearchLifeMListInBoat(ref lp, LifeMType.SUMMONPET, camp); foreach (Role r in lp) { if (CheckCanAttack(r.CurrentAction) && CheckRangeAttackTarget(r, m_Parent.GetMapGrid(), skill.m_sort, skill.m_range, WalkDir.WALKSTOP)) { RoleList.Add(r); } } } /*int distant = skill.m_distance / MapGrid.m_Pixel; * if ((skill.m_targettype & (int)TargetType.Soldier) == (int)TargetType.Soldier) * { * List<Life> l = new List<Life>(); * ///需要排除隐形 。。。。。。。。。。。。。。。。。。 * CM.SearchLifeMListInBoat(ref l, LifeMType.SOLDIER, camp); * foreach (Role r in l) * { * * * if ( CheckAttackTarget(r, skill.m_sort, distant, skill.m_condition != (int)SkillCondition.SameLayer) ) * RoleList.Add(r); * } * } * if ((skill.m_targettype & (int)TargetType.Pet) == (int)TargetType.Pet) * { * List<Life> lp = new List<Life>(); * CM.SearchLifeMListInBoat(ref lp, LifeMType.SUMMONPET, camp); * foreach (Life p in lp) * { * * if (CheckAttackTarget(p, skill.m_sort, distant, skill.m_condition != (int)SkillCondition.SameLayer) ) * RoleList.Add(p); * } * } * CheckMultiple(ref RoleList, m_skill);*/ return(RoleList); }
public void SetData(SoldierSkill skill, int skillNo, int dsoldierID, int soldierLevel) { m_soldierSkill = skill; m_iSkillNo = skillNo; m_dSoldierID = dsoldierID; m_iSoldierLevel = soldierLevel; SetUI(); }
/// <summary> /// 获取技能 /// </summary> public SoldierSkill GetSkill(int SkillNo) { if (SkillNo >= 0 && SkillNo <= 6) { SoldierSkill s = m_Skillinfo[SkillNo]; return(s); } return(null); }
/// <summary> /// 获取技能 /// </summary> public static bool GetSkillInfo(int type, int level, ref SoldierSkill Info) { s_skillupInfo up = GetSkillUp(type, level); s_skill_typeInfo v = GetSkillType(type); if (v == null || up == null) { return(false); } SetSoldierSkill(up, v, ref Info); return(true); }
public void DoSkill(int times) { if (m_skill == null) { return; } SoldierSkill skill = m_skill as SoldierSkill; List <Life> targetlist = new List <Life>(); LifeMCamp camp = m_parent.m_Core.m_Camp == LifeMCamp.ATTACK?LifeMCamp.DEFENSE : LifeMCamp.ATTACK; targetlist = GetRangeAttackList(MapGrid.GetMG(m_parent.m_Pos), skill, camp, null); if (skill.m_actiontype == 0) { StatusSelfBuff(m_parent, m_skill); for (int i = 0; i < targetlist.Count; i++) { if (!targetlist[i].InBoat) { continue; } SkillReleaseInfo info = Life.CalcDamage(m_parent, targetlist[i], null, m_skill); if (skill.m_attckmodeid > 0) { float power = skill.GetAttackPower(times); info.m_Damage = (int)(info.m_Damage * power); } Transform attackT = m_parent.m_thisT; targetlist[i].ApplyDamage(info, attackT); } //Debug.Log(str); } else if (skill.m_actiontype == 1) { StatusSelfBuff(m_parent, m_skill); for (int i = 0; i < targetlist.Count; i++) { if (!targetlist[i].InBoat) { continue; } SkillReleaseInfo info = Life.CalcDamage(m_parent, targetlist[i], null, m_skill); Debug.Log("doskill " + m_skill.m_name + "," + info.m_Damage); if (skill.m_attckmodeid > 0) { float power = skill.GetAttackPower(times); info.m_Damage = (int)(info.m_Damage * power); } Transform attackT = m_parent.m_thisT; targetlist[i].ApplyDamage(info, attackT); } //Debug.Log(str); } }
private void CreateSkillItem(SoldierSkill soldierSkill) { GameObject go = NDLoad.LoadWndItem("BigSkillItem", MyHead.SkillTable); if (go) { BigSkillItem item = go.GetComponent <BigSkillItem>(); if (item != null) { item.SetData(soldierSkill, false); } } }
public override void RemoveStatus(float duration) { base.RemoveStatus(duration); mcd -= duration; if (mcd <= 0) { mStatusActive = true; SoldierSkill sourceSkill = new SoldierSkill(); SkillM.GetSkillInfo(m_StatusInfo.exSkill1, m_StatusInfo.exSkillLevel1, ref sourceSkill); mcd = sourceSkill.m_cd * 0.001f; Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role; RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero); } }
public override void RemoveStatus(float duration) { if (mStatusActive) { return; } base.RemoveStatus(duration); if (IsStatusOver()) { mStatusActive = true; SoldierSkill sourceSkill = new SoldierSkill(); SkillM.GetSkillInfo(m_StatusInfo.exSkill2, m_StatusInfo.exSkillLevel2, ref sourceSkill); Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role; RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero); } }
public override void InterruptStatus(LifeAction Action) { if (mStatusActive) { return; } base.InterruptStatus(Action); if (Action == LifeAction.Die) { mStatusActive = true; SoldierSkill sourceSkill = new SoldierSkill(); SkillM.GetSkillInfo(m_StatusInfo.exSkill1, m_StatusInfo.exSkillLevel1, ref sourceSkill); Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role; RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero); } }
/// <summary> /// 获取技能 /// </summary> public static bool GetSkillInfo(int id, ref SoldierSkill Info) { s_skillupInfo up = GetSkillUp(id); if (up == null) { return(false); } s_skill_typeInfo v = GetSkillType(up.type); if (v == null) { return(false); } SetSoldierSkill(up, v, ref Info); return(true); }
public void SetSkill(s_monsterInfo monster) { if (monster == null) { return; } SoldierSkill Info = new SoldierSkill(); //0 SkillM.GetSkillInfo(monster.gskillid, ref Info); m_Skillinfo.Add(Info); //1 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.skill1id, ref Info); m_skill1_level = Info.m_level; m_Skillinfo.Add(Info); //2 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.skill2id, ref Info); m_skill2_level = Info.m_level; m_Skillinfo.Add(Info); //3 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.skill3id, ref Info); m_skill3_level = Info.m_level; m_Skillinfo.Add(Info); //4 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.skill4id, ref Info); m_skill4_level = Info.m_level; m_Skillinfo.Add(Info); //5 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.skill5id, ref Info); m_skill5_level = Info.m_level; m_Skillinfo.Add(Info); //6 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.askillid, ref Info); m_Skillinfo.Add(Info); //7 Info = new SoldierSkill(); SkillM.GetSkillInfo(monster.lskillid, ref Info); m_Skillinfo.Add(Info); }
private void CreateSkillItem(SoldierSkill info, int skillNo, int dsoldierID) { if (info.m_level == 0) { return; } GameObject go = NDLoad.LoadWndItem("AddSkillItem", MyHead.Parent.transform); AddSkillItem addSkillItem = go.GetComponent <AddSkillItem>(); addSkillItem.SetData(info, skillNo, dsoldierID, m_Info.Level); m_skillItems.Add(addSkillItem); if (addSkillItem.CheckSkillCanUp() == 0 && m_tGuide == null) { m_tGuide = addSkillItem; addSkillItem.BGuideSelect = true; } }
public void SetInfo(Vector3 dest, SkillUseFun fun, float speed, WalkDir dir, SoldierSkill skill, LifeMCamp camp, int layer, bool isPlaySound = true) { m_dir = dir; m_Skill = false; m_skillinfo = skill; m_Start = transform.localPosition; m_Start.z = -0.5f; m_Destination = dest; m_Destination.z = -0.5f; //m_Destination.y = m_Start.y; m_fun = fun; m_Speed = speed; m_Duration = Mathf.Abs(transform.localPosition.x - m_Destination.x) / speed; //effect = SkillEffects._instance.LoadEffect("effect/prefab/", "1002011",transform.position,0.5f); m_camp = camp; m_info = m_skillinfo.m_skilleffectinfo; m_layer = layer; //Debug.Log("bullet:" + transform.localPosition + "," +m_Destination + "," + m_Speed + "," + m_Duration + ","+Mathf.Abs(transform.localPosition.x - m_Destination.x)); }
/// <summary> /// 攻击技能释放 /// </summary> public void DoSkill(DoAttackFun DoAttackFun, SoldierSkill info, int times) { if (info.m_type == 1029 || info.m_type == 1031) { string name = "1003101"; if (info.m_type == 1031) { name = "1003111"; } GameObject posgo = m_Owner.m_Skin.ProPerty.HelpPoint.GetVauleByKey(HelpPointName.LeftHandPos); if (posgo != null) { GameObjectActionExcute gae = EffectM.LoadEffect(EffectM.sPath, name, posgo.transform.position, posgo.transform); m_effectGo = gae.gameObject; if (gae != null) { GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(2f); gae.AddAction(ndEffect); } } } m_petState = Pet1002State.toAttackPos; m_DoAttackFun = DoAttackFun; m_skillInfo = info; m_times = times; m_Owner.m_target = m_Owner.m_Parent.m_Skill.m_AttackTarget; Int2 mappos = m_Owner.m_Parent.GetMapPos(); if ((m_Owner.m_Parent as Role).WalkDir == WalkDir.WALKLEFT) { mappos.Unit -= 3; } else { mappos.Unit += 3; } m_run.SetBorn(mappos, 0); m_run.UpdataPath(); }
public static PetInfo GetPetInfo(int PetID) { foreach (sdata.s_summonInfo I in m_lPet) { if (I.id == PetID) { PetInfo Info = new PetInfo(); Info.m_id = I.id; Info.m_type = I.type; Info.m_mp = I.mp; Info.m_damage = I.damage; Info.m_name = I.name; Info.LifeTime = I.time; Info.m_isattack = I.isattack; Info.m_attacktype = I.attacktype; Info.m_speedpercent = I.speedpercent; Info.m_jumppercent = I.jumppercent; Info.m_hppercent = I.hppercent; Info.m_phydamagepercent = I.phydamagepercent; Info.m_phyattackpercent = I.phyattackpercent; Info.m_phydefendpercent = I.phydefendpercent; Info.m_magicattackpercent = I.magicattackpercent; Info.m_magicdamagepercent = I.magicdamagepercent; Info.m_magicdefendpercent = I.magicdefendpercent; Info.m_phy_critpercent = I.phy_critpercent; Info.m_magic_critpercent = I.magic_critpercent; Info.m_skill1 = I.skill1; SoldierSkill skillInfo = new SoldierSkill(); //0 SkillM.GetSkillInfo(Info.m_skill1, ref skillInfo); Info.m_skillinfo1 = skillInfo; SkillM.SetSkillStatus(ref Info.m_status, I.status); return(Info); } } return(null); }
public void SetData(SoldierSkill soldierSkill, bool isBigSkill = true) { int iconID = soldierSkill.m_type; string name = soldierSkill.m_name; string[] s = soldierSkill.m_description1.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries); if (s.Length < 2) { NGUIUtil.DebugLog("Skill m_description1 data error: " + soldierSkill.m_description1); return; } string desc = s[0]; string skillEffect = s[1]; SetUI(iconID, name, desc, skillEffect); if (!isBigSkill) { NGUIUtil.SetActive(LblBiSha, false); transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); Vector3 pos = Spr2dSkillIcon.gameObject.transform.localPosition; Spr2dSkillIcon.gameObject.transform.localPosition = U3DUtil.AddY(pos, 35f); } }
public void SetSkillInfo(Vector3 dest, DoAttackFun fun, float speed, WalkDir dir, Vector3 outpos, Vector3 inpos, BulletType t, SoldierSkill skill) { SetInfo(dest, fun, speed, dir, t, skill, false); SoundPlay.Play("missile_launch", false, false); m_fadeinpos = inpos; m_fadeoutpos = outpos; m_fadeoutpos.z = 1.5f; m_Skill = true; m_outtime = 0.3f; //Vector3.Distance(transform.localPosition,outpos) /speed; m_intime = Vector3.Distance(inpos, dest) / speed; m_Duration = 1.3f; //m_outtime + m_intime; Vector3 pos = transform.localPosition; //myBezier = new Bezier( m_fadeoutpos, new Vector3(0,-10,0), new Vector3(0,-10,0), m_Destination ); myBezier = new Bezier(m_fadeoutpos, new Vector3(0, -m_info.m_locus, 0), new Vector3(0, -m_info.m_locus, 0), m_Destination); //UnityEditor.Handles.DrawBezier(m_fadeoutpos, m_Destination, new Vector3(0, -10, 0), new Vector3(0, -10, 0), // Color.red, null, 1f); //Debug.Log(m_Start +","+m_fadeoutpos +","+m_fadeinpos +","+m_Destination); //Debug.Log( m_fadeoutpos+","+ new Vector3(m_fadeoutpos.x,m_fadeoutpos.y -10,m_fadeoutpos.z)+","+ new Vector3(m_Destination.x,m_Destination.y -10,m_Destination.z)+","+ m_Destination); //Debug.Log("bullet:" + transform.localPosition + "," +m_Destination + "," + m_Speed + "," + m_Duration + ","+Mathf.Abs(transform.localPosition.x - m_Destination.x)); }
public void InitSkill() { m_Skillinfo.Clear(); SoldierSkill Info = new SoldierSkill(); //0 SkillM.GetSkillInfo(m_gskilltype, 1, ref Info); m_Skillinfo.Add(Info); //1 Info = new SoldierSkill(); if (m_skill1_level == 0) { SkillM.GetSkillInfo(m_skill1_type, 1, ref Info); Info.m_enable = false; Info.m_enableQuality = ConfigM.GetEnableSkillQuatlity(2); } else { SkillM.GetSkillInfo(m_skill1_type, m_skill1_level, ref Info); } m_Skillinfo.Add(Info); //2 Info = new SoldierSkill(); if (m_skill2_level == 0) { SkillM.GetSkillInfo(m_skill2_type, 1, ref Info); Info.m_enable = false; Info.m_enableQuality = ConfigM.GetEnableSkillQuatlity(3); } else { SkillM.GetSkillInfo(m_skill2_type, m_skill2_level, ref Info); } m_Skillinfo.Add(Info); //3 Info = new SoldierSkill(); if (m_skill3_level == 0) { SkillM.GetSkillInfo(m_skill3_type, 1, ref Info); Info.m_enable = false; Info.m_enableQuality = ConfigM.GetEnableSkillQuatlity(4); } else { SkillM.GetSkillInfo(m_skill3_type, m_skill3_level, ref Info); } m_Skillinfo.Add(Info); //4 Info = new SoldierSkill(); if (m_skill4_level == 0) { SkillM.GetSkillInfo(m_skill4_type, 1, ref Info); Info.m_enable = false; Info.m_enableQuality = ConfigM.GetEnableSkillQuatlity(5); } else { SkillM.GetSkillInfo(m_skill4_type, m_skill4_level, ref Info); } m_Skillinfo.Add(Info); //5 Info = new SoldierSkill(); if (m_skill5_level == 0) { SkillM.GetSkillInfo(m_skill5_type, 1, ref Info); Info.m_enable = false; Info.m_enableQuality = ConfigM.GetEnableSkillQuatlity(6); } else { SkillM.GetSkillInfo(m_skill5_type, m_skill5_level, ref Info); } m_Skillinfo.Add(Info); //6 Info = new SoldierSkill(); if (m_askill_level == 0) { SkillM.GetSkillInfo(m_askilltype, 1, ref Info); Info.m_enable = false; Info.m_enableQuality = ConfigM.GetEnableSkillQuatlity(1); } else { SkillM.GetSkillInfo(m_askilltype, m_askill_level, ref Info); } m_Skillinfo.Add(Info); //7 Info = new SoldierSkill(); SkillM.GetSkillInfo(m_lskilltype, 1, ref Info); m_Skillinfo.Add(Info); }
//目标做为攻击目标 public static List <Life> GetSkillTarget(List <Life> Attacklist, SoldierSkill info) { int term1 = info.m_term1; int term2 = info.m_term2; int term3 = info.m_term3; int index = -1; int value = -1; List <Life> l = new List <Life>(); List <Life> temp = new List <Life>(); if (term1 == 0) { return(Attacklist); } //2015.4.23 by txm //分支start List <Life> lbuild = new List <Life>(); List <Life> lRandom = new List <Life> (); for (int i = 0; i < Attacklist.Count; i++) { if (Attacklist[i] is Building) { lbuild.Add(Attacklist[i]); } else if (!(Attacklist[i] is IggWall)) { //Role w = Attacklist[i] as Role; int newvalue = GetTerm1Vaule(Attacklist[i], term1); if (term1 > 0) { bool ret = CheckCondition1(newvalue, term2, term3); if (ret) { temp.Add(Attacklist[i]); } } /* if ((term1 >= 1 && term1 <= 5) || term1 == 99) * { * if (i == 0) * { * value = newvalue; * index = i; * l.Add(Attacklist[i]); * } * else * { * if (CheckCondition(value,newvalue,term2,term3)) * { * value = newvalue; * index = i; * l[0] = Attacklist[i]; * } * } * } * else if(term1 == 8) * { * bool ret = CheckCondition(newvalue,0,term2,term3); * if (ret) * { * lRandom.Add(Attacklist[i]); * } * * if(i == Attacklist.Count -1 && lRandom.Count > 0) * { * int random = Random.Range(0,lRandom.Count -1); * l.Add(lRandom[random]); * } * } * else if (term1 >= 5) * { * bool ret = CheckCondition(newvalue,0,term2,term3); * if (ret) * { * l.Add(Attacklist[i]); * } * * }*/ else if (term1 == 0) { temp.Add(Attacklist[i]); } } } if (temp.Count > 0) { if (term1 == 99 || term1 == 8) { Random.seed = GlobalTimer.GetNowTimeInt(); int i = Random.Range(0, temp.Count); l.Add(temp[i]); } else if (term1 == 0 || term2 < term3) { l.AddRange(temp); } else { for (int i = 0; i < temp.Count; i++) { int newvalue = GetTerm1Vaule(temp[i], term1); if (i == 0) { value = newvalue; index = i; l.Add(temp[i]); } else { if (CheckCondition2(value, newvalue, term2, term3)) { value = newvalue; index = i; l[0] = temp[i]; } } } } } temp.Clear(); if (l.Count == 0) { for (int i = 0; i < lbuild.Count; i++) { if (!(lbuild[i] is IggWall)) { //Role w = Attacklist[i] as Role; int newvalue = GetTerm1Vaule(lbuild[i], term1); if (term1 > 0) { bool ret = CheckCondition1(newvalue, term2, term3); if (ret) { temp.Add(lbuild[i]); } } /* if ((term1 >= 1 && term1 <= 5) || term1 == 99) * { * if (i == 0) * { * value = newvalue; * index = i; * l.Add(lbuild[i]); * } * else * { * if (CheckCondition(value,newvalue,term2,term3)) * { * value = newvalue; * index = i; * l[0] = lbuild[i]; * } * } * } * else if(term1 == 8) * { * bool ret = CheckCondition(newvalue,0,term2,term3); * if (ret) * { * lRandom.Add(lbuild[i]); * } * if(i == lbuild.Count -1 && lRandom.Count > 0) * { * int random = Random.Range(0,lRandom.Count -1); * l.Add(lRandom[random]); * } * } * else if (term1 > 5) * { * bool ret = CheckCondition(newvalue,0,term2,term3); * if (ret) * { * l.Add(lbuild[i]); * } * * }*/ else if (term1 == 0) { l.Add(lbuild[i]); } } } if (temp.Count > 0) { if (term1 == 0 || term2 < term3) { l.AddRange(temp); } else if (term1 == 99 || term1 == 8) { l.Add(temp[Random.Range(0, temp.Count)]); } else { for (int i = 0; i < temp.Count; i++) { int newvalue = GetTerm1Vaule(temp[i], term1); if (i == 0) { value = newvalue; index = i; l.Add(temp[i]); } else { if (CheckCondition2(value, newvalue, term2, term3)) { value = newvalue; index = i; l[0] = temp[i]; } } } } } } return(l); }
//目标做为攻击目标 public static List <Life> GetSkillTarget(List <Life> Attacklist, SoldierSkill info) { int term1 = info.m_term1; int term2 = info.m_term2; int term3 = info.m_term3; int index = -1; int value = -1; List <Life> l = new List <Life>(); for (int i = 0; i < Attacklist.Count; i++) { if (Attacklist[i] is Role) { Role w = Attacklist[i] as Role; int newvalue = GetTerm1Vaule(w, term1); if (term1 >= 1 && term1 <= 3) { if (i == 0) { value = newvalue; index = i; l.Add(Attacklist[i]); } else { if (CheckCondition(value, newvalue, term2, term3)) { value = newvalue; index = i; l[0] = Attacklist[i]; } } } else if (term1 > 3) { bool ret = CheckCondition(newvalue, 0, term2, term3); if (ret) { l.Add(Attacklist[i]); } } else if (term1 == 0) { l.Add(Attacklist[i]); } } else if (Attacklist[i] is Pet) { Pet w = Attacklist[i] as Pet; int newvalue = GetTerm1Vaule(w, term1); if (term1 >= 1 && term1 <= 3) { if (i == 0) { value = newvalue; index = i; l.Add(Attacklist[i]); } else { if (CheckCondition(value, newvalue, term2, term3)) { value = newvalue; index = i; l[0] = Attacklist[i]; } } } else if (term1 > 3) { if (CheckCondition(newvalue, 0, term2, term3)) { l.Add(Attacklist[i]); } } else if (term1 == 0) { l.Add(Attacklist[i]); } } else { // Pet w = Attacklist[i] as Pet; int newvalue = GetTerm1Vaule(Attacklist[i], term1); if (term1 > 3) { if (CheckCondition(newvalue, 0, term2, term3)) { l.Add(Attacklist[i]); } } else if (term1 == 0) { l.Add(Attacklist[i]); } } } /*if (index >= 0) * return mAttacklist[index];*/ return(l); }
/// <summary> /// 设置召唤物数据 /// </summary> private static void SetSummonPetInfo(ref SummonpetInfo Info, s_summonpetInfo I) { if (Info == null || I == null) { return; } Info.m_id = I.id; Info.m_name = I.name; Info.m_type = I.type; Info.m_modeltype = I.modeltype; Info.m_isattack = I.isattack; Info.m_level = I.level; Info.m_shape = I.shape; Info.m_goorder = I.goorder; Info.m_attack_like = I.attack_like; Info.m_attack_type = I.attacktype; Info.m_attack_time = I.attack_time * 0.001f; Info.m_speed = I.speed * 1.0f / MapGrid.m_Pixel; Info.m_jump_distance = I.jump_distance / MapGrid.m_Pixel; Info.m_resist = I.resist; Info.m_hp = I.hp; Info.m_phy_attack = I.physical_attack; Info.m_phy_defend = I.physical_defend; Info.m_phy_crit = I.physical_crit; Info.m_magic_attack = I.magic_attack; Info.m_magic_defend = I.magic_defend; Info.m_magic_crit = I.magic_crit; Info.m_dodge = I.dodge; Info.m_time = I.time; Info.m_AddAttr.SetAddAttrInfo(I); //爆击及闪避 s_soldier_experienceInfo ExpInfo = SoldierM.GetSoldierExpData(I.level); if (ExpInfo != null) { Info.m_critratio = ExpInfo.critratio; Info.m_dodgeratio = ExpInfo.dodgeratio; } // if (I.gskillid > 0) { SoldierSkill skill = new SoldierSkill(); if (SkillM.GetSkillInfo(I.gskillid, ref skill) == true) { Info.m_Skillinfo.Add(skill); } } if (I.skill1id > 0) { SoldierSkill skill = new SoldierSkill(); if (SkillM.GetSkillInfo(I.skill1id, ref skill) == true) { Info.m_Skillinfo.Add(skill); } } if (I.skill2id > 0) { SoldierSkill skill = new SoldierSkill(); if (SkillM.GetSkillInfo(I.skill2id, ref skill) == true) { Info.m_Skillinfo.Add(skill); } } if (I.skill3id > 0) { SoldierSkill skill = new SoldierSkill(); if (SkillM.GetSkillInfo(I.skill3id, ref skill) == true) { Info.m_Skillinfo.Add(skill); } } if (I.skill4id > 0) { SoldierSkill skill = new SoldierSkill(); if (SkillM.GetSkillInfo(I.skill4id, ref skill) == true) { Info.m_Skillinfo.Add(skill); } } }
public virtual void DoAttack(int count) { if (count == 1) { SoldierSkill skill = m_skillinfo as SoldierSkill; if (skill.m_Screen == 1) { MainCameraM.s_Instance.transform.DOShakePosition(skill.m_ScreenTime); } } Life target = m_skillinfo.m_LifeTarget; //m_ConditionSkillTarget[PropSkillInfo.m_type]; MapGrid pos = m_skillinfo.m_TargetPos; //m_ConditionSkillTargetPos[PropSkillInfo.m_type]; if (m_skillinfo.m_target != 2 && target != null) { pos = target.GetMapGrid(); } //if (PropSkillInfo.m_type == 1009 || PropSkillInfo.m_type == 1028) // NGUIUtil.DebugLog( "doskill " + PropSkillInfo.m_type + "," + m_ConditionSkillTarget[PropSkillInfo.m_type] + "," + PropSkillInfo.m_name,"red"); //播放攻击动画 //受击掉血 m_LifePrent.m_Attr.Attacked = true; if (m_skillinfo.m_skilleffectinfo != null && m_skillinfo.m_type != 1005) //RoleModelsM.GetSkillResourcesData(PropSkillInfo.m_type,"HasBullet") == 1) { GameObject posgo = m_LifePrent.GetSkin().ProPerty.HelpPoint.GetVauleByKey(HelpPointName.FirePos); /*if (m_skillinfo.m_type == 1041) * posgo = m_LifePrent.GetSkin().ProPerty.HelpPoint.GetVauleByKey(HelpPointName.LeftHandPos); * else if (m_skillinfo.m_type == 1044) * posgo = m_LifePrent.GetSkin().ProPerty.HelpPoint.GetVauleByKey(HelpPointName.bagPos);*/ Transform fireplace = posgo.transform; if (fireplace != null) { string bulletname = m_skillinfo.m_skilleffectinfo.m_targeteffect; if (BattleEnvironmentM.GetLifeMBornNode(true) == null) { return; } GameObject go = GameObjectLoader.LoadPath("effect/prefab/", bulletname, fireplace.position, BattleEnvironmentM.GetLifeMBornNode(true)); if (m_LifePrent.WalkDir == WalkDir.WALKRIGHT) { go.transform.Rotate(0, 180, 0); } //go.transform.localScale = new Vector3(-go.transform.localScale.x,go.transform.localScale.y,go.transform.localScale.z); Bullet bullet = go.AddComponent <Bullet>(); if (bullet != null) { Bullet.BulletType t = Bullet.BulletType.Bullet; Vector3 vpos = pos.pos; if (m_skillinfo.m_skilleffectinfo.m_postion == 0) { vpos.y = go.transform.localPosition.y; } else { vpos.y += 0.2f; } bullet.SetInfo(vpos, m_DoAttack, 5f, m_LifePrent.WalkDir, t, (m_skillinfo as SoldierSkill), true); //vpos,m_DoAttack,10f,m_LifePrent.WalkDir,t,m_skillinfo as SoldierSkill); } } } else { m_DoAttack(m_skillinfo as SoldierSkill, count); } //m_DoAttack(count); }
/// <summary> /// check 能否释放技能 /// </summary> /// <param name="Attacker">技能发起者</param> /// <param name="ConditionSkillInfo">条件技能</param> /// <param name="attackgo"></param> /// <returns>false:不能释放;true: 能释放</returns> public static bool CheckCanRelease(Role Attacker, SoldierSkill ConditionSkillInfo) { return(false); }
/// <summary> /// Update 调用 /// </summary> public override void Update() { SoldierSkill conditionskillinfo = new SoldierSkill(); bool isnewaction = false; if (CurrentAction == null) { CurrentAction = run.GetNextAction(); DoPathEvent(); #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction:" + CurrentAction + ",mStart:" + CurrentAction.m_Start + ",mEnd:" + CurrentAction.m_End + ",dir:" + CurrentAction.m_Dir + ",mDuration:" + CurrentAction.m_Duration + ",mattackid:" + CurrentAction.m_AttackSceneID + ",mGrid:" + m_Owner.MapPos + ",mNGrid:" + m_run.NGrid + ",deep:" + m_run.RankDeep + ",reject" + m_run.Reject); #endif } else if (CurrentAction.IsDone() /*&& !m_Owner.WaitServer*/) { if (m_Owner.m_bTrunBack) { m_Owner.TurnsInto(false); } else { #if UNITY_EDITOR_LOG string str = "skill:" + m_Owner.PropAttackSkillInfo.m_type + " ,pos" + m_Owner.m_thisT.localPosition + ",mGrid:" + m_Owner.MapPos + ",mNGrid:" + m_run.NGrid + ",deep:" + m_run.RankDeep + ",reject" + m_run.Reject + ", attackstation:" + run.AttackStation + ", Nattackstation:" + run.NAttackStation + ", olddir:" + m_Owner.WalkDir; #endif isnewaction = true; m_ActionList.Add(CurrentAction); CurrentAction = run.GetNextAction(); #if UNITY_EDITOR_LOG if (CurrentAction != null) { FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction1111:" + CurrentAction + ",mStart:" + CurrentAction.m_Start + ",mEnd:" + CurrentAction.m_End + ",dir:" + CurrentAction.m_Dir + ", new dir:" + m_Owner.WalkDir + ",mDuration:" + CurrentAction.m_Duration + ",mattackid:" + CurrentAction.m_AttackSceneID + str + "newGrid" + m_Owner.MapPos + " time:" + Time.realtimeSinceStartup + ", curpos :" + m_Owner.m_thisT.localPosition); } #endif m_Owner.m_Hit = false; if (!m_Owner.m_isDead) { if (m_ActionList[m_ActionList.Count - 1] is GridActionCmdConditionSkill && !(m_ActionList[m_ActionList.Count - 1] as GridActionCmdConditionSkill).RealDone()) { GridActionCmdConditionSkill cs = m_ActionList[m_ActionList.Count - 1] as GridActionCmdConditionSkill; if (!(CurrentAction is GridActionCmdJump || CurrentAction is GridActionCmdStair || CurrentAction is GridActionCmdFall || CurrentAction is GridActionCmdSpecialJump || CurrentAction is GridActionCmdHitByBuild || CurrentAction is GridActionCmdJumpDown || CurrentAction is GridActionCmdJumpUp) ) { bool ismove = false; if (CurrentAction is GridActionCmdWalk) { ismove = true; } cs.ExtendDuration(CurrentAction.m_Duration, CurrentAction.m_Start, CurrentAction.m_End, ismove); #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction4444:" + m_Owner.m_thisT.localPosition); #endif CurrentAction = cs; } } else if (RoleSkill.CheckConditionSkillAction(m_Owner.m_SceneID, ref conditionskillinfo, true, m_Owner.m_SkillRelease)) { #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction3333:" + m_Owner.m_thisT.localPosition + "," + conditionskillinfo.m_type + "," + conditionskillinfo.m_name); #endif if (!(CurrentAction is GridActionCmdJump || CurrentAction is GridActionCmdStair || CurrentAction is GridActionCmdFall || CurrentAction is GridActionCmdSpecialJump)) { bool ismove = false; if (CurrentAction is GridActionCmdWalk) { ismove = true; } //Debug.Log(m_CurrentAction + "," + conditionskillinfo.m_type); GridActionCmd action = null; if (conditionskillinfo.m_ismove == 1) { action = RoleSkill.GetConditionSkillAction(m_Owner.m_SceneID, conditionskillinfo, CurrentAction.m_Start, CurrentAction.m_End, CurrentAction.m_Duration, ismove); } else { action = RoleSkill.GetConditionSkillAction(m_Owner.m_SceneID, conditionskillinfo, CurrentAction.m_Start, CurrentAction.m_Start, CurrentAction.m_Duration, ismove); } if (action != null && action is GridActionSkill) { if (m_Owner.m_Status.SeleStatusInterRupt(conditionskillinfo) == false) { CurrentAction = action; run.ResetIndex(conditionskillinfo.m_ismove == 1); } else { action.SetDone(); } } } } DoPathEvent(); m_Owner.m_SkillRelease = false; if (CurrentAction != null) { List <IggWall> lw = new List <IggWall>(); MapGrid.GetWallList(ref lw, m_Owner.GetMapPos(), run.AttackStation); foreach (IggWall w in lw) { w.OpenDoor(OpenDoorStyle.passDoor, m_Owner.m_Core.m_Camp, Mathf.Abs(m_Owner.GetMapPos().Unit - w.GetMapPos().Unit)); } #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, run.PreGrid + "," + m_Owner.SceneID + ",CurrentAction2222:" + CurrentAction + ",mStart:" + CurrentAction.m_Start + ",mEnd:" + CurrentAction.m_End + ",dir:" + CurrentAction.m_Dir + "new dir" + m_Owner.WalkDir + ",mDuration:" + CurrentAction.m_Duration + ",mattackid:" + CurrentAction.m_AttackSceneID + str + "newGrid" + m_Owner.MapPos + " time:" + Time.realtimeSinceStartup + ", curpos :" + m_Owner.m_thisT.localPosition); #endif } } } } else { if (RoleSkill.CheckConditionSkillAction(m_Owner.m_SceneID, ref conditionskillinfo, false, m_Owner.m_SkillRelease)) { if (CurrentAction is GridActionCmdAttack || CurrentAction is GridActionCmdConditionSkill) { if (conditionskillinfo.m_ipriority > m_Owner.PropSkillInfo.m_ipriority) { CurrentAction.SetDone(); m_ActionList.Add(CurrentAction); CurrentAction = RoleSkill.GetConditionSkillAction(m_Owner.m_SceneID, conditionskillinfo, m_Owner.m_thisT.localPosition, m_Owner.m_thisT.localPosition, 0f, false); } } } } if (CurrentAction != null) { if (CurrentAction is GridActionCmdWalk) { List <int> rolelist = new List <int>(); MapGrid g = MapGrid.GetMG(run.PreGrid); g.GetRoleList(ref rolelist); int bwalk = 0; if (rolelist.Count > 0) { for (int i = 0; i < rolelist.Count; i++) { Role l = CM.GetAllLifeM(rolelist[i], LifeMType.SOLDIER | LifeMType.SUMMONPET) as Role; if (l == null) { continue; } if (l != m_Owner && l.m_Attr.Goorder >= m_Owner.m_Attr.Goorder) { if (l.CurrentAction is GridActionCmdWalk) { bwalk++; if (l.m_Attr.Goorder == m_Owner.m_Attr.Goorder && l.SceneID < m_Owner.SceneID) { bwalk--; } } } } } if (!isnewaction) { if (bwalk == 0) { if (CurrentAction.m_TimeCount == 0 && m_Owner.m_ajustcount < m_Owner.m_ajustduration) { m_Owner.AdjustPosition(Time.deltaTime); } else { CurrentAction.Update(); } } else if (bwalk == 1 && CurrentAction.m_TimeCount == 0) { m_Owner.AdjustPosition(Time.deltaTime); } } else { if (bwalk > 0) { run.ChangeDeep(0); //m_Owner.m_ajustcount = m_Owner.m_ajustduration; } else { m_Owner.m_ajustcount += m_Owner.m_ajustduration; } } } else { CurrentAction.Update(); } if (CurrentAction.TestNextDone()) { if (CurrentAction is GridActionCmdAttack || CurrentAction is GridActionCmdCDStand || CurrentAction is GridActionCmdHit || CurrentAction is GridActionCmdSkillStand || CurrentAction is GridActionCmdFallDown || (CurrentAction is GridActionCmdConditionSkill && m_Owner.PropSkillInfo.m_ismove == 0)) { run.RegisterNextAction(false); } else { run.RegisterNextAction(); } } } else { #if UNITY_EDITOR_LOG FileLog.write(m_Owner.m_SceneID, m_Owner.m_SceneID + "创建action出错" + ",技能类型:" + m_Owner.PropSkillInfo.m_type); Debug.LogError(m_Owner.m_thisT.gameObject.name + m_Owner.m_SceneID + "创建action出错" + ",技能类型:" + m_Owner.PropSkillInfo.m_type); #endif } }
public void ReSetBigCDTime() { SoldierSkill bigskill = GetBigSkill(); m_CdTime = bigskill.m_cd * 0.001f; }
/// <summary> /// 设置技能 /// </summary> private static void SetSoldierSkill(s_skillupInfo up, s_skill_typeInfo v, ref SoldierSkill Info) { if (v == null || Info == null || up == null) { return; } Info.m_id = up.id; Info.m_level = up.level; //Info.m_soldierid = v.soldierid; Info.m_power1 = up.power1; Info.m_power2 = up.power2; //Info.m_percent = up.percent; SetSkillStatus(ref Info.m_own_status, up.own_status); SetSkillStatus(ref Info.m_attack_status_own, up.attack_status_own); SetSkillStatus(ref Info.m_attack_status_enemy, up.attack_status_enemy); SetSkillStatus(ref Info.m_buildstatus, up.buildstatus); //Info.m_attr_type = v.at; Info.m_data0 = up.data0; Info.m_data1 = up.data1; Info.m_data2 = up.data2; Info.m_data3 = up.data3; //Info.m_ldistance = v.ldistance; Info.m_rankslevel = up.ranklevel; //Info.m_trapbreach = v.trapbreach; Info.m_description2 = up.description; Info.m_power3 = up.power3; Info.m_power4 = up.power4; Info.m_ischangetarget = v.ischangetarget; Info.m_step_secs = v.step_secs; Info.m_intone_speed = v.intone_speed; SetSkillStatus(ref Info.m_releasedown_status, v.releasedown_status); SetSkillStatus(ref Info.m_releasedenemy_status, v.releasedenemy_status); SetSkillStatus(ref Info.m_releasedself_status, v.releasedself_status); Info.m_type = v.type; Info.m_name = v.name; Info.m_attacktype = v.attacktype; Info.m_priority = v.priority; Info.m_sort = v.sort; Info.m_multiple = v.multiple; Info.m_actiontype = v.actiontype; Info.m_use_mp = v.use_mp; Info.m_target = v.target; Info.m_distance = v.distance; Info.m_term1 = v.term1; Info.m_term2 = v.term2; Info.m_term3 = v.term3; Info.m_cd = v.cd; Info.m_timeinterval = v.timeinterval; Info.m_range = (v.range * MapGrid.m_width / MapGrid.m_Pixel); Info.m_attckmodeid = v.attackmodeid; s_attackmodeInfo I = GetAttackMode(Info.m_attckmodeid); if (I != null) { SetAttackPower(I, ref Info.m_lAttackPower); } Info.m_interrupt_skill = v.interrupt_skill; Info.m_condition = v.condition; Info.m_condition_data0 = v.condition_data0; Info.m_condition_data1 = v.condition_data1; Info.m_ipriority = v.ipriority; Info.m_struckeffect = v.struckeffect; Info.m_ismove = v.ismove; Info.m_blackscreentime = v.blackscreentime * 0.001f; s_skilleffectInfo e = GetSkillEffect(Info.m_type); if (e != null) { SetSkillEffect(e, ref Info.m_skilleffectinfo); } SetSkillAttributeType(ref Info.m_AttributeType, v.attribute); Info.m_description1 = v.description1; Info.m_status_hitratio = v.status_hitratio * 0.001f; Info.m_targettype = v.targettype; Info.m_damagetargettype = v.damagetargettype; Info.m_Screen = v.screen; Info.m_ScreenTime = v.screentime * 0.001f; }