/// <summary> /// Get The Hero by it's ID and load it from the file. /// use this when you want to generate a new hero. /// </summary> /// <param name="heroID"></param> /// <returns></returns> private void SetHeroFromBlank(string heroID) { LoadMe(heroID); HeroSkill.SetUpSkills(); CustomName = Name; HeroID = heroID; // The Basic level of the hero should be 1 Level = 1; // Look, the Skills should be summed with the following, // But the level of the skills are zero, so they will be zero. HP = (Level * HeroSerialize.HP_Rate) + HeroSkill.GetTotalHPOfSkills(); ATK = (Level * HeroSerialize.ATK_Rate) + HeroSkill.GetTotalATKOfSkills(); INT = (Level * HeroSerialize.INT_Rate) + HeroSkill.GetTotalINTOfSkills(); DEF = (Level * HeroSerialize.DEF_Rate) + HeroSkill.GetTotalDEFOfSkills(); RES = (Level * HeroSerialize.RES_Rate) + HeroSkill.GetTotalRESOfSkills(); SPD = (Level * HeroSerialize.SPD_Rate) + HeroSkill.GetTotalSPDOfSkills(); PEN = (Level * HeroSerialize.PEN_Rate) + HeroSkill.GetTotalPENOfSkills(); Block = (Level * HeroSerialize.Block_Rate) + HeroSkill.GetTotalBlockOfSkills(); ReloadPower(); HeroCurrentExp = Unit.GetBasicUnit(); SkillPoint = Unit.GetBasicUnit(); Stars = 0; return; }
//------------------------------------------------- public static HeroSkill GetHeroSkill(string heroSkillString, uint count, Hero owner) { HeroSkill heroSkill = new HeroSkill(count); string[] myStrings = heroSkillString.Split(OutCharSeparator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < heroSkill.Skills.Length; i++) { heroSkill.Skills[i] = Skill.Parse(myStrings[i], owner); } return(heroSkill); }
/// <summary> /// Loading the ordinary Information of this hero from /// the file. /// loading <see cref="Name"/>, /// <see cref="HeroSkill"/> (by: <see cref="HeroSkill.GetHeroSkill(string, uint)"/> /// which string is <see cref="HeroSerialize.HeroSkillsString"/> and /// uint is <see cref="HeroSerialize.HeroSkillsCount"/>), /// <see cref="HeroType"/>. /// </summary> /// <param name="heroID"></param> protected virtual void LoadMe(StrongString heroID) { if (this.MyRes is null) { this.MyRes = new WotoRes(typeof(Hero)); } //--------------------------------------------- this.HeroSerialize = HeroSerialize.GetHeroSerialize(heroID.GetValue()); this.Name = this.HeroSerialize.HeroName; this.HeroSkill = HeroSkill.GetHeroSkill(this.HeroSerialize.HeroSkillsString, this.HeroSerialize.HeroSkillsCount, this); this.HeroType = this.HeroSerialize.HeroType; this.HeroElement = this.HeroSerialize.HeroElement; //--------------------------------------------- }
//------------------------------------------------- #endregion Properties Region //------------------------------------------------- #region Constructor Region /// <summary> /// /// </summary> /// <param name="heroIDValue"></param> /// <param name="customNameValue"></param> /// <param name="levelValue"></param> /// <param name="powerValue"></param> /// <param name="skillStringValue"></param> protected Hero( StrongString customNameValue, StrongString heroIDValue, uint levelValue, Unit powerValue, Unit skillPoint, uint stars, StrongString skillStringValue ) { CustomName = customNameValue; HeroID = heroIDValue; Level = levelValue; Power = powerValue; SkillPoint = skillPoint; Stars = stars; LoadMe(heroIDValue); // Load values which should be loaded locally. HeroSkill.LoadInfo(skillStringValue.GetValue()); // Load from the server string. }
//------------------------------------------------- #region Virtual Methods Region public virtual StrongString GetForServer() { StrongString myString = CustomName + InCharSeparator + // index : 0 HeroID + InCharSeparator + // index : 1 Level.ToString() + InCharSeparator + // index : 2 Power.GetForServer() + InCharSeparator + // index : 3 SkillPoint.GetForServer() + InCharSeparator + // index : 4 Stars.ToString() + InCharSeparator + // index : 5 HeroSkill.GetForServer() + InCharSeparator + // index : 6 HP.GetForServer() + InCharSeparator + // index : 7 ATK.GetForServer() + InCharSeparator + // index : 8 INT.GetForServer() + InCharSeparator + // index : 9 DEF.GetForServer() + InCharSeparator + // index : 10 RES.GetForServer() + InCharSeparator + // index : 11 SPD.GetForServer() + InCharSeparator + // index : 12 PEN.GetForServer() + InCharSeparator + // index : 13 Block.GetForServer() + InCharSeparator + // index : 14 HeroCurrentExp.GetForServer() + InCharSeparator; // index : 15 return(myString); }