예제 #1
0
        bool?IsDefensiveVillage(DateTime currentTime, CurrentArmy stationedArmy, CurrentArmy ownedArmy)
        {
            if (ownedArmy != null && ownedArmy.IsRecent(currentTime) && !ownedArmy.IsOffensive())
            {
                return(true);
            }

            if (stationedArmy != null && ownedArmy.IsRecent(currentTime) && !stationedArmy.IsOffensive())
            {
                return(true);
            }

            return(null);
        }
 public static bool IsRecent(this CurrentArmy army, DateTime currentTime) => IsRecentArmy(army, currentTime);
 public static bool IsDefensive(this CurrentArmy army) => IsDefensiveArmy(army);
 public static bool IsRecentArmy(CurrentArmy army, DateTime currentTime) =>
 army.LastUpdated != null && (currentTime - army.LastUpdated.Value) < MaxArmyAge;
 public static bool IsDefensiveArmy(CurrentArmy army) =>
 army.Spear > 2000 || army.Sword > 2000;
 public static bool IsOffensiveArmy(CurrentArmy army) =>
 army.Axe > 1000 || army.Light > 400;
예제 #7
0
 bool ArmyIsOld(CurrentArmy army, DateTime serverTime) => (serverTime - army.LastUpdated.Value).TotalDays >= 1;