예제 #1
0
        /// <summary>
        /// 根据消除块个数,计算随机攻击伤害值
        /// </summary>
        /// <returns>The random damage.</returns>
        /// <param name="matchCardFinalCount">Match card final count.</param>
        private int GetRandomDamage(int matchCardFinalCount)
        {
            if (matchCardFinalCount <= 3)
            {
                return(Random.Range(1, 4));
            }
            else
            {
                BossData bossMy = CurrentMyBoss;
                if (bossMy == null)
                {
                    return(1);
                }

                if (matchCardFinalCount == 4)
                {
                    return((int)(bossMy.NormalAttack * 0.1f * 5));
                }
                else if (matchCardFinalCount == 5)
                {
                    return((int)(bossMy.NormalAttack * 0.1f * 8));
                }
                else
                {
                    //(≥6之后,系数=5+0.5*消除块数量)
                    return((int)(bossMy.NormalAttack * 0.1f * (5 + 0.5f * matchCardFinalCount)));
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 普通攻击对方
        /// </summary>
        public void NormalAttack(int continueCount, int firstDamage)
        {
            BossData bossOpp = CurrentOppBoss;
            BossData bossMy  = CurrentMyBoss;

            if (bossOpp != null && bossMy != null)
            {
                int bossHp = bossOpp.RealCurrentHp;

                if (bossHp <= 0)
                {
                    return;
                }

//				int damage = (int)(bossMy.NormalAttack * (1 + BossData.NormalAttackPara * (continueCount-1)));

                                #if MinDamage
                int damage = 300;
                                #else
                int damage = (int)(bossMy.NormalAttack * (1 + BossData.NormalAttackPara * (continueCount - 1))) + firstDamage;
                                #endif

                bossHp -= damage;
                if (bossHp < 0)
                {
                    bossHp = 0;
                }
//				bossOpp.CurrentHp = bossHp;
                bossOpp.RealCurrentHp = bossHp;

                //通知服务端
                Util.CallMethod("Network", "ClientAttack", CurrentOppBossId, damage, (int)AttackType.NORMAL, 0, 0, 0);
//				Debug.Log("<color=orange>boss :</color>" + CurrentOppBoss.CurrentHp.ToString() + " damage:" + (-damage).ToString());

                SkillData skillData = new SkillData();
                skillData.BossId       = CurrentOppBossId;
                skillData.Damage       = damage;
                skillData.CurrentHp    = bossOpp.RealCurrentHp;
                skillData.SkillType    = SkillTable.SkillType.GongZhuNormal;
                skillData.IsLastAttack = bossHp <= 0;
                skillData.SkillId      = 0;

                FightMgr.Instance.CurrentMyBoss.AddAttackAction(skillData);
//				FightMgr.Instance.CurrentMyBoss.SwithchState(StateDef.Attack,skillData);

                //del
//				FightMgr.Instance.CurrentOppBoss.SwithchState(StateDef.Hurt);
//
//				//显示敌方扣血
//				EventDispatcher.TriggerEvent<int,int>("CLIENT_ATTACK", CurrentOppBossId,bossHp);
//
//				//播放动画
//				FightMgr.Instance.PlayBossAnim(CurrentOppBossId,bossHp > 0);
            }
            else
            {
                DebugUtil.Error("普通攻击对方Boss,对方boss不存在");
            }
        }
예제 #3
0
        public void SetData()
        {
            LevelId = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).LevelId;
//			LevelId[0] = 5;
            OpponentBossId = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).OpponentBossId;
            var dicOppData = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).DicOpponentBoss;

            DicOppBossData = new Dictionary <int, BossData>();
            int bossKey;

            for (int i = 0; i < OpponentBossId.Length; i++)
            {
                bossKey = OpponentBossId[i];

                BossData bossData = new BossData();
                bossData.BossId        = bossKey;
                bossData.CurrentHp     = dicOppData[bossKey];
                bossData.RealCurrentHp = bossData.CurrentHp;
                bossData.OriHp         = bossData.CurrentHp;
                bossData.Level         = 1;
                DicOppBossData.Add(bossKey, bossData);
            }

            MyBossId      = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).MyBossId;
            dicOppData    = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).DicMyBossHp;
            DicMyBossData = new Dictionary <int, BossData>();
            for (int i = 0; i < MyBossId.Length; i++)
            {
                bossKey = MyBossId[i];

                BossData bossData = new BossData();
                bossData.BossId    = bossKey;
                bossData.CurrentHp = dicOppData[bossKey];
                if (i == 0)
                {
                    //获取额外加成血量
                    //现在只有第一个boss
                    bossData.CurrentHp += GetAddHpByBossBattleIndex(1);
                }
                //获取额外加成攻击
                bossData.AddAttack = GetAddAttackByBossBattleIndex(i + 1);

                bossData.RealCurrentHp = bossData.CurrentHp;
                bossData.OriHp         = bossData.CurrentHp;
                bossData.Level         = 1;
                DicMyBossData.Add(bossKey, bossData);
            }

            _opponentOriTotalHp = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).OpponentOriTotalHp;
            _myOriTotalHp       = AppFacade.Instance.GetManager <FightDataManager>(ManagerName.FightData).MyOriTotalHp;

            _bossSkillTrigger = new Dictionary <int, bool>();

            //第一个上阵boss
            CurrentMyBossId  = MyBossId[0];
            CurrentOppBossId = OpponentBossId[0];
        }
