Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #1103

Merged
merged 4 commits into from
Feb 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ void Bitmap::TiledBlit(int ox, int oy, Rect const& src_rect, Bitmap const& src,
return;

if (ox >= src_rect.width) ox %= src_rect.width;
if (oy >= src_rect.height) ox %= src_rect.height;
if (oy >= src_rect.height) oy %= src_rect.height;
if (ox < 0) ox += src_rect.width * ((-ox + src_rect.width - 1) / src_rect.width);
if (oy < 0) oy += src_rect.height * ((-oy + src_rect.height - 1) / src_rect.height);

Expand Down
11 changes: 5 additions & 6 deletions src/game_battlealgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,15 +1399,14 @@ bool Game_BattleAlgorithm::Escape::Execute() {
int ally_agi = Main_Data::game_party->GetAverageAgility();
int enemy_agi = Main_Data::game_enemyparty->GetAverageAgility();

double to_hit = 1.5 * ((float)ally_agi / enemy_agi);
// flee chance is 0% when ally has less than 70% of enemy agi
// 100% -> 50% flee, 200% -> 100% flee
float to_hit = std::max(0.0f, 1.5f - ((float)enemy_agi / ally_agi));

// Every failed escape is worth 10% higher escape chance (see help file)
for (int i = 0; i < Game_Battle::escape_fail_count; ++i) {
to_hit += (to_hit * 0.1);
}
// Every failed escape is worth 10% higher escape chance
to_hit += to_hit * Game_Battle::escape_fail_count * 0.1f;

to_hit *= 100;

this->success = Utils::GetRandomNumber(0, 99) < (int)to_hit;
}

Expand Down
4 changes: 2 additions & 2 deletions src/game_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void Game_Map::ScrollDown(int distance) {
map_info.position_y = (map_info.position_y + distance + height) % height;
parallax_y -= map_info.parallax_vert ? distance / 2 : 0;
} else {
if (map_info.position_y + distance < (GetHeight() - 15) * SCREEN_TILE_WIDTH) {
if (map_info.position_y + distance <= (GetHeight() - 15) * SCREEN_TILE_WIDTH) {
map_info.position_y += distance;
if (map_info.parallax_vert)
parallax_y -= distance / 2;
Expand Down Expand Up @@ -390,7 +390,7 @@ void Game_Map::ScrollRight(int distance) {
map_info.position_x = (map_info.position_x + distance + width) % width;
parallax_x -= map_info.parallax_horz ? distance / 2 : 0;
} else {
if (map_info.position_x + distance < (GetWidth() - 20) * SCREEN_TILE_WIDTH) {
if (map_info.position_x + distance <= (GetWidth() - 20) * SCREEN_TILE_WIDTH) {
map_info.position_x += distance;
if (map_info.parallax_horz)
parallax_x -= distance / 2;
Expand Down
3 changes: 3 additions & 0 deletions src/scene_battle_rpg2k.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ void Scene_Battle_Rpg2k::Escape() {
escape_success = escape_alg.Execute();
escape_alg.Apply();

if (escape_success)
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Escape));

battle_result_messages.clear();
escape_alg.GetResultMessages(battle_result_messages);

Expand Down
1 change: 1 addition & 0 deletions src/scene_battle_rpg2k3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ void Scene_Battle_Rpg2k3::Escape() {
ShowNotification(battle_result_messages[0]);
}
else {
Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Escape));
Game_Temp::battle_result = Game_Temp::BattleEscape;

// ToDo: Run away animation
Expand Down