增加好感策略
This commit is contained in:
parent
b565c35ebf
commit
6d1febb91b
@ -65,6 +65,25 @@ namespace RuntimeData
|
||||
Suspicion,
|
||||
Terrible,
|
||||
}
|
||||
|
||||
|
||||
// 好感策略枚举
|
||||
public enum FeelingStrategy
|
||||
{
|
||||
Wise,
|
||||
Charming,
|
||||
Peaceful,
|
||||
Diplomatic,
|
||||
Powerful,
|
||||
Brave,
|
||||
Violent,
|
||||
Threatening,
|
||||
Weak,
|
||||
Annoying,
|
||||
Foolish,
|
||||
Intrusive,
|
||||
Dominative,
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
@ -476,6 +495,7 @@ namespace RuntimeData
|
||||
if (player.Id == Id) continue;
|
||||
DiplomacyData.GetCountryDiplomacyInfo(player.Id, out var selfToPlayer);
|
||||
player.DiplomacyData.GetCountryDiplomacyInfo(Id, out var playerToSelf);
|
||||
selfToPlayer.FeelingStrategyList.Clear();
|
||||
if (playerToSelf == null || selfToPlayer == null) continue;
|
||||
var score = 0f;
|
||||
|
||||
@ -492,22 +512,51 @@ namespace RuntimeData
|
||||
if (selfToOtherPlayer.DiplomacyState == playerToOtherPlayer.DiplomacyState) score1 += 5;
|
||||
else score1 -= 5;
|
||||
}
|
||||
if (score1 + 5 > 0) score += Mathf.Min(20, score1);
|
||||
if (score1 - 5 < 0) score += Mathf.Max(-20, score1);
|
||||
|
||||
if (score1 + 5 > 0)
|
||||
{
|
||||
score += Mathf.Min(20, score1);
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Wise);
|
||||
}
|
||||
if (score1 - 5 < 0)
|
||||
{
|
||||
score += Mathf.Max(-20, score1);
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Foolish);
|
||||
}
|
||||
|
||||
// 迷人的 恼人的
|
||||
if (map.MapConfig.AIDiff == AIDifficult.EASY && player.Id == map.PlayerMap.SelfPlayerId &&
|
||||
Id != map.PlayerMap.SelfPlayerId) score += 15;
|
||||
if (map.MapConfig.AIDiff == AIDifficult.LUNATIC && player.Id == map.PlayerMap.SelfPlayerId &&
|
||||
Id != map.PlayerMap.SelfPlayerId) score -= 15;
|
||||
|
||||
if (map.MapConfig.AIDiff == AIDifficult.EASY && player.Id == map.PlayerMap.SelfPlayerId &&
|
||||
Id != map.PlayerMap.SelfPlayerId)
|
||||
{
|
||||
score += 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Charming);
|
||||
}
|
||||
|
||||
if (map.MapConfig.AIDiff == AIDifficult.LUNATIC && player.Id == map.PlayerMap.SelfPlayerId &&
|
||||
Id != map.PlayerMap.SelfPlayerId)
|
||||
{
|
||||
score -= 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Annoying);
|
||||
}
|
||||
|
||||
// 和平的 暴力的
|
||||
if (!CheckTurnsAttacker(3, player.Id)) score += 15;
|
||||
else score -= 15;
|
||||
|
||||
if (!CheckTurnsAttacker(3, player.Id))
|
||||
{
|
||||
score += 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Peaceful);
|
||||
}
|
||||
else
|
||||
{
|
||||
score -= 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Violent);
|
||||
}
|
||||
|
||||
// 外交的
|
||||
if (selfToPlayer.IsEmbassy || playerToSelf.IsEmbassy) score += 15;
|
||||
|
||||
if (selfToPlayer.IsEmbassy || playerToSelf.IsEmbassy)
|
||||
{
|
||||
score += 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Diplomatic);
|
||||
}
|
||||
|
||||
// 强大的 弱小的
|
||||
var selfScore = 0f;
|
||||
var playerScore = 0f;
|
||||
@ -518,14 +567,26 @@ namespace RuntimeData
|
||||
if (ownerId == Id) selfScore += unit.GetMilitary();
|
||||
if (ownerId == player.Id) playerScore += unit.GetMilitary();
|
||||
}
|
||||
if (selfScore < playerScore) score += 15;
|
||||
if (selfScore > playerScore) score -= 15;
|
||||
|
||||
if (selfScore < playerScore)
|
||||
{
|
||||
score += 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Powerful);
|
||||
}
|
||||
if (selfScore > playerScore)
|
||||
{
|
||||
score -= 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Weak);
|
||||
}
|
||||
|
||||
// 勇敢的
|
||||
if (maxScorePlayer != Id)
|
||||
{
|
||||
player.DiplomacyData.GetCountryDiplomacyInfo(maxScorePlayer, out var playerToMaxScorePlayer);
|
||||
if (playerToMaxScorePlayer.DiplomacyState == DiplomacyState.War) score += 15;
|
||||
if (playerToMaxScorePlayer.DiplomacyState == DiplomacyState.War)
|
||||
{
|
||||
score += 15;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Brave);
|
||||
}
|
||||
}
|
||||
|
||||
// 威胁的
|
||||
@ -541,7 +602,8 @@ namespace RuntimeData
|
||||
var dis = map.GridMap.CalcDistance(unitGrid, gridData);
|
||||
if (dis > 1) continue;
|
||||
score -= 15;
|
||||
return;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Threatening);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,7 +618,8 @@ namespace RuntimeData
|
||||
var dis = map.GridMap.CalcDistance(playerGrid, selfGrid);
|
||||
if (dis > 1) continue;
|
||||
score -= 15;
|
||||
return;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Intrusive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,6 +632,7 @@ namespace RuntimeData
|
||||
foreach (var city in playerCity) if (Main.CityLogic.CheckCradleCapital(map,player,city)) count++;
|
||||
if (count > 0) count--;
|
||||
score -= 15 + count * 5;
|
||||
selfToPlayer.FeelingStrategyList.Add(FeelingStrategy.Dominative);
|
||||
}
|
||||
|
||||
score = Mathf.Max(0, score);
|
||||
@ -997,6 +1061,8 @@ namespace RuntimeData
|
||||
public float FeelingValue;
|
||||
// 我对国家 PlayerId 的好感态度
|
||||
public FeelingState FeelingState;
|
||||
// 我对国家 PlayerId 的好感策略
|
||||
public List<FeelingStrategy> FeelingStrategyList;
|
||||
// 国家 PlayerId 攻击我的回合记录
|
||||
public uint AttackTurn;
|
||||
// 国家 PlayerId 是否在我国建立了大使馆
|
||||
@ -1006,12 +1072,14 @@ namespace RuntimeData
|
||||
// 国家对我发起的结盟请求
|
||||
public bool IsLeagueRequest;
|
||||
|
||||
|
||||
public CountryDiplomacyInfo()
|
||||
{
|
||||
AttackTurn = 0;
|
||||
IsEmbassy = false;
|
||||
IsLeagueRupture = false;
|
||||
IsLeagueRequest = false;
|
||||
FeelingStrategyList = new List<FeelingStrategy>();
|
||||
}
|
||||
|
||||
public CountryDiplomacyInfo(CountryDiplomacyInfo copyData)
|
||||
@ -1021,6 +1089,8 @@ namespace RuntimeData
|
||||
DiplomacyState = copyData.DiplomacyState;
|
||||
FeelingValue = copyData.FeelingValue;
|
||||
FeelingState = copyData.FeelingState;
|
||||
FeelingStrategyList= new List<FeelingStrategy>();
|
||||
foreach (var strategy in copyData.FeelingStrategyList)FeelingStrategyList.Add(strategy);
|
||||
IsEmbassy = copyData.IsEmbassy;
|
||||
IsLeagueRupture = copyData.IsLeagueRupture;
|
||||
IsLeagueRequest = copyData.IsLeagueRequest;
|
||||
@ -1033,6 +1103,8 @@ namespace RuntimeData
|
||||
DiplomacyState = copyData.DiplomacyState;
|
||||
FeelingValue = copyData.FeelingValue;
|
||||
FeelingState = copyData.FeelingState;
|
||||
FeelingStrategyList.Clear();
|
||||
foreach (var strategy in copyData.FeelingStrategyList)FeelingStrategyList.Add(strategy);
|
||||
IsEmbassy = copyData.IsEmbassy;
|
||||
IsLeagueRupture = copyData.IsLeagueRupture;
|
||||
IsLeagueRequest = copyData.IsLeagueRequest;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user