Skip to content

Commit

Permalink
additions to produced resources
Browse files Browse the repository at this point in the history
-each comp tech gives 5% bonus to research,
same for weapon tech and security
(so all research types grant something after level 14)

-systems with minors grant boni according to race properties
after affiliation/conquest
  • Loading branch information
anonymissimus committed Dec 28, 2013
1 parent a66a72a commit 45213bf
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 5 deletions.
48 changes: 48 additions & 0 deletions BotE Game/trunk/Source/Gamedata/Races/Minor.cpp
Expand Up @@ -672,3 +672,51 @@ void CMinor::SetOwner(const boost::shared_ptr<CMajor>& race)
{
m_Owner = race;
}

double CMinor::RaceMod(RACE_MOD_TYPE type) const
{
double bonus = 0;
switch(type)
{
case RACE_MOD_TYPE_FOOD:
if(IsRaceProperty(RACE_PROPERTY::AGRARIAN))
bonus += 25;
if(IsRaceProperty(RACE_PROPERTY::PACIFIST))
bonus += 15;
break;
case RACE_MOD_TYPE_INDUSTRY:
if(IsRaceProperty(RACE_PROPERTY::WARLIKE) || IsRaceProperty(RACE_PROPERTY::HOSTILE))
bonus += 15;
if(IsRaceProperty(RACE_PROPERTY::INDUSTRIAL))
bonus += 25;
if(IsRaceProperty(RACE_PROPERTY::SNEAKY))
bonus += 10;
break;
case RACE_MOD_TYPE_ENERGY:
if(IsRaceProperty(RACE_PROPERTY::WARLIKE) || IsRaceProperty(RACE_PROPERTY::HOSTILE))
bonus += 10;
break;
case RACE_MOD_TYPE_SECURITY:
if(IsRaceProperty(RACE_PROPERTY::SECRET))
bonus += 25;
if(IsRaceProperty(RACE_PROPERTY::SNEAKY))
bonus += 15;
break;
case RACE_MOD_TYPE_RESEARCH:
if(IsRaceProperty(RACE_PROPERTY::SCIENTIFIC))
bonus += 25;
if(IsRaceProperty(RACE_PROPERTY::PACIFIST))
bonus += 10;
break;
case RACE_MOD_TYPE_ALL_RESOURCES:
if(IsRaceProperty(RACE_PROPERTY::PRODUCER))
bonus += 10;
break;
case RACE_MOD_TYPE_CREDITS:
if (IsRaceProperty(RACE_PROPERTY::FINANCIAL))
bonus += 25;
break;

}
return bonus;
}
12 changes: 12 additions & 0 deletions BotE Game/trunk/Source/Gamedata/Races/Minor.h
Expand Up @@ -127,6 +127,18 @@ class CMinor : public CRace

void SetOwner(const boost::shared_ptr<CMajor>& race);

enum RACE_MOD_TYPE
{
RACE_MOD_TYPE_FOOD,
RACE_MOD_TYPE_INDUSTRY,
RACE_MOD_TYPE_ENERGY,
RACE_MOD_TYPE_SECURITY,
RACE_MOD_TYPE_RESEARCH,
RACE_MOD_TYPE_ALL_RESOURCES,
RACE_MOD_TYPE_CREDITS
};
double RaceMod(RACE_MOD_TYPE type) const;

protected:

// Attribute
Expand Down
30 changes: 25 additions & 5 deletions BotE Game/trunk/Source/Gamedata/System/System.cpp
Expand Up @@ -904,11 +904,12 @@ void CSystem::CalculateVariables()
m_Production.m_iIridiumProd *= 2;

// Die Boni auf die einzelnen Produktionen berechnen
short tmpFoodBoni = m_Owner->GetEmpire()->GetResearch()->GetBioTech() * TECHPRODBONUS;
short tmpIndustryBoni = m_Owner->GetEmpire()->GetResearch()->GetConstructionTech() * TECHPRODBONUS;
short tmpEnergyBoni = m_Owner->GetEmpire()->GetResearch()->GetEnergyTech() * TECHPRODBONUS;
short tmpSecurityBoni = 0;
short tmpResearchBoni = 0;
const CResearch* const research = m_Owner->GetEmpire()->GetResearch();
short tmpFoodBoni = research->GetBioTech() * TECHPRODBONUS;
short tmpIndustryBoni = research->GetConstructionTech() * TECHPRODBONUS;
short tmpEnergyBoni = research->GetEnergyTech() * TECHPRODBONUS;
short tmpSecurityBoni = research->GetWeaponTech() * TECHPRODBONUS;
short tmpResearchBoni = research->GetCompTech() * TECHPRODBONUS;
short tmpTitanBoni = 0;
short tmpDeuteriumBoni = 0;
short tmpDuraniumBoni = 0;
Expand Down Expand Up @@ -977,6 +978,25 @@ void CSystem::CalculateVariables()
}
m_Production.m_iDeritiumProd *= deritiumProdMulti;


//modify boni according to race properties
if(GetMinorRace())
{
const boost::shared_ptr<const CMinor> minor = boost::dynamic_pointer_cast<CMinor>(m_HomeOf);
tmpFoodBoni += minor->RaceMod(CMinor::RACE_MOD_TYPE_FOOD);
tmpIndustryBoni += minor->RaceMod(CMinor::RACE_MOD_TYPE_INDUSTRY);
tmpEnergyBoni += minor->RaceMod(CMinor::RACE_MOD_TYPE_ENERGY);
tmpSecurityBoni += minor->RaceMod(CMinor::RACE_MOD_TYPE_SECURITY);
tmpResearchBoni += minor->RaceMod(CMinor::RACE_MOD_TYPE_RESEARCH);
tmpAllRessourcesBoni = minor->RaceMod(CMinor::RACE_MOD_TYPE_ALL_RESOURCES);
tmpTitanBoni += tmpAllRessourcesBoni;
tmpDeuteriumBoni += tmpAllRessourcesBoni;
tmpDuraniumBoni += tmpAllRessourcesBoni;
tmpCrystalBoni += tmpAllRessourcesBoni;
tmpIridiumBoni += tmpAllRessourcesBoni;
tmpCreditsBoni += minor->RaceMod(CMinor::RACE_MOD_TYPE_CREDITS);
}

AddBonusToProd(m_Production.m_iFoodProd, tmpFoodBoni);
AddBonusToProd(m_Production.m_iIndustryProd, tmpIndustryBoni);
AddBonusToProd(m_Production.m_iPotentialIndustryProd, tmpIndustryBoni);
Expand Down

0 comments on commit 45213bf

Please sign in to comment.