forked from Musashi1584/RPGO
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced Natural Aptitude as counterpart to ComInt but for stats
- Loading branch information
1 parent
a64ab97
commit 248447f
Showing
14 changed files
with
216 additions
and
25 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+11.1 KB
(120%)
RPG/Content/DetailedSoldierListWOTC/UILibrary_LWToolbox.upk
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
class StatUIHelper extends Object config(StatUpgradeUI); | ||
|
||
enum ENaturalAptitude | ||
{ | ||
eNaturalAptitude_Standard, | ||
eNaturalAptitude_AboveAverage, | ||
eNaturalAptitude_Gifted, | ||
eNaturalAptitude_Genius, | ||
eNaturalAptitude_Savant, | ||
}; | ||
|
||
|
||
var config array<name> NaturalAptitudeCharacterTemplates; | ||
var config array<int> NaturalAptitudeThresholds; | ||
var config int NaturalAptitudeAboveAverageChance; | ||
var config array<ENaturalAptitude> BaseSoldierNaturalAptitude; | ||
|
||
var localized string NaturalAptitudeLabel[ENaturalAptitude.EnumCount]<BoundEnum = ENaturalAptitude>; | ||
var localized string NaturalAptitude; | ||
|
||
static function OnPostCharacterTemplatesCreated() | ||
{ | ||
local X2CharacterTemplateManager CharacterTemplateMgr; | ||
local X2CharacterTemplate SoldierTemplate; | ||
local array<X2DataTemplate> DataTemplates; | ||
local int ScanTemplates, ScanAdditions; | ||
|
||
CharacterTemplateMgr = class'X2CharacterTemplateManager'.static.GetCharacterTemplateManager(); | ||
|
||
for ( ScanAdditions = 0; ScanAdditions < default.NaturalAptitudeCharacterTemplates.Length; ++ScanAdditions ) | ||
{ | ||
CharacterTemplateMgr.FindDataTemplateAllDifficulties(default.NaturalAptitudeCharacterTemplates[ScanAdditions], DataTemplates); | ||
for (ScanTemplates = 0; ScanTemplates < DataTemplates.Length; ++ScanTemplates) | ||
{ | ||
SoldierTemplate = X2CharacterTemplate(DataTemplates[ScanTemplates]); | ||
if (SoldierTemplate != none) | ||
{ | ||
SoldierTemplate.OnStatAssignmentCompleteFn = class'StatUIHelper'.static.OnStatAssignmentCompleteNaturalAptitude; | ||
} | ||
} | ||
} | ||
} | ||
|
||
static function OnStatAssignmentCompleteNaturalAptitude(XComGameState_Unit UnitState) | ||
{ | ||
local ENaturalAptitude Apt; | ||
|
||
Apt = RollNaturalAptitude(); | ||
|
||
//`LOG(default.Class @ GetFuncName() @ Apt @ float(Apt),, 'RPG'); | ||
UnitState.SetUnitFloatValue('NaturalAptitude', float(Apt) , eCleanUp_Never); | ||
} | ||
|
||
static function int GetBonusStatPointsFromNaturalAptitude(XComGameState_Unit UnitState) | ||
{ | ||
//`LOG(default.Class @ GetFuncName() @ default.BaseSoldierNaturalAptitude[GetNaturalAptitude(UnitState)],, 'RPG'); | ||
return default.BaseSoldierNaturalAptitude[GetNaturalAptitude(UnitState)]; | ||
} | ||
|
||
static function ENaturalAptitude GetNaturalAptitude(XComGameState_Unit UnitState) | ||
{ | ||
local UnitValue NaturalAptitudeValue; | ||
|
||
UnitState.GetUnitValue('NaturalAptitude', NaturalAptitudeValue); | ||
|
||
//`LOG(default.Class @ GetFuncName() @ NaturalAptitudeValue.fValue @ GetEnum(Enum'ENaturalAptitude', NaturalAptitudeValue.fValue),, 'RPG'); | ||
|
||
return ENaturalAptitude(NaturalAptitudeValue.fValue); | ||
} | ||
|
||
static function ENaturalAptitude RollNaturalAptitude() | ||
{ | ||
local array<int> Thresholds; | ||
local int idx, NaturalAptitudeRoll; | ||
|
||
if (class'X2StrategyGameRulesetDataStructures'.static.Roll(default.NaturalAptitudeAboveAverageChance)) | ||
{ | ||
Thresholds = default.NaturalAptitudeThresholds; | ||
NaturalAptitudeRoll = `SYNC_RAND_STATIC(100); | ||
|
||
for (idx = 0; idx < Thresholds.Length; idx++) | ||
{ | ||
if (NaturalAptitudeRoll < Thresholds[idx]) | ||
{ | ||
return ENaturalAptitude(1 + idx); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return eNaturalAptitude_Standard; | ||
} | ||
|
||
static function string GetNaturalAptitudeLabel(ENaturalAptitude NatApt) | ||
{ | ||
//`LOG(default.Class @ GetFuncName() @ NatApt @ default.NaturalAptitudeLabel[NatApt] @ default.NaturalAptitudeLabel[eNaturalAptitude_Standard],, 'RPGO'); | ||
return default.NaturalAptitudeLabel[NatApt]; | ||
} | ||
|
||
static function int GetSoldierSP(XComGameState_Unit UnitState) | ||
{ | ||
local UnitValue StatPointsValue; | ||
UnitState.GetUnitValue('StatPoints', StatPointsValue); | ||
return int(StatPointsValue.fValue); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
RPG/Src/StatUpgradeUI/Classes/X2DownloadableContentInfo_StatUpgradeUI.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.