| 614 | } |
| 615 | |
| 616 | bool Game_Player::Move(int dir) { |
| 617 | if (!IsStopping()) { |
| 618 | return true; |
| 619 | } |
| 620 | |
| 621 | Game_Character::Move(dir); |
| 622 | if (IsStopping()) { |
| 623 | return false; |
| 624 | } |
| 625 | |
| 626 | if (InAirship()) { |
| 627 | return true; |
| 628 | } |
| 629 | |
| 630 | int terrain_id = Game_Map::GetTerrainTag(GetX(), GetY()); |
| 631 | const auto* terrain = lcf::ReaderUtil::GetElement(lcf::Data::terrains, terrain_id); |
| 632 | bool red_flash = false; |
| 633 | |
| 634 | if (terrain) { |
| 635 | if (terrain->damage != 0) { |
| 636 | for (auto hero : Main_Data::game_party->GetActors()) { |
| 637 | if (terrain->damage < 0 || !hero->PreventsTerrainDamage()) { |
| 638 | if (terrain->damage > 0) { |
| 639 | red_flash = true; |
| 640 | } |
| 641 | if (terrain->easyrpg_damage_in_percent) { |
| 642 | int value = std::max<int>(1, std::abs(hero->GetMaxHp() * terrain->damage / 100)); |
| 643 | hero->ChangeHp((terrain->damage > 0 ? -value : value), terrain->easyrpg_damage_can_kill); |
| 644 | } else { |
| 645 | hero->ChangeHp(-terrain->damage, terrain->easyrpg_damage_can_kill); |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | if (terrain->damage > 0 && terrain->easyrpg_damage_can_kill) { |
| 650 | if (!Main_Data::game_party->IsAnyActive() && Main_Data::game_party->GetBattlerCount() > 0) { |
| 651 | Scene::instance->SetRequestedScene(std::make_shared<Scene_Gameover>()); |
| 652 | return true; |
| 653 | } |
| 654 | } |
| 655 | } |
| 656 | if ((!terrain->on_damage_se || red_flash) && Player::IsRPG2k3()) { |
| 657 | Main_Data::game_system->SePlay(terrain->footstep); |
| 658 | } |
| 659 | } else { |
| 660 | Output::Warning("Player BeginMove: Invalid terrain ID {} at ({}, {})", terrain_id, GetX(), GetY()); |
| 661 | } |
| 662 | |
| 663 | if (red_flash) { |
| 664 | Main_Data::game_screen->FlashMapStepDamage(); |
| 665 | } |
| 666 | |
| 667 | return true; |
| 668 | } |
| 669 | |
| 670 | bool Game_Player::IsAboard() const { |
| 671 | return data()->aboard; |
nothing calls this directly
no test coverage detected