2021-04-08 20:09:59 +08:00
|
|
|
|
using Cal;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
using Cal.DataTable;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public enum NumTargetType
|
|
|
|
|
{
|
|
|
|
|
Self,
|
|
|
|
|
Target
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static class BattleHelper
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
public static void GetNumType(ValueCalculate valueCalculate, NumTargetType numTargetType, NumericComponent _num, NumericComponent _numTarget,
|
|
|
|
|
out NumericComponent num, out NumericType numericType)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
num = numTargetType switch
|
|
|
|
|
{
|
|
|
|
|
NumTargetType.Self => _num,
|
|
|
|
|
NumTargetType.Target => _numTarget ?? throw new Exception("numTarget is null ,baseOriType 类型错误!"),
|
|
|
|
|
_ => throw new Exception("baseOriType 类型错误!"),
|
|
|
|
|
};
|
|
|
|
|
numericType = valueCalculate.calculateType switch
|
|
|
|
|
{
|
|
|
|
|
ValueCalculateType.物理攻击力x系数 => NumericType.PhyAtk,
|
|
|
|
|
ValueCalculateType.精神攻击力x系数 => NumericType.SpiAtk,
|
|
|
|
|
ValueCalculateType.生命值上限x系数 => NumericType.MaxHp,
|
|
|
|
|
ValueCalculateType.当前生命值x系数 => NumericType.Hp,
|
|
|
|
|
_ => throw new Exception("basePercEffectType 类型错误!")
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算伤害
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="damageType"></param>
|
|
|
|
|
/// <param name="owner"></param>
|
|
|
|
|
/// <param name="target"></param>
|
|
|
|
|
/// <param name="damageCalculate_Self"></param>
|
|
|
|
|
/// <param name="damageCalculate_Target"></param>
|
|
|
|
|
/// <param name="data"></param>
|
2021-04-18 15:54:51 +08:00
|
|
|
|
internal static void Calculate(SkillDamageType damageType, ISkillSender skillSender, Unit target, ValueCalculate damageCalculate_Self,
|
|
|
|
|
ValueCalculate damageCalculate_Target, out BallisticData data)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
if (damageCalculate_Self == null && damageCalculate_Target == null)
|
|
|
|
|
{
|
|
|
|
|
data = default;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = skillSender.caster.GetComponent<NumericComponent>();
|
|
|
|
|
NumericComponent numTarget = target.GetComponent<NumericComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
switch (damageType)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case SkillDamageType.None:
|
|
|
|
|
data = default;
|
|
|
|
|
break;
|
|
|
|
|
case SkillDamageType.物理伤害:
|
2021-04-18 15:54:51 +08:00
|
|
|
|
PhyBuffDamageCalculate.Calculate(num, numTarget, damageCalculate_Self, damageCalculate_Target,
|
|
|
|
|
skillSender.skillLogic.skillConfigId, out data);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case SkillDamageType.精神伤害:
|
2021-04-18 15:54:51 +08:00
|
|
|
|
SpiBuffDamageCalculate.Calculate(num, numTarget, damageCalculate_Self, damageCalculate_Target,
|
|
|
|
|
skillSender.skillLogic.skillConfigId, out data);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case SkillDamageType.真实伤害:
|
2021-04-18 15:54:51 +08:00
|
|
|
|
RealBuffDamageCalculate.Calculate(num, numTarget, damageCalculate_Self, damageCalculate_Target,
|
|
|
|
|
skillSender.skillLogic.skillConfigId, out data);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case SkillDamageType.护盾治疗:
|
2021-04-18 15:54:51 +08:00
|
|
|
|
TreatBuffDamageCalculate.Calculate(num, numTarget, damageCalculate_Self, damageCalculate_Target,
|
|
|
|
|
skillSender.skillLogic.skillConfigId, out data);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
internal static void SetTargets(CopyBattle battle, IEnumerable<Unit> teamList, IEnumerable<Unit> targetTeamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit unit in teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
unit.BattleId = battle.Id;
|
2021-04-18 15:54:51 +08:00
|
|
|
|
unit.GetComponent<AttackComponent>().Clear();
|
|
|
|
|
TargetableUnitComponent targetUnits = unit.GetComponent<TargetableUnitComponent>();
|
|
|
|
|
targetUnits.Clear();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
targetUnits.AddEnermy(targetTeamList);
|
|
|
|
|
targetUnits.AddTeam(teamList);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
Log.Error(e);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit unit in targetTeamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
unit.BattleId = battle.Id;
|
2021-04-18 15:54:51 +08:00
|
|
|
|
unit.GetComponent<AttackComponent>().Clear();
|
|
|
|
|
TargetableUnitComponent targetUnits = unit.GetComponent<TargetableUnitComponent>();
|
|
|
|
|
targetUnits.Clear();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
targetUnits.AddEnermy(teamList);
|
|
|
|
|
targetUnits.AddTeam(targetTeamList);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
Log.Error(e);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
//!玩家释放技能
|
|
|
|
|
public static void PlayerSkill(Unit unit, long now)
|
|
|
|
|
{
|
|
|
|
|
if (!unit.IsAlive) return;
|
|
|
|
|
if (unit.GetComponent<UserSetting>().IsAutoSkill)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
SkillAI ai = unit.GetComponent<SkillAI>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
ai.canSkill = true;
|
|
|
|
|
ai.PlayAutoSkill(now);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
//!怪物释放技能
|
|
|
|
|
public static void MonsterSkill(Unit unit)
|
|
|
|
|
{
|
|
|
|
|
if (!unit.IsAlive) return;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
SkillAI ai = unit.GetComponent<SkillAI>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
ai.PlaySkill();
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
public static void UpdateChangeMapTaskStateEvent(UnitScene unitScene, IEnumerable<Unit> teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit u in teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-05-01 11:27:41 +08:00
|
|
|
|
Game.EventSystem.Publish(new EventType.UpdateTaskState { unit = u, type = TaskTargetType.ChangeMapTask, value = unitScene.MapId })
|
|
|
|
|
.Coroutine();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
|
|
|
|
private static async ETVoid BrocastReword(IEnumerable<Unit> teamList, UnOrderMultiMapComponent<long, (int, int)> rewordMap)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
using ListComponent<string> listComponent = ListComponent<string>.Create();
|
|
|
|
|
foreach (KeyValuePair<long, List<(int, int)>> kp in rewordMap.MultiMap.GetDictionary())
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
long unitId = kp.Key;
|
2021-04-11 19:50:39 +08:00
|
|
|
|
User user = await UserHelper.Query(unitId);
|
|
|
|
|
foreach ((int id, int count) in kp.Value)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
listComponent.List.Add($"[color=#ffff00]【{user?.NickName}】[/color]获得了[color=#226655]{BagHelper.GetName(id)}x{count}[/color]");
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit unit in teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-15 00:12:07 +08:00
|
|
|
|
Chat.Instance.SendSystemCahtNoBrocast(unit, listComponent.List);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
rewordMap.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
public static async ETVoid UnitDead(CopyBattle self, Unit unit)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!unit)
|
|
|
|
|
Log.Error($"unit is invalid which Id = {unit?.Id}");
|
|
|
|
|
//!触发死亡事件
|
|
|
|
|
if (unit.UnitType != UnitType.Player)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
UnitEnermy unitInfo = unit.GetComponent<UnitEnermy>();
|
|
|
|
|
Unit attackerUnit = unitInfo.unit;
|
2021-04-10 19:49:32 +08:00
|
|
|
|
int monsterId = unitInfo.MonsterId;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
await Game.EventSystem.Publish(new EventType.UpdateTaskState
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
type = TaskTargetType.KillSpecialTask, unit = attackerUnit, value = monsterId
|
2021-04-08 20:09:59 +08:00
|
|
|
|
});
|
|
|
|
|
await Game.EventSystem.Publish(new EventType.UpdateTaskState
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
type = TaskTargetType.KillAnyTask, unit = attackerUnit, value = monsterId
|
2021-04-08 20:09:59 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
LinkedList<Unit> teamList = self.team.GetUnits();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
|
|
|
|
if (self.team.Contains(unit.Id))
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
Log.Info($"【{UserComponent.Instance.Get(unit.Id)?.NickName} ({unit.Id})】战斗死亡了!");
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//!给客户端广播怪物死亡消息
|
2021-04-18 15:54:51 +08:00
|
|
|
|
IActorMessage deadMessage = new M2C_UnitDead() { UnitId = unit.Id };
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
2021-04-18 15:54:51 +08:00
|
|
|
|
BrocastComponent brocastComponent = unit.GetComponent<BrocastComponent>();
|
|
|
|
|
brocastComponent.BrocastInterval(deadMessage);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
internal static async ETTask VictoryOption(CopyBattle self, Team team, long configid = 0)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
LinkedList<Unit> teamList = team.GetUnits();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
team.ChangeState(TeamState.None);
|
|
|
|
|
|
|
|
|
|
//!战斗结束事件(回血,奖励)
|
2021-04-13 20:39:32 +08:00
|
|
|
|
UnOrderMultiMapComponent<long, (int, int)> rewordMapComponent = UnOrderMultiMapComponent<long, (int, int)>.Create();
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit u in teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
await Game.EventSystem.Publish(new EventType.BattleEnd_Reword
|
|
|
|
|
{
|
|
|
|
|
unit = u, rewordMap = rewordMapComponent.MultiMap, battleType = self.battleType, configid = configid
|
|
|
|
|
});
|
2021-05-16 17:22:42 +08:00
|
|
|
|
u.Live();
|
|
|
|
|
Game.EventSystem.Publish(new EventType.BattleEnd { unit = u, team = team }).Coroutine();
|
|
|
|
|
Game.EventSystem.Publish(new EventType.BattleEnd_AddHp { unit = u }).Coroutine();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-05-16 17:22:42 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
BattleHelper.BrocastReword(teamList, rewordMapComponent).Coroutine();
|
|
|
|
|
//!移除不在线玩家
|
|
|
|
|
await TeamComponent.Instance.RemoveAllOffLineId(team);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-01 11:27:41 +08:00
|
|
|
|
|
2021-05-16 17:22:42 +08:00
|
|
|
|
internal static async ETTask DefeatOption(CopyBattle self, Team team, bool hasReward = false)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
LinkedList<Unit> teamList = team.GetUnits();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
team.ChangeState(TeamState.None);
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit u in teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
MessageHelper.SendActor(u, new M2C_BattleDefeat { BattleType = (int) self.battleType });
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-05-16 17:22:42 +08:00
|
|
|
|
UnOrderMultiMapComponent<long, (int, int)> rewordMapComponent = null;
|
|
|
|
|
if (hasReward)
|
|
|
|
|
rewordMapComponent = UnOrderMultiMapComponent<long, (int, int)>.Create();
|
2021-04-11 19:50:39 +08:00
|
|
|
|
foreach (Unit u in teamList)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
if (u.IsTeamLeader)
|
|
|
|
|
{
|
2021-04-18 15:54:51 +08:00
|
|
|
|
Game.EventSystem.Publish(new EventType.BackMainCity { unit = u, isForce = true }).Coroutine();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-05-16 17:22:42 +08:00
|
|
|
|
if (hasReward)
|
|
|
|
|
{
|
|
|
|
|
await Game.EventSystem.Publish(new EventType.BattleEnd_Reword
|
|
|
|
|
{
|
|
|
|
|
unit = u, rewordMap = rewordMapComponent.MultiMap, battleType = self.battleType, configid = self.configId
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
u.Live();
|
|
|
|
|
//!战斗结束事件(回血)
|
2021-04-18 15:54:51 +08:00
|
|
|
|
Game.EventSystem.Publish(new EventType.BattleEnd { unit = u, team = team }).Coroutine();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
Game.EventSystem.Publish(new EventType.BattleEnd_AddHp { unit = u }).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-16 17:22:42 +08:00
|
|
|
|
if (hasReward)
|
|
|
|
|
BattleHelper.BrocastReword(teamList, rewordMapComponent).Coroutine();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
//!移除不在线玩家
|
|
|
|
|
await TeamComponent.Instance.RemoveAllOffLineId(team);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
public static string SelectFixedTarget(this CopyBattle self, Unit unit, long unitId, Team targetTeam, TeamType teamType)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
AttackComponent attacker = unit.GetComponent<AttackComponent>();
|
|
|
|
|
TargetableUnitComponent targetComponent = unit.GetComponent<TargetableUnitComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
switch (teamType)
|
|
|
|
|
{
|
|
|
|
|
case TeamType.Self:
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Team team = self.team;
|
|
|
|
|
Unit targetUnit = team.Get(unitId);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (targetUnit == null)
|
|
|
|
|
{
|
|
|
|
|
return "系统错误";
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
targetComponent.selectedTeamMember = targetUnit;
|
|
|
|
|
break;
|
|
|
|
|
case TeamType.Target:
|
|
|
|
|
team = targetTeam;
|
|
|
|
|
targetUnit = team.Get(unitId);
|
|
|
|
|
if (targetUnit == null)
|
|
|
|
|
{
|
|
|
|
|
return "系统错误";
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
targetComponent.selectedEnermy = targetUnit;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return null;
|
|
|
|
|
}
|
2021-04-24 17:39:11 +08:00
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
public static void FamilyBossAddProperty(CopyBattle self, Unit unit)
|
2021-04-24 17:39:11 +08:00
|
|
|
|
{
|
2021-05-01 11:27:41 +08:00
|
|
|
|
FamilyBossConfig familyBossConfig = FamilyBossConfigCategory.Instance.Get(self.configId);
|
|
|
|
|
float additional = familyBossConfig.CharacterAdd;
|
|
|
|
|
|
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
|
|
|
int atk = MathHelper.RoundToInt(num.GetAsInt(NumericType.PhyAtkBase) * additional);
|
|
|
|
|
num.AddSet(NumericType.PhyAtk, atk);
|
|
|
|
|
atk = MathHelper.RoundToInt(num.GetAsInt(NumericType.SpiAtkBase) * additional);
|
|
|
|
|
num.AddSet(NumericType.SpiAtk, atk);
|
|
|
|
|
int def = MathHelper.RoundToInt(num.GetAsInt(NumericType.PhyDefBase) * additional);
|
|
|
|
|
num.AddSet(NumericType.PhyDef, def);
|
|
|
|
|
def = MathHelper.RoundToInt(num.GetAsInt(NumericType.SpiDefBase) * additional);
|
|
|
|
|
num.AddSet(NumericType.SpiDef, def);
|
2021-04-24 17:39:11 +08:00
|
|
|
|
}
|
2021-05-16 17:22:42 +08:00
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
public static Team GetAnotherTeam(this CopyBattle self, Team team)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (team.Id == self.team.Id)
|
|
|
|
|
return self.targetTeam;
|
|
|
|
|
return self.team;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void StartCopy(Unit unit, string name)
|
|
|
|
|
{
|
|
|
|
|
Scene scene = MapFactory.CreateMap(unit.DomainZone(), name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int GetAliveCount(Team team)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
foreach (Unit item in team.GetUnits())
|
|
|
|
|
{
|
|
|
|
|
if (item.IsAlive)
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-04-18 15:54:51 +08:00
|
|
|
|
}
|