MCPcopy Create free account
hub / github.com/EasyRPG/Player / testEnemyAttackEnemy

Function testEnemyAttackEnemy

tests/algo.cpp:678–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678static void testEnemyAttackEnemy(Game_Battler& source, Game_Battler& target, int dmg, int crit, int charged) {
679 for (int wid = -1; wid <= 2; ++wid) {
680 for (int cid = 0; cid <= 4; ++cid) {
681 CAPTURE(wid);
682 CAPTURE(cid);
683
684 SUBCASE("no crit") {
685 REQUIRE_EQ(dmg, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), false, false, false, lcf::rpg::System::BattleCondition(cid), true));
686 REQUIRE_EQ(dmg, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), false, false, false, lcf::rpg::System::BattleCondition(cid), false));
687 }
688
689 SUBCASE("crit") {
690 REQUIRE_EQ(crit, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), true, false, false, lcf::rpg::System::BattleCondition(cid), true));
691 REQUIRE_EQ(crit, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), true, false, false, lcf::rpg::System::BattleCondition(cid), false));
692 }
693
694 SUBCASE("charged") {
695 REQUIRE_EQ(charged, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), false, true, false, lcf::rpg::System::BattleCondition(cid), true));
696 REQUIRE_EQ(charged, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), false, true, false, lcf::rpg::System::BattleCondition(cid), false));
697 }
698
699 SUBCASE("crit+charged") {
700 REQUIRE_EQ(crit, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), true, true, false, lcf::rpg::System::BattleCondition(cid), true));
701 REQUIRE_EQ(crit, Algo::CalcNormalAttackEffect(source, target, Game_Battler::Weapon(wid), true, true, false, lcf::rpg::System::BattleCondition(cid), false));
702 }
703 }
704 }
705}
706
707static void testActorAttackRow(Game_Battler& source, Game_Battler& target, int none, int back, int surround, int pincers, int back_no_bug, int surround_no_bug) {
708 REQUIRE_EQ(none, Algo::CalcNormalAttackEffect(source, target, Game_Battler::WeaponAll, false, false, false, lcf::rpg::System::BattleCondition_none, true));

Callers 1

TestNormalAttackFunction · 0.85

Calls 2

CalcNormalAttackEffectFunction · 0.85
WeaponEnum · 0.85

Tested by 1

TestNormalAttackFunction · 0.68