/// <summary>
 /// 执行DOT效果
 /// </summary>
 /// <param name="index"></param>
 public void ExeCountEndState(int index)
 {
     foreach (State s in state)
     {
         if (s.type != StateType.DamageOverTime && s.type != StateType.HealOverTime)
         {
             continue;
         }
         string text = string.Format("因为{0}的效果!", s.name);
         if (s.type == StateType.DamageOverTime)
         {
             if (s.times == 0 && s.counts == 0)
             {
                 continue;
             }
             if (s.times > 0)
             {
                 s.times--;
             }
             MyDraw.DrawBattleMessage(text);
             if (!IsInvincible())
             {
                 GetDamage(s.damage, index);
             }
         }
     }
 }
 /// <summary>
 /// 执行HOT效果
 /// </summary>
 /// <param name="index"></param>
 public void ExeCountStartState(int index)
 {
     foreach (State s in state)
     {
         if (s.type != StateType.DamageOverTime && s.type != StateType.HealOverTime)
         {
             continue;
         }
         string text = string.Format("因为{0}的效果!", s.name);
         if (s.type == StateType.HealOverTime)
         {
             if (s.times == 0 && s.counts == 0)
             {
                 continue;
             }
             if (s.times > 0)
             {
                 s.times--;
             }
             MyDraw.DrawBattleMessage(text);
             if (!IsForbidHeal())
             {
                 GetRecover(s.hprecover, index);
             }
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 玩家的行动部分
 /// </summary>
 private void HerosAction()
 {
     //玩家的行动
     for (int i = 0; i < heros.Count; i++)
     {
         if (heros[i].Hp == 0 || heros[i].IsDizzy())
         {
             continue;
         }
         actionIndex = i;
         textPos.Clear();
         SetSkillPos();
         DrawSkill();
         MyDraw.DrawIntroText("轮到" + heros[actionIndex].name + "行动了,请选择指令:");
         tempSkill = heros[actionIndex].skill[GetSkillChoice(heros[actionIndex])];
         MyDraw.DrawBattleMessage(heros[actionIndex].name + "选择了技能:" + tempSkill.name);
         if (tempSkill.targetType == TargetType.EnemySingle)
         {
             MyDraw.DrawIntroText("请选择目标:");
             SetEnemyPos();
             DrawEnemy();
             targetEnemy = GetEnemyChoice();
             if (targetEnemy == -1)
             {
                 i--;
                 continue;
             }
             tempSkill.UseSkillSingle(heros[actionIndex], actionIndex, enemy[targetEnemy], targetEnemy);
         }
         if (tempSkill.targetType == TargetType.EnemyMulti)
         {
             tempSkill.UseSkillMulti(heros[actionIndex], actionIndex, enemy);
         }
         if (tempSkill.targetType == TargetType.PartySingle)
         {
             MyDraw.DrawIntroText("请选择目标:");
             SetPartyPos();
             DrawParty();
             targetEnemy = GetPartyChoice();
             if (targetEnemy == -1)
             {
                 i--;
                 continue;
             }
             tempSkill.UseSkillSingle(heros[actionIndex], actionIndex, heros[targetEnemy], targetEnemy);
         }
         if (tempSkill.targetType == TargetType.PartyMulti)
         {
             tempSkill.UseSkillMulti(heros[actionIndex], actionIndex, heros);
         }
         if (tempSkill.targetType == TargetType.Self)
         {
             tempSkill.UseSkillSingle(heros[actionIndex], actionIndex, heros[actionIndex], actionIndex);
         }
     }
 }
Exemplo n.º 4
0
        public int GetPartyChoice()
        {
            int temp = 0;

            MyDraw.DrawChoiced(temp, heros[temp].name, textPos[temp]);
            bool enter = false;

            while (!enter)
            {
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.LeftArrow)
                {
                    if (temp > 0)
                    {
                        MyDraw.ClearLine(21);
                        MyDraw.DrawChoiceText(temp, heros[temp].name, textPos[temp]);
                        temp = temp - 1;
                        MyDraw.DrawChoiced(temp, heros[temp].name, textPos[temp]);
                    }
                }
                else if (key.Key == ConsoleKey.RightArrow)
                {
                    if (temp < textPos.Count - 1)
                    {
                        MyDraw.ClearLine(21);
                        MyDraw.DrawChoiceText(temp, heros[temp].name, textPos[temp]);
                        temp = temp + 1;
                        MyDraw.DrawChoiced(temp, heros[temp].name, textPos[temp]);
                    }
                }
                else if (key.Key == ConsoleKey.Enter)
                {
                    if (heros[temp].CanBeTarget(tempSkill))
                    {
                        MyDraw.ClearChoiceText();
                        break;
                    }
                    else
                    {
                        MyDraw.DrawBattleMessage("无法选择已经死亡的目标,请重新选择");
                    }
                }
                else if (key.Key == ConsoleKey.Escape)
                {
                    MyDraw.ClearLine(1);
                    return(-1);
                }
            }
            return(temp);
        }
Exemplo n.º 5
0
 private bool IsOver()
 {
     if (IsAllDead(enemy))
     {
         MyDraw.DrawBattleMessage("敌人全灭,玩家胜利!");
         return(true);
     }
     if (IsAllDead(heros))
     {
         MyDraw.DrawBattleMessage("玩家全灭,战斗失败!");
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 判断角色是否能够释放技能
        /// </summary>
        /// <param name="attacker"></param>
        /// <returns></returns>
        public bool CanUseSkill(BaseCharacter attacker)
        {
            //判断角色是否有足够的资源释放技能
            if (attacker.Hp <= hpCost || attacker.Mp < mpCost)
            {
                MyDraw.DrawBattleMessage("消耗不足,无法使用技能!");
                return(false);
            }

            //判断角色是否被禁用了技能
            if (attacker.IsSilence() && type != SkillType.NormalAttack)
            {
                MyDraw.DrawBattleMessage(attacker.name + "被沉默了,无法使用技能!");
                return(false);
            }
            return(true);
        }