using UnityEngine; using System; using System.Collections; using System.Collections.Generic; using Newtonsoft.Json.Linq; namespace YLBattle { /// /// 角色适配器 /// public class HeroAdapter : IFighterAdapter { /// /// /// private sm_hero mTle = null; /// /// 英雄实例数据 /// private GameHeroVo mInst = null; /// /// 是否可以修改玩家数据 /// private bool canModify = false; /// /// /// private int mSeat = 0; /// /// /// private bool isLeader = false; /// /// 友方 /// private bool isNotLocalHero = false; /// /// 所属玩家ID /// private string mPlayerUID = string.Empty; /// /// 构造(pve) /// /// (同服)实例ID /// 等级 public HeroAdapter(string _strIid, string mSeatId, bool bolLeader) { this.isNotLocalHero = false; this.mInst = UserProxy.Instance.player.collectHero.GetHeroGameInfoByHeroUId(_strIid); this.mTle = sm_hero.GetMoByID(this.mInst.typeId); this.canModify = true; this.mSeat = System.Convert.ToInt32(mSeatId); this.isLeader = bolLeader; } /// /// 预加载 /// /// public HeroAdapter(string frindUID) { //JObject result = FriendProxy.Instance.FindRecordFriendSharedHeroInfo(frindUID); //if (result["sharedHero"] == null) //{ // return; //} //GameHeroVo vo = GameCollectHero.ConverJobjToData(result["sharedHero"] as JObject); //this.mInst = vo; //this.mTle = sm_hero.GetMoByID(this.mInst.typeId); //this.canModify = true; //this.mSeat = -1; //this.isLeader = false; //this.isNotLocalHero = true; //this.mPlayerUID = frindUID; } /// /// PVP /// /// public HeroAdapter(GameHeroVo vo, int seat, bool isLeader) { this.mInst = vo; this.mTle = sm_hero.GetMoByID(this.mInst.typeId); this.canModify = true; this.mSeat = seat; this.isLeader = isLeader; this.isNotLocalHero = true; } /// /// Header /// /// public bool IsLeader() { return this.isLeader; } /// /// 关联对象实例 /// /// 对象实例 public object Inst() { return this.mInst; } /// /// 角色类型 0=小怪 1=英雄 (战斗中英雄使用公共技能槽) /// /// public int RoleType() { return this.mTle.roletype; } /// /// /// /// public string FName() { return this.mTle.name; } /// /// 玩家ID (友情帮助时才有此数据) /// /// public string PlayerUID() { return this.mPlayerUID; } /// /// 英雄在游戏中的实例id /// /// 英雄游戏实例id public string IID() { ///如果是友方,则附加前缀“F”防止ID重复 return (this.isNotLocalHero == true ? "F" : "") + this.mInst.uid; } /// /// 模板ID /// /// public string TID() { return this.mTle.heroId.ToString(); } /// /// 技能列表 /// /// //public int CriticalPowerRate() //{ // return SkillProxy.Instance.GetSkillCondiValue(this.mTle.manuSkill2); ; //} /// /// /// /// public int Seat { set { this.mSeat = value; } get { return this.mSeat; } } /// /// /// /// public string DragonboneName() { return this.mTle.dragonBoneMod; } /// /// 等级 /// /// public int Level() { return this.mInst.level; } /// /// 等阶 /// /// public int StrengthLevel() { return this.mInst.strengthLevel; } /// /// /// /// public string NormalSound() { return this.mTle.normalSound; } /// /// /// /// public string SkillSound() { return this.mTle.skillSound; } /// /// /// /// public string BeattackSound() { return this.mTle.beattackSound; } /// /// /// /// //public int Attack() //{ // return this.mTle.wuligongji; //} /// /// /// /// public int Agile() { return (int)((1 / this.mTle.gongjisudu) * 1000.0f); } #region 战斗技能 /// /// 手动攻击技能 /// /// 技能模板id public string NormalSkill() { return this.mTle.normalSkill; } /// /// 主动技能1 /// /// 技能模板id public string ManuSkill1() { return this.mTle.manuSkill1; } /// /// 主动技能2 /// /// 技能模板id public string ManuSkill2() { return this.mTle.manuSkill2; } /// /// 队长技能 /// /// 技能模板id public string PassiveSkill() { return this.mTle.passiveSkill; } /// /// 队长技能 /// /// 技能模板id public string LeaderSkill() { return this.mTle.leaderSkill == null ? string.Empty : this.mTle.leaderSkill; } /// /// 获取英雄技能列表 /// /// 技能列表 public string[] Skills() { return new string[] { this.mTle.normalSkill, this.mTle.manuSkill1, this.mTle.manuSkill2, this.mTle.passiveSkill }; } /// /// 获取英雄技能列表 /// /// 技能列表 [Obsolete("过时,2020.4.21")] public int SkillLevel(string tid) { string parm = string.Empty; if (tid == this.mTle.normalSkill) { parm = "normalSkill"; } if (tid == this.mTle.manuSkill1) { parm = "manuSkill1"; } if (tid == this.mTle.manuSkill2) { parm = "manuSkill2"; } if (tid == this.mTle.passiveSkill) { parm = "passiveSkill"; } return this.mInst.GetSkillLevel(parm); } /// /// 获取技能冷冻回合数 /// /// //public int GetSkillBeLockedRound(string skillId) //{ // return SkillProxy.Instance.GetSkillCondiValue(skillId); //} #endregion /// /// /// /// /// public double GetProperty(EBattleProperty ep) { ///属性值=初始值+成长*(等级-1) double pvalue = 0; switch (ep) { case EBattleProperty.HP: pvalue = this.mInst.getHpForBattle(); break; case EBattleProperty.HPMAX: pvalue = this.mInst.getHpForBattle(); break; case EBattleProperty.ATTACK: pvalue = this.mInst.getWuLiGongJiForBattle(); break; case EBattleProperty.ATTACKSPEED: pvalue = this.mInst.getGongJiSuDuForBattle(); break; case EBattleProperty.CRITICALPROB: //pvalue = this.mInst.getCriticalForBattle(); // 2020.6.3 根据策划指导修正暴击率 pvalue = this.mInst.getCriticalRatioInBattle(); break; case EBattleProperty.DEFENSE: pvalue = this.mInst.getFangYuHuJiaForBattle(); break; case EBattleProperty.MAGICFORCE: pvalue = this.mInst.getMoFaKangXingForBattle(); break; case EBattleProperty.MAGICSTRENGTH: pvalue = this.mInst.getFaShuQiangDuForBattle(); break; case EBattleProperty.LEVEL: pvalue = this.mInst.level; break; case EBattleProperty.NMAXPOWER: pvalue = this.mTle.npower; break; case EBattleProperty.NPOWER: pvalue = this.mInst.getNengLiangZhi(); break; case EBattleProperty.HEIGHT: pvalue = this.mTle.height; break; default: pvalue = 0; break; } return pvalue; } /// /// /// /// /// public void ModifyProperty(EBattleProperty ep, float val) { } } }