示例#1
0
        public void Attack(HS_PlayerInstance fromPlayer, sbyte attackerIndex, HS_PlayerInstance targetPlayer, sbyte defenderIndex)
        {
            List <HS_CreatureInstance> fromField = GetField(fromPlayer);
            List <HS_CreatureInstance> toField   = GetField(targetPlayer);

            if (attackerIndex >= 0 && defenderIndex >= 0)
            {
                Combat(fromField[attackerIndex], toField[defenderIndex]);
            }
            else
            {
                if (defenderIndex == -1)
                {
                    targetPlayer.TakeDamage(fromField[attackerIndex].CreatureStats.Power);
                }
            }
            if (attackerIndex >= 0 && fromField[attackerIndex].CreatureStats.Health <= 0)
            {
                fromField.RemoveAt(attackerIndex);
            }
            if (defenderIndex >= 0 && toField[defenderIndex].CreatureStats.Health <= 0)
            {
                toField.RemoveAt(defenderIndex);
            }
        }
示例#2
0
 public void AddPlayer(HS_PlayerInstance player)
 {
     if (!playerFieldIndicies.ContainsKey(player))
     {
         playerFieldIndicies.Add(player, PlayerCount);
         fields.Add(new List <HS_CreatureInstance>());
     }
 }
示例#3
0
        public void AddCreature(HS_PlayerInstance player, HS_CreatureInstance ci)
        {
            List <HS_CreatureInstance> field = GetField(player);

            if (field.Count < MAX)
            {
                field.Add(ci);
            }
        }
示例#4
0
文件: Game.cs 项目: mtear/hearthclone
 public void StartTurn(HS_PlayerInstance player)
 {
     player.AddManaCrystal();
     player.ResetMana();
     foreach (HS_CreatureInstance bi in battlefield.GetField(player))
     {
         bi.Refresh();
     }
     player.Draw();
 }
示例#5
0
 public List <HS_CreatureInstance> GetField(HS_PlayerInstance player)
 {
     try
     {
         return(fields[(int)playerFieldIndicies[player]]);
     }
     catch {
         return(null);
     }
 }