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> attributeBonusPerLevelMultiplier;
|
||||||
public static ConfigEntry<float> disassemblyBonusMultiplier;
|
public static ConfigEntry<float> disassemblyBonusMultiplier;
|
||||||
|
|
||||||
|
public static ConfigEntry<float> reverseEngineerChanceMultiplier;
|
||||||
|
|
||||||
public static ConfigEntry<bool> debugMode;
|
public static ConfigEntry<bool> debugMode;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
@@ -39,6 +41,8 @@ namespace CykaOfQud {
|
|||||||
new ConfigDescription("Attribute Bonus Per Level Multiplier"));
|
new ConfigDescription("Attribute Bonus Per Level Multiplier"));
|
||||||
disassemblyBonusMultiplier = Config.Bind("General", "Disassembly Bonus Multiplier", 1f,
|
disassemblyBonusMultiplier = Config.Bind("General", "Disassembly Bonus Multiplier", 1f,
|
||||||
new ConfigDescription("Disassembly Bonus Multiplier"));
|
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"));
|
debugMode = Config.Bind("General", "Debug Mode", false, new ConfigDescription("Debug Mode"));
|
||||||
|
|
||||||
|
@@ -88,20 +88,36 @@ namespace CykaOfIndustry {
|
|||||||
foreach (char c in Bits) {
|
foreach (char c in Bits) {
|
||||||
output.Append(new string(c, (int)Math.Ceiling(Main.disassemblyBonusMultiplier.Value)));
|
output.Append(new string(c, (int)Math.Ceiling(Main.disassemblyBonusMultiplier.Value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Bits = output.ToString();
|
Bits = output.ToString();
|
||||||
|
|
||||||
if (Main.debugMode.Value)
|
if (Main.debugMode.Value)
|
||||||
Console.WriteLine("CykaOfQud: AddBits: New {0}", Bits);
|
Console.WriteLine("CykaOfQud: AddBits: New {0}", Bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(XRL.World.Parts.BitLocker), "AddAllBits")]
|
[HarmonyPatch(typeof(GetTinkeringBonusEvent), nameof(GetTinkeringBonusEvent.GetFor),
|
||||||
static void addAllBits(ref int num) {
|
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)
|
if (Main.debugMode.Value)
|
||||||
Console.WriteLine("CykaOfQud: AddAllBits: Old {0}", num);
|
Console.WriteLine(
|
||||||
num = (int)(num * Main.disassemblyBonusMultiplier.Value);
|
"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)
|
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