//Calculations for Echelon 1, returns an int array (all of the rest are basically copies, but for each echelon) //You'll realize why I did it this way soon, yes it could be done differently and it will eventually. private int[] CalcE1() { //Create a Logistic, and initialize it. Logistic logi = null; //vars to hold our information from logi, we technically dont *need* them but I'm lazy. int man, ammo, rations, parts; Drop d1, d2; double time; //We have to reset the output text, but we dont want to call Reset() labelE1Resources.Text = ""; labelE1Rewards.Text = ""; //Resources //Get a Logistic from our selected chapter and map, they are stored locally for debugging reasons logi = GetLogisticFromNum(comboE1Chapter.SelectedIndex, comboE1Map.SelectedIndex); man = logi.Manpower; ammo = logi.Ammunition; rations = logi.Rations; parts = logi.Parts; time = logi.Time; //We have to divide by 60, because we are in minutes, needs to be hours String sTime = GetTimeFormat(time / 60); labelE1Resources.Text = "" + "ManP: " + man + " | Ammo: " + ammo + " | Rations: " + rations + " | Parts: " + parts + " | Time: " + sTime; //Drops //Basically we get the drop from the Logisitic, if no drop then emptyDrop //We can call it this way, due to the static nature of the variable if (logi.NumOfDrops == 1) { d1 = logi.GetDrop(1); d2 = Mission.emptyDrop; } else if (logi.NumOfDrops == 2) { d1 = logi.GetDrop(1); d2 = logi.GetDrop(2); } else { d1 = Mission.emptyDrop; d2 = Mission.emptyDrop; } labelE1Rewards.Text = "Potential Rewards: " + GetTextFromDrop(d1) + GetTextFromDrop(d2); // Okay, to explain the array: when we get the total of all resources, gotta send it back somehow and // normally we can't return > 1 object, so we return an array containing all the useful stuff // time is an int now, since it doesnt have decimal places/etc. int[] data = new int[] { man, ammo, rations, parts, (int)time }; return(data); }
private int[] CalcE3() { Logistic logi = null; int man, ammo, rations, parts; Drop d1, d2; double time; labelE3Resources.Text = ""; labelE3Rewards.Text = ""; //Resources logi = GetLogisticFromNum(comboE3Chapter.SelectedIndex, comboE3Map.SelectedIndex); man = logi.Manpower; ammo = logi.Ammunition; rations = logi.Rations; parts = logi.Parts; time = logi.Time; String sTime = GetTimeFormat(time / 60); labelE3Resources.Text = "" + "ManP: " + man + " | Ammo: " + ammo + " | Rations: " + rations + " | Parts: " + parts + " | Time: " + sTime; //Drops if (logi.NumOfDrops == 1) { d1 = logi.GetDrop(1); d2 = Mission.emptyDrop; } else if (logi.NumOfDrops == 2) { d1 = logi.GetDrop(1); d2 = logi.GetDrop(2); } else { d1 = Mission.emptyDrop; d2 = Mission.emptyDrop; } labelE3Rewards.Text = "Potential Rewards: " + GetTextFromDrop(d1) + GetTextFromDrop(d2); int[] data = new int[] { man, ammo, rations, parts, (int)time }; return(data); }
//Mission contructor //Called from Form.cs, sets up all the Logistic objects, no parameters as we dont need them public Mission() { emptyDrop = new Drop("", 0); tDoll = new Drop("T-Doll Contact", 1); equip = new Drop("Equipment Contract", 2); construct = new Drop("Instant Construction", 3); repair = new Drop("Instant Repair", 4); token = new Drop("Token", 5); //White = tdoll, Blue = equipment, Orange = construct, Green = repair, Dot = token emptyMission = new Logistic(0, 0, 0, 0, 0); //Chapter 0 c0e1 = new Logistic(0, 145, 145, 0, 50, 2, construct, repair); c0e2 = new Logistic(550, 0, 0, 350, 180, 1, tDoll); c0e3 = new Logistic(900, 900, 900, 250, 720, 2, equip, repair); c0e4 = new Logistic(0, 1200, 800, 750, 1440, 1, token); //Chapter 1 c1e1 = new Logistic(10, 30, 15, 0, 15); c1e2 = new Logistic(0, 40, 60, 0, 30); c1e3 = new Logistic(30, 0, 30, 10, 60, 1, repair); c1e4 = new Logistic(160, 160, 0, 0, 120, 1, tDoll); //Chapter 2 c2e1 = new Logistic(100, 0, 0, 30, 40); c2e2 = new Logistic(60, 200, 80, 0, 90, 1, repair); c2e3 = new Logistic(10, 10, 10, 230, 240, 2, construct, repair); c2e4 = new Logistic(0, 250, 600, 60, 360, 1, tDoll); //Chapter 3 c3e1 = new Logistic(50, 0, 75, 0, 20); c3e2 = new Logistic(0, 120, 70, 30, 45); c3e3 = new Logistic(0, 300, 0, 0, 90, 2, construct, repair); c3e4 = new Logistic(0, 0, 300, 300, 300, 2, tDoll, equip); //Chapter 4 c4e1 = new Logistic(0, 185, 185, 0, 60, 1, equip); c4e2 = new Logistic(0, 0, 0, 210, 120, 1, construct); c4e3 = new Logistic(800, 550, 0, 0, 360, 2, tDoll, repair); c4e4 = new Logistic(400, 400, 400, 0, 480, 1, construct); //Chapter 5 c5e1 = new Logistic(0, 0, 100, 45, 30); c5e2 = new Logistic(0, 600, 300, 0, 150, 1, repair); c5e3 = new Logistic(800, 400, 400, 0, 240, 1, equip); c5e4 = new Logistic(100, 0, 0, 700, 400, 1, tDoll); //Chapter 6 c6e1 = new Logistic(300, 300, 0, 100, 120); c6e2 = new Logistic(0, 200, 550, 100, 180, 2, construct, equip); c6e3 = new Logistic(0, 0, 200, 500, 300, 1, equip); c6e4 = new Logistic(800, 800, 800, 0, 720, 1, token); //Chapter 7 c7e1 = new Logistic(650, 0, 650, 0, 150); c7e2 = new Logistic(0, 650, 0, 300, 240, 2, construct, repair); c7e3 = new Logistic(900, 600, 600, 0, 330, 1, equip); c7e4 = new Logistic(250, 250, 250, 600, 480, 1, construct); //Chapter 8 c8e1 = new Logistic(150, 150, 150, 0, 60, 1, equip); c8e2 = new Logistic(0, 0, 0, 450, 180, 1, repair); c8e3 = new Logistic(400, 600, 800, 0, 360, 2, construct, repair); c8e4 = new Logistic(1500, 400, 400, 100, 540, 1, tDoll); //Chapter 9 c9e1 = new Logistic(0, 0, 100, 50, 30); c9e2 = new Logistic(180, 0, 180, 100, 90, 1, construct); c9e3 = new Logistic(750, 750, 0, 0, 270, 1, tDoll); c9e4 = new Logistic(500, 900, 900, 0, 420, 1, equip); //Chapter 10 c10e1 = new Logistic(140, 200, 0, 0, 40); c10e2 = new Logistic(0, 240, 180, 0, 100, 2, tDoll, construct); c10e3 = new Logistic(0, 480, 480, 300, 320, 2, construct, repair); c10e4 = new Logistic(660, 660, 660, 360, 600, 1, equip); }
//Returns a Logistic from specifed chapter and mission num private Logistic GetLogisticFromNum(int chapter, int mission) { Logistic logistic = null; if (chapter == 0) { switch (mission) { case 0: logistic = missions.c0e1; break; case 1: logistic = missions.c0e2; break; case 2: logistic = missions.c0e3; break; case 3: logistic = missions.c0e4; break; } } else if (chapter == 1) { switch (mission) { case 0: logistic = missions.c1e1; break; case 1: logistic = missions.c1e2; break; case 2: logistic = missions.c1e3; break; case 3: logistic = missions.c1e4; break; } } else if (chapter == 2) { switch (mission) { case 0: logistic = missions.c2e1; break; case 1: logistic = missions.c2e2; break; case 2: logistic = missions.c2e3; break; case 3: logistic = missions.c2e4; break; } } else if (chapter == 3) { switch (mission) { case 0: logistic = missions.c3e1; break; case 1: logistic = missions.c3e2; break; case 2: logistic = missions.c3e3; break; case 3: logistic = missions.c3e4; break; } } else if (chapter == 4) { switch (mission) { case 0: logistic = missions.c4e1; break; case 1: logistic = missions.c4e2; break; case 2: logistic = missions.c4e3; break; case 3: logistic = missions.c4e4; break; } } else if (chapter == 5) { switch (mission) { case 0: logistic = missions.c5e1; break; case 1: logistic = missions.c5e2; break; case 2: logistic = missions.c5e3; break; case 3: logistic = missions.c5e4; break; } } else if (chapter == 6) { switch (mission) { case 0: logistic = missions.c6e1; break; case 1: logistic = missions.c6e2; break; case 2: logistic = missions.c6e3; break; case 3: logistic = missions.c6e4; break; default: logistic = null; break; } } else if (chapter == 7) { switch (mission) { case 0: logistic = missions.c7e1; break; case 1: logistic = missions.c7e2; break; case 2: logistic = missions.c7e3; break; case 3: logistic = missions.c7e4; break; default: logistic = null; break; } } else if (chapter == 8) { switch (mission) { case 0: logistic = missions.c8e1; break; case 1: logistic = missions.c8e2; break; case 2: logistic = missions.c8e3; break; case 3: logistic = missions.c8e4; break; default: logistic = null; break; } } else if (chapter == 9) { switch (mission) { case 0: logistic = missions.c9e1; break; case 1: logistic = missions.c9e2; break; case 2: logistic = missions.c9e3; break; case 3: logistic = missions.c9e4; break; default: logistic = null; break; } } else if (chapter == 10) { switch (mission) { case 0: logistic = missions.c10e1; break; case 1: logistic = missions.c10e2; break; case 2: logistic = missions.c10e3; break; case 3: logistic = missions.c10e4; break; default: logistic = null; break; } } else { //fallback: no NullPtrs for us logistic = missions.emptyMission; } return(logistic); }