Beispiel #1
0
        public void RemoveChar(CharHandler handler)
        {
            if (BattleEnum.Enum_CharSide.Mine == handler.m_CharData.m_eSide)
            {
                switch (handler.m_CharData.m_eType)
                {
                case BattleEnum.Enum_CharType.General:
                    m_listGeneralMine.Remove(handler);
                    m_listDeadMine.Add(handler);
                    break;

                case BattleEnum.Enum_CharType.Official:
                    m_listOfficialMine.Remove(handler);
                    break;
                }
            }
            else
            {
                switch (handler.m_CharData.m_eType)
                {
                case BattleEnum.Enum_CharType.General:
                    m_listGeneralEnemy.Remove(handler);
                    m_listDeadEnemy.Add(handler);
                    break;

                case BattleEnum.Enum_CharType.Official:
                    m_listOfficialEnemy.Remove(handler);
                    break;

                case BattleEnum.Enum_CharType.Monster:
                    m_listMonster.Remove(handler);
                    break;
                }
            }
        }
Beispiel #2
0
        private void TypeHPLeast(CharHandler charHandler, SkillDataSon skillDataSon, List <List <CharHandler> > lists, List <CharHandler> listRet)
        {
            CharHandler con = GetConcentrate(charHandler, skillDataSon.m_eAimSide);

            if (null == con)
            {
                for (int i = 0; i < lists.Count; ++i)
                {
                    for (int j = 0; j < lists[i].Count; ++j)
                    {
                        CharHandler tmpChar = lists[i][j];
                        if (!tmpChar.IsInexistence())
                        {
                            if (0 == listRet.Count)
                            {
                                listRet.Add(lists[i][j]);
                            }
                            else if (tmpChar.m_CharData.CurHP < listRet[0].m_CharData.CurHP)
                            {
                                listRet[0] = tmpChar;
                            }
                        }
                    }
                }
            }
            else
            {
                listRet.Add(con);
            }
        }
Beispiel #3
0
        private void OnDoSkill(SkillDataSon skillDataSon, CharHandler charHandler, List <CharHandler> targets, int skillInstId)
        {
            switch (skillDataSon.m_eSkillType)
            {
            case SkillEnum.SkillType.Buff:
            case SkillEnum.SkillType.Debuff:
            case SkillEnum.SkillType.SuperBuff:
            case SkillEnum.SkillType.SuperDebuff:
                _skillBuff.DoSkill(skillDataSon, charHandler, targets, skillInstId);
                break;

            case SkillEnum.SkillType.Property:
                _skillProperty.DoSkill(skillDataSon, charHandler, targets, skillInstId);
                break;

            case SkillEnum.SkillType.Bullet:
                _skillBullet.DoSkill(skillDataSon, charHandler, targets, skillInstId);
                break;

            case SkillEnum.SkillType.Special:
                _skillSpecial.DoSkill(skillDataSon, charHandler, targets, skillInstId);
                break;

            default:
                break;
            }
        }
Beispiel #4
0
        public override void DoSkill(SkillDataSon skillDataSon, CharHandler charHandler, List <CharHandler> targets, int skillInstId)
        {
            List <SkillData> skillDatas = skillDataSon.GetSkillDataList();

            switch (skillDatas[0].m_eSkillSonType)
            {
            case SkillEnum.SkillSonType.SkillRelease:
                ReleaseSkill(skillDataSon, charHandler, targets);
                break;

            case SkillEnum.SkillSonType.CleanBuff:
                CleanBuff(skillDataSon, charHandler, targets);
                break;

            case SkillEnum.SkillSonType.CleanDebuff:
                CleanDebuff(skillDataSon, charHandler, targets);
                break;

            case SkillEnum.SkillSonType.CleanBuffDebuff:
                CleanBuffDebuff(skillDataSon, charHandler, targets);
                break;

            case SkillEnum.SkillSonType.ReviveHero:
                ReviveHero(skillDatas[0], charHandler, targets);
                break;

            default:
                break;
            }
        }
Beispiel #5
0
 private void CleanBuffDebuff(SkillDataSon skillDataSon, CharHandler charHandler, List <CharHandler> targets)
 {
     for (int i = 0; i < targets.Count; ++i)
     {
         targets[i].m_CharTick.CancelAll();
     }
 }
Beispiel #6
0
 private void ReleaseSkill(SkillDataSon skillDataSon, CharHandler charHandler, List <CharHandler> targets)
 {
     for (int i = 0; i < targets.Count; ++i)
     {
         targets[i].ReleaseSkill(targets[i].m_CharData.SkillIDs[0]);
     }
 }
Beispiel #7
0
 private void CleanDebuff(SkillDataSon skillDataSon, CharHandler charHandler, List <CharHandler> targets)
 {
     for (int i = 0; i < targets.Count; ++i)
     {
         targets[i].m_CharTick.CancelByType(SkillEnum.SkillType.Debuff);
     }
 }
        //--血量Trigger-------------------------------------------------------------------------------------------
        public void HPChanged(int hpPercent, CharHandler charHandler)
        {
            for (int i = _lstTriggerHPSelf.Count - 1; i >= 0; --i)
            {
                if (hpPercent < _lstTriggerHPSelf[i].m_iPercent)
                {
                    CharHandler c = _lstTriggerHPSelf[i].m_CharHandler;
                    if (c.m_CharData.m_eSide == charHandler.m_CharData.m_eSide)
                    {
                        c.m_CharSkill.HPTriggerSelf(hpPercent, charHandler);
                        _lstTriggerHPSelf.RemoveAt(i);
                    }
                }
            }

            for (int i = _lstTriggerHPAim.Count - 1; i >= 0; --i)
            {
                if (hpPercent < _lstTriggerHPAim[i].m_iPercent)
                {
                    CharHandler c = _lstTriggerHPAim[i].m_CharHandler;
                    if (c.m_CharData.m_eSide != charHandler.m_CharData.m_eSide)
                    {
                        c.m_CharSkill.HPTriggerAim(hpPercent, charHandler);
                        _lstTriggerHPAim.RemoveAt(i);
                    }
                }
            }
        }
Beispiel #9
0
        private void TypeDistanceNear(CharHandler charHandler, SkillDataSon skillDataSon, List <List <CharHandler> > lists, List <CharHandler> listRet)
        {
            CharHandler con = GetConcentrate(charHandler, skillDataSon.m_eAimSide);

            if (null == con)
            {
                for (int i = 0; i < lists.Count; ++i)
                {
                    GetCharNearest(charHandler, 360f, skillDataSon.m_iDistance, lists[i], listRet);
                }
            }
            else
            {
                listRet.Add(con);
            }

            if (listRet.Count > 0)
            {
                charHandler.m_CharSkill.m_vecDistancePos = listRet[0].m_ParentTrans.position;
            }
            else
            {
                charHandler.m_CharSkill.m_vecDistancePos = charHandler.m_ParentTrans.position;
            }
        }
        private static void SetMonsterData(CharHandler charHandler)
        {
            int lv = SpawnHandler.GetInst().CurSpawnIndex * 10 + SpawnHandler.GetInst().CurWave;

            CharData charData = charHandler.m_CharData;

            charData.m_eSide = BattleEnum.Enum_CharSide.Enemy;
            charData.m_eType = BattleEnum.Enum_CharType.Monster;

            ConfigRow monsterInfo = ConfigData.GetValue("Monster_Client", charData.m_iCharID.ToString());

            charData.m_fAtkX       = float.Parse(monsterInfo.GetValue("AttackX"));
            charData.m_fAtkRange   = float.Parse(monsterInfo.GetValue("AtkRange"));
            charData.m_fBodyRange  = float.Parse(monsterInfo.GetValue("BodyRange"));
            charData.m_fMoveSpeed  = float.Parse(monsterInfo.GetValue("MoveSpeed"));
            charData.CurAttack     = float.Parse(monsterInfo.GetValue("Attack")) * (1 + 0.2f * lv);
            charData.OriAtk        = charData.CurAttack;
            charData.CurDefence    = float.Parse(monsterInfo.GetValue("Defence")) * (1 + 0.2f * lv);
            charData.OriDef        = charData.CurDefence;
            charData.CriticalRatio = float.Parse(monsterInfo.GetValue("CriticalRatio"));
            charData.BlockRatio    = float.Parse(monsterInfo.GetValue("BlockRatio"));
            charData.MaxHP         = float.Parse(monsterInfo.GetValue("Hp")) * (1 + 0.2f * lv);
            charData.CurHP         = charData.MaxHP;
            charData.OriHP         = charData.MaxHP;
            charData.CurStar       = BattleManager.GetInst().m_iEnemyPlayerLevel;

            charHandler.m_CharDefence.m_fBackwardClock = 0;
        }
Beispiel #11
0
        //吸血
        private void AbsorbHP(float hurt, CharHandler srcHandler)
        {
            float addHp = Mathf.Max(1f, hurt * srcHandler.m_CharData.AbsorbHP.Value);

            srcHandler.m_CharData.CurHP += addHp;
            HUDTextMgr.GetInst().NewText(string.Format("{0:N0}", addHp), srcHandler, HUDTextMgr.HUDTextType.AbsorbHP);
        }
Beispiel #12
0
        //最近
        public CharHandler GetNearestChar(CharHandler charHandler, BattleEnum.Enum_CharSide side, ref float dis)
        {
            List <CharHandler> lst = BattleEnum.Enum_CharSide.Mine == side ? m_listGeneralMine : m_listGeneralEnemy;
            Vector3            pos = charHandler.m_ParentTrans.position;
            CharHandler        ret = null;

            for (int i = 0; i < lst.Count; ++i)
            {
                CharHandler tmpChar = lst[i];
                if (tmpChar == charHandler || tmpChar.IsInexistence())
                {
                    continue;
                }

                float temp = Vector3.Distance(tmpChar.m_ParentTrans.position, pos);
                if (temp < dis)
                {
                    dis = temp;
                    ret = tmpChar;
                }
            }

            if (BattleEnum.Enum_CharSide.Mine != side)
            {
                CharHandler ch = GetNearestMonster(charHandler, ref dis);
                if (null != ch)
                {
                    ret = ch;
                }
            }

            return(ret);
        }
Beispiel #13
0
        protected void GetCharNearest(CharHandler charHandler, float angle, float raidus, List <CharHandler> srcLst, List <CharHandler> retLst)
        {
            float       retDis  = 0xffff;
            CharHandler retChar = null;

            for (int i = 0; i < srcLst.Count; ++i)
            {
                CharHandler tmpChar = srcLst[i];
                if (null == charHandler || tmpChar.IsInexistence())
                {
                    continue;
                }

                float tmpAngle = Vector3.Angle(charHandler.m_ParentTrans.localRotation * Vector3.forward, tmpChar.m_ParentTrans.position - charHandler.m_ParentTrans.position);
                float tmpDis   = Vector3.Distance(charHandler.m_ParentTrans.position, tmpChar.m_ParentTrans.position);

                if (tmpAngle <= angle / 2f && tmpDis < raidus && tmpDis < retDis)
                {
                    retDis  = tmpDis;
                    retChar = tmpChar;
                }
            }

            if (null != retChar)
            {
                retLst.Add(retChar);
            }
        }
Beispiel #14
0
        protected override void Excute(CharHandler charHandler, int index = -1, int skillInstId = -1)
        {
            CharData           charData = charHandler.m_CharData;
            List <CharHandler> targets  = GetTargets(charHandler);
            float hurt;

            if (BattleEnum.Enum_CharType.Monster == charHandler.m_CharData.m_eType)
            {
                for (int i = 0; i < targets.Count; ++i)
                {
                    hurt = BattleCalculate.MonsterNormalHurt(charData, targets[i].m_CharData);
                    hurt = ChangeProperty.RatioCoefficient(hurt, SkillEnum.SkillKind.Force, charHandler, targets[i]);
                    targets[i].BeHit(hurt, charHandler);
                }
            }
            else
            {
                for (int i = 0; i < targets.Count; ++i)
                {
                    hurt = BattleCalculate.HeroNormalHurt(charData, targets[i].m_CharData);
                    hurt = ChangeProperty.RatioCoefficient(hurt, SkillEnum.SkillKind.Force, charHandler, targets[i]);
                    targets[i].BeHit(hurt, charHandler);
                }
            }
        }
Beispiel #15
0
 public void OnProcess(CharHandler charHandler, int index = -1)
 {
     if (CheckCondition(charHandler))
     {
         Excute(charHandler, index);
     }
 }
Beispiel #16
0
        private void TypeRandom(CharHandler charHandler, SkillDataSon skillDataSon, List <List <CharHandler> > lists, List <CharHandler> listRet)
        {
            int totalNum = 0;

            for (int i = 0; i < lists.Count; ++i)
            {
                totalNum += lists[i].Count;
            }
            if (totalNum > skillDataSon.m_iCatchNum)
            {
                List <CharHandler> tmpList = new List <CharHandler>();
                AddAllChar(lists, tmpList);
                for (int i = 0; i < skillDataSon.m_iCatchNum; ++i)
                {
                    int index = Random.Range(0, tmpList.Count);
                    listRet.Add(tmpList[index]);
                    tmpList.RemoveAt(index);
                }
            }
            else
            {
                AddAllChar(lists, listRet);
            }

            CharHandler con = GetConcentrate(charHandler, skillDataSon.m_eAimSide);

            if (null != con && !listRet.Contains(con))
            {
                listRet[0] = con;
            }
        }
Beispiel #17
0
        public void NewText(string text, CharHandler handler, HUDTextType type)
        {
            HUDTextItem item      = GetText(type);
            Vector3     createPos = handler.UIFollowGo.transform.position;

            item.Show(text, handler, type, createPos);
        }
Beispiel #18
0
        public void BeHit(float hurt, CharHandler srcHandler, SkillDataSon srcSkillDataSon, bool bDirect)
        {
            if (CheckCanBeHit())
            {
                hurt = Mathf.Max(1f, hurt);

                if (_charHandler.m_CharData.Rebound.Value > 0 && bDirect)
                {
                    _BeHit(hurt, srcHandler, srcSkillDataSon, bDirect);
                    Rebound(hurt, srcHandler);
                }
                else if (_charHandler.m_CharData.Absorb.Value > 0)
                {
                    Absorb(hurt, srcHandler);
                }
                else
                {
                    _BeHit(hurt, srcHandler, srcSkillDataSon, bDirect);
                    if (null != srcHandler && srcHandler.m_CharData.AbsorbHP.Value > 0)
                    {
                        AbsorbHP(hurt, srcHandler);
                    }
                }
            }
        }
Beispiel #19
0
 private void ResetHeroPosition(CharHandler charHandler)
 {
     charHandler.ToIdle();
     charHandler.m_CharState.enabled = true;
     charHandler.m_CharMove.SetAgentEnable(true);
     charHandler.m_CharSkill.RunCD(true);
     charHandler.m_CharSkill.InitTriggerSkill();
 }
Beispiel #20
0
 public override void DoSkill(SkillDataSon skillDataSon, CharHandler charHandler, List <CharHandler> targets, int skillInstId)
 {
     for (int i = 0; i < targets.Count; ++i)
     {
         TickData tickData = new TickData(charHandler, targets[i], skillDataSon, i, skillInstId);
         targets[i].m_CharTick.AddTick(tickData);
     }
 }
Beispiel #21
0
        public CharDefence(CharHandler handler)
        {
            _charHandler = handler;

            _MPData            = BattleManager.GetInst().GetMPData();
            _iLoseHpTemp       = 0;
            _iLoseHpSingleTemp = 0;
        }
Beispiel #22
0
        //反弹伤害
        private void Rebound(float hurt, CharHandler srcHandler)
        {
            float rebound = _charHandler.m_CharData.Rebound.Value;

            hurt *= rebound;
            srcHandler.BeHit(hurt, _charHandler, null, false);
            HUDTextMgr.GetInst().NewText(string.Format(ConfigData.GetHUDText("17"), hurt), _charHandler, HUDTextMgr.HUDTextType.BUFF);                //"反弹伤害 {0:N0}"
        }
Beispiel #23
0
        private static string ReplaceProerty(string sFormula, CharHandler charHandler, bool bAim)
        {
            CharData charData = charHandler.m_CharData;

            sFormula = ReplaceBaseProperty(sFormula, bAim, charData);
            sFormula = ReplaceHeroProperty(sFormula, bAim, charData);
            return(sFormula);
        }
Beispiel #24
0
        public CharHandler AddHero(int heroId, int heroLv, int heroIndex)
        {
            CharHandler h = SpawnHandler.GetInst().CreateHeroM(heroId, heroIndex);

            h.EnableChar();
            BattleHeroListPanel.GetInst().InsertBattleHero(heroId, heroLv, heroIndex);
            return(h);
        }
Beispiel #25
0
        public TickData(CharHandler charHandler, CharHandler aimCharHandler, SkillDataSon skillDataSon, int aimCharIndex, int skillInstId)
        {
            m_iInstanceID   = ++iTickDataInstanceID;
            _CharHandler    = charHandler;
            _AimCharHandler = aimCharHandler;
            m_SkillDataSon  = skillDataSon;
            m_eBuffType     = skillDataSon.GetSkillDataList()[0].m_eSkillSonType;
            _iAimCharIndex  = aimCharIndex;

            float fTotalSecOri;

            if (float.TryParse(m_SkillDataSon.m_sTimeLong, out fTotalSecOri))
            {
                m_fTotalSec = fTotalSecOri;
            }
            else
            {
                fTotalSecOri = Mathf.Ceil(BattleCalculate.ExcuteFormula(m_SkillDataSon.m_sTimeLong, m_SkillDataSon.m_sTimeMaxLong, charHandler, aimCharHandler));
                m_fTotalSec  = ChangeProperty.RatioCoefficient(fTotalSecOri, skillDataSon.m_Parent.m_eSkillKind, charHandler, aimCharHandler);
            }

            if (skillDataSon.m_bDeliver)
            {
                fTotalSecOri *= aimCharIndex + 1;
            }

            switch (m_eBuffType)
            {
            case SkillEnum.SkillSonType.Stun:
                m_fTotalSec = fTotalSecOri * (1 - aimCharHandler.m_CharData.StunDefRatio);                          //1 - 抗晕
                break;

            case SkillEnum.SkillSonType.SkillForbid:
                m_fTotalSec = fTotalSecOri * (1 - aimCharHandler.m_CharData.ForbidDefRatio);                            //1 - 抗封
                break;

            default:
                m_fTotalSec = fTotalSecOri;
                break;
            }

            if (m_fTotalSec > 0f)
            {
                m_fUnitSec = m_SkillDataSon.m_fTimeUnit;

                if (m_fUnitSec > 0f)
                {
                    m_fTotalSec = m_fTotalSec - m_fTotalSec % m_fUnitSec;
                }
                else
                {
                    m_fUnitSec = m_fTotalSec;
                }

                SetFunction(skillInstId);
            }
        }
Beispiel #26
0
        private void AbsorbHPShow(string text, CharHandler handler)
        {
            m_text.fontSize = 30;

            gradient.topColor    = hpColTop;
            gradient.bottomColor = hpColBtm;

            TextAnimetor();
        }
Beispiel #27
0
        private void BuffShow(string text, CharHandler handler)
        {
            m_text.fontSize = 32;

            gradient.topColor    = buffColTop;
            gradient.bottomColor = buffColBtm;

            TextAnimetor();
        }
Beispiel #28
0
        private void ReviveHero(SkillData skillData, CharHandler charHandler, List <CharHandler> targets)
        {
            CharHandler aimCharHandler = targets[0];
            float       value          = BattleCalculate.ExcuteFormula(skillData.m_sEffectExpress, skillData.m_sEffectExpressMax, charHandler, aimCharHandler);

            aimCharHandler.m_CharData.CurHP = value;
            BattleManager.GetInst().m_CharInScene.ReAddChar(aimCharHandler);
            aimCharHandler.Revive();
        }
Beispiel #29
0
        protected virtual bool CheckDead(CharHandler charHandler)
        {
            if (BattleEnum.Enum_CharState.Dead == charHandler.m_CharData.m_eState)
            {
                return(false);
            }

            return(true);
        }
Beispiel #30
0
        protected override List <CharHandler> GetTargets(CharHandler charHandler, SkillDataSon skillDataSon = null, int index = -1)
        {
            List <CharHandler>         ret   = null;
            List <List <CharHandler> > lists = GetTargetsByAimSideType(charHandler, skillDataSon);

            ret = GetTargetsByCatchType(charHandler, skillDataSon, lists, index);
            CheckRate(skillDataSon.m_Parent, charHandler, ref ret);
            return(ret);
        }