Shadowrun: Awakened 29 September 2011 - Build 871
SraAttributeUtility.h
Go to the documentation of this file.
00001 #ifndef __SRAATTRIBUTEUTILITY_H
00002 #define __SRAATTRIBUTEUTILITY_H
00003 
00004 #include "CodeGenMacros.h"
00005 #include "SrConstants.h"
00006 #include "SraConstants.h"
00007 #include "SraTypes.h"
00008 
00009 //As of 6/20/2010, this is a legacy file that may need to be re-implemented in UnrealScript as needed
00010 
00011 //NOTE: All functions inlined for performance
00012 
00013 namespace SraLogic
00014 {
00016     //Humans
00018 
00022     INLINE int GetHumanMin(Attribute attribute)
00023     {
00024         switch(attribute)
00025         {
00026             case Body:          return HUMAN_MIN_BOD;
00027             case Agility:       return HUMAN_MIN_AGI;
00028             case Reaction:      return HUMAN_MIN_REA;
00029             case Strength:      return HUMAN_MIN_STR;
00030             case Charisma:      return HUMAN_MIN_CHA;
00031             case Intuition:     return HUMAN_MIN_INT;
00032             case Logic:         return HUMAN_MIN_LOG;
00033             case Willpower:     return HUMAN_MIN_WIL;
00034             case Essence :      return MIN_ESS;
00035             case Initiative:    return HUMAN_MIN_INI;
00036             case Edge :         return MIN_EDGE;
00037             case Magic :        return MIN_MAGIC;
00038             case Resonance :    return MIN_RESONANCE;
00039         }
00040 
00041         return -1;
00042     }
00043 
00047     INLINE int GetHumanMaxStart(Attribute attribute)
00048     {
00049         switch(attribute)
00050         {
00051             case Body:          return HUMAN_MAXSTART_BOD;
00052             case Agility:       return HUMAN_MAXSTART_AGI;
00053             case Reaction:      return HUMAN_MAXSTART_REA;
00054             case Strength:      return HUMAN_MAXSTART_STR;
00055             case Charisma:      return HUMAN_MAXSTART_CHA;
00056             case Intuition:     return HUMAN_MAXSTART_INT;
00057             case Logic:         return HUMAN_MAXSTART_LOG;
00058             case Willpower:     return HUMAN_MAXSTART_WIL;
00059             case Essence :      return INITIAL_ESS;
00060             case Initiative:    return HUMAN_MAXSTART_INI;
00061             case Edge :         return MAXSTART_EDGE + HUMAN_EDGE_BONUS;
00062             case Magic :        return MAXSTART_MAGIC;
00063             case Resonance :    return MAXSTART_RESONANCE;
00064         }
00065 
00066         return -1;
00067     }
00068 
00072     INLINE int GetHumanMax(Attribute attribute)
00073     {
00074         switch(attribute)
00075         {
00076             case Body:          return HUMAN_MAX_BOD;
00077             case Agility:       return HUMAN_MAX_AGI;
00078             case Reaction:      return HUMAN_MAX_REA;
00079             case Strength:      return HUMAN_MAX_STR;
00080             case Charisma:      return HUMAN_MAX_CHA;
00081             case Intuition:     return HUMAN_MAX_INT;
00082             case Logic:         return HUMAN_MAX_LOG;
00083             case Willpower:     return HUMAN_MAX_WIL;
00084             case Essence :      return INITIAL_ESS;
00085             case Initiative:    return HUMAN_MAX_INI;
00086             case Edge :         return MAX_EDGE + HUMAN_EDGE_BONUS;
00087             case Magic :        return MAX_MAGIC;
00088             case Resonance :    return MAX_RESONANCE;
00089         }
00090 
00091         return -1;
00092     }
00093 
00095     //Orks
00097 
00101     INLINE int GetOrkMin(Attribute attribute)
00102     {
00103         switch(attribute)
00104         {
00105             case Body:          return ORK_MIN_BOD;
00106             case Agility:       return ORK_MIN_AGI;
00107             case Reaction:      return ORK_MIN_REA;
00108             case Strength:      return ORK_MIN_STR;
00109             case Charisma:      return ORK_MIN_CHA;
00110             case Intuition:     return ORK_MIN_INT;
00111             case Logic:         return ORK_MIN_LOG;
00112             case Willpower:     return ORK_MIN_WIL;
00113             case Essence :      return MIN_ESS;
00114             case Initiative:    return ORK_MIN_INI;
00115             case Edge :         return MIN_EDGE;
00116             case Magic :        return MIN_MAGIC;
00117             case Resonance :    return MIN_RESONANCE;
00118         }
00119 
00120         return -1;
00121     }
00122 
00126     INLINE int GetOrkMaxStart(Attribute attribute)
00127     {
00128         switch(attribute)
00129         {
00130             case Body:          return ORK_MAXSTART_BOD;
00131             case Agility:       return ORK_MAXSTART_AGI;
00132             case Reaction:      return ORK_MAXSTART_REA;
00133             case Strength:      return ORK_MAXSTART_STR;
00134             case Charisma:      return ORK_MAXSTART_CHA;
00135             case Intuition:     return ORK_MAXSTART_INT;
00136             case Logic:         return ORK_MAXSTART_LOG;
00137             case Willpower:     return ORK_MAXSTART_WIL;
00138             case Essence :      return INITIAL_ESS;
00139             case Initiative:    return ORK_MAXSTART_INI;
00140             case Edge :         return MAXSTART_EDGE;
00141             case Magic :        return MAXSTART_MAGIC;
00142             case Resonance :    return MAXSTART_RESONANCE;
00143         }
00144 
00145         return -1;
00146     }
00147 
00151     INLINE int GetOrkMax(Attribute attribute)
00152     {
00153         switch(attribute)
00154         {
00155             case Body:          return ORK_MAX_BOD;
00156             case Agility:       return ORK_MAX_AGI;
00157             case Reaction:      return ORK_MAX_REA;
00158             case Strength:      return ORK_MAX_STR;
00159             case Charisma:      return ORK_MAX_CHA;
00160             case Intuition:     return ORK_MAX_INT;
00161             case Logic:         return ORK_MAX_LOG;
00162             case Willpower:     return ORK_MAX_WIL;
00163             case Essence :      return INITIAL_ESS;
00164             case Initiative:    return ORK_MAX_INI;
00165             case Edge :         return MAX_EDGE;
00166             case Magic :        return MAX_MAGIC;
00167             case Resonance :    return MAX_RESONANCE;
00168         }
00169 
00170         return -1;
00171     }
00172 
00174     //Dwarf
00176 
00180     INLINE int GetDwarfMin(Attribute attribute)
00181     {
00182         switch(attribute)
00183         {
00184             case Body:          return DWARF_MIN_BOD;
00185             case Agility:       return DWARF_MIN_AGI;
00186             case Reaction:      return DWARF_MIN_REA;
00187             case Strength:      return DWARF_MIN_STR;
00188             case Charisma:      return DWARF_MIN_CHA;
00189             case Intuition:     return DWARF_MIN_INT;
00190             case Logic:         return DWARF_MIN_LOG;
00191             case Willpower:     return DWARF_MIN_WIL;
00192             case Essence :      return MIN_ESS;
00193             case Initiative:    return DWARF_MIN_INI;
00194             case Edge :         return MIN_EDGE;
00195             case Magic :        return MIN_MAGIC;
00196             case Resonance :    return MIN_RESONANCE;
00197         }
00198 
00199         return -1;
00200     }
00201 
00205     INLINE int GetDwarfMaxStart(Attribute attribute)
00206     {
00207         switch(attribute)
00208         {
00209             case Body:          return DWARF_MAXSTART_BOD;
00210             case Agility:       return DWARF_MAXSTART_AGI;
00211             case Reaction:      return DWARF_MAXSTART_REA;
00212             case Strength:      return DWARF_MAXSTART_STR;
00213             case Charisma:      return DWARF_MAXSTART_CHA;
00214             case Intuition:     return DWARF_MAXSTART_INT;
00215             case Logic:         return DWARF_MAXSTART_LOG;
00216             case Willpower:     return DWARF_MAXSTART_WIL;
00217             case Essence :      return INITIAL_ESS;
00218             case Initiative:    return DWARF_MAXSTART_INI;
00219             case Edge :         return MAXSTART_EDGE;
00220             case Magic :        return MAXSTART_MAGIC;
00221             case Resonance :    return MAXSTART_RESONANCE;
00222         }
00223 
00224         return -1;
00225     }
00226 
00230     INLINE int GetDwarfMax(Attribute attribute)
00231     {
00232         switch(attribute)
00233         {
00234             case Body:          return DWARF_MAX_BOD;
00235             case Agility:       return DWARF_MAX_AGI;
00236             case Reaction:      return DWARF_MAX_REA;
00237             case Strength:      return DWARF_MAX_STR;
00238             case Charisma:      return DWARF_MAX_CHA;
00239             case Intuition:     return DWARF_MAX_INT;
00240             case Logic:         return DWARF_MAX_LOG;
00241             case Willpower:     return DWARF_MAX_WIL;
00242             case Essence :      return INITIAL_ESS;
00243             case Initiative:    return DWARF_MAX_INI;
00244             case Edge :         return MAX_EDGE;
00245             case Magic :        return MAX_MAGIC;
00246             case Resonance :    return MAX_RESONANCE;
00247         }
00248 
00249         return -1;
00250     }
00251 
00253     //Elf
00255 
00259     INLINE int GetElfMin(Attribute attribute)
00260     {
00261         switch(attribute)
00262         {
00263             case Body:          return ELF_MIN_BOD;
00264             case Agility:       return ELF_MIN_AGI;
00265             case Reaction:      return ELF_MIN_REA;
00266             case Strength:      return ELF_MIN_STR;
00267             case Charisma:      return ELF_MIN_CHA;
00268             case Intuition:     return ELF_MIN_INT;
00269             case Logic:         return ELF_MIN_LOG;
00270             case Willpower:     return ELF_MIN_WIL;
00271             case Essence :      return MIN_ESS;
00272             case Initiative:    return ELF_MIN_INI;
00273             case Edge :         return MIN_EDGE;
00274             case Magic :        return MIN_MAGIC;
00275             case Resonance :    return MIN_RESONANCE;
00276         }
00277 
00278         return -1;
00279     }
00280 
00284     INLINE int GetElfMaxStart(Attribute attribute)
00285     {
00286         switch(attribute)
00287         {
00288             case Body:          return ELF_MAXSTART_BOD;
00289             case Agility:       return ELF_MAXSTART_AGI;
00290             case Reaction:      return ELF_MAXSTART_REA;
00291             case Strength:      return ELF_MAXSTART_STR;
00292             case Charisma:      return ELF_MAXSTART_CHA;
00293             case Intuition:     return ELF_MAXSTART_INT;
00294             case Logic:         return ELF_MAXSTART_LOG;
00295             case Willpower:     return ELF_MAXSTART_WIL;
00296             case Essence :      return INITIAL_ESS;
00297             case Initiative:    return ELF_MAXSTART_INI;
00298             case Edge :         return MAXSTART_EDGE;
00299             case Magic :        return MAXSTART_MAGIC;
00300             case Resonance :    return MAXSTART_RESONANCE;
00301         }
00302 
00303         return -1;
00304     }
00305 
00309     INLINE int GetElfMax(Attribute attribute)
00310     {
00311         switch(attribute)
00312         {
00313             case Body:          return ELF_MAX_BOD;
00314             case Agility:       return ELF_MAX_AGI;
00315             case Reaction:      return ELF_MAX_REA;
00316             case Strength:      return ELF_MAX_STR;
00317             case Charisma:      return ELF_MAX_CHA;
00318             case Intuition:     return ELF_MAX_INT;
00319             case Logic:         return ELF_MAX_LOG;
00320             case Willpower:     return ELF_MAX_WIL;
00321             case Essence :      return INITIAL_ESS;
00322             case Initiative:    return ELF_MAX_INI;
00323             case Edge :         return MAX_EDGE;
00324             case Magic :        return MAX_MAGIC;
00325             case Resonance :    return MAX_RESONANCE;
00326         }
00327 
00328         return -1;
00329     }
00330 
00332     //Troll
00334 
00338     INLINE int GetTrollMin(Attribute attribute)
00339     {
00340         switch(attribute)
00341         {
00342             case Body:          return TROLL_MIN_BOD;
00343             case Agility:       return TROLL_MIN_AGI;
00344             case Reaction:      return TROLL_MIN_REA;
00345             case Strength:      return TROLL_MIN_STR;
00346             case Charisma:      return TROLL_MIN_CHA;
00347             case Intuition:     return TROLL_MIN_INT;
00348             case Logic:         return TROLL_MIN_LOG;
00349             case Willpower:     return TROLL_MIN_WIL;
00350             case Essence :      return MIN_ESS;
00351             case Initiative:    return TROLL_MIN_INI;
00352             case Edge :         return MIN_EDGE;
00353             case Magic :        return MIN_MAGIC;
00354             case Resonance :    return MIN_RESONANCE;
00355         }
00356 
00357         return -1;
00358     }
00359 
00363     INLINE int GetTrollMaxStart(Attribute attribute)
00364     {
00365         switch(attribute)
00366         {
00367             case Body:          return TROLL_MAXSTART_BOD;
00368             case Agility:       return TROLL_MAXSTART_AGI;
00369             case Reaction:      return TROLL_MAXSTART_REA;
00370             case Strength:      return TROLL_MAXSTART_STR;
00371             case Charisma:      return TROLL_MAXSTART_CHA;
00372             case Intuition:     return TROLL_MAXSTART_INT;
00373             case Logic:         return TROLL_MAXSTART_LOG;
00374             case Willpower:     return TROLL_MAXSTART_WIL;
00375             case Essence :      return INITIAL_ESS;
00376             case Initiative:    return TROLL_MAXSTART_INI;
00377             case Edge :         return MAXSTART_EDGE;
00378             case Magic :        return MAXSTART_MAGIC;
00379             case Resonance :    return MAXSTART_RESONANCE;
00380         }
00381 
00382         return -1;
00383     }
00384 
00388     INLINE int GetTrollMax(Attribute attribute)
00389     {
00390         switch(attribute)
00391         {
00392             case Body:          return TROLL_MAX_BOD;
00393             case Agility:       return TROLL_MAX_AGI;
00394             case Reaction:      return TROLL_MAX_REA;
00395             case Strength:      return TROLL_MAX_STR;
00396             case Charisma:      return TROLL_MAX_CHA;
00397             case Intuition:     return TROLL_MAX_INT;
00398             case Logic:         return TROLL_MAX_LOG;
00399             case Willpower:     return TROLL_MAX_WIL;
00400             case Essence :      return INITIAL_ESS;
00401             case Initiative:    return TROLL_MAX_INI;
00402             case Edge :         return MAX_EDGE;
00403             case Magic :        return MAX_MAGIC;
00404             case Resonance :    return MAX_RESONANCE;
00405         }
00406 
00407         return -1;
00408     }
00409 
00413     INLINE int GetAttributeMin(Race race, Attribute attribute)
00414     {
00415         switch(race)
00416         {
00417             case Human :    return GetHumanMin(attribute);
00418             case Ork :      return GetOrkMin(attribute);
00419             case Dwarf :    return GetDwarfMin(attribute);
00420             case Elf :      return GetElfMin(attribute);
00421             case Troll :    return GetTrollMin(attribute);
00422         }
00423 
00424         return -1;
00425     }
00426 
00430     INLINE int GetAttributeMaxStart(Race race, Attribute attribute)
00431     {
00432         switch(race)
00433         {
00434             case Human :    return GetHumanMaxStart(attribute);
00435             case Ork :      return GetOrkMaxStart(attribute);
00436             case Dwarf :    return GetDwarfMaxStart(attribute);
00437             case Elf :      return GetElfMaxStart(attribute);
00438             case Troll :    return GetTrollMaxStart(attribute);
00439         }
00440 
00441         return -1;
00442     }
00443 
00447     INLINE int GetAttributeMax(Race race, Attribute attribute)
00448     {
00449         switch(race)
00450         {
00451             case Human :    return GetHumanMax(attribute);
00452             case Ork :      return GetOrkMax(attribute);
00453             case Dwarf :    return GetDwarfMax(attribute);
00454             case Elf :      return GetElfMax(attribute);
00455             case Troll :    return GetTrollMax(attribute);
00456         }
00457 
00458         return -1;
00459     }
00460 
00466     INLINE int GetAttributeAve(Race race, Attribute attribute)
00467     {
00468         if(attribute == Magic)
00469             return MIN_MAGIC;
00470         else if(attribute == Resonance)
00471             return MIN_RESONANCE;
00472         else if(attribute == Essence)
00473             return INITIAL_ESS;
00474         else if(attribute == Edge)
00475             return MIN_EDGE;
00476 
00477         switch(race)
00478         {
00479             case Human :    return (GetHumanMaxStart(attribute) + GetHumanMin(attribute))/2;
00480             case Ork :      return (GetOrkMaxStart(attribute) + GetOrkMin(attribute))/2;
00481             case Dwarf :    return (GetDwarfMaxStart(attribute) + GetDwarfMin(attribute))/2;
00482             case Elf :      return (GetElfMaxStart(attribute) + GetElfMin(attribute))/2;
00483             case Troll :    return (GetTrollMaxStart(attribute) + GetTrollMin(attribute))/2;
00484         }
00485 
00486         return -1;
00487     }
00488 }
00489 
00490 #endif

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net