Exemple #1
0
 private void UseSkill(CharacterBattleData player, SkillData skill)
 {
     lock (syncLock) {
         Console.SetCursorPosition(width / 2 - 20, cursorTop);
         Console.WriteLine("Player {0} used {1}\n", player.characterProperties.characterName, skill.skillName);
         cursorTop = Console.CursorTop;
     }
 }
Exemple #2
0
 public void Battle(CharacterProperties dataPlayer1, CharacterProperties dataPlayer2)
 {
     Init();
     player1 = new CharacterBattleData(dataPlayer1);
     player2 = new CharacterBattleData(dataPlayer2);
     RegenHpAndMp(player1);
     RegenHpAndMp(player2);
 }
Exemple #3
0
 private void EndBattle(CharacterBattleData winPlayer, CharacterBattleData lostPlayer)
 {
     lock (syncLock)
     {
         Console.SetCursorPosition(width / 2 - 20, cursorTop);
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("The WINNER is {0}, the LOSER is {1}", winPlayer.characterProperties.characterName, lostPlayer.characterProperties.characterName);
     }
 }
Exemple #4
0
 private void RegenHpAndMp(CharacterBattleData player)
 {
     lock (syncLock)
     {
         Console.SetCursorPosition(width / 2 - 20, cursorTop);
         Console.WriteLine("Player {0} has regenerated HP and MP\n", player.characterProperties.characterName);
         cursorTop = Console.CursorTop;
     }
 }
Exemple #5
0
 private void Attack(CharacterBattleData player, SkillEffectData skill)
 {
     lock (syncLock)
     {
         Console.SetCursorPosition(width / 2 - 20, cursorTop);
         Console.WriteLine("Player {0} get {1} damage\n", player.characterProperties.characterName, skill.effectValue);
         cursorTop = Console.CursorTop;
     }
 }
Exemple #6
0
 public void UpdateHPAndMP(CharacterBattleData player1, CharacterBattleData player2)
 {
     lock (syncLock)
     {
         Console.SetCursorPosition(7, 5);
         Console.Write(Ultils.FormatText(MyLocalization.GetText("HP:   "), 10) + player1.hp + "\t" + Ultils.FormatText(MyLocalization.GetText("MP:   "), 10) + player1.mp);
         Console.SetCursorPosition(left + 3, 5);
         Console.Write(Ultils.FormatText(MyLocalization.GetText("HP:   "), 10) + player2.hp + "\t" + Ultils.FormatText(MyLocalization.GetText("MP:   "), 10) + player2.mp);
     }
 }
Exemple #7
0
        private void Healer(CharacterBattleData player)
        {
            lock (syncLock)
            {
                Console.SetCursorPosition(width / 2 - 20, cursorTop);

                Console.WriteLine("Player {0} heal: hp = {1},  mp = {2}\n", player.characterProperties.characterName, player.hp, player.mp);
                cursorTop = Console.CursorTop;
            }
        }
Exemple #8
0
        private void UseSkill(SkillData skill, CharacterBattleData player)
        {
            CharacterBattleData usedPlayer = null, enemyPlayer = null;

            if (player.characterProperties.id == player1.characterProperties.id)
            {
                usedPlayer  = player1;
                enemyPlayer = player2;
            }
            else if (player.characterProperties.id == player2.characterProperties.id)
            {
                usedPlayer  = player2;
                enemyPlayer = player1;
            }
            for (int i = 0; i < skill.listSkillEffect.Length; i++)
            {
                if (skill.listSkillEffect[i] != null)
                {
                    if (skill.listSkillEffect[i].typeEffect == ETypeEffect.ATTACK)
                    {
                        enemyPlayer.hp -= skill.listSkillEffect[i].effectValue;
                        if (enemyPlayer.hp <= 0)
                        {
                            _isComplete = true;
                            EndBattleCallBack.Invoke(usedPlayer, enemyPlayer);
                            return;
                        }
                        UpdateHpAndMpCallBack.Invoke(player1, player2);
                        SkillAttackCallBack.Invoke(enemyPlayer, skill.listSkillEffect[i]);
                    }
                    else if (skill.listSkillEffect[i].typeEffect == ETypeEffect.BUFF)
                    {
                        if (skill.listSkillEffect[i].typeAction == ESkillEffect.HEAL)
                        {
                            usedPlayer.RecoverHp(skill.listSkillEffect[i].effectValue);
                            UpdateHpAndMpCallBack.Invoke(player1, player2);
                        }
                    }
                }
            }
        }
Exemple #9
0
 private void ProcessRegenHpAndMp(CharacterBattleData player)
 {
     player.RecoverHp(player.characterProperties.hpRegen);
     player.RecoverMp(player.characterProperties.mpRegen);
     RegenHpAndMpCallBack.Invoke(player);
 }
Exemple #10
0
 private void RegenHpAndMp(CharacterBattleData player)
 {
     GameTimer.Instance.AddTimer(1, () => ProcessRegenHpAndMp(player));
 }