epfly6 / RepentanceAPIIssueTracker

An unofficial issue tracker for issues with The Binding of Isaac: Repentance's API.
18 stars 1 forks source link

Callback to properly manipulate the chances for devil/angel/planetarium rooms #217

Open StrangeWergon opened 3 years ago

StrangeWergon commented 3 years ago

I think we need a callback like MC_EVALUATE_CACHE to make changes to chances without losing the current calculations the game is doing.

For example, we need to create an passive item that will add +7% to devil/angel/planetarium room spawn chance. Now we don't have an arsenal to change these values, but functions like SetDevilRoomChance() or SetPlanetariumRoomChance() isn't a solution to the problem. We need a way to participate in calculation process of this chances.

Possible solution: MC_ROOM_EVALUATE_CACHE - Called when a room chances must be re-evaluated.

And properties are similar to the Player stats. Something like:

P.S. I'm not sure, but the current functions for room chances don't seem to work:

Btw, why GetDevilRoomChance() is a method of Room class, but GetAngelRoomChance() is a method of Level class?

AgentCucco commented 3 years ago

P.S. I'm not sure, but the current functions for room chances don't seem to work:

  • GetDevilRoomChance() - always return 1.35 for me
  • GetAngelRoomChance() - always return 0.0 for me
  • AddAngelRoomChance() - does nothing or sets 100% chance

A bit off topic, but it is worth mentioning that both GetAngelRoomChance() and AddAngelRoomChance() work as intended, the former returns a value between 0 and 1, being the angel room chance (or angel room chance / 100 I guess), and the latter actually adds the value properly, but the game is retarded and will only display 100.

This even happens ingame, if you use a a confessionary, or self sacrifice room, your angel deal chance after getting a You Feel Blessed message would display 100%, while in reality you only gained around 10% chance.

StrangeWergon commented 3 years ago

@AgentCucco, I have now double-checked, the values are indeed correct, but they work differently.

These are the statistics by floor:

  1. Floor 1: GetDevilRoomChance() = 1.35, GetAngelRoomChance() = 0.0 (Real Chances: Devil = 0%, Angel = 0%)
  2. Floor 2: GetDevilRoomChance() = 1.35, GetAngelRoomChance() = 0.0 (Real Chances: Devil = 100%, Angel = 0%)
  3. Floor 3: GetDevilRoomChance() = 0.33, GetAngelRoomChance() = 0.0 (Real Chances: Devil = 0%, Angel = 33%)
  4. Floor 4: GetDevilRoomChance() = 0.33, GetAngelRoomChance() = 0.0 (Real Chances: Devil = 17%, Angel = 17%)

We can see that GetDevilRoomChance() always returns the total chance (angel + devil), except for the first floor, which is bugged. GetAngelRoomChance() always returns 0.0, because this isn't a chance of the angel room spawn, but a bonus for the angel room spawn.

For example, on the fourth floor we have the following chances: Devil = 17%, Angel = 17% (50%/50%). Then we earn a "You Feel Blessed" message in the sacrifice room. Now GetAngelRoomChance() returns 0.15 (15% bonus) and new rooms chances are: Devil = 14.3%, Angel 19.4% (42.5%/57.5%).

It's terribly counterintuitive, but this is how it works now.