public override void Excute() { int count = 0; for (int i = 0; i < owner.Data.BuffList.Count; i++) { BattleBuffData buff = owner.Data.BuffList[i]; if (buff.BuffId == actionArg) { count = buff.Layer; break; } } if (count < 3) { owner.Data.MP += 5; if (owner.Data.MP > owner.Data.MaxMP) { owner.Data.MP = owner.Data.MaxMP; } } if (count >= 3) { owner.Data.MP += 5; if (owner.Data.MP > owner.Data.MaxMP) { owner.Data.MP = owner.Data.MaxMP; } Create(BattleActionType.Attack, 1, 0, sourceData, owner, target, null).Excute(); } }
public override void Excute() { Debug.LogError((owner.IsMe ? "[我]" : "[怪]") + "添加了一个buff-> " + actionArg + "[L:" + actionArg2 + "][T:" + BattleBuffTableSettings.Get(actionArg).Time + "]"); //buff已经存在的标识 bool added = false; for (int i = 0; i < owner.Data.BuffList.Count; i++) { BattleBuffData buff = owner.Data.BuffList[i]; if (actionArg == buff.BuffId) { added = true; //刷新buff时间,不叠加 BattleBuffTableSetting buffData = BattleBuffTableSettings.Get(buff.BuffId); if (buffData.IsOverlay) { buff.Layer = Mathf.Max(buff.Layer + buffData.DefaultLayer, buffData.MaxLayer); } //有持续时间的 if (buff.Time >= 0) { //buff.Time = Mathf.Max(buff.Time + buffData.Time, buffData.MaxLayer); buff.Time = buff.Time + buffData.Time; } break; } } if (added == false) { BattleBuffData buffData = null; if (userdata != null && (userdata is BattleBuffData)) { //转移buff BattleBuffData sourceBuff = (userdata as BattleBuffData); buffData = new BattleBuffData(actionArg, sourceBuff.Time, sourceBuff.Layer, sourceData, owner, owner); } else { //新增buff buffData = new BattleBuffData(actionArg, 0, actionArg2, sourceData, owner, owner); } owner.Data.BuffList.Add(buffData); //UI用独立的buff数据,和血量什么的一样 battleMgr.AddUIAction(new UIAction.UIAddBuff(buffData)); //battleMgr.AddUIAction(new UIAction.UIAddBuff(new BattleBuffData(actionArg, actionArg2, sourceData, owner, owner))); } }
public override void Excute() { for (int i = 0; i < target.Data.BuffList.Count; i++) { BattleBuffData buff = target.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.DodgeDamage: //播放闪避动画 buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } battleMgr.AddUIAction(new UIAction.UIDodgeDamage()); return; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { switch ((BattleActionType)equip.Data.ActionTypes[j]) { case BattleActionType.DodgeDamage: //播放闪避动画 battleMgr.AddUIAction(new UIAction.UIDodgeDamage()); return; default: break; } } } target.Data.HP -= actionArg; Debug.LogError((owner.IsMe ? "[我]" : "[怪]") + "无视防御伤害" + (target.IsMe ? "[我]" : "[怪]") + "了 " + actionArg + "[" + target.Data.HP + "/" + target.Data.MaxHP + "]"); battleMgr.AddUIAction(new UIAction.UIHpDamage(target, actionArg)); }
public override void Excute() { BattlePlayer player = actionArg == 0 ? owner : target; List <BattleBuffData> removeList = new List <BattleBuffData>(); for (int i = 0; i < player.Data.BuffList.Count; i++) { BattleBuffData buff = player.Data.BuffList[i]; if (buff.Data.DispelGrade <= actionArg2) { removeList.Add(buff); } } for (int i = 0; i < removeList.Count; i++) { player.Data.BuffList.Remove(removeList[i]); } }
public override void Excute() { if (sourceData.ItemType == BattleEffectItemType.Buff) { BattleBuffData buff = sourceData as BattleBuffData; buff.Layer -= actionArg; if (buff.Layer <= 0) { sourceData.Owner.Data.BuffList.Remove(buff); } battleMgr.AddUIAction(new UIAction.UIRemoveBuff(target, buff.BuffId, actionArg)); return; } else { Debug.LogError("这是BUFF专用效果!"); } }
void SetBuffUI() { foreach (var item in buffIcons) { item.Value.SetActive(false); } List <BattleBuffData> removeList = new List <BattleBuffData>(); for (int i = 0; i < playerInfo.Buffs.Count; i++) { BattleBuffData buffData = playerInfo.Buffs[i]; //if (buffData.Time == 0) //{ // removeList.Add(buffData); // continue; //} GameObject buffIcon; if (!buffIcons.ContainsKey(buffData.BuffId)) { buffIcon = Instantiate(goBuffIconTemplete, gridBuffGrid.transform); buffIcon.name = buffData.BuffId.ToString(); buffIcons.Add(buffData.BuffId, buffIcon); buffIcon.transform.Find("icon").GetComponent <UITexture>().Load(buffData.Data.IconID); UIUtility.SetBuffTips(buffIcon, buffData.BuffId); } else { buffIcon = buffIcons[buffData.BuffId]; } buffIcon.SetActive(true); buffIcon.transform.Find("Label").GetComponent <UILabel>().text = buffData.Layer > 1 ? buffData.Layer.ToString() : ""; buffIcon.transform.Find("border").GetComponent <UITexture>().fillAmount = buffData.Time == -1 ? 1f : ((float)buffData.Time / (float)buffData.Data.Time); } for (int i = 0; i < removeList.Count; i++) { playerInfo.Buffs.Remove(removeList[i]); } //if (removeList.Count > 0) { gridBuffGrid.Reposition(); } }
public void AddBuff(BattleBuffData buffData) { playerInfo.Buffs.Add(buffData); }
public override void Excute() { int finalDamage = actionArg; bool skipDamage = false; //先计算加伤 for (int i = 0; i < owner.Data.BuffList.Count; i++) { BattleBuffData buff = owner.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.BuffLayerDamage: finalDamage = finalDamage + buff.Layer * buff.Data.ActionParams[j]; buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } break; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { switch ((BattleActionType)equip.Data.ActionTypes[j]) { default: break; } } } //没有伤害,不消耗特效 if (finalDamage == 0) { return; } //计算减伤 for (int i = 0; i < target.Data.BuffList.Count; i++) { BattleBuffData buff = target.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { if (skipDamage) { break; } switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.DefenseDamage: finalDamage = finalDamage - buff.Data.ActionParams[j]; buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } break; case BattleActionType.WithstandOneAttack: buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } skipDamage = true; break; case BattleActionType.DodgeDamage: //播放闪避动画 buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } battleMgr.AddUIAction(new UIAction.UIDodgeDamage()); skipDamage = true; break; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { if (skipDamage) { break; } switch ((BattleActionType)equip.Data.ActionTypes[j]) { case BattleActionType.DefenseDamage: finalDamage = finalDamage - equip.Data.ActionPrarms[j]; break; case BattleActionType.WithstandOneAttack: skipDamage = true; break; case BattleActionType.DodgeDamage: //播放闪避动画 skipDamage = true; battleMgr.AddUIAction(new UIAction.UIDodgeDamage()); break; default: break; } } } //应用伤害 if (!skipDamage) { target.Data.HP -= finalDamage; Debug.LogError((owner.IsMe ? "[我]" : "[怪]") + "伤害" + (target.IsMe ? "[我]" : "[怪]") + "了 " + finalDamage + "[" + target.Data.HP + "/" + target.Data.MaxHP + "]"); battleMgr.AddUIAction(new UIAction.UIHpDamage(target, finalDamage)); for (int i = 0; i < target.Data.BuffList.Count; i++) { BattleBuffData buff = target.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.ReflectionDamage: if (depth > 1) { break; } buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } if (actionArg > UnityEngine.Random.Range(0, 100)) { Create(BattleActionType.Attack, finalDamage, 0, buff.CardData, target, owner, buff).Excute(); } break; case BattleActionType.GetOppHandCardByAttack: buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } Create(BattleActionType.GetOppHandCardByAttack, buff.Data.ActionParams[j], buff.Data.ActionParams2[j], buff.CardData, owner, target, buff).Excute(); break; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { switch ((BattleActionType)equip.Data.ActionTypes[j]) { case BattleActionType.ReflectionDamage: if (depth > 1) { break; } if (actionArg > UnityEngine.Random.Range(0, 100)) { Create(BattleActionType.Attack, finalDamage, 0, equip.CardData, target, owner, equip).Excute(); } break; default: break; } } } } //计算附加伤害 int extraDamage = 0; skipDamage = false; for (int i = 0; i < owner.Data.BuffList.Count; i++) { BattleBuffData buff = owner.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.ExtraPercentDamage: extraDamage += Mathf.RoundToInt((float)finalDamage * ((float)buff.Data.ActionParams[j] / 100f)); buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } break; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { switch ((BattleActionType)equip.Data.ActionTypes[j]) { case BattleActionType.ExtraPercentDamage: extraDamage += Mathf.RoundToInt((float)finalDamage * ((float)equip.Data.ActionPrarms[j] / 100f)); break; default: break; } } } //没有伤害,不消耗特效 if (extraDamage == 0) { return; } //附加伤害的减伤 for (int i = 0; i < target.Data.BuffList.Count; i++) { BattleBuffData buff = target.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { if (skipDamage) { break; } switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.DefenseDamage: extraDamage = extraDamage - buff.Data.ActionParams[j]; buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } break; case BattleActionType.WithstandOneAttack: buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } skipDamage = true; break; case BattleActionType.DodgeDamage: //播放闪避动画 buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } battleMgr.AddUIAction(new UIAction.UIDodgeDamage()); skipDamage = true; break; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { if (skipDamage) { break; } switch ((BattleActionType)equip.Data.ActionTypes[j]) { case BattleActionType.DefenseDamage: extraDamage = extraDamage - equip.Data.ActionPrarms[j]; break; case BattleActionType.WithstandOneAttack: skipDamage = true; break; case BattleActionType.DodgeDamage: //播放闪避动画 skipDamage = true; battleMgr.AddUIAction(new UIAction.UIDodgeDamage()); break; default: break; } } } //应用附加伤害 if (!skipDamage) { target.Data.HP -= extraDamage; Debug.LogError((owner.IsMe ? "[我]" : "[怪]") + "额外伤害" + (target.IsMe ? "[我]" : "[怪]") + "了 " + extraDamage + "[" + target.Data.HP + "/" + target.Data.MaxHP + "]"); battleMgr.AddUIAction(new UIAction.UIHpDamage(target, extraDamage)); for (int i = 0; i < target.Data.BuffList.Count; i++) { BattleBuffData buff = target.Data.BuffList[i]; for (int j = 0; j < buff.Data.ActionTypes.Count; j++) { switch ((BattleActionType)buff.Data.ActionTypes[j]) { case BattleActionType.ReflectionDamage: if (depth > 1) { break; } buff.Layer--; if (buff.Layer == 0) { target.Data.BuffList.RemoveAt(i); } if (actionArg > UnityEngine.Random.Range(0, 100)) { Create(BattleActionType.Attack, extraDamage, 0, buff.CardData, target, owner, buff).Excute(); } break; default: break; } } } for (int i = 0; i < target.Data.EquipList.Count; i++) { BattleEquipData equip = target.Data.EquipList[i]; for (int j = 0; j < equip.Data.ActionTypes.Count; j++) { switch ((BattleActionType)equip.Data.ActionTypes[j]) { case BattleActionType.ReflectionDamage: if (depth > 1) { break; } if (actionArg > UnityEngine.Random.Range(0, 100)) { Create(BattleActionType.Attack, extraDamage, 0, equip.CardData, target, owner, equip).Excute(); } break; default: break; } } } } }
public UIAddBuff(BattleBuffData buffData) : base() { BuffData = buffData; }