| 719 | } |
| 720 | |
| 721 | static void TestNormalAttack(int engine) { |
| 722 | const MockBattle m(4, 4, engine); |
| 723 | lcf::Data::enemies[1].attribute_ranks[0] = 2; |
| 724 | MakeDBAttribute(1, lcf::rpg::Attribute::Type_physical, 200, 200, 200, 200, 200); |
| 725 | |
| 726 | const bool is2k3 = Player::IsRPG2k3(); |
| 727 | |
| 728 | SUBCASE("enemy 120/0 -> enemy 0/90") { |
| 729 | auto source = MakeStatEnemy(0, 120, 0, 0); |
| 730 | auto target = MakeStatEnemy(1, 0, 90, 0); |
| 731 | |
| 732 | REQUIRE_EQ(source->GetAtk(), 120); |
| 733 | REQUIRE_EQ(target->GetDef(), 90); |
| 734 | |
| 735 | testEnemyAttackEnemy(*source, *target, 38, 114, 76); |
| 736 | } |
| 737 | |
| 738 | SUBCASE("enemy 0/0 -> enemy 0/100") { |
| 739 | auto source = MakeStatEnemy(0, 0, 0, 0); |
| 740 | auto target = MakeStatEnemy(1, 0, 100, 0); |
| 741 | |
| 742 | REQUIRE_EQ(0, Algo::CalcNormalAttackEffect(*source, *target, Game_Battler::WeaponAll, false, false, false, lcf::rpg::System::BattleCondition_none, true)); |
| 743 | } |
| 744 | |
| 745 | SUBCASE("enemy 9999/0 -> enemy 0/0") { |
| 746 | auto source = MakeStatEnemy(0, 9999, 0, 0); |
| 747 | auto target = MakeStatEnemy(1, 0, 0, 0); |
| 748 | |
| 749 | REQUIRE_EQ(4999, Algo::CalcNormalAttackEffect(*source, *target, Game_Battler::WeaponAll, false, false, false, lcf::rpg::System::BattleCondition_none, true)); |
| 750 | } |
| 751 | |
| 752 | SUBCASE("actor 120/0 -> enemy 0/90") { |
| 753 | auto source = MakeStatActor(0, 120, 0, 0); |
| 754 | auto target = MakeStatEnemy(0, 0, 90, 0); |
| 755 | |
| 756 | REQUIRE_EQ(source->GetAtk(), 120); |
| 757 | REQUIRE_EQ(target->GetDef(), 90); |
| 758 | |
| 759 | SUBCASE("front row") { |
| 760 | source->SetBattleRow(lcf::rpg::SaveActor::RowType_front); |
| 761 | if (is2k3) { |
| 762 | testActorAttackRow(*source, *target, 47, 28, 35, 38, 38, 47); |
| 763 | } else { |
| 764 | testActorAttackRow(*source, *target, 38, 38, 38, 38, 38, 38); |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | SUBCASE("back row") { |
| 769 | source->SetBattleRow(lcf::rpg::SaveActor::RowType_back); |
| 770 | if (is2k3) { |
| 771 | testActorAttackRow(*source, *target, 38, 35, 35, 38, 47, 47); |
| 772 | } else { |
| 773 | testActorAttackRow(*source, *target, 38, 38, 38, 38, 38, 38); |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | SUBCASE("weapons and attributes") { |
| 778 | MakeDBEquip(1, lcf::rpg::Item::Type_weapon, 20, 0, 0, 0, 0); |
no test coverage detected