Skip to content

Commit

Permalink
Updating conversation. Removed debug flag to force 1 turn withdraw.
Browse files Browse the repository at this point in the history
  • Loading branch information
IceRaptor committed Feb 21, 2019
1 parent 64dfc84 commit 5158aac
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 27 deletions.
48 changes: 26 additions & 22 deletions DisorderlyWithdrawal/DisorderlyWithdrawal/Patches/Patches.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BattleTech;
using BattleTech.Framework;
using BattleTech.UI;
using Harmony;
using System;
Expand Down Expand Up @@ -55,8 +56,6 @@ public static bool Prefix(CombatHUDRetreatEscMenu __instance, CombatGameState __
} else {

int roundsToWait = Helper.RoundsToWaitByAerospace();
// TODO: TESTING - REMOVE
roundsToWait = 1;

DisorderlyWithdrawal.Logger.Log($"Player must wait:{roundsToWait} rounds for pickup.");

Expand Down Expand Up @@ -226,31 +225,36 @@ public static void Postfix(SimGameState __instance, ref int __result, bool proRa
}
}

[HarmonyPatch(typeof(AAR_ContractResults_Screen), "FillInData")]
public static class AAR_ContractResults_Screen_FillInData {

public static void Postfix(AAR_ContractResults_Screen __instance) {
if (ModState.CombatDamage != 0) {
int repairCost = (int)Math.Ceiling(ModState.CombatDamage) * DisorderlyWithdrawal.ModConfig.LeopardRepairCostPerDamage;
GenericPopupBuilder.Create(GenericPopupType.Info,
$"The Leopard was damaged in the extraction process, and needs to be repaired." +
$"{SimGameState.GetCBillString(repairCost)} will be deducted for repairs."
)
.AddButton("Continue", new Action(OnContinue), true, null)
.Render();
}
}
[HarmonyPatch(typeof(AAR_ContractObjectivesWidget), "FillInObjectives")]
[HarmonyAfter(new string[] { "de.morphyum.DropCostPerMech" })]
public static class AAR_ContractObjectivesWidget_FillInObjectives {

public static void OnContinue() {
static void Prefix(AAR_ContractObjectivesWidget __instance, Contract ___theContract) {
int repairCost = (int)Math.Ceiling(ModState.CombatDamage) * DisorderlyWithdrawal.ModConfig.LeopardRepairCostPerDamage;
DisorderlyWithdrawal.Logger.LogIfDebug($"Charging player {SimGameState.GetCBillString(repairCost)} for Leopard repairs.");
if (repairCost != 0) {
DisorderlyWithdrawal.Logger.LogIfDebug($"AAR_COW:FIO adding repair cost objective:{repairCost}");
string objectiveLabel = $"LEOPARD REPAIR COSTS: {SimGameState.GetCBillString(repairCost)}";
MissionObjectiveResult missionObjectiveResult = new MissionObjectiveResult(objectiveLabel, "7facf07a-626d-4a3b-a1ec-b29a35ff1ac0", false, true, ObjectiveStatus.Succeeded, false);
___theContract.MissionObjectiveResultList.Add(missionObjectiveResult);
//Traverse traverse = Traverse.Create(__instance).Method("AddObjective", new Type[] { typeof(MissionObjectiveResult) });
//traverse.GetValue(new object[] { missionObjectiveResult });
}
}
}

SimGameState simGameState = UnityGameInstance.BattleTechGame.Simulation;
simGameState.AddFunds(repairCost * -1);
[HarmonyPatch(typeof(Contract), "CompleteContract")]
[HarmonyAfter(new string[] { "de.morphyum.DropCostPerMech", "de.morphyum.PersistentMapClient" })]
public static class Contract_CompleteContract {

ModState.CombatDamage = 0;
static void Postfix(Contract __instance) {
int repairCost = (int)Math.Ceiling(ModState.CombatDamage) * DisorderlyWithdrawal.ModConfig.LeopardRepairCostPerDamage;
if (repairCost != 0) {
DisorderlyWithdrawal.Logger.LogIfDebug($"C:CC adding repair costs:{repairCost}");
int newMoneyResults = Mathf.FloorToInt(__instance.MoneyResults - repairCost);
Traverse traverse = Traverse.Create(__instance).Property("MoneyResults");
traverse.SetValue(newMoneyResults);
}
}

}

[HarmonyPatch(typeof(SGCaptainsQuartersStatusScreen), "RefreshData")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ModConfig {
public int HeavyWingMonthlyCost = 100000;
public float HeavyWingLeopardDamage = 0.6f;

public int LeopardRepairCostPerDamage = 10;
public int LeopardRepairCostPerDamage = 100;

public override string ToString() {
return $"Debug:{Debug}";
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@ This mod for the [HBS BattleTech](http://battletechgame.com/) provides a more pu

Options:

* Heavy Wing: 0-2 turn pickup. 60% Leopard damage. 100,000 maintenance.
* Heavy Wing: 1-2 turn pickup. 60% Leopard damage. 100,000 maintenance.
* Medium Wing: 1-3 turn pickup. 30% Leopard damage. 50,000 maintenance.
* Light Wing: 2-4 turn pickup. 0% Leopard damage. 50,000 maintenance.
* No Aerospace: 3-6 turn pickup. 100% Leopard damage. 0 maintenance.
* No Aerospace: 3-5 turn pickup. 100% Leopard damage. 0 maintenance.

# WIP Features
- [ ] Delayed withdrawal; from 2-6 turns when you click the withdrawal button before you are picked up

- [ ] Damage expenses - you have to pay for dropship repairs. Total enemy damage for 2 turns is calculated and applied. You have to pay the repair bill.

- [ ] Monthly expenses - pay for aerospace support to have quicker pickups

- [ ] Should the wings suffer damage in some cases (extra expenses)?

- [ ] Compare damage vs Leopard armor for a total wipe scenario?

- [ ] Show projected damage amount to player in the confirm dialog

- [ ] Allow immediate withdrawal if enemydamage 0 and closest enemy == 1000m?


Binary file not shown.
4 changes: 4 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"DependsOn" : [ ],
"Settings": {
"Debug" : true,
"LightWingMonthlyCost" : 50000,
"LightWingMonthlyCost" : 75000,
"HeavyWingMonthlyCost" : 100000,
"LeopardRepairCostPerDamage" : 100
}
}
Binary file not shown.

0 comments on commit 5158aac

Please sign in to comment.