From d59b27f08c957b23d80f1d36b6f113c61311ca78 Mon Sep 17 00:00:00 2001 From: Peter WONG Date: Wed, 10 Jan 2018 21:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WorldOfTheThreeKingdoms/GameObjects/Troop.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/WorldOfTheThreeKingdoms/GameObjects/Troop.cs b/WorldOfTheThreeKingdoms/GameObjects/Troop.cs index 85132ee01..ac3691520 100644 --- a/WorldOfTheThreeKingdoms/GameObjects/Troop.cs +++ b/WorldOfTheThreeKingdoms/GameObjects/Troop.cs @@ -12059,7 +12059,15 @@ public int Defence { get //县令防御力加成公式 { - float mayorFactor = Math.Min(1, this.StartingArchitecture.MayorOnDutyDays / 90.0f); + float mayorFactor; + if (this.StartingArchitecture != null) + { + mayorFactor = Math.Min(1, this.StartingArchitecture.MayorOnDutyDays / 90.0f); + } + else + { + mayorFactor = 0; + } float mayorRate = 1; float leaderRate = 1; if (BuffAvail()) @@ -12772,7 +12780,14 @@ public int Offence { get { //县令加成公式 - float mayorFactor = Math.Min(1, this.StartingArchitecture.MayorOnDutyDays / 90.0f); + float mayorFactor; + if (this.StartingArchitecture != null) + { + mayorFactor = Math.Min(1, this.StartingArchitecture.MayorOnDutyDays / 90.0f); + } else + { + mayorFactor = 0; + } float mayorRate = 1; float leaderRate = 1; if (BuffAvail())