Implement reverse engineer chance multiplier
This commit is contained in:
@@ -23,6 +23,8 @@ namespace CykaOfQud {
|
||||
public static ConfigEntry<float> attributeBonusPerLevelMultiplier;
|
||||
public static ConfigEntry<float> disassemblyBonusMultiplier;
|
||||
|
||||
public static ConfigEntry<float> reverseEngineerChanceMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> debugMode;
|
||||
|
||||
public void Awake() {
|
||||
@@ -39,6 +41,8 @@ namespace CykaOfQud {
|
||||
new ConfigDescription("Attribute Bonus Per Level Multiplier"));
|
||||
disassemblyBonusMultiplier = Config.Bind("General", "Disassembly Bonus Multiplier", 1f,
|
||||
new ConfigDescription("Disassembly Bonus Multiplier"));
|
||||
reverseEngineerChanceMultiplier = Config.Bind("General", "Reverse Engineer Chance Multiplier", 1f,
|
||||
new ConfigDescription("Reverse Engineer Chance Multiplier"));
|
||||
|
||||
debugMode = Config.Bind("General", "Debug Mode", false, new ConfigDescription("Debug Mode"));
|
||||
|
||||
|
@@ -88,20 +88,36 @@ namespace CykaOfIndustry {
|
||||
foreach (char c in Bits) {
|
||||
output.Append(new string(c, (int)Math.Ceiling(Main.disassemblyBonusMultiplier.Value)));
|
||||
}
|
||||
|
||||
Bits = output.ToString();
|
||||
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaOfQud: AddBits: New {0}", Bits);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(XRL.World.Parts.BitLocker), "AddAllBits")]
|
||||
static void addAllBits(ref int num) {
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GetTinkeringBonusEvent), nameof(GetTinkeringBonusEvent.GetFor),
|
||||
new Type[] {
|
||||
typeof(GameObject), typeof(GameObject), typeof(string), typeof(int), typeof(int), typeof(int),
|
||||
typeof(bool), typeof(bool), typeof(bool), typeof(bool)
|
||||
},
|
||||
new ArgumentType[] {
|
||||
ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal,
|
||||
ArgumentType.Out, ArgumentType.Out, ArgumentType.Out, ArgumentType.Normal, ArgumentType.Normal
|
||||
})]
|
||||
static void reverseEngineerChanceMultiplier(GameObject Actor, GameObject Item, string Type, int BaseRating,
|
||||
int Bonus, ref int SecondaryBonus, ref bool Interrupt, ref bool PsychometryApplied, bool Interruptable,
|
||||
bool ForSifrah, ref int __result) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaOfQud: AddAllBits: Old {0}", num);
|
||||
num = (int)(num * Main.disassemblyBonusMultiplier.Value);
|
||||
Console.WriteLine(
|
||||
"CykaOfQud: GetFor: Actor {0} Item {1} Type {2} BaseRating {3} Bonus {4} SecondaryBonus {5} Interrupt {6} PsychometryApplied {7} Interruptable {8} ForSifrah {9} Result {10}",
|
||||
Actor.ID, Item.ID, Type, BaseRating, Bonus, SecondaryBonus, Interrupt, PsychometryApplied,
|
||||
Interruptable, ForSifrah, __result);
|
||||
__result = (int)(__result * Main.reverseEngineerChanceMultiplier.Value);
|
||||
if (__result > 100)
|
||||
__result = 100;
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaOfQud: AddAllBits: New {0}", num);
|
||||
Console.WriteLine("CykaOfQud: GetFor: New Result {0}", __result);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user