mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 23:35:43 +00:00
Fix game generation
This commit is contained in:
@@ -598,7 +598,7 @@ ActionResultInfo ShardokActionPerformer::PerformScoutAction(SimpleAction action)
|
||||
HeroUPtr& actor = allHeroes[action.actor];
|
||||
vector<HeroInfo> changedHeroes;
|
||||
|
||||
PercentileRollOdds scoutOdds = stealthManager->GetScoutingOdds({}, actor->GetAgility(), actor->GetIntelligence());
|
||||
PercentileRollOdds scoutOdds = stealthManager->GetScoutingOdds({map->GetTerrain(action.target)}, actor->GetAgility(), actor->GetIntelligence());
|
||||
double roll = randomGenerator->OpenEndedPercentile();
|
||||
if (scoutOdds.PercentileRollSucceeds(roll)) {
|
||||
auto possibleTarget = InternalScoutOneTile(actor, action.target, true);
|
||||
|
||||
@@ -16,6 +16,8 @@ class StealthManager {
|
||||
public:
|
||||
virtual PercentileRollOdds GetScoutingOdds(const vector<HexMapTerrain>& traversedTerrain, double agility, double intelligence) const;
|
||||
virtual PercentileRollOdds GetAmbushOdds(HexMapTerrain targetTerrain, double agility, double intelligence) const;
|
||||
|
||||
virtual ~StealthManager() {}
|
||||
};
|
||||
|
||||
#endif /* StealthManager_hpp */
|
||||
|
||||
@@ -17,7 +17,7 @@ using std::string;
|
||||
// ratio of random heroes to standard ones
|
||||
const double RANDOM_HERO_RATIO = 2.0;
|
||||
|
||||
const double PROFESSION_CHANCE = 0.25;
|
||||
const double PROFESSION_CHANCE = 0.4;
|
||||
|
||||
RandomHeroGenerator::RandomHeroGenerator(const string& heroFilePath, std::shared_ptr<ShardokRandomGenerator> randomGenerator) {
|
||||
this->randomGenerator = randomGenerator;
|
||||
@@ -88,7 +88,7 @@ HeroInfo RandomHeroGenerator::CreateRandomHero() {
|
||||
break;
|
||||
}
|
||||
case ranger: {
|
||||
newInfo.constitution = primeStatGenerator(g);
|
||||
newInfo.agility = primeStatGenerator(g);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ HeroInfo RandomHeroGenerator::GenerateHero(bool attacker) {
|
||||
}
|
||||
HeroInfo hero = availableHeroes.back();
|
||||
availableHeroes.pop_back();
|
||||
hero.battalion = GetWeightedRandomBattalion(hero.profession, attacker);
|
||||
hero.battalion = GetWeightedRandomBattalion(hero.profession);
|
||||
|
||||
return hero;
|
||||
}
|
||||
@@ -152,24 +152,24 @@ double RandomHeroGenerator::GetWeightedRandomStat() {
|
||||
}
|
||||
}
|
||||
|
||||
bool BattalionTypeIsAppropriate(BattalionTypeId typeId, Profession profession, bool attacker);
|
||||
bool BattalionTypeIsAppropriate(BattalionTypeId typeId, Profession profession);
|
||||
|
||||
bool BattalionTypeIsAppropriate(BattalionTypeId typeId, Profession profession, bool attacker) {
|
||||
bool BattalionTypeIsAppropriate(BattalionTypeId typeId, Profession profession) {
|
||||
if (profession == mage && (typeId == BattalionTypeId_heavyInfantry || typeId == BattalionTypeId_heavyCavalry)) {
|
||||
return false;
|
||||
}
|
||||
if ((profession == ranger && !attacker) && (typeId == BattalionTypeId_heavyInfantry || typeId == BattalionTypeId_heavyCavalry || typeId == BattalionTypeId_lightCavalry)) {
|
||||
if ((profession == ranger) && (typeId == BattalionTypeId_heavyInfantry || typeId == BattalionTypeId_heavyCavalry || typeId == BattalionTypeId_lightCavalry)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BattalionInfo RandomHeroGenerator::GetWeightedRandomBattalion(Profession profession, bool attacker) {
|
||||
BattalionInfo RandomHeroGenerator::GetWeightedRandomBattalion(Profession profession) {
|
||||
BattalionTypeId typeId;
|
||||
do {
|
||||
typeId = GetWeightedRandomTypeId();
|
||||
} while (!BattalionTypeIsAppropriate(typeId, profession, attacker));
|
||||
} while (!BattalionTypeIsAppropriate(typeId, profession));
|
||||
BattalionInfo battalion;
|
||||
|
||||
battalion.type.typeId = typeId;
|
||||
|
||||
@@ -34,7 +34,7 @@ private:
|
||||
|
||||
double GetWeightedRandomStat();
|
||||
BattalionTypeId GetWeightedRandomTypeId();
|
||||
BattalionInfo GetWeightedRandomBattalion(Profession profession, bool attacker);
|
||||
BattalionInfo GetWeightedRandomBattalion(Profession profession);
|
||||
|
||||
HeroInfo CreateRandomHero();
|
||||
|
||||
|
||||
@@ -113,11 +113,6 @@ class BackendClient
|
||||
message_with_headers = create_message_with_headers(message, current_id)
|
||||
|
||||
add_responder(Responder.new(stream_out), current_id)
|
||||
#stream_out.errback do |err|
|
||||
# binding.pry
|
||||
# puts "Lost connection for message #{current_id}"
|
||||
# remove_responder(current_id)
|
||||
# end
|
||||
|
||||
puts "Streaming responses for id #{current_id}"
|
||||
@send_mutex.synchronize do
|
||||
@@ -138,6 +133,7 @@ class BackendClient
|
||||
|
||||
def receive
|
||||
header_bytes = @socket.recv(16)
|
||||
puts 'received header bytes'
|
||||
return if header_bytes.nil?
|
||||
message_id_words = header_bytes.unpack('LLLL')
|
||||
message_id = message_id_words[0] << 32 | message_id_words[1]
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo rsync -rtlDv server/installdata/usr/local/share/eagle0/ /usr/local/share/eagle0/
|
||||
|
||||
sudo rsync -rtlDv server/installdata/www/ /www/
|
||||
|
||||
Reference in New Issue
Block a user