Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List

Race.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2003 - 2005 Elliott Kleinrock, Dan Neely, Kurt W. Over, Damon Domjan
00003 
00004 This file is part of FreeStars, a free clone of the Stars! game.
00005 
00006 FreeStars is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 FreeStars is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with FreeStars; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 The full GPL Copyright notice should be in the file COPYING.txt
00021 
00022 Contact:
00023 Email Elliott at 9jm0tjj02@sneakemail.com
00024 */
00025 
00030 #if !defined(Race_h)
00031 #define Race_h
00032 
00033 #include <string>
00034 #include <deque>
00035 #include <algorithm>
00036 using namespace std;
00037 
00038 class TiXmlNode;
00039 class Player;
00040 class Hull;
00041 class RacialTrait;
00042 
00043 #include "Cost.h"
00044 #include "FSTypes.h"
00045 #include "Component.h"
00046 
00050 class Race {
00051 public:
00052         Race();
00053         virtual ~Race();
00054         void ResetDefaults();
00055         bool ParseNode(const TiXmlNode * node, bool other);
00056         void WriteNode(TiXmlNode * node) const;
00057         void WriteHabs(TiXmlNode * node) const;
00058 
00059         const RacialTrait * GetPRT() const      { return mPRT; }
00060         bool HasLRT(const RacialTrait * lrt) const              { return find(mLRTs.begin(), mLRTs.end(), lrt) != mLRTs.end(); }
00061 
00062         string GetSingleName() const            { return mSingularName; }
00063         string GetPluralName() const            { return mPluralName; }
00064 
00065         // Racial Trait abilities
00066         double GroundAttackFactor() const;
00067         double GroundDefenseFactor() const;
00068         double GrowthRateFactor() const;
00069         double PopulationFactor() const;
00070         long InherentCloaking(HullType hc) const;
00071         bool CloakCargo() const;
00072         long MineSpeedBonus() const;
00073         double SpyTechBonus() const;
00074         double BattleSpeedBonus() const;
00075         double ComponentCostFactor(ComponentType ct) const;
00076         double PermaformChance() const;
00077         bool CanSeeHabSettings() const;
00078         bool TemporaryTerraform() const;
00079         bool ScanDesign() const;
00080         double RepairFactor() const;
00081         double FreighterReproduction() const;
00082         bool MineFieldScanning() const;
00083         bool CanRemoteDetonate() const;
00084         double MineDecayFactor() const;
00085 
00086         bool PacketTerraform() const;
00087         bool PacketScanning() const;
00088         double PacketCostMinFactor() const;
00089         long PacketSizeOneMin() const;
00090         long PacketSizeMixed() const;
00091         long PacketCostResources() const;
00092         double PacketDecayFactor() const;
00093         double PacketCatchFactor() const;
00094         long PacketDecayPenalty() const;
00095 
00096         long PRTStartTech(TechType tt) const;
00097         long LRTStartTech(TechType tt) const;
00098 
00099         long StartAtBonus() const;
00100         bool HasSecondPlanet() const;
00101         bool GateCargo() const;
00102         double OvergateLossFactor() const;
00103         bool GateScanning() const;
00104         long ARTechType() const;
00105         double FuelFactor() const;
00106         bool GeneralResearch() const;
00107         bool UltimateRecycle() const;
00108         double EngineFailure(long speed) const;
00109         double SpaceScanFactor() const;
00110         double PenScanFactor() const;
00111         double StartingPopFactor() const;
00112         double Miniturize(long diff) const
00113                 { return (diff == 0) ? ZeroTechCost() : min(MaxMiniturize(), MiniturizeRate() * diff); }
00114         double ZeroTechCost() const;
00115         double MaxMiniturize() const;
00116         double MiniturizeRate() const;
00117         double ShieldFactor() const;
00118         double ArmorFactor() const;
00119         double ShieldRegenRate() const;
00120 
00121         double DefenseFactor() const;
00122 
00123         long BuiltinScan(const Player * player, HullType hc, bool PenScan, long pop = 0) const;
00124 
00125 
00126         // Race settings (everything after the LRT selection)
00127         double RadDamage(HabType ht) const;
00128         double HabFactor(HabType ht, long tick) const;  // gives how habitable this is abs(tick - midpoint)/width or negative if outside range
00129         long HabFactor(const Planet * p) const;                 // gives how habitable this planet is
00130         long HabCenter(HabType ht) const;
00131         long HabWidth(HabType ht) const;
00132         double GrowthRate() const                               { return mGrowthRate * GrowthRateFactor(); }
00133         long PopEfficiency() const                              { return mPopEfficiency; }
00134         long FactoryRate() const                                { return mFactoryRate; }
00135         const Cost & FactoryCost() const                { return mFactoryCost; }
00136         long FactoriesRun() const                               { return mFactoriesRun; }
00137         long MineRate() const                                   { return mMineRate; }
00138         const Cost & MineCost() const                   { return mMineCost; }
00139         long MinesRun() const                                   { return mMinesRun; }
00140         double TechCostFactor(TechType tt) const;
00141         bool StartAt() const                                    { return mStartAt; }
00142 
00143         const RacialTrait * GetLRT(int i)               { return mLRTs[i]; }
00144         long GetLRTCount()                                              { return mLRTs.size(); }
00145 
00146         long GetStartMinerals() const                   { return mStartMinerals; }
00147         long GetStartConcentrations() const             { return mStartConcentrations; }
00148         long GetStartMines() const                              { return mStartMines; }
00149         long GetStartFactories() const                  { return mStartFactories; }
00150         long GetStartDefneses() const                   { return mStartDefneses; }
00151 
00152 protected:
00153         const RacialTrait * mPRT;
00154         deque<const RacialTrait *> mLRTs;
00155         string mSingularName;
00156         string mPluralName;
00157         long mRaceEmblem;
00158         deque<double> mTechCostFactor;          // (.5, 1.0, 1.75)
00159 
00160         deque<long> mHabCenter;
00161         deque<long> mHabWidth;
00162         double mGrowthRate;
00163         long mPopEfficiency;
00164         long mFactoryRate;
00165         string mPassword;
00166         Cost mFactoryCost;
00167         long mFactoriesRun;
00168         long mMineRate;
00169         Cost mMineCost;
00170         long mMinesRun;
00171         bool mStartAt;
00172 
00173         long mStartMinerals;
00174         long mStartConcentrations;
00175         long mStartMines;
00176         long mStartFactories;
00177         long mStartDefneses;
00178 
00179         // Calculated Values
00180         double CVGroundAttackFactor;
00181         bool CCalcGroundAttackFactor;
00182         double CVGroundDefenseFactor;
00183         bool CCalcGroundDefenseFactor;
00184         double CVGrowthRateFactor;
00185         bool CCalcGrowthRateFactor;
00186         double CVPopulationFactor;
00187         bool CCalcPopulationFactor;
00188         long CVCloakCargo;
00189         long CVMineSpeedBonus;
00190         double CVSpyTechBonus;
00191         bool CCalcSpyTechBonus;
00192         double CVBattleSpeedBonus;
00193         bool CCalcBattleSpeedBonus;
00194         double CVPermaformChance;
00195         bool CCalcPermaformChance;
00196         long CVCanSeeHabSettings;
00197         long CVTemporaryTerraform;
00198         long CVScanDesign;
00199         double CVRepairFactor;
00200         bool CCalcRepairFactor;
00201         double CVFreighterReproduction;
00202         bool CCalcFreighterReproduction;
00203         long CVMineFieldScanning;
00204         long CVCanRemoteDetonate;
00205         double CVMineDecayFactor;
00206         bool CCalcMineDecayFactor;
00207 
00208         long CVPacketTerraform;
00209         long CVPacketScanning;
00210         double CVPacketCostMinFactor;
00211         bool CCalcPacketCostMinFactor;
00212         long CVPacketSizeOneMin;
00213         long CVPacketSizeMixed;
00214         long CVPacketCostResources;
00215         double CVPacketDecayFactor;
00216         bool CCalcPacketDecayFactor;
00217         double CVPacketCatchFactor;
00218         bool CCalcPacketCatchFactor;
00219         long CVPacketDecayPenalty;
00220 
00221         long CVStartAtBonus;
00222         long CVGateCargo;
00223         double CVOvergateLossFactor;
00224         bool CCalcOvergateLossFactor;
00225         long CVGateScanning;
00226         long CVARTechType;
00227         double CVFuelFactor;
00228         bool CCalcFuelFactor;
00229         long CVGeneralResearch;
00230         long CVUltimateRecycle;
00231         double CVSpaceScanFactor;
00232         bool CCalcSpaceScanFactor;
00233         double CVPenScanFactor;
00234         bool CCalcPenScanFactor;
00235         double CVZeroTechCost;
00236         bool CCalcZeroTechCost;
00237         double CVMaxMiniturize;
00238         bool CCalcMaxMiniturize;
00239         double CVMiniturizeRate;
00240         bool CCalcMiniturizeRate;
00241         double CVStartingPopFactor;
00242         bool CCalcStartingPopFactor;
00243         double CVShieldFactor;
00244         bool CCalcShieldFactor;
00245         double CVArmorFactor;
00246         bool CCalcArmorFactor;
00247         double CVShieldRegenRate;
00248         bool CCalcShieldRegenRate;
00249         double CVDefenseFactor;
00250         bool CCalcDefenseFactor;
00251         deque<double> CVEngineFailure;
00252 };
00253 
00254 #endif // !defined(Race_h)

Generated on Mon Aug 8 21:33:45 2005 for Freestars by  doxygen 1.4.2-20050421