HearthSim / Hearthstone-Deck-Tracker

A deck tracker and deck manager for Hearthstone on Windows
https://hsreplay.net/downloads/
4.75k stars 1.12k forks source link

[dev] API for combat simulation results #4317

Open InsaneDoggo opened 3 years ago

InsaneDoggo commented 3 years ago

Would be nice to have API for combat simulation results:

float PlayerLethalRate 
float WinRate 
float TieRate 
float LossRate 
float OpponentLethalRate 

int Iterations

It's useful in general, but my usecase is to detect opponent's high roll when player lose match. e.g. if (OpponentLethalRate < X) {...}

IIRC it's calculated right before combat begins (Opponent's TurnStart), if i'm wrong than would be nice to have additional event: OnCombatSimulationReady(...)

sgkoishi commented 3 years ago

https://github.com/HearthSim/Hearthstone-Deck-Tracker/blob/0bd5bac9f62bfb8ec94e6eaa650467572b9d874b/Hearthstone%20Deck%20Tracker/BobsBuddy/BobsBuddyInvoker.cs#L445-L456

All those methods, classes and the BobsBuddy library are either private, internal or source unavailable - I'm not sure if that means something. You may still find some way to patch the existing method :)

KkEeVvIiNnn commented 3 years ago

have u already solved this problem? I am faced with the same problem ( want to get the win/tie/loss rate after each turn simulation done ) for developing an analyze plugin thanks a lot!!

sgkoishi commented 3 years ago

have u already solved this problem? I am faced with the same problem ( want to get the win/tie/loss rate after each turn simulation done ) for developing an analyze plugin thanks a lot!!

Both the BobsBuddy library and all related methods and classes are either private, internal or source unavailable. I would guess they are intended to keep those data secretly without public access.

You could still try to 'patch' them using tools like Harmony

KkEeVvIiNnn commented 3 years ago

have u already solved this problem? I am faced with the same problem ( want to get the win/tie/loss rate after each turn simulation done ) for developing an analyze plugin thanks a lot!!

Both the BobsBuddy library and all related methods and classes are either private, internal or source unavailable. I would guess they are intended to keep those data secretly without public access.

~You could still try to 'patch' them using tools like Harmony~

so does it means that i need to run my own simulation? ( can't just fetch the results that HDT already calced )

sgkoishi commented 3 years ago

have u already solved this problem? I am faced with the same problem ( want to get the win/tie/loss rate after each turn simulation done ) for developing an analyze plugin thanks a lot!!

Both the BobsBuddy library and all related methods and classes are either private, internal or source unavailable. I would guess they are intended to keep those data secretly without public access. ~You could still try to 'patch' them using tools like Harmony~

so does it means that i need to run my own simulation? ( can't just fetch the results that HDT already calced )

By patching you can change the logic of HDT itself, thus 'steal' those results once the simulation is done. Without patching you could still get the result from Hearthstone_Deck_Tracker.BobsBuddy.BobsBuddyInvoker.Output using reflection, but there's no way to know when the simulation is done. Of course, you can run your own simulation, but since BobsBuddy is non-public you still need reflection, otherwise, you may write your own simulator.

KkEeVvIiNnn commented 3 years ago

have u already solved this problem? I am faced with the same problem ( want to get the win/tie/loss rate after each turn simulation done ) for developing an analyze plugin thanks a lot!!

Both the BobsBuddy library and all related methods and classes are either private, internal or source unavailable. I would guess they are intended to keep those data secretly without public access. ~You could still try to 'patch' them using tools like Harmony~

so does it means that i need to run my own simulation? ( can't just fetch the results that HDT already calced )

By patching you can change the logic of HDT itself, thus 'steal' those results once the simulation is done. Without patching you could still get the result from Hearthstone_Deck_Tracker.BobsBuddy.BobsBuddyInvoker.Output using reflection, but there's no way to know when the simulation is done.

Thank you very much. I have to learn more about what you've mentioned.😅 And if I can use Hearthstone_Deck_Tracker.Controls.Overlay.BobsBuddyPanel.WinRateDisplay (the problem is that this property is not static)