/** Constructor for MilitaryTask class. @param location - vector specifying game board space @param radius - area of operation radius (bounds of military task) @param GoalsToHold - contains Goals @param Owner - the faction to whom the MilitaryTask targets, i.e. the opposition faction */ public MilitaryTask(Vector2 location, float radius, List<Goal> GoalsToHold, Empire Owner) { this.type = MilitaryTask.TaskType.ClearAreaOfEnemies; //enumerated value this.AO = location; this.AORadius = radius; //pools GoalsToHold into this MilitaryTask //by "held," the goal is acknowledge as having been accepted for MilitaryTask to fulfill: this.HeldGoals foreach (Goal g in GoalsToHold) { g.Held = true; this.HeldGoals.Add(g.guid); } //KeyValuePair is an enumarted variable type from System.Collections.Generic //A pin is an embedded sublass of ThreatMatrix; containing details on the threat: location, faction, etc. //This "foreach" loop selects all threats in this Empire's recognized threats foreach (KeyValuePair<Guid, ThreatMatrix.Pin> pin in Owner.GetGSAI().ThreatMatrix.Pins) { //if threat is outside the area of operation (AO), ignore it //"contine" increments the loop to the next threat (pin) if (Vector2.Distance(this.AO, pin.Value.Position) >= this.AORadius || EmpireManager.GetEmpireByName(pin.Value.EmpireName) == Owner) { continue; } //declare new MilitaryTask, assign it equal to this current instance of MiliTaryTask //what is the purpose of assigning initial enemy strength, and enemy strenght? MilitaryTask initialEnemyStrength = this; initialEnemyStrength.InitialEnemyStrength = initialEnemyStrength.InitialEnemyStrength + pin.Value.Strength; MilitaryTask enemyStrength = this; enemyStrength.EnemyStrength = enemyStrength.EnemyStrength + pin.Value.Strength; } //what is MinimumTaskForceStrength used for? //minimum task force must be at least 75% of enemy strength //convential military doctrine requires 3:1 Attackers:Defenders advantage for minimal success potential this.MinimumTaskForceStrength = this.EnemyStrength * 3f;//*.75f; //why by 75%? //Ermenildo V. Castro, Jr. //07/25/15 //Altered to "* 3f", instead of original "* .75f" this.empire = Owner; //Empire specifies the opposition faction }
//Overloaded constructor public MilitaryTask(Planet target, Empire Owner) { this.type = MilitaryTask.TaskType.AssaultPlanet; this.TargetPlanet = target; this.TargetPlanetGuid = target.guid; //Guid = Gui id? this.AO = target.Position; this.AORadius = 35000f; //constant planet radius; should be a declared planet constant property. Sloppy. this.empire = Owner; //Empire specifies the opposition faction }