public LevelUpResult LevelUpCharacter(Character character, Origin origin, List <Speciality> specialities, CharacterLevelUpRequest request) { var levelUpResult = new LevelUpResult(); character.Level++; levelUpResult.NewLevel = character.Level; levelUpResult.NewModifiers.Add(CreateLevelUpCharacterModifier(character, request)); if (request.SkillId.HasValue) { levelUpResult.NewSkills.Add(CreateCharacterSkill(character, request.SkillId.Value)); } foreach (var speciality in specialities) { levelUpResult.NewSpecialities.Add(CreateCharacterSpeciality(character, speciality)); } if ((character.Level == 2 || character.Level == 3) && _originUtil.HasFlag(origin, "CHA_+1_LVL2_LVL3")) { levelUpResult.NewModifiers.Add(CreateChaLevelUpCharacterModifier(character)); } return(levelUpResult); }
public LevelUpResult LevelUp() { r_characterSheet.m_experience += (int)m_expGain; m_levelUpResult = r_characterSheet.LevelUP(); if (m_levelUpResult != null) { while (m_levelUpResult.m_anotherLevel == true) { m_levelUpResult = r_characterSheet.LevelUP(m_levelUpResult); } } return(m_levelUpResult); }
public LevelUpResult LevelUP(LevelUpResult carryLevel = null) { LevelUpResult alevel = new LevelUpResult(); if (m_experience >= m_expForNextLevel) { alevel.m_startLevel = m_level; if (carryLevel != null) { alevel.m_startLevel = carryLevel.m_startLevel; } m_level++; alevel.m_finalLevel = m_level; m_experience -= m_expForNextLevel; m_expForNextLevel += (int)Mathf.Pow(m_expForNextLevel, m_expRequiredUpPower); if (m_experience >= m_expForNextLevel) { alevel.m_anotherLevel = true; } //growth section float growth; //HP growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthHP) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_maxHP += 5; alevel.m_HP = 5; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_maxHP += 5; alevel.m_HP = 5; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_maxHP += 5; alevel.m_HP = 5; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_maxHP += 5; alevel.m_HP = 5; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_maxHP += 5; alevel.m_HP = 5; } break; default: alevel.m_HP = 0; break; } if (carryLevel != null) { alevel.m_HP += carryLevel.m_HP; } m_currentHP = m_maxHP; } //SP growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthSP) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_maxSP += 3; alevel.m_SP = 3; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_maxSP += 3; alevel.m_SP = 3; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_maxSP += 3; alevel.m_SP = 3; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_maxSP += 3; alevel.m_SP = 3; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_maxSP += 3; alevel.m_SP = 3; } break; default: alevel.m_SP = 0; break; } if (carryLevel != null) { alevel.m_SP += carryLevel.m_SP; } m_currentSP = m_maxSP; } //Strength growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthStrength) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_strength += 1; alevel.m_strength = 1; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_strength += 1; alevel.m_strength = 1; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_strength += 1; alevel.m_strength = 1; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_strength += 1; alevel.m_strength = 1; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_strength += 1; alevel.m_strength = 1; } break; default: alevel.m_strength = 0; break; } if (carryLevel != null) { alevel.m_strength += carryLevel.m_strength; } } //Fortitude growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthFortitude) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_fortitude += 1; alevel.m_fortitude = 1; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_fortitude += 1; alevel.m_fortitude = 1; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_fortitude += 1; alevel.m_fortitude = 1; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_fortitude += 1; alevel.m_fortitude = 1; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_fortitude += 1; alevel.m_fortitude = 1; } break; default: alevel.m_fortitude = 0; break; } if (carryLevel != null) { alevel.m_fortitude += carryLevel.m_fortitude; } } //Wisdom growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthWisdom) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_wisdom += 1; alevel.m_wisdom = 1; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_wisdom += 1; alevel.m_wisdom = 1; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_wisdom += 1; alevel.m_wisdom = 1; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_wisdom += 1; alevel.m_wisdom = 1; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_wisdom += 1; alevel.m_wisdom = 1; } break; default: alevel.m_wisdom = 0; break; } if (carryLevel != null) { alevel.m_wisdom += carryLevel.m_wisdom; } } //Resistance growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthResistance) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_resistance += 1; alevel.m_resistance = 1; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_resistance += 1; alevel.m_resistance = 1; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_resistance += 1; alevel.m_resistance = 1; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_resistance += 1; alevel.m_resistance = 1; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_resistance += 1; alevel.m_resistance = 1; } break; default: alevel.m_resistance = 0; break; } if (carryLevel != null) { alevel.m_resistance += carryLevel.m_resistance; } } //Agility growth { growth = Random.Range(0.0f, 1.0f); switch (m_growthAgility) { case Growth.GROWTH_A: if (growth <= 0.8f) { m_agility += 1; alevel.m_agility = 1; } break; case Growth.GROWTH_B: if (growth <= 0.65f) { m_agility += 1; alevel.m_agility = 1; } break; case Growth.GROWTH_C: if (growth <= 0.5f) { m_agility += 1; alevel.m_agility = 1; } break; case Growth.GROWTH_D: if (growth <= 0.35f) { m_agility += 1; alevel.m_agility = 1; } break; case Growth.GROWTH_E: if (growth <= 0.2f) { m_agility += 1; alevel.m_agility = 1; } break; default: alevel.m_agility = 0; break; } if (carryLevel != null) { alevel.m_agility += carryLevel.m_agility; } } } else { alevel = null; } return(alevel); }
void LevelUp() { for (int i = 0; i < m_partyMembers.Count; i++) { LevelUpResult result = m_partyMembers[i].LevelUp(); r_victoryBox1.transform.Find("EXP").gameObject.SetActive(false); r_victoryBox2.transform.Find("EXP").gameObject.SetActive(false); r_victoryBox3.transform.Find("EXP").gameObject.SetActive(false); r_victoryBox4.transform.Find("EXP").gameObject.SetActive(false); if (result != null) { if (i == 0) { r_victoryBox1.transform.Find("LevelUpText").gameObject.SetActive(true); r_victoryBox1.transform.Find("Level").GetComponent <Text>().text = "Level " + result.m_startLevel + " - " + result.m_finalLevel; r_victoryBox1.transform.Find("Level").gameObject.SetActive(true); r_victoryBox1.transform.Find("Result").GetComponent <Text>().text = ""; if (result.m_HP != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Max HP + " + result.m_HP.ToString() + "\n"; } if (result.m_SP != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Max SP + " + result.m_SP.ToString() + "\n"; } if (result.m_strength != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Strength + " + result.m_strength.ToString() + "\n"; } if (result.m_fortitude != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Fortitude + " + result.m_fortitude.ToString() + "\n"; } if (result.m_wisdom != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Wisdom + " + result.m_wisdom.ToString() + "\n"; } if (result.m_resistance != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Resistance + " + result.m_resistance.ToString() + "\n"; } if (result.m_agility != 0) { r_victoryBox1.transform.Find("Result").GetComponent <Text>().text += "Agility + " + result.m_agility.ToString() + "\n"; } r_victoryBox1.transform.Find("Result").gameObject.SetActive(true); } if (i == 1) { r_victoryBox2.transform.Find("LevelUpText").gameObject.SetActive(true); r_victoryBox2.transform.Find("Level").GetComponent <Text>().text = "Level " + result.m_startLevel + " - " + result.m_finalLevel; r_victoryBox2.transform.Find("Level").gameObject.SetActive(true); r_victoryBox2.transform.Find("Result").GetComponent <Text>().text = ""; if (result.m_HP != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Max HP + " + result.m_HP.ToString() + "\n"; } if (result.m_SP != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Max SP + " + result.m_SP.ToString() + "\n"; } if (result.m_strength != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Strength + " + result.m_strength.ToString() + "\n"; } if (result.m_fortitude != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Fortitude + " + result.m_fortitude.ToString() + "\n"; } if (result.m_wisdom != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Wisdom + " + result.m_wisdom.ToString() + "\n"; } if (result.m_resistance != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Resistance + " + result.m_resistance.ToString() + "\n"; } if (result.m_agility != 0) { r_victoryBox2.transform.Find("Result").GetComponent <Text>().text += "Agility + " + result.m_agility.ToString() + "\n"; } r_victoryBox2.transform.Find("Result").gameObject.SetActive(true); } if (i == 2) { r_victoryBox3.transform.Find("LevelUpText").gameObject.SetActive(true); r_victoryBox3.transform.Find("Level").GetComponent <Text>().text = "Level " + result.m_startLevel + " - " + result.m_finalLevel; r_victoryBox3.transform.Find("Level").gameObject.SetActive(true); r_victoryBox3.transform.Find("Result").GetComponent <Text>().text = ""; if (result.m_HP != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Max HP + " + result.m_HP.ToString() + "\n"; } if (result.m_SP != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Max SP + " + result.m_SP.ToString() + "\n"; } if (result.m_strength != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Strength + " + result.m_strength.ToString() + "\n"; } if (result.m_fortitude != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Fortitude + " + result.m_fortitude.ToString() + "\n"; } if (result.m_wisdom != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Wisdom + " + result.m_wisdom.ToString() + "\n"; } if (result.m_resistance != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Resistance + " + result.m_resistance.ToString() + "\n"; } if (result.m_agility != 0) { r_victoryBox3.transform.Find("Result").GetComponent <Text>().text += "Agility + " + result.m_agility.ToString() + "\n"; } r_victoryBox3.transform.Find("Result").gameObject.SetActive(true); } if (i == 3) { r_victoryBox4.transform.Find("LevelUpText").gameObject.SetActive(true); r_victoryBox4.transform.Find("Level").GetComponent <Text>().text = "Level " + result.m_startLevel + " - " + result.m_finalLevel; r_victoryBox4.transform.Find("Level").gameObject.SetActive(true); r_victoryBox4.transform.Find("Result").GetComponent <Text>().text = ""; if (result.m_HP != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Max HP + " + result.m_HP.ToString() + "\n"; } if (result.m_SP != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Max SP + " + result.m_SP.ToString() + "\n"; } if (result.m_strength != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Strength + " + result.m_strength.ToString() + "\n"; } if (result.m_fortitude != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Fortitude + " + result.m_fortitude.ToString() + "\n"; } if (result.m_wisdom != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Wisdom + " + result.m_wisdom.ToString() + "\n"; } if (result.m_resistance != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Resistance + " + result.m_resistance.ToString() + "\n"; } if (result.m_agility != 0) { r_victoryBox4.transform.Find("Result").GetComponent <Text>().text += "Agility + " + result.m_agility.ToString() + "\n"; } r_victoryBox4.transform.Find("Result").gameObject.SetActive(true); } } } }
public INotificationPacket BuildCharacterLevelUp(int characterId, LevelUpResult levelUpResult) { return(BuildCharacterChange(characterId, "levelUp", _mapper.Map <CharacterLevelUpResponse>(levelUpResult))); }
public void NotifyCharacterLevelUp(int characterId, LevelUpResult levelUpResult) { _packets.Add(_packetBuilder.BuildCharacterLevelUp(characterId, levelUpResult)); }