예제 #4
0
        public void UseEnergy(int useEnergy)
        {
            BossData boss = CurrentMyBoss;

            if (boss != null)
            {
                boss.UseEnergy(useEnergy);
            }
            else
            {
                DebugUtil.Error("减少本方Boss能量,本方boss不存在");
            }
        }
예제 #5
0
        /// <summary>
        /// 随机
        /// </summary>
        public void NormalRandomAttack(int matchCardFinalCount, int firstDamage)
        {
            BossData boss = CurrentOppBoss;

            if (boss != null)
            {
                int bossHp = boss.RealCurrentHp;

                if (bossHp <= 0)
                {
                    return;
                }

                int damage = GetRandomDamage(matchCardFinalCount) + firstDamage;

                bossHp -= damage;
                if (bossHp < 0)
                {
                    bossHp = 0;
                }
//				boss.CurrentHp = bossHp;
                boss.RealCurrentHp = bossHp;

                //通知服务端
                Util.CallMethod("Network", "ClientAttack", CurrentOppBossId, damage, (int)AttackType.NORMAL, 0, 0, 0);

                SkillData skillData = new SkillData();
                skillData.BossId       = CurrentOppBossId;
                skillData.Damage       = damage;
                skillData.CurrentHp    = boss.RealCurrentHp;
                skillData.SkillType    = SkillTable.SkillType.GongZhuRandomNormal;
                skillData.IsLastAttack = bossHp <= 0;
                skillData.SkillId      = 0;

                FightMgr.Instance.CurrentMyBoss.AddAttackAction(skillData);
//				FightMgr.Instance.CurrentMyBoss.SwithchState(StateDef.Attack,skillData);

                //del
                //				FightMgr.Instance.CurrentOppBoss.SwithchState(StateDef.Hurt);
                //
                //				//显示敌方扣血
                //				EventDispatcher.TriggerEvent<int,int>("CLIENT_ATTACK", CurrentOppBossId,bossHp);
                //
                //				//播放动画
                //				FightMgr.Instance.PlayBossAnim(CurrentOppBossId,bossHp > 0);
            }
            else
            {
                DebugUtil.Error("普通攻击对方Boss,对方boss不存在");
            }
        }
예제 #6
0
        /// <summary>
        /// 自己boss充能
        /// </summary>
        /// <param name="type">Type.</param>
        public void AddEnergy(E_AddEnergyType type)
        {
            BossData boss = CurrentMyBoss;

            if (boss != null)
            {
                boss.AddEnergy(type);

//				if(boss.IsCanUseSkill)
//					SkillAttackBoss();
            }
            else
            {
                DebugUtil.Error("增加本方Boss能量,本方boss不存在");
            }
        }
