public Skill(string[] temps) { int offset = 0; ID = temps[offset].ToString(); offset++; Name = temps[offset].ToString(); offset++; Ico = temps[offset].ToString(); offset++; SkillType = (Global.SkillType) int.Parse(temps[offset]); offset++; SkillMono = temps[offset].ToString(); offset++; SkillEndDelay = float.Parse(temps[offset].ToString()); offset++; IsPassiveSkill = temps[offset].ToString() == "0" ? false : true; offset++; SkillEffectPaths = new List <string>(); SkillEffectPaths.AddRange(temps[offset].ToString().Split(new string[] { "|" }, System.StringSplitOptions.RemoveEmptyEntries)); offset++; ActiveState = (Global.BuffActiveState) int.Parse(temps[offset]); offset++; TargetType = (Global.SkillTargetType) int.Parse(temps[offset]); offset++; Level = int.Parse(temps[offset]); offset++; CostHeroProperty = new HeroProperty(temps[offset]); offset++; DelayTurn = int.Parse(temps[offset]); offset++; CauseHeroProperty = new HeroProperty(temps[offset]); offset++; HurtHeroProperty = new HeroProperty(temps[offset]); offset++; CriticalChance = int.Parse(temps[offset]); offset++; SkillBuff = new List <Buff>(); string[] buffs = temps[offset].ToString().Split(';'); offset++; for (int i = 0; i < buffs.Length; i++) { string[] bf = buffs[i].Split('|'); if (bf.Length == 2) { SkillBuff.Add(new Buff(bf[0], int.Parse(bf[1]))); } } Description = temps[offset].ToString(); offset++; }
/// <summary> /// 在特定状态下执行一个技能 /// </summary> /// <param name="activeState">特定的状态</param> /// <returns>如果有技能发动,则返回true,否则返回false</returns> public bool ExcuteSkill(Global.BuffActiveState activeState) { if (IsDead()) { if (activeState != Global.BuffActiveState.IsDead) { OnDead(); return(false); } if (!HasIsDeadSkill()) { OnDead(); return(false); } } bool result = false; foreach (BaseSkill skill in _Skills.Values) { if (skill.IsPassiveSkill && skill.ActiveState == activeState) { Attack(skill.SkillType); result = true; } } return(result); }
/// <summary> /// Buff构造函数 /// </summary> /// <param name="ID">ID</param> public Buff(string ID) { this.ID = ID; this.Name = "Buff"; this.BuffType = Global.BuffType.IncreaseLife; this.TargetType = Global.BuffTargetType.None; this.BuffActiveState = Global.BuffActiveState.BeforeAction; this.ChangeHeroProperty = new HeroProperty(); this.IsBuff = true; this.Description = "buff描述"; }
/// <summary> /// 根据技能进行构造数据 /// </summary> /// <param name="ID">技能ID</param> /// <param name="chance">技能成功几率</param> public Buff(string ID, int chance) { Buff buff = BuffTable.Instance.GetBuffByID(ID); this.ID = buff.ID; this.Name = buff.Name; this.BuffType = buff.BuffType; this.TargetType = buff.TargetType; this.BuffActiveState = buff.BuffActiveState; this.StayTurn = buff.StayTurn; this.ChangeHeroProperty = buff.ChangeHeroProperty; this.IsBuff = buff.IsBuff; this.Description = buff.Description; this.SuccessChance = chance; }
/// <summary> /// 通过读取表格数据使用的构造函数 /// </summary> /// <param name="temps">读取的一条表格数据</param> public Buff(string[] temps) { int offset = 0; ID = temps[offset].ToString(); offset++; Name = temps[offset].ToString(); offset++; BuffType = (Global.BuffType) int.Parse(temps[offset]); offset++; TargetType = (Global.BuffTargetType) int.Parse(temps[offset]); offset++; BuffActiveState = (Global.BuffActiveState) int.Parse(temps[offset]); offset++; ChangeHeroProperty = new HeroProperty(temps[offset]); offset++; IsBuff = temps[offset] == "0" ? false : true; offset++; SuccessChance = int.Parse(temps[offset]); offset++; Description = temps[offset].ToString(); offset++; //赋值buff持续回合 StayTurn = ChangeHeroProperty.Turn; }
/// <summary> /// 编辑器使用的构造函数 /// </summary> /// <param name="ID">ID</param> /// <param name="Level">等级</param> public Skill(string ID, int Level) { this.ID = ID; this.Level = Level; this.Name = "新技能"; this.Ico = ""; this.SkillType = Global.SkillType.Physic; this.SkillMono = "BaseSkill"; this.SkillEndDelay = 0f; this.IsPassiveSkill = false; this.SkillEffectPaths = new List <string>(); this.ActiveState = Global.BuffActiveState.Actioning; this.TargetType = Global.SkillTargetType.None; this.CostHeroProperty = new HeroProperty(); this.DelayTurn = 0; this.CauseHeroProperty = new HeroProperty(); this.HurtHeroProperty = new HeroProperty(); this.CriticalChance = 0; this.SkillBuff = new List <Buff>(); this.Description = "技能描述"; }
/// <summary> /// 执行一遍某个状态会激活得buff /// </summary> /// <param name="buffState">执行的状态</param> public void ExcuteBuff(Global.BuffActiveState buffState) { if (IsDead() && buffState != Global.BuffActiveState.IsDead) { return; } //执行增益状态 for (int i = 0; i < _BuffList.Count; i++) { if (buffState == _BuffList[i].BuffActiveState) { SkillController.Instance.ExcuteBuff(this, _BuffList[i]); BuffTurnCost(_BuffList[i]); BattleController.Instance.CurrentBattleUI.OnBuffAction(this, _BuffList[i]); if (_BuffList[i].StayTurn <= 0) { //表示这个buff已经结束了,需要移除 RemoveBuff(_BuffList[i]); } } } //执行负面状态 for (int i = 0; i < _DebuffList.Count; i++) { if (buffState == _DebuffList[i].BuffActiveState) { SkillController.Instance.ExcuteBuff(this, _DebuffList[i]); BuffTurnCost(_DebuffList[i]); BattleController.Instance.CurrentBattleUI.OnBuffAction(this, _DebuffList[i]); if (_DebuffList[i].StayTurn <= 0) { //表示这个buff已经结束了,需要移除 RemoveBuff(_DebuffList[i]); } } } }