| | |
| | | { |
| | | public BattleField battleField; |
| | | |
| | | public BattleObjectBuffMgr buffMgr; |
| | | |
| | | public BattleObjectLayerMgr layerMgr; |
| | | |
| | | public int ObjID { get; set; } |
| | | |
| | | public BattleCamp Camp { get; protected set; } |
| | | |
| | | public TeamHero teamHero { get; protected set; } |
| | | |
| | | public BattleObject(BattleField _battleField) |
| | | { |
| | | battleField = _battleField; |
| | | } |
| | | |
| | | public abstract void Init(TeamHero _teamHero, BattleCamp _camp); |
| | | // ============ 抽象访问方法(子类返回各自的Team类型信息) ============ |
| | | |
| | | public abstract int GetPositionNum(); |
| | | public abstract float GetModelScale(); |
| | | public abstract string GetName(); |
| | | |
| | | // Buff 管理器访问方法(Hero 有 buff,Mingge 返回 null) |
| | | public abstract BattleObjectBuffMgr GetBuffMgr(); |
| | | |
| | | // 状态查询抽象方法 |
| | | protected abstract bool GetIsStunned(); |
| | | protected abstract bool GetIsFrozen(); |
| | | protected abstract bool GetIsStoned(); |
| | | protected abstract bool GetIsSlient(); |
| | | protected abstract bool GetIsDisarmed(); |
| | | protected abstract bool GetIsInvincible(); |
| | | protected abstract bool GetIsDead(); |
| | | public abstract int GetRage(); |
| | | |
| | | // 血量相关抽象方法(Hero 特有,Mingge 返回默认值) |
| | | public abstract long GetCurHp(); |
| | | public abstract long GetMaxHp(); |
| | | public abstract void SetCurHp(long value); |
| | | public abstract void SetIsDead(bool value); |
| | | |
| | | // 其他属性访问方法 |
| | | public abstract int GetNPCID(); |
| | | public abstract long GetFightPower(); |
| | | |
| | | public abstract void Run(); |
| | | |
| | |
| | | // 眩晕 |
| | | public bool IsStunned() |
| | | { |
| | | return teamHero.isStunned; |
| | | return GetIsStunned(); |
| | | } |
| | | |
| | | // 冰冻 |
| | | public bool IsFrozen() |
| | | { |
| | | return teamHero.isFrozen; |
| | | return GetIsFrozen(); |
| | | } |
| | | |
| | | // 石化 |
| | | public bool IsStoned() |
| | | { |
| | | return teamHero.isStoned; |
| | | return GetIsStoned(); |
| | | } |
| | | |
| | | // 被沉默 |
| | | public bool IsSlient() |
| | | { |
| | | return teamHero.isSlient; |
| | | return GetIsSlient(); |
| | | } |
| | | |
| | | // 被缴械 |
| | | public bool IsDisarmed() |
| | | { |
| | | return teamHero.isDisarmed; |
| | | return GetIsDisarmed(); |
| | | } |
| | | |
| | | // 是否无敌 |
| | | public bool IsInvincable() |
| | | { |
| | | return teamHero.isInvinceble; |
| | | return GetIsInvincible(); |
| | | } |
| | | |
| | | // 是否死亡 |
| | | public bool IsDead() |
| | | { |
| | | return teamHero.isDead; |
| | | return GetIsDead(); |
| | | } |
| | | |
| | | // 是否被控住了 |
| | |
| | | } |
| | | |
| | | // 看看怒气是否达到释放要求 |
| | | return teamHero.rage >= 100; |
| | | return GetRage() >= 100; |
| | | } |
| | | |
| | | public virtual bool IsCanNormalAttack() |
| | |
| | | if (hasReflectHp && casterDmgInfo.casterDamageList != null && casterDmgInfo.casterDamageList.Count > 0) |
| | | { |
| | | long totalReflect = casterDmgInfo.casterDamageList.Sum(d => d.damage); |
| | | if (totalReflect > 0 && !buffMgr.isControled[BattleConst.HardControlGroup]) |
| | | var buffMgr = GetBuffMgr(); |
| | | if (totalReflect > 0 && buffMgr != null && !buffMgr.isControled[BattleConst.HardControlGroup]) |
| | | { |
| | | OnPlayHitAnimation(); |
| | | } |
| | |
| | | { |
| | | BattleCastObj caster = battleHurtParam.caster; |
| | | |
| | | // 应用血量变化 |
| | | teamHero.curHp = caster.toHp; |
| | | // 应用血量变化(由子类实现) |
| | | ApplyCasterHpChange(caster.toHp); |
| | | |
| | | // 打印所有角色的名字和当前血量跟总血量 |
| | | // foreach (var obj in battleField.battleObjMgr.allBattleObjDict.Values) |
| | |
| | | /// 播放受击动画(只有 Hero 有实现,Mingge 留空) |
| | | /// </summary> |
| | | protected abstract void OnPlayHitAnimation(); |
| | | |
| | | /// <summary> |
| | | /// 应用施法者血量变化(吸血/反伤) |
| | | /// </summary> |
| | | protected abstract void ApplyCasterHpChange(long newHp); |
| | | } |