public override IEnumerator Excute() { yield return(null); BattleEquipData removedEquip = null; PlayerInfoView playerInfoView = BattleForm.GetPlayerInfoViewByPlayer(EquipData.Owner); if (playerInfoView.PlayerInfo.Equips.Count > 0 && playerInfoView.PlayerInfo.Equips.Count >= BattleMgr.MAX_EQUIP_COUNT) { removedEquip = playerInfoView.PlayerInfo.Equips[0]; playerInfoView.PlayerInfo.Equips.RemoveAt(0); } playerInfoView.PlayerInfo.Equips.Add(EquipData); GameObject goEquip = null; if (playerInfoView.EquipIcons.ContainsKey(EquipData.EquipId)) { goEquip = playerInfoView.EquipIcons[EquipData.EquipId]; } if (goEquip == null) { goEquip = GameObject.Instantiate(playerInfoView.goEquipTemplete); playerInfoView.EquipIcons.Add(EquipData.EquipId, goEquip); goEquip.transform.parent = playerInfoView.gridEquipGrid.transform; goEquip.transform.localScale = Vector3.one; } goEquip.SetActive(true); goEquip.name = EquipData.EquipId.ToString(); UIUtility.SetEquipTips(goEquip, EquipData.EquipId); goEquip.transform.Find("Icon").GetComponent <UITexture>().Load(EquipData.Data.IconID); yield return(null); playerInfoView.gridEquipGrid.Reposition(); }
public override void Excute() { if (owner.Data.EquipList.Count > 0 && owner.Data.EquipList.Count >= BattleMgr.MAX_EQUIP_COUNT) { owner.Data.EquipList.RemoveAt(0); } BattleEquipData battleEquipData = new BattleEquipData(actionArg, sourceData, owner); owner.Data.EquipList.Add(battleEquipData); battleMgr.AddUIAction(new UIAction.UIAddEquip(battleEquipData)); }
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 UIAddEquip(BattleEquipData battleCardData) : base() { EquipData = battleCardData; }
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; } } } } }