97 lines
2.5 KiB
C#
97 lines
2.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace EDPlayerJournal.BGS;
|
|
public class CombatZone : Transaction {
|
|
/// <summary>
|
|
/// Type, either on foot or ship
|
|
/// </summary>
|
|
public string Type { get; set; } = CombatZones.ShipCombatZone;
|
|
|
|
/// <summary>
|
|
/// Difficulty type, low, medium or high.
|
|
/// </summary>
|
|
public string Grade { get; set; } = CombatZones.DifficultyLow;
|
|
|
|
/// <summary>
|
|
/// Whether spec ops were won.
|
|
/// </summary>
|
|
public bool? SpecOps { get; set; }
|
|
|
|
/// <summary>
|
|
/// Whether captain was won
|
|
/// </summary>
|
|
public bool? Captain { get; set; }
|
|
|
|
/// <summary>
|
|
/// Whether correspondent objective was won
|
|
/// </summary>
|
|
public bool? Correspondent { get; set; }
|
|
|
|
/// <summary>
|
|
/// Whether cap ship objective was won
|
|
/// </summary>
|
|
public bool? CapitalShip { get; set; }
|
|
|
|
/// <summary>
|
|
/// How many optional objectives were completed?
|
|
/// </summary>
|
|
public int OptionalObjectivesCompleted {
|
|
get {
|
|
if (IsGround) {
|
|
return 0;
|
|
}
|
|
return new List<bool?>() { SpecOps, Captain, Correspondent, CapitalShip }
|
|
.Where(x => x != null && x == true)
|
|
.Count()
|
|
;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns true if it is an on foot/ground combat zone
|
|
/// </summary>
|
|
public bool IsGround {
|
|
get { return string.Compare(Type, CombatZones.GroundCombatZone) == 0; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns true if it is an on foot combat zone
|
|
/// </summary>
|
|
public bool IsShip {
|
|
get { return string.Compare(Type, CombatZones.ShipCombatZone) == 0; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns true if it is a thargoid combat zone
|
|
/// </summary>
|
|
public bool IsThargoid {
|
|
get { return string.Compare(Type, CombatZones.ThargoidCombatZone) == 0; }
|
|
}
|
|
|
|
public override int CompareTo(Transaction? obj) {
|
|
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
|
return -1;
|
|
}
|
|
|
|
CombatZone? b = obj as CombatZone;
|
|
if (b == null) {
|
|
return -1;
|
|
}
|
|
|
|
if (b.Faction != Faction || b.System != System) {
|
|
return -1; // System and faction don't match
|
|
}
|
|
|
|
if (b.Type != b.Type || b.Grade != b.Grade) {
|
|
return -1; // grade and type don't match
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return string.Format("Won {0} {1} Combat Zone", Grade, Type);
|
|
}
|
|
}
|