mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 06:35:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea3252db90 |
@@ -46,12 +46,12 @@ auto ConvertVictoryCondition(const net::eagle0::shardok::common::VictoryConditio
|
||||
|
||||
auto FromPlayerInfoProto(flatbuffers::FlatBufferBuilder& fbb, const PlayerInfoProto& piProto)
|
||||
-> flatbuffers::Offset<net::eagle0::shardok::storage::fb::PlayerInfo> {
|
||||
auto alliesVec = std::vector<AlliedPlayer>();
|
||||
std::vector<AlliedPlayer> alliesVec;
|
||||
alliesVec.reserve(piProto.allies_size());
|
||||
for (const auto& apProto : piProto.allies()) { alliesVec.emplace_back(apProto.player_id()); }
|
||||
const auto alliesOffset = fbb.CreateVectorOfStructs(alliesVec);
|
||||
|
||||
auto vcVec = std::vector<int8_t>();
|
||||
std::vector<int8_t> vcVec;
|
||||
const int victoryConditionCount = piProto.victory_conditions_size();
|
||||
vcVec.reserve(victoryConditionCount);
|
||||
for (int i = 0; i < victoryConditionCount; i++) {
|
||||
@@ -142,7 +142,7 @@ auto SetupInitialGameState(
|
||||
&endGameCondition);
|
||||
auto gameIdOffset = fbb.CreateString(gameId);
|
||||
|
||||
auto playerInfoVec = std::vector<Offset<PlayerInfo>>();
|
||||
std::vector<Offset<PlayerInfo>> playerInfoVec;
|
||||
playerInfoVec.reserve(playerInfoProtos.size());
|
||||
for (const auto& piProto : playerInfoProtos) {
|
||||
playerInfoVec.push_back(FromPlayerInfoProto(fbb, piProto));
|
||||
@@ -162,7 +162,7 @@ auto SetupInitialGameState(
|
||||
// Add slack units: 3 per necromancer, minimum 5 for general use
|
||||
const int slackUnits = std::max(5, necromancerCount * 3);
|
||||
|
||||
auto unitsVec = std::vector<Unit>();
|
||||
std::vector<Unit> unitsVec;
|
||||
unitsVec.reserve(units.size() + slackUnits);
|
||||
for (const auto& unit : units) {
|
||||
Unit modifiedUnit = unit;
|
||||
|
||||
@@ -157,7 +157,7 @@ TEST_F(MeleeActionTests, Execute_givesDamageBasedOnBattalionTypeInfo) {
|
||||
|
||||
PercentileRollOdds ambushOdds = MakeOdds(0);
|
||||
|
||||
std::vector<double> rolls{ambushRoll, attackerRoll, defenderRoll};
|
||||
auto rolls = std::vector<double>{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 std::vector<double> rolls{0, 50, 50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.0, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.0, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.0, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.0, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.0, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.0, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.25, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.25, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.25, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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 std::vector<double> rolls{0.75, 0.50, 0.50};
|
||||
const auto rolls = std::vector<double>{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) {
|
||||
std::vector<double> rolls{0.75, 0.50, 0.50};
|
||||
auto rolls = std::vector<double>{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) {
|
||||
std::vector<double> rolls{0.75, 0.50, 0.50};
|
||||
auto rolls = std::vector<double>{0.75, 0.50, 0.50};
|
||||
auto generator = SequenceRandomGenerator::WithSequence(rolls);
|
||||
|
||||
GetGameSettingsSetter().SetDouble(kSettingsKeys.fortifyDamageTakenMultiplier, 0.9);
|
||||
|
||||
Reference in New Issue
Block a user