Created
December 23, 2015 18:43
-
-
Save hawksprite/0eee6482f33f1be48631 to your computer and use it in GitHub Desktop.
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
CActionTypesSystem *poActionTypesSystem = GetMeeting()->GetActionTypesSystem(); | |
CCharacter &oFocalCharacter = GetMeeting()->GetFocalCharacter(); | |
float fGeneralDirection; | |
float fPersonalAlignement; | |
float fIdeaPlayingTension; | |
float fPotentialGroupAlignment; | |
float fInactivityCharacterUpdate; | |
float fTotalTensionIncrease; | |
fGeneralDirection = 0; | |
fPersonalAlignement = 0; | |
fIdeaPlayingTension = 0; | |
fPotentialGroupAlignment = 0; | |
fInactivityCharacterUpdate = 0; | |
if ( oFocalCharacter.GetLastFinalActionType().GetType() == CActionType::ETYPE_OPPOSE_CHARACTER | |
|| oFocalCharacter.GetLastFinalActionType().GetType() == CActionType::ETYPE_SUPPORT_CHARACTER) | |
{ | |
CCharacter *poTarget = oFocalCharacter.GetLastFinalActionType().GetCharacter(); | |
fGeneralDirection = -1 * (oFocalCharacter.GetOpinionOfCharacter(poTarget)/10.0f); | |
fPersonalAlignement = -1 * oFocalCharacter.GetOpinionOfCharacter(poTarget) * GetOpinionOfCharacter(poTarget)/15.0f; | |
} | |
// here we compute the increase/decrease of tension for current character, due to the ideas played in the meeting | |
for (int k = 0 ; k < (int)m_oIdeaTensions.size(); k++) | |
{ | |
if ( m_oIdeaTensions[k].GetIdea()->GetCurrentMode() == EIDEA_MODE_PLAYING ) | |
{ | |
float fTensionBase = m_oIdeaTensions[k].GetIncreaseOfTensionWhenIdeaIsIntroduced(); | |
fIdeaPlayingTension = fTensionBase * m_oIdeaTensions[k].GetIdea()->GetTensionUpdateRatio(); | |
} | |
} | |
if ( oFocalCharacter.GetLastFinalActionType().GetType() == CActionType::ETYPE_OPPOSE_IDEA | |
|| oFocalCharacter.GetLastFinalActionType().GetType() == CActionType::ETYPE_SUPPORT_IDEA) | |
{ | |
EIdeaId IdeaId = oFocalCharacter.GetLastFinalActionType().GetIdea()->GetId(); | |
fPotentialGroupAlignment = (fabs(oFocalCharacter.GetOpinionOfIdea(IdeaId) - oFocalCharacter.GetAverageOpinionAboutThisIdeaForAllOtherCharacters(IdeaId)) - 3.0f)/10.0f; | |
} | |
// we increase the tension by 10% if the last final action type of the focal character is DO_NOTHING | |
if ( m_pkoMeeting->GetFocalCharacter().GetLastFinalActionType().GetType() == CActionType::ETYPE_DO_NOTHING) | |
{ | |
fInactivityCharacterUpdate = fabs(GetCurrentTension().GetCurrentValue()) * (m_pkoMeeting->GetDoNothingIncreaseTensionPct()/100.0f); | |
} | |
fTotalTensionIncrease = fGeneralDirection | |
+ fPersonalAlignement | |
+ fIdeaPlayingTension | |
+ fPotentialGroupAlignment | |
+ fInactivityCharacterUpdate; | |
float fNextTension = GetCurrentTension().GetCurrentValue() + fTotalTensionIncrease; | |
float fPreviousTension = GetCurrentTension().GetCurrentValue(); | |
// We set the new tension of the character i, moderated by the "GetLimitedNextValue" function. | |
SetCurrentTension(m_pkoMeeting->GetLimitedNextValue(fPreviousTension,fNextTension)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment