Ejemplo n.º 1
0
    public static float CalcAffectValue(SkillTables.BuffInfo _buff, Unit _Caster, Unit _Target, float prefix = 1f)
    {
        //if (SimulationGameInfo.SimulationGameCheck)
        //    Debug.Log(string.Format("BuffCalcAffectValue  BuffIdx[{0}], baseFactor[{1}], factorRate[{2}]", _buff.Indx, _buff.baseFactor, _buff.factorRate));

        //< 아래의 값들은 전부다 수치가 %로만 저장되야하므로 베이스팩터는 0이어야함
        //< 그렇기때문에 따로 계산할필요없이 팩터레이트값만 리턴해주면됨
        switch ((BuffType)_buff.buffType)
        {
        /*
         * case BuffType.Attack:
         * case BuffType.Def:
         * case BuffType.CriticalRate:
         * case BuffType.CriticalDam:
         *
         * case BuffType.NatureAttack:
         * case BuffType.PoisonAttack:
         * case BuffType.WaterAttack:
         * case BuffType.MetalAttack:
         * case BuffType.FireAttack:
         * case BuffType.HollyAttack:
         * case BuffType.DarkAttack:
         *
         * case BuffType.AttackSpeed:
         * case BuffType.IgnoreDef:
         * case BuffType.MaxHp:
         */
        case BuffType.DAMAGE_INCREASE:
        case BuffType.ATTACKSPEED_INCREASE:
        case BuffType.DAMAGEREDUCE_INCRESE:
        case BuffType.DAMAGEREDUCEPER_INCREASE:
        case BuffType.CRITICALRATE_INCREASE:
        case BuffType.CRITICALDAMAGE_INCREASE:
        case BuffType.CRITICALRES_INCREASE:
        case BuffType.HITRATE_INCREASE:
        case BuffType.DODGERATE_INCREASE:
        case BuffType.LIFESTEAL_INCREASE:
        case BuffType.ANGLEDEFUP:
            return(_buff.factorRate * prefix);
        }

        return(CalcAffectValue(_buff.baseFactor, _buff.factorRate, 0f, _Caster, _Target, prefix));
    }
    //< 버프가 추가되었을시 머리위에 출력하기위함
    public static void BuffInfoStringShow(Unit caster, Unit target, SkillTables.BuffInfo _buffInfo, string subStr)
    {
        //string str = LowDataMgr.GetLocale(_buffInfo.name).title;

        string str = _LowDataMgr.instance.GetStringSkillName(_buffInfo.buffDisplay);

        //< 저항했을시 조립
        str += " " + subStr;
        //< 버프가 붙었을때 스트링을 띄우려면 이곳에서!!

        if (SceneManager.instance.IsRTNetwork)
        {
        }
        else
        {
            if (target.gameObject.activeSelf && G_GameInfo.GameInfo.BoardPanel != null)
            {
                G_GameInfo.GameInfo.BoardPanel.ShowBuff(target.gameObject, caster.gameObject, str);
            }
        }
    }
    //< 버프 추가
    //public void AttachBuff(Unit caster, Unit target, SkillTables.BuffInfo _buffInfo, AbilityData _ability)
    public void AttachBuff(Unit caster, Unit target, SkillTables.BuffInfo _buffInfo, uint _BuffRate, float _BuffDuration)
    {
        if (_buffInfo == null)
        {
            return;
        }
//	    LOGEX.LogEx("BuffController.AttachBuff()", LOGEX.LogType.NONE, LOGEX.ColorType.PURPLE);
        //< 일단 확률을 먼저 검사한다.
        ushort ran = (ushort)Random.Range(0, 10000);

        if ((ushort)ran > _BuffRate)
        {
            BuffInfoStringShow(caster, target, _buffInfo, "抵抗");
            return;
        }

        //< 적용할 수치를 계산한다.

        //버프의 데미지율은 천분율이라 0.001곱하는데 이건좀...
        float affectValue;

        if (SceneManager.instance.IsRTNetwork)
        {
            affectValue = 1;
        }
        else
        {
            affectValue = SkillAbility.CalcAffectValue(_buffInfo, caster, target, 0.001f);
        }

        //< 같은 타입의 버프가 존재하는지 검사
        bool accrue = false;

        for (int i = 0; i < BuffDic.Count; i++)
        {
            //< 같은 버프를 또 쓸경우 중첩됨
            if (BuffDic[i].buffInfo.Indx == _buffInfo.Indx)
            {
                BuffDic[i].OnAttach(this, caster, target, _buffInfo, affectValue, (BuffDurationType)_buffInfo.buffAbility, _BuffDuration);
                accrue = true;
                break;
            }
        }

        //< 중첩되는 버프가 없다면 새로 만들어서 넣어줌
        if (!accrue)
        {
            //< 새버프 생성
            Buff newBuff = new Buff();
            BuffDic.Add(newBuff);
            newBuff.OnAttach(this, caster, target, _buffInfo, affectValue, (BuffDurationType)_buffInfo.buffAbility, _BuffDuration);
        }

        if (AddBuffCallBack != null)
        {
            AddBuffCallBack();
        }

        //< 게임패널에서 업데이트하기 위함
        EventListner.instance.TriggerEvent("BuffUpdate");
    }
    public void FreeFightUserEnter(PMsgBattleMapRoleInfoS anotherUserInfo)
    {
        if (!(G_GameInfo.CharacterMgr.FindRoomUnit((ulong)anotherUserInfo.UllRoleId) != null))
        {
            Vector3 pos = NaviTileInfo.instance.GetTilePos(anotherUserInfo.UnPosX, anotherUserInfo.UnPosY);

            NavMeshHit navHit;
            if (NavMesh.SamplePosition(pos, out navHit, 20, -1))
            {
                pos = navHit.position;
            }

            _PlayerSyncData syncData = NetData.instance.OtherPcSyncData((ulong)anotherUserInfo.UllRoleId, (ulong)anotherUserInfo.UllRoleId
                                                                        , anotherUserInfo.SzName, (uint)anotherUserInfo.UnType, (uint)anotherUserInfo.UnCostumeId, 1
                                                                        , anotherUserInfo.UnTitlePrefix, anotherUserInfo.UnTitleSuffix, (uint)anotherUserInfo.UnMaxSuperArmor, 0);  //싱크 데이터를 하나 만들어 주고

            byte TeamID = (byte)eTeamType.Min;
            if (FreeFightGameState.GameMode == GAME_MODE.FREEFIGHT)
            {
                TeamID = (byte)eTeamType.Team2;
            }
            else if (FreeFightGameState.GameMode == GAME_MODE.COLOSSEUM || FreeFightGameState.GameMode == GAME_MODE.MULTI_RAID)
            {
                TeamID = (byte)eTeamType.Team1;
            }

            G_GameInfo.GameInfo.SpawnNetworkUnit((ulong)anotherUserInfo.UllRoleId, TeamID, syncData.playerSyncDatas[0], pos, Quaternion.identity, false);

            Unit player = G_GameInfo.CharacterMgr.FindRoomUnit((ulong)anotherUserInfo.UllRoleId);
            if (player != null)
            {
                player.CharInfo.MaxHp         = anotherUserInfo.UnMaxHp;
                player.CharInfo.Hp            = anotherUserInfo.UnHp;
                player.CharInfo.SuperArmor    = (uint)anotherUserInfo.UnSuperArmor;
                player.CharInfo.MaxSuperArmor = (uint)anotherUserInfo.UnMaxSuperArmor;

                player.StaticState(false);
                player.SetTarget(GameDefine.unassignedID);

                //버프도 적용
                for (int i = 0; i < anotherUserInfo.CInfo.Count; i++)
                {
                    SkillTables.BuffInfo buff = _LowDataMgr.GetBuffData((uint)anotherUserInfo.CInfo[i].UnBuffId);

                    player.BuffCtlr.AttachBuff(null, player, buff, 10000, (uint)anotherUserInfo.CInfo[i].FBuffTime);
                }

                G_GameInfo.CharacterMgr.RoomPlayerEnter((ulong)anotherUserInfo.UllRoleId, player);
            }


            UIBasePanel board = UIMgr.GetUIBasePanel("UIPanel/InGameBoardPanel");
            if (board != null)
            {
                (board as InGameBoardPanel).ChangeNameColor();
            }

            return;
        }


        UIBasePanel board1 = UIMgr.GetUIBasePanel("UIPanel/InGameBoardPanel");

        if (board1 != null)
        {
            (board1 as InGameBoardPanel).ChangeNameColor();
        }
    }
Ejemplo n.º 5
0
    public void OnAttach(BuffController _controller, Unit _Caster, Unit _Target, SkillTables.BuffInfo _buffInfo, float _affectValue, BuffDurationType _Type, float _BuffDuration)
    {
        controller = _controller;
        buffInfo   = _buffInfo;
        //ability = _ability;
        BuffDurType  = _Type;
        BuffDuration = _BuffDuration;
        Caster       = _Caster;
        Target       = _Target;

        byte overLapCount = _buffInfo.overLapCount;

        if (overLapCount == 0)
        {
            overLapCount = 1;
        }

        //< 중첩 카운트 체크
        if (overLapCount <= AccrueCount)
        {
            //BuffController.BuffInfoStringShow(_Caster, _Target, buffInfo, "(Max)");
            return;
        }

        //< 능력치부터 적용
        AffectBuff(_affectValue, (type) =>
        {
            if (!type)
            {
                //< 적용부터 실패했다면 바로 버프를 삭제시켜줌
                controller.DetachBuff(this, true);
                BuffController.BuffInfoStringShow(_Caster, _Target, buffInfo, "抵抗");
                return;
            }

            //< 머리위에 띄워주기위함
            BuffController.BuffInfoStringShow(_Caster, _Target, buffInfo, "");

            //< 값 누적
            affectedValue += _affectValue;

            //< 데이터 적용
            AccrueCount++;
            affectValue = _affectValue;

            //< 무적관련 버프일경우에는 이미 버프중에 무적이 걸려있을때에 이전 이펙트를 삭제시켜준다.
            switch ((BuffType)_buffInfo.buffType)
            {
            case BuffType.AllImmune:
            case BuffType.AttackImmune:
            case BuffType.SkillImmune:
                controller.SetImmuneEffect(false);
                break;
            }

            Live = true;

            //< 버프에따른 이펙트를 붙인다
            SetEffect(true);

            //< 버프 아이콘 이름 대입
            if (BuffIcon == "")
            {
                UnitStateBase _UnitStateBase = null;
                if (Caster != null && Caster.FSM.GetState(UnitState.Skill, out _UnitStateBase) && _UnitStateBase is SkillState && (_UnitStateBase as SkillState).actionData != null)
                {
                    BuffIcon = _LowDataMgr.instance.GetLowDataIcon((_UnitStateBase as SkillState).actionData.Icon);
                }
                else
                {
                    BuffIcon = buffInfo.icon;
                }
            }

            //< 버프 유지시간 대입
            LifeTime = _BuffDuration;

            //< 틱 시간 대입
            TickTime = buffInfo.tic;

            //if (SkillAbility.SkillDebugMode && _Caster.UnitType == UnitType.Unit && SimulationGameInfo.SimulationGameCheck)
            //    Debug.Log("버프 생성 : " + (BuffType)_buffInfo.buffType + " , LifeTime " + LifeTime + " , TickTime" + TickTime, Target.gameObject);
        });
    }
Ejemplo n.º 6
0
    //< 버프로 인한 스킬 적용
    public static bool BuffApplySkill(bool Apply, SkillTables.BuffInfo _info, Unit _Caster, Unit _Target, float _affectValue, Buff _buff)
    {
        if (SceneManager.instance.IsRTNetwork)
        {
            //네트워크상태에선 캐스터가 없다
            if (_Target == null || !_Target.gameObject.activeSelf)
            {
                return(false);
            }
        }
        else
        {
            if (_Caster == null || _Target == null || !_Caster.gameObject.activeSelf || !_Target.gameObject.activeSelf)
            {
                return(false);
            }
        }

        if (!_Target.CharInfo.BuffValue.ContainsKey((BuffType)_info.buffType))
        {
            _Target.CharInfo.BuffValue.Add((BuffType)_info.buffType, 0);
        }

        switch ((BuffType)_info.buffType)
        {
        //< 수치 타입
        case BuffType.DAMAGE_INCREASE:
        case BuffType.ATTACKSPEED_INCREASE:
        case BuffType.DAMAGEREDUCE_INCRESE:
        case BuffType.DAMAGEREDUCEPER_INCREASE:
        case BuffType.CRITICALRATE_INCREASE:
        case BuffType.CRITICALDAMAGE_INCREASE:
        case BuffType.CRITICALRES_INCREASE:
        case BuffType.HITRATE_INCREASE:
        case BuffType.DODGERATE_INCREASE:
        case BuffType.LIFESTEAL_INCREASE:
        case BuffType.ANGLEDEFUP:
            if (Apply)
            {
                _Target.CharInfo.BuffValue[(BuffType)_info.buffType] += _affectValue;
            }
            else
            {
                _Target.CharInfo.BuffValue[(BuffType)_info.buffType] -= _affectValue;
            }
            break;

        case BuffType.Knockback:
        //case BuffType.Freeze:
        //case BuffType.StoneCurse:
        case BuffType.Stun:
        case BuffType.Down:
            bool success = _Target.SetUnitState(Apply, _info.buffType, _info.factorRate, _Caster);
            if (Apply && !success)
            {
                return(false);
            }

            break;

        //< 즉시적용
        case BuffType.BurnDot:
        case BuffType.PoisoningDot:
            //카메라 푸쉬등의 어빌리티에서 가져오는 데이터가 없으므로 그냥 적용
            if (!SceneManager.instance.IsRTNetwork)
            {
                if (Apply)
                {
                    _Target.TakeDamage(_Caster, 1, _affectValue, 0, eAttackType.All, true, null);
                }
            }
            break;

            /*
             * case BuffType.Attack:
             * case BuffType.Def:
             * case BuffType.CriticalRate:
             * case BuffType.CriticalDam:
             *
             * case BuffType.NatureAttack:
             * case BuffType.PoisonAttack:
             * case BuffType.WaterAttack:
             * case BuffType.MetalAttack:
             * case BuffType.FireAttack:
             * case BuffType.HollyAttack:
             * case BuffType.DarkAttack:
             *
             * case BuffType.AttackSpeed:
             * case BuffType.IgnoreDef:
             *  if (Apply)  _Target.CharInfo.BuffValue[(BuffType)_info.buffType] += _affectValue;
             *  else        _Target.CharInfo.BuffValue[(BuffType)_info.buffType] -= _affectValue;
             *  break;
             *
             *  //< 얘는 버프벨류로 체크안함.
             * case BuffType.Shield:
             *  break;
             *
             *  //< MaxHP 적용
             * case BuffType.MaxHp:
             *  //< 현재 MaxHP를 얻음
             *  int NowMaxHp = _Target.CharInfo.MaxHp;
             *
             *  //< 값 적용
             *  if (Apply)  _Target.CharInfo.BuffValue[(BuffType)_info.buffType] += _affectValue;
             *  else        _Target.CharInfo.BuffValue[(BuffType)_info.buffType] -= _affectValue;
             *
             *  //< 증가된후의 차액을 얻음
             *  int MaxHpValue = _Target.CharInfo.MaxHp - NowMaxHp;
             *
             *  //< 맥스HP가 증가되는거라면 증가되는 수치만큼 현재체력도 증가시켜줌
             *  if (MaxHpValue > 0)
             *      _Target.CharInfo.Hp += (int)MaxHpValue;
             *  else
             *  {
             *      if (_Target.CharInfo.Hp > _Target.CharInfo.MaxHp)
             *          _Target.CharInfo.Hp = _Target.CharInfo.MaxHp;
             *  }
             *
             *  _Target.hp = _Target.CharInfo.Hp;
             *  break;
             *
             *
             * case BuffType.AllImmune:
             * case BuffType.AttackImmune:
             * case BuffType.SkillImmune:
             *  _Target.CharInfo.BuffValue[(BuffType)_info.buffType] = Apply ? 1 : 0;
             *  break;
             *
             *  //< 즉시적용(힐)
             * case BuffType.Heal:
             * case BuffType.HealDot:
             *  if(Apply)   _Target.SetHp(_Caster, _affectValue);
             *  break;
             *
             * //< 상태이상
             *
             *
             *  //< 분신소환
             * //case BuffType.Clone:
             * //    if (Apply)  _buff.AddUnit(_Caster, (int)_buff.buffInfo.eventValue1);
             * //    else        _buff.DeleteUnit();
             * //    break;
             *
             * //    //< 유닛 소환
             * //case BuffType.Summon:
             * //    if (Apply)  _buff.AddEnemy(_Caster, (int)_buff.buffInfo.eventValue1, _buff.buffInfo.eventValue2);
             * //    else        _buff.DeleteUnit();
             * //    break;
             *
             *  //< 광폭화
             * case BuffType.Berserker:
             *  break;
             *
             *  //< 스플래쉬 대미지
             * case BuffType.Splash:
             *  if (Apply)
             *  {
             *      if (_buff.ability != null)
             *      {
             *          //< 적의 리스트를 얻어온다.(스플래쉬는 자신을 주변으로 공격하는것이므로 타겟 기준으로 가져옴)
             *          List<Unit> targetList = GetTargetList(1, _Target);
             *          for (int i = 0; i < targetList.Count; i++)
             *          {
             *              if (targetList[i] == null || targetList[i].IsDie)
             *              {
             *                  //< 범위를 체크한다.
             *                  Vector3 caster = _Target.transform.position;
             *                  Vector3 target = targetList[i].transform.position;
             *                  if ((target - caster).magnitude <= _buff.ability.radius)
             *                      targetList[i].TakeDamage(_Target, 1, _affectValue, eAttackType.All, true);
             *              }
             *          }
             *      }
             *  }
             *  break;
             */
        }

        return(true);
    }