Created
May 15, 2018 09:27
-
-
Save xpdlf1004/3c909dc9515b335bdc57635db81b10e7 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
function _getPlayerEventScore(bytes data, uint playerIndex, EventType eventType, EventColor _eventMajorColor, EventColor _eventMinorColor) internal pure returns(uint) { | |
uint partOffset = (PLAYER_SIZE * playerIndex) + PLAYER_BASE_SIZE + (uint256(eventType) * PART_SIZE); | |
uint level = _getPartLevel(data, partOffset); | |
uint majorSkillSum = 0; | |
uint minorSkillSum = 0; | |
byte eventMajorColor = byte(uint8(_eventMajorColor)); | |
byte eventMinorColor = byte(uint8(_eventMinorColor)); | |
for (uint i = 0; i < 3; i++) { | |
byte skillColor = _getPartSkillColor(data, partOffset, i); | |
if (skillColor == eventMajorColor) { | |
majorSkillSum += _getPartSkillLevel(data, partOffset, i); | |
} else if (skillColor == eventMinorColor) { | |
minorSkillSum += _getPartSkillLevel(data, partOffset, i); | |
} | |
} | |
byte playerThemeEffect = _getPlayerThemeEffect(data, PLAYER_SIZE * playerIndex); | |
if (playerThemeEffect != 0) { | |
return level + (majorSkillSum * 4) + (minorSkillSum * 2); | |
} else { | |
return level + (majorSkillSum * 3) + (minorSkillSum * 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment