private void TroopChangeRealDestination(Troop troop) { if (troop.mingling == "Attack" || troop.mingling == "Stratagem") { if (troop.CurrentStratagem != null) { troop.mingling = "Stratagem"; } if (troop.TargetTroop != null) { if (troop.BaseAttackEveryAround || troop.AttackEveryAround)//修复雷霆战法攻击方式 { foreach (Troop troop2 in troop.GetAllOtherTroopsInView()) { if ((!troop.AttackedTroopList.HasGameObject(troop2)) && troop.mingling == "Attack" && troop.CanAttack(troop2) && (!troop.TroopNoAccidentalInjury || !troop.IsFriendly(troop2.BelongedFaction))) { troop.AttackTroop(troop2); } } } if (!((troop.mingling == "Attack" && troop.CanAttack(troop.TargetTroop)) || (troop.CurrentStratagem != null && troop.CanStratagem(troop.TargetTroop)))) { troop.RealDestination = troop.TargetTroop.Position; } else { troop.RealDestination = troop.Position; } } else if (troop.TargetArchitecture != null && troop.mingling == "Attack")//&& !troop.CanAttack(troop.TargetArchitecture) { troop.RealDestination = troop.TargetArchitecture.Position; } else { //troop.RealDestination = troop.Position; } } else if (troop.TargetTroop != null && troop.Will.ToString() == "行军" && troop.mingling != "Move" && ((troop.CurrentStratagem == null && troop.CanAttack(troop.TargetTroop)) || (troop.CurrentStratagem != null && troop.CanStratagem(troop.TargetTroop))))//ai { if (troop.BaseAttackEveryAround || troop.AttackEveryAround) {//修复雷霆战法攻击方式 foreach (Troop troop2 in troop.GetAllOtherTroopsInView()) { if ((!troop.AttackedTroopList.HasGameObject(troop2)) && troop.CanAttack(troop2) && (!troop.TroopNoAccidentalInjury || !troop.IsFriendly(troop2.BelongedFaction))) { troop.AttackTroop(troop2); } } } troop.RealDestination = troop.Position; } else if (troop.TargetArchitecture != null) { troop.RealDestination = troop.TargetArchitecture.Position; } }