Compare commits

..
Author SHA1 Message Date
admin 11547dac4e Use direct melee roll vector declarations 2026-06-23 13:02:30 -07:00
8 changed files with 24 additions and 24 deletions
@@ -34,7 +34,7 @@ TEST_F(FallIntoWaterActionTests, takesDamage) {
Coords c{2, 2};
auto fallerOffset = AddGenericUnit(1, 0, c);
std::vector<Unit> unitsVec{fallerOffset};
auto unitsVec = std::vector<Unit>{fallerOffset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
net::eagle0::shardok::storage::fb::Weather weather;
@@ -77,7 +77,7 @@ TEST_F(FallIntoWaterActionTests, highRoll_sweptAway) {
Coords c{2, 2};
auto fallerOffset = AddGenericUnit(1, 0, c);
std::vector<Unit> unitsVec{fallerOffset};
auto unitsVec = std::vector<Unit>{fallerOffset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
net::eagle0::shardok::storage::fb::Weather weather;
@@ -121,7 +121,7 @@ TEST_F(FallIntoWaterActionTests, lowRoll_escapes) {
Coords c{2, 2};
auto fallerOffset = AddGenericUnit(1, 0, c);
std::vector<Unit> unitsVec{fallerOffset};
auto unitsVec = std::vector<Unit>{fallerOffset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
net::eagle0::shardok::storage::fb::Weather weather;
@@ -170,7 +170,7 @@ TEST_F(FallIntoWaterActionTests, noHero_alwaysSweptAway) {
unit.mutable_location() = c;
unit.mutable_battalion().mutate_size(500);
std::vector<Unit> unitsVec{unit};
auto unitsVec = std::vector<Unit>{unit};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
net::eagle0::shardok::storage::fb::Weather weather;
@@ -53,7 +53,7 @@ class MeteorCastActionTests : public ::testing::Test {
auto otherOffset = AddGenericUnit(1, 1, Coords(1, 1));
std::vector<Unit> unitsVec{casterOffset, otherOffset};
auto unitsVec = std::vector<Unit>{casterOffset, otherOffset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
auto hexMap = AddHexMap(fbb, BASIC_MAP_FB);
@@ -104,7 +104,7 @@ auto MakeGameState() -> GameStateW {
ub.mutable_location() = coords;
ub.mutate_status(net::eagle0::shardok::storage::fb::UnitStatus_NORMAL_UNIT);
std::vector<Unit> unitsVec{ub};
auto unitsVec = std::vector<Unit>{ub};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
auto weather = net::eagle0::shardok::storage::fb::Weather(
@@ -45,7 +45,7 @@ class PerformUndeadCommandsActionTest : public ::testing::Test {
auto undeadOff = AddGenericUndead(UNCONTROLLED_PLAYER_ID, 1, undeadPosition);
auto targetedOff = AddGenericUnit(4, 2, Coords(5, 5));
std::vector<Unit> unitsVec{adjOff, undeadOff, targetedOff};
auto unitsVec = std::vector<Unit>{adjOff, undeadOff, targetedOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
auto mapOff = AddBasicMap(fbb);
@@ -22,7 +22,7 @@ class PlaceHiddenUnitCommandTest : public ::testing::Test {
auto actorOff = AddGenericUnit(0, 0, Coords(-1, -1));
std::vector<Unit> unitsVec{actorOff};
auto unitsVec = std::vector<Unit>{actorOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
auto hexMapOffset = AddHexMap(fbb, BASIC_MAP_FB);
@@ -21,7 +21,7 @@ class UndeadChangeAction_test : public ::testing::Test {
auto firstUndeadOff = AddGenericUndead(1, 1, Coords(4, 4));
auto secondUndeadOff = AddGenericUndead(2, 2, Coords(1, 1));
vector<Unit> unitsVec{otherUnit, firstUndeadOff, secondUndeadOff};
auto unitsVec = vector<Unit>{otherUnit, firstUndeadOff, secondUndeadOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
GameStateBuilder gsb(fbb);
@@ -39,7 +39,7 @@ class UpdateOpponentKnowledgeActionTests : public ::testing::Test {
auto attackerOff = AddGenericUnit(0, 0, attackerPosition);
auto defenderOff = AddGenericUnit(1, 1, notAdjacentPosition);
vector<Unit> unitsVec{attackerOff, defenderOff};
auto unitsVec = vector<Unit>{attackerOff, defenderOff};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
auto statusBuilder = net::eagle0::shardok::storage::fb::GameStatusBuilder(fbb);
@@ -157,7 +157,7 @@ TEST_F(MeleeActionTests, Execute_givesDamageBasedOnBattalionTypeInfo) {
PercentileRollOdds ambushOdds = MakeOdds(0);
auto rolls = std::vector<double>{ambushRoll, attackerRoll, defenderRoll};
std::vector<double> rolls{ambushRoll, attackerRoll, defenderRoll};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
for (int size = 0; size <= 1000; size += 100) {
@@ -205,7 +205,7 @@ TEST_F(MeleeActionTests, Execute_givesDamageBasedOnBattalionTypeInfo) {
}
TEST_F(MeleeActionTests, Execute_normalPlayers_increasesOpponentKnowledge) {
const auto rolls = std::vector<double>{0, 50, 50};
const std::vector<double> rolls{0, 50, 50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutable_opponent_knowledge()->Mutate(1, 51);
@@ -238,7 +238,7 @@ TEST_F(MeleeActionTests, Execute_normalPlayers_increasesOpponentKnowledge) {
}
TEST_F(MeleeActionTests, Execute_lledUnit_increasesOpponentKnowledge) {
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutable_opponent_knowledge()->Mutate(1, 51);
@@ -272,7 +272,7 @@ TEST_F(MeleeActionTests, Execute_lledUnit_increasesOpponentKnowledge) {
}
TEST_F(MeleeActionTests, Execute_givesAttackerStrengthXp) {
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutable_attached_hero().mutate_strength_xp(57);
@@ -297,7 +297,7 @@ TEST_F(MeleeActionTests, Execute_givesAttackerStrengthXp) {
}
TEST_F(MeleeActionTests, Execute_givesDefenderStrengthXp) {
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
defenderWithHero->mutable_attached_hero().mutate_strength_xp(12);
@@ -322,7 +322,7 @@ TEST_F(MeleeActionTests, Execute_givesDefenderStrengthXp) {
}
TEST_F(MeleeActionTests, ExecuteWithOutAmbush_givesNoAttackerAgilityXp) {
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutable_attached_hero().mutate_agility_xp(88);
@@ -347,7 +347,7 @@ TEST_F(MeleeActionTests, ExecuteWithOutAmbush_givesNoAttackerAgilityXp) {
}
TEST_F(MeleeActionTests, ExecuteWithAmbush_givesAttackerAgilityXp) {
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutate_hidden(true);
@@ -373,7 +373,7 @@ TEST_F(MeleeActionTests, ExecuteWithAmbush_givesAttackerAgilityXp) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttacker_unhides) {
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutate_hidden(true);
@@ -398,7 +398,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttacker_unhides) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_ambushes) {
const auto rolls = std::vector<double>{0.25, 0.50, 0.50};
const std::vector<double> rolls{0.25, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutate_hidden(true);
@@ -419,7 +419,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_ambushes) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_intoCastle_noAmbush) {
const auto rolls = std::vector<double>{0.25, 0.50, 0.50};
const std::vector<double> rolls{0.25, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutate_hidden(true);
@@ -444,7 +444,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_intoCastle_noAmbush) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_stunsDefender) {
const auto rolls = std::vector<double>{0.25, 0.50, 0.50};
const std::vector<double> rolls{0.25, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutate_hidden(true);
@@ -467,7 +467,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_stunsDefender) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerHighRoll_noAmbush) {
const auto rolls = std::vector<double>{0.75, 0.50, 0.50};
const std::vector<double> rolls{0.75, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutate_hidden(true);
@@ -491,7 +491,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerHighRoll_noAmbush) {
}
TEST_F(MeleeActionTests, Execute_onStunnedDefender_doesMoreDamage) {
auto rolls = std::vector<double>{0.75, 0.50, 0.50};
std::vector<double> rolls{0.75, 0.50, 0.50};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
GetGameSettingsSetter().SetDouble(kSettingsKeys.damageReceivedMultiplierFromStun, 1.25);
@@ -533,7 +533,7 @@ TEST_F(MeleeActionTests, Execute_onStunnedDefender_doesMoreDamage) {
}
TEST_F(MeleeActionTests, Execute_onFortifiedDefender_doesLessDamage) {
auto rolls = std::vector<double>{0.75, 0.50, 0.50};
std::vector<double> rolls{0.75, 0.50, 0.50};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
GetGameSettingsSetter().SetDouble(kSettingsKeys.fortifyDamageTakenMultiplier, 0.9);