protected override void ResetSelf() { if (character.GetComponent <CharacterStatus>().Buffs.Contains(buff)) { buff.Undo(character); } }
public virtual void GetHit() { if (calculateDamage) { //寻找是否有最终伤害buff FinalDamageBuff finalDamageBuff = (FinalDamageBuff)character.GetComponent <Unit>().Buffs.Find(b => b.GetType() == typeof(FinalDamageBuff)); foreach (var o in other) { //<伤害序列,伤害结果> List <int> damageList = new List <int>(); if (ExtraHitSystem(extraHit)) { DebugLogPanel.GetInstance().Log("速击!" + "(" + character.GetComponent <CharacterStatus>().roleCName + " -> " + o.GetComponent <CharacterStatus>().roleCName + ")"); hit++; } //每Hit for (int i = 0; i < hit; i++) { int d; var doNextHit = DamageSystem.ApplyDamage(character, o, this, comboSkill == null && hoverRange == 0 || comboSkill != null && comboSkill.hoverRange == 0, finalDamageBuff == null ? 0 : finalDamageBuff.Factor, out d); damageList.Add(d); if (!doNextHit) { break; } } //如果有最终伤害Buff,且Duration小于0,手动撤销影响。(此处应为倍化术) if (finalDamageBuff != null && finalDamageBuff.Duration < 0) { finalDamageBuff.Undo(character); } for (int i = 0; i < damageList.Count; i++) { bool donePost = false; //异步时,要把迭代器传进去。 GameController.GetInstance().Invoke(j => { if (o) { //飘字 if (damage > 0) { if (damageList[j] > 0) { //受击动作 HitEffect(o); UIManager.GetInstance().FlyNum(o.GetComponent <CharacterStatus>().arrowPosition / 2 + o.position, damageList[j].ToString(), Color.white, true); } else if (damageList[j] == 0) { UIManager.GetInstance().FlyNum(o.GetComponent <CharacterStatus>().arrowPosition / 2 + o.position, damageList[j].ToString(), Color.white, false); } else if (damageList[j] < 0) { //受击动作 HitEffect(o); } } else { UIManager.GetInstance().FlyNum(o.GetComponent <CharacterStatus>().arrowPosition / 2 + o.position, Mathf.Abs(damageList[j]).ToString(), UIManager.hpColor, false); } if (!donePost) { PostEffect(o); donePost = true; } } }, hitInterval * i, i); } } } }
public override void Effect() { if (effectState == EffectState.origin) { originSkill.Effect(); } else { //结算消耗以及动作归位。 base.Effect(); if (calculateDamage) { //寻找是否有最终伤害buff FinalDamageBuff finalDamageBuff = (FinalDamageBuff)character.GetComponent <Unit>().Buffs.Find(b => b.GetType() == typeof(FinalDamageBuff)); foreach (var o in other) { //<伤害序列,伤害结果> Dictionary <int, int> damageDic = new Dictionary <int, int>(); //每Hit for (int i = 0; i < hit; i++) { int d; var doNextHit = DamageSystem.ApplyDamage(character, o, skipDodge, damageFactor, skillRate, extraCrit, extraPounce, comboSkill == null && hoverRange == 0 || comboSkill != null && comboSkill.hoverRange == 0, finalDamageBuff == null ? 0 : finalDamageBuff.Factor, out d); damageDic.Add(i, d); if (!doNextHit) { break; } } //如果有最终伤害Buff,且Duration小于0,手动撤销影响。(此处应为倍化术) if (finalDamageBuff != null && finalDamageBuff.Duration < 0) { finalDamageBuff.Undo(character); } //comboSkill是指组合技的第二个技能。这里说明是第一个技能,结合前面的条件,则这里是无连续技的技能逻辑。 if (comboSkill == null) { //寻求合击的逻辑 var comboUnits = DamageSystem.ComboDetect(character, o); if (comboUnits.Count > 0) { for (int i = 0; i < comboUnits.Count; i++) { int d; FinalDamageBuff u_finalDamageBuff = (FinalDamageBuff)comboUnits[i].GetComponent <Unit>().Buffs.Find(b => b.GetType() == typeof(FinalDamageBuff)); var ninjaCombo = new NinjaCombo(); ninjaCombo.SetLevel(comboUnits[i].GetComponent <CharacterStatus>().skills["NinjaCombo"]); DamageSystem.ApplyDamage(comboUnits[i], o, false, ninjaCombo.damageFactor, ninjaCombo.skillRate, ninjaCombo.extraCrit, ninjaCombo.extraPounce, ninjaCombo.hoverRange == 0, u_finalDamageBuff == null ? 0 : u_finalDamageBuff.Factor, out d); damageDic.Add(damageDic.Count + i, d); comboUnits[i].GetComponent <Animator>().SetInteger("Skill", 0); } } } FlyNum(damageDic, o); } } } }
public override void Effect() { if (effectState == EffectState.origin) { originSkill.Effect(); } else { base.Effect(); FinalDamageBuff finalDamageBuff = (FinalDamageBuff)character.GetComponent <Unit>().Buffs.Find(b => b.GetType() == typeof(FinalDamageBuff)); foreach (var o in other) { //<伤害序列,伤害结果> Dictionary <int, int> damageDic = new Dictionary <int, int>(); //每Hit for (int i = 0; i < hit; i++) { int d; var doNextHit = DamageSystem.ApplyDamage(character, o, damageFactor, skillRate, extraCrit, extraPounce, comboSkill == null && hoverRange == 0 || comboSkill != null && comboSkill.hoverRange == 0, finalDamageBuff == null ? 0 : finalDamageBuff.Factor, out d); damageDic.Add(i, d); if (!doNextHit) { break; } } foreach (var data in damageDic) { RoundManager.GetInstance().Invoke(i => { if (o) { if (data.Value >= 0) { UIManager.GetInstance().FlyNum(o.GetComponent <CharacterStatus>().arrowPosition / 2 + o.position + Vector3.down * 0.2f * i + Vector3.left * 0.2f * (Mathf.Pow(-1, i) > 0 ? 0 : 1), damageDic[i].ToString()); } } }, 0.2f * data.Key, data.Key); } if (finalDamageBuff != null && finalDamageBuff.Duration < 0) { finalDamageBuff.Undo(character); } //comboSkill是指组合技的第二个技能。 if (comboSkill == null) { var comboUnits = DamageSystem.ComboDetect(character, o); if (comboUnits.Count > 0) { foreach (var u in comboUnits) { int d; FinalDamageBuff u_finalDamageBuff = (FinalDamageBuff)u.GetComponent <Unit>().Buffs.Find(b => b.GetType() == typeof(FinalDamageBuff)); var ninjaCombo = new NinjaCombo(); ninjaCombo.SetLevel(u.GetComponent <CharacterStatus>().skills["NinjaCombo"]); DamageSystem.ApplyDamage(u, o, ninjaCombo.damageFactor, ninjaCombo.skillRate, ninjaCombo.extraCrit, ninjaCombo.extraPounce, ninjaCombo.hoverRange == 0, u_finalDamageBuff == null ? 0 : u_finalDamageBuff.Factor, out d); UIManager.GetInstance().FlyNum(o.GetComponent <CharacterStatus>().arrowPosition / 2 + o.position, d.ToString()); u.GetComponent <Animator>().SetInteger("Skill", 0); } } } } } }