예제 #7
0
        /// <summary>
        /// 显示区域
        /// </summary>
        /// <param name="disPlay">If set to <c>true</c> dis play.</param>
        public void ShowSkill(bool disPlay)
        {
            if (disPlay)
            {
                _goSkill.SetActive(true);
                _goSkillMask.SetActive(true);

                                #if FightTest
                for (int i = 0; i < _skillBtns.Length; i++)
                {
                    _skillBtns[i].gameObject.SetActive(true);
                    _skillBtns[i].SetSkillId(1001);
                }
                                #else
                BossData bossData = FightMgr.Instance.ModuleFight.CurrentMyBoss;
                for (int i = 0; i < _skillBtns.Length; i++)
                {
                    if (i < bossData.SkillId.Length)
                    {
                        _skillBtns[i].gameObject.SetActive(true);
                        _skillBtns[i].SetSkillId(bossData.SkillId[i]);
                    }
                    else
                    {
                        _skillBtns[i].gameObject.SetActive(false);
                    }
                }
                                #endif

                _scaleSkillBgCircleTime = 0f;
                _progress             = 0f;
                _isScaleSkillBgCircle = true;

                _goSkillNoteParticle.SetActive(false);
            }
            else
            {
                _goSkill.SetActive(false);
                if (Fight.LevelProfile.NewCurrentLevelProfile.Level > 2)
                {
                    _goSkillNoteParticle.SetActive(_energyPrevious >= SkillModuleMgr.Instance.MinNeedEnergy);
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 获取第一次攻击值
        /// </summary>
        /// <param name="matchCardFinalCount">Match card final count.</param>
        public int GetFirstRandomAttack(int matchCardFinalCount)
        {
            int      damage = 0;
            BossData boss   = CurrentOppBoss;

            if (boss != null)
            {
                int bossHp = boss.CurrentHp;

                if (bossHp <= 0)
                {
                    return(damage);
                }

                damage = GetRandomDamage(matchCardFinalCount);
            }

            return(damage);
        }
예제 #9
0
        public void TriggerSkill(int skillId)
        {
            SkillModule skill = SkillModuleMgr.Instance.GetSkill(skillId);

            if (skill == null)
            {
                DebugUtil.Error("未找到skill,id = " + skillId);
            }

            BossData bossData = ModuleFight.CurrentMyBoss;

            //暂时屏蔽
            if (skill.NeedEnergy > bossData.Energy)
            {
                ShowMsg(FightDefine.E_NoteMsgType.NotEnoughEnergy);
                return;
            }

            ModuleFight.UseEnergy(skill.NeedEnergy);
            ModuleFight.SkillAttackBoss(skill);
        }
예제 #10
0
        /// <summary>
        /// 技能攻击对方
        /// </summary>
        public void SkillAttackBoss(SkillModule skill)
        {
            BossData boss    = CurrentMyBoss;
            BossData bossOpp = CurrentOppBoss;

            if (boss != null && bossOpp != null)
            {
                int bossHp = bossOpp.RealCurrentHp;

                if (bossHp <= 0)
                {
                    return;
                }

                                #if MinDamage
                int damage = 1;
                                #else
                int damage = (int)(boss.NormalAttack * skill.HarmPara);
                                #endif

                bossHp -= damage;
                if (bossHp < 0)
                {
                    bossHp = 0;
                }
//				bossOpp.CurrentHp = bossHp;
                bossOpp.RealCurrentHp = bossHp;

                //通知服务端
                Util.CallMethod("Network", "ClientAttack", CurrentOppBossId, damage, (int)AttackType.SKILL_1, skill.Id, 0, 0);

//				Debug.Log("<color=orange>boss :</color>" + CurrentOppBoss.CurrentHp.ToString() + " damage:" + (-damage).ToString());
                SkillData skillData = new SkillData();
                skillData.BossId       = CurrentOppBossId;
                skillData.CurrentHp    = bossOpp.RealCurrentHp;
                skillData.Damage       = damage;
                skillData.SkillType    = SkillTable.SkillType.GongZhuSkill;
                skillData.SkillId      = skill.Id;
                skillData.IsLastAttack = bossHp <= 0;

                FightMgr.Instance.CurrentMyBoss.AddAttackAction(skillData);

//				boss.AddEnergy(E_AddEnergyType.UseSkill);
            }
            else
            {
                DebugUtil.Error("技能攻击对方Boss,本方boss不存在");
            }



            //原来直接播放技能伤害逻辑
//			BossData boss = CurrentMyBoss;
//			BossData bossOpp = CurrentOppBoss;
//
//			if(boss != null && bossOpp != null && boss.IsCanUseSkill)
//			{
//
//				int bossHp = bossOpp.RealCurrentHp;
//
//				if(bossHp <= 0) return;
//
//				#if MinDamage
//				int damage = 1;
//				#else
//				int damage = boss.SkillAttack;
//				#endif
//
//				bossHp -= damage;
//				if(bossHp < 0) bossHp = 0;
////				bossOpp.CurrentHp = bossHp;
//				bossOpp.RealCurrentHp = bossHp;
//
//				//通知服务端
//				Util.CallMethod("Network", "ClientAttack",CurrentOppBossId, damage, (int)AttackType.SKILL_1);
//
////				Debug.Log("<color=orange>boss :</color>" + CurrentOppBoss.CurrentHp.ToString() + " damage:" + (-damage).ToString());
//				SkillData skillData = new SkillData();
//				skillData.BossId = CurrentOppBossId;
//				skillData.CurrentHp = bossOpp.RealCurrentHp;
//				skillData.Damage = damage;
//				skillData.SkillType = SkillTable.SkillType.GongZhuSkill;
//				skillData.IsLastAttack = bossHp <= 0;
//
//				FightMgr.Instance.CurrentMyBoss.AddAttackAction(skillData);
//
//				boss.AddEnergy(E_AddEnergyType.UseSkill);
//			}
//			else
//			{
//				DebugUtil.Error("技能攻击对方Boss,本方boss不存在");
//			}
        }