fix: Fix rand() ranges to match the actual game

This commit is contained in:
Tristan Russell 2025-01-17 22:11:06 -05:00
parent 27fdf340e0
commit 7446804451
1 changed files with 7 additions and 7 deletions

View File

@ -22,27 +22,27 @@ void Step(struct SS13ArcadeEnv* instance, const int action, struct Observation*
switch (action) {
case 0: // Attack
instance->enemy_hp -= rand() % 4 + 2;
instance->enemy_hp -= (rand() % 5) + 2; // 2-6
break;
case 1: // Heal
instance->player_hp += rand() % 6 + 2;
instance->player_mp -= rand() % 1 + 2;
instance->player_hp += (rand() % 3) + 6; // 6-8
instance->player_mp -= (rand() % 3) + 1; // 1-3
break;
case 2: // Charge
instance->player_mp += rand() % 4 + 3;
instance->player_mp += (rand() % 4) + 4; // 4-7
break;
}
if(instance->enemy_hp <= 0 || instance->enemy_mp <= 0) { // Enemy Defeated
reward = 1;
terminated = true;
} else if(instance->enemy_mp <= 5 && rand() % 1 + 9 >= 7) { // Enemy Drain Player MP
instance->player_mp -= rand() % 2 + 1;
} else if(instance->enemy_mp <= 5 && (rand() % 10) + 1 >= 7) { // Enemy Drain Player MP 1-10
instance->player_mp -= (rand() % 2) + 2; // 2-3
} else if(instance->enemy_hp <= 10 && instance->enemy_mp > 4) { // Enemy Heal
instance->enemy_hp += 4;
instance->enemy_mp -= 4;
} else {
instance->player_hp -= rand() % 3 + 3;
instance->player_hp -= (rand() % 4) + 3; // 3-6
}
if(instance->player_hp <= 0 || instance->player_mp <= 0) {