private BoardUnit CreateBoardUnit(WorkingCard card, Player owner)
        {
            GameObject playerBoard = owner.IsLocalPlayer ?
                                     BattlegroundController.PlayerBoardObject :
                                     BattlegroundController.OpponentBoardObject;

            BoardUnit boardUnit = new BoardUnit(playerBoard.transform);

            boardUnit.Transform.tag      = owner.IsLocalPlayer ? SRTags.PlayerOwned : SRTags.OpponentOwned;
            boardUnit.Transform.parent   = playerBoard.transform;
            boardUnit.Transform.position =
                new Vector2(2f * owner.BoardCards.Count, owner.IsLocalPlayer ? -1.66f : 1.66f);
            boardUnit.OwnerPlayer = owner;
            boardUnit.SetObjectInfo(card);

            if (!owner.Equals(GameplayManager.CurrentTurnPlayer))
            {
                boardUnit.IsPlayable = true;
            }

            boardUnit.PlayArrivalAnimation();

            GameplayManager.CanDoDragActions = true;

            return(boardUnit);
        }
        public override void SetInfo()
        {
            base.SetInfo();

            _attackingCreature = GameAction.Parameters[0] as BoardUnit;
            _attackingDamage   = (int)GameAction.Parameters[1];
            _attackedCreature  = GameAction.Parameters[2] as BoardUnit;
            _attackedDamage    = (int)GameAction.Parameters[3];

            PreviewImage.sprite   = _attackingCreature.Sprite;
            _attackingCreatureObj = CreateCardPreview(_attackingCreature.Card, Vector3.zero);
            _attackedCreatureObj  = CreateCardPreview(_attackedCreature.Card, Vector3.right * 6);

            AttackingPictureObject.SetActive(true);

            GameObject attackViewPlayer = _attackedCreatureObj.transform.Find("AttackingHealth").gameObject;

            attackViewPlayer.SetActive(true);
            TextMeshPro damageText = attackViewPlayer.transform.Find("AttackText").GetComponent <TextMeshPro>();

            damageText.text = (-_attackingDamage).ToString();
            attackViewPlayer.transform.localPosition = -Vector3.up * 3;

            if (_attackedDamage > 0)
            {
                GameObject attackViewCreature = _attackingCreatureObj.transform.Find("AttackingHealth").gameObject;
                attackViewCreature.SetActive(true);
                TextMeshPro damageTextCreature =
                    attackViewCreature.transform.Find("AttackText").GetComponent <TextMeshPro>();
                damageTextCreature.text = (-_attackedDamage).ToString();
                attackViewCreature.transform.localPosition = -Vector3.up * 3;
            }
        }
Beispiel #3
0
        public override void SetInfo()
        {
            base.SetInfo();

            _callerPlayer    = GameAction.Parameters[0] as Player;
            _usedSkill       = GameAction.Parameters[1] as HeroSkill;
            _skillValue      = (int)GameAction.Parameters[2];
            _skillUsedOnUnit = GameAction.Parameters[3] as BoardUnit;

            PreviewImage.sprite = LoadObjectsManager.GetObjectByPath <Sprite>("Images/Heroes/CZB_2D_Hero_Portrait_" +
                                                                              _callerPlayer.SelfHero.HeroElement + "_EXP");

            AttackingPictureObject.SetActive(true);

            _attackedCreatureObj = CreateCardPreview(_skillUsedOnUnit.Card, Vector3.right * 6);
            _attackingPlayerObj  = CreatePlayerPreview(_callerPlayer, Vector3.zero);

            GameObject cardView = _attackedCreatureObj.transform.Find("AttackingHealth").gameObject;

            cardView.SetActive(true);
            TextMeshPro damageText = cardView.transform.Find("AttackText").GetComponent <TextMeshPro>();

            damageText.text = (-_skillValue).ToString();
            cardView.transform.localPosition = -Vector3.up * 3;
        }
Beispiel #4
0
        private void HealingTouchAction(Player owner, BoardSkill boardSkill, HeroSkill skill, object target)
        {
            if (target is Player)
            {
                Player player = target as Player;

                _battleController.HealPlayerBySkill(owner, skill, player);

                _vfxController.CreateVfx(
                    _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Skills/HealingTouchVFX"), player);
                _soundManager.PlaySound(Enumerators.SoundType.OVERLORD_ABILITIES, skill.OverlordSkill.ToString().ToLower(),
                                        Constants.OverlordAbilitySoundVolume, Enumerators.CardSoundType.NONE);
            }
            else
            {
                BoardUnit unit = target as BoardUnit;

                _battleController.HealUnitBySkill(owner, skill, unit);

                _vfxController.CreateVfx(
                    _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Skills/HealingTouchVFX"), unit);
                _soundManager.PlaySound(Enumerators.SoundType.OVERLORD_ABILITIES, skill.OverlordSkill.ToString().ToLower(),
                                        Constants.OverlordAbilitySoundVolume, Enumerators.CardSoundType.NONE);
            }
        }
        public void AttackUnitByAbility(
            object attacker, AbilityData ability, BoardUnit attackedUnit, int damageOverride = -1)
        {
            int damage = ability.Value;

            if (damageOverride > 0)
            {
                damage = damageOverride;
            }

            if (attackedUnit != null)
            {
                if (damage > 0 && attackedUnit.HasBuffShield)
                {
                    damage = 0;
                    attackedUnit.UseShieldFromBuff();
                }

                attackedUnit.CurrentHp -= damage;

                _vfxController.SpawnGotDamageEffect(attackedUnit, -damage);
                _actionsQueueController.PostGameActionReport(_actionsQueueController.FormatGameActionReport(
                                                                 Enumerators.ActionType.ATTACK_CREATURE_BY_ABILITY, new[]
                {
                    attacker, ability, damage, attackedUnit
                }));
            }
        }
        public override void Action(object info = null)
        {
            base.Action(info);

            BoardUnit unit = info as BoardUnit;

            int targetIndex = -1;

            for (int i = 0; i < unit.OwnerPlayer.BoardCards.Count; i++)
            {
                if (unit.OwnerPlayer.BoardCards[i] == unit)
                {
                    targetIndex = i;
                    break;
                }
            }

            if (targetIndex > -1)
            {
                if (targetIndex - 1 > -1)
                {
                    TakeDamageToUnit(unit.OwnerPlayer.BoardCards[targetIndex - 1]);
                }

                if (targetIndex + 1 < unit.OwnerPlayer.BoardCards.Count)
                {
                    TakeDamageToUnit(unit.OwnerPlayer.BoardCards[targetIndex + 1]);
                }
            }
        }
Beispiel #7
0
        private void ReviveUnit(WorkingCard workingCard)
        {
            Player playerOwner = workingCard.Owner;

            if (playerOwner.BoardCards.Count >= Constants.MaxBoardUnits)
            {
                return;
            }

            Card libraryCard = workingCard.LibraryCard.Clone();

            WorkingCard card = new WorkingCard(libraryCard, playerOwner);
            BoardUnit   unit = BattlegroundController.CreateBoardUnit(playerOwner, card);

            playerOwner.RemoveCardFromGraveyard(workingCard);
            playerOwner.AddCardToBoard(card);
            playerOwner.BoardCards.Add(unit);

            if (playerOwner.IsLocalPlayer)
            {
                BattlegroundController.PlayerBoardCards.Add(unit);
                BattlegroundController.UpdatePositionOfBoardUnitsOfPlayer(GameplayManager.CurrentPlayer.BoardCards);
            }
            else
            {
                BattlegroundController.OpponentBoardCards.Add(unit);
                BattlegroundController.UpdatePositionOfBoardUnitsOfOpponent();
            }
        }
        public override void OnCardSelected(BoardUnit unit)
        {
            if (unit.CurrentHp <= 0)
            {
                return;
            }

            if (PossibleTargets.Contains(Enumerators.AbilityTargetType.PLAYER_CARD) &&
                unit.GameObject.CompareTag(SRTags.PlayerOwned) ||
                PossibleTargets.Contains(Enumerators.AbilityTargetType.OPPONENT_CARD) &&
                unit.GameObject.CompareTag(SRTags.OpponentOwned) ||
                PossibleTargets.Contains(Enumerators.AbilityTargetType.ALL))
            {
                if (TargetUnitType == Enumerators.CardType.NONE || unit.InitialUnitType == TargetUnitType)
                {
                    if (TargetUnitStatusType == Enumerators.UnitStatusType.NONE ||
                        unit.UnitStatus == TargetUnitStatusType)
                    {
                        if (SelfBoardCreature != unit)
                        {
                            SelectedCard?.SetSelectedUnit(false);

                            SelectedCard = unit;
                            SelectedPlayer?.SetGlowStatus(false);

                            SelectedPlayer = null;
                            SelectedCard.SetSelectedUnit(true);

                            CardSelected?.Invoke(unit);
                        }
                    }
                }
            }
        }
        public void ReturnCardToHand(BoardUnit unit)
        {
            Player      unitOwner     = unit.OwnerPlayer;
            WorkingCard returningCard = unit.Card;

            returningCard.InitialCost = returningCard.LibraryCard.Cost;
            returningCard.RealCost    = returningCard.InitialCost;

            Vector3 unitPosition = unit.Transform.position;

            _timerManager.AddTimer(
                x =>
            {
                // STEP 1 - REMOVE UNIT FROM BOARD
                unitOwner.BoardCards.Remove(unit);

                // STEP 2 - DESTROY UNIT ON THE BOARD OR ANIMATE
                unit.Die(true);
                Object.Destroy(unit.GameObject);

                // STEP 3 - REMOVE WORKING CARD FROM BOARD
                unitOwner.RemoveCardFromBoard(returningCard);

                // STEP 4 - RETURN CARD TO HAND
                ReturnToHandBoardUnit(returningCard, unitOwner, unitPosition);

                // STEP 4 - REARRANGE HANDS
                _gameplayManager.RearrangeHands();
            },
                null,
                2f);
        }
Beispiel #10
0
 public override void OnCardUnselected(BoardUnit creature)
 {
     if (SelectedCard == creature)
     {
         SelectedCard.SetSelectedUnit(false);
         SelectedCard = null;
     }
 }
Beispiel #11
0
        private void PointerEventSolverEndedHandler()
        {
            _delayTimerOfClick   = 0f;
            _startedOnClickDelay = false;

            _topmostBoardCard  = null;
            _selectedBoardUnit = null;
        }
        public override void Action(object info = null)
        {
            base.Action(info);

            BoardUnit unit = info as BoardUnit;

            BattlegroundController.DestroyBoardUnit(unit);
        }
Beispiel #13
0
        public override void Action(object info = null)
        {
            base.Action(info);

            BoardUnit unit = info as BoardUnit;

            Player playerOwner = unit.OwnerPlayer;

            BoardUnit leftAdjustment = null, rightAdjastment = null;

            int targetIndex       = -1;
            List <BoardUnit> list = null;

            for (int i = 0; i < playerOwner.BoardCards.Count; i++)
            {
                if (playerOwner.BoardCards[i] == unit)
                {
                    targetIndex = i;
                    list        = playerOwner.BoardCards;
                    break;
                }
            }

            object caller = AbilityUnitOwner != null ? AbilityUnitOwner : (object)BoardSpell;

            if (targetIndex > -1)
            {
                if (targetIndex - 1 > -1)
                {
                    leftAdjustment = list[targetIndex - 1];
                }

                if (targetIndex + 1 < list.Count)
                {
                    rightAdjastment = list[targetIndex + 1];
                }
            }

            if (leftAdjustment != null)
            {
                CreateAndMoveParticle(
                    () =>
                {
                    BattleController.AttackUnitByAbility(caller, AbilityData, leftAdjustment);
                },
                    leftAdjustment.Transform.position);
            }

            if (rightAdjastment != null)
            {
                CreateAndMoveParticle(
                    () =>
                {
                    BattleController.AttackUnitByAbility(caller, AbilityData, rightAdjastment);
                },
                    rightAdjastment.Transform.position);
            }
        }
Beispiel #14
0
        public void KillBoardCard(BoardUnit cardToDestroy)
        {
            if (cardToDestroy == null)
            {
                return;
            }

            if (_lastBoardUntilOnPreview != null && cardToDestroy == _lastBoardUntilOnPreview)
            {
                DestroyCardPreview();
            }

            cardToDestroy.Transform.position = new Vector3(cardToDestroy.Transform.position.x,
                                                           cardToDestroy.Transform.position.y, cardToDestroy.Transform.position.z + 0.2f);

            _timerManager.AddTimer(
                x =>
            {
                cardToDestroy.Transform.DOShakePosition(.7f, 0.25f, 10, 90, false, false);

                string cardDeathSoundName =
                    cardToDestroy.Card.LibraryCard.Name.ToLower() + "_" + Constants.CardSoundDeath;
                float soundLength = 0f;

                if (!cardToDestroy.OwnerPlayer.Equals(_gameplayManager.CurrentTurnPlayer))
                {
                    _soundManager.PlaySound(Enumerators.SoundType.CARDS, cardDeathSoundName,
                                            Constants.ZombieDeathVoDelayBeforeFadeout, Constants.ZombiesSoundVolume,
                                            Enumerators.CardSoundType.DEATH);
                    soundLength = _soundManager.GetSoundLength(Enumerators.SoundType.CARDS, cardDeathSoundName);
                }

                _timerManager.AddTimer(
                    t =>
                {
                    cardToDestroy.OwnerPlayer.BoardCards.Remove(cardToDestroy);
                    cardToDestroy.OwnerPlayer.RemoveCardFromBoard(cardToDestroy.Card);
                    cardToDestroy.OwnerPlayer.AddCardToGraveyard(cardToDestroy.Card);

                    cardToDestroy.InvokeUnitDied();
                    cardToDestroy.Transform.DOKill();
                    Object.Destroy(cardToDestroy.GameObject);

                    _timerManager.AddTimer(
                        f =>
                    {
                        UpdatePositionOfBoardUnitsOfOpponent();
                        UpdatePositionOfBoardUnitsOfPlayer(_gameplayManager.CurrentPlayer.BoardCards);
                    },
                        null,
                        Time.deltaTime);
                },
                    null,
                    soundLength);
            });
        }
Beispiel #15
0
        public void HideCardPreview()
        {
            StopHandTimer();
            _battlegroundController.DestroyCardPreview();

            _delayTimerOfClick   = 0f;
            _startedOnClickDelay = false;
            _topmostBoardCard    = null;
            _selectedBoardUnit   = null;
        }
Beispiel #16
0
        public BoardUnit GetBoardUnitFromHisObject(GameObject unitObject)
        {
            BoardUnit unit = PlayerBoardCards.Find(x => x.GameObject.Equals(unitObject));

            if (unit == null)
            {
                unit = OpponentBoardCards.Find(x => x.GameObject.Equals(unitObject));
            }

            return(unit);
        }
        public override void SetInfo()
        {
            base.SetInfo();

            _callerPlayer = GameAction.Parameters[0] as Player;
            _playedCard   = GameAction.Parameters[1] as BoardUnit;

            PreviewImage.sprite = _playedCard.Sprite;

            _playedCardPreviewObject = CreateCardPreview(_playedCard.Card, Vector3.zero);
        }
        public void AttackUnitByUnit(BoardUnit attackingUnit, BoardUnit attackedUnit, int additionalDamage = 0)
        {
            int damageAttacked = 0;
            int damageAttacking;

            if (attackingUnit != null && attackedUnit != null)
            {
                int additionalDamageAttacker =
                    _abilitiesController.GetStatModificatorByAbility(attackingUnit, attackedUnit, true);
                int additionalDamageAttacked =
                    _abilitiesController.GetStatModificatorByAbility(attackedUnit, attackingUnit, false);

                damageAttacking = attackingUnit.CurrentDamage + additionalDamageAttacker + additionalDamage;

                if (damageAttacking > 0 && attackedUnit.HasBuffShield)
                {
                    damageAttacking = 0;
                    attackedUnit.HasUsedBuffShield = true;
                }

                attackedUnit.CurrentHp -= damageAttacking;

                _vfxController.SpawnGotDamageEffect(attackedUnit, -damageAttacking);

                attackedUnit.InvokeUnitDamaged(attackingUnit);
                attackingUnit.InvokeUnitAttacked(attackedUnit, damageAttacking, true);

                if (attackedUnit.CurrentHp > 0 && attackingUnit.AttackAsFirst || !attackingUnit.AttackAsFirst)
                {
                    damageAttacked = attackedUnit.CurrentDamage + additionalDamageAttacked;

                    if (damageAttacked > 0 && attackingUnit.HasBuffShield)
                    {
                        damageAttacked = 0;
                        attackingUnit.HasUsedBuffShield = true;
                    }

                    attackingUnit.CurrentHp -= damageAttacked;

                    _vfxController.SpawnGotDamageEffect(attackingUnit, -damageAttacked);

                    attackingUnit.InvokeUnitDamaged(attackedUnit);
                    attackedUnit.InvokeUnitAttacked(attackingUnit, damageAttacked, false);
                }

                _actionsQueueController.PostGameActionReport(_actionsQueueController.FormatGameActionReport(
                                                                 Enumerators.ActionType.ATTACK_CREATURE_BY_CREATURE, new object[]
                {
                    attackingUnit, damageAttacking, attackedUnit, damageAttacked
                }));

                _tutorialManager.ReportAction(Enumerators.TutorialReportAction.ATTACK_CARD_CARD);
            }
        }
        private void ReturnBoardUnitToDeck(BoardUnit unit)
        {
            if (AbilityUnitOwner != null && unit == AbilityUnitOwner || unit == null)
            {
                return;
            }

            // implement animation
            unit.OwnerPlayer.AddCardToDeck(new WorkingCard(unit.Card.LibraryCard.Clone(), unit.OwnerPlayer));
            unit.MoveUnitFromBoardToDeck();
        }
        private void ReturnBoardUnitToHand(BoardUnit unit)
        {
            CreateVfx(unit.Transform.position, true, 3f, true);

            CardsController.ReturnCardToHand(unit);

            ActionsQueueController.PostGameActionReport(ActionsQueueController.FormatGameActionReport(
                                                            Enumerators.ActionType.RETURN_TO_HAND_CARD_ABILITY, new object[]
            {
                PlayerCallerOfAbility, AbilityData, unit
            }));
        }
        public override void SetInfo()
        {
            base.SetInfo();

            _callerPlayer    = GameAction.Parameters[0] as Player;
            _skillUsedOnUnit = GameAction.Parameters[1] as BoardUnit;

            PreviewImage.sprite = _skillUsedOnUnit.Sprite;

            _skillOwnerObject         = CreatePlayerPreview(_callerPlayer, Vector3.zero);
            _stunnedUnitPreviewObject = CreateCardPreview(_skillUsedOnUnit.Card, Vector3.right * 6);
        }
Beispiel #22
0
        public void End(BoardUnit creature)
        {
            if (!StartedDrag)
            {
                return;
            }

            StartedDrag = false;

            creature.DoCombat(SelectedCard ?? (object)SelectedPlayer);
            Dispose();
        }
        public override void SetInfo()
        {
            base.SetInfo();

            _abilityUnitOwner  = GameAction.Parameters[0] as BoardUnit;
            _abilityUsedOnUnit = GameAction.Parameters[1] as BoardUnit;

            PreviewImage.sprite = _abilityUnitOwner.Sprite;

            _abilityOwnerObject       = CreateCardPreview(_abilityUnitOwner.Card, Vector3.zero);
            _stunnedUnitPreviewObject = CreateCardPreview(_abilityUsedOnUnit.Card, Vector3.zero);
        }
Beispiel #24
0
        public void UpdatePositionOfBoardUnitsOfOpponent(Action onComplete = null)
        {
            if (_gameplayManager.IsGameEnded)
            {
                return;
            }

            if (_rearrangingTopRealTimeSequence != null)
            {
                _rearrangingTopRealTimeSequence.Kill();
                _rearrangingTopRealTimeSequence = null;
            }

            List <BoardUnit> opponentBoardCards = _gameplayManager.OpponentPlayer.BoardCards;

            float boardWidth = 0.0f;
            float spacing    = 0.2f;
            float cardWidth  = 0.0f;

            for (int i = 0; i < opponentBoardCards.Count; i++)
            {
                cardWidth   = 2.5f;
                boardWidth += cardWidth;
                boardWidth += spacing;
            }

            boardWidth -= spacing;

            List <Vector2> newPositions = new List <Vector2>(opponentBoardCards.Count);
            Vector3        pivot        = OpponentBoardObject.transform.position;

            for (int i = 0; i < opponentBoardCards.Count; i++)
            {
                newPositions.Add(new Vector2(pivot.x - boardWidth / 2 + cardWidth / 2, pivot.y + 0.0f));
                pivot.x += boardWidth / opponentBoardCards.Count;
            }

            Sequence sequence = DOTween.Sequence();

            for (int i = 0; i < opponentBoardCards.Count; i++)
            {
                BoardUnit card = opponentBoardCards[i];
                sequence.Insert(0, card.Transform.DOMove(newPositions[i], 0.4f).SetEase(Ease.OutSine));
            }

            _rearrangingTopRealTimeSequence = sequence;
            sequence.OnComplete(
                () =>
            {
                onComplete?.Invoke();
            });
        }
 public void ResetPlayerCardsOnBattlegroundPosition()
 {
     if (_indexOfCard != -1)
     {
         _battlegroundController.UpdatePositionOfBoardUnitsOfPlayer(_gameplayManager.CurrentPlayer.BoardCards);
         _indexOfCard = -1;
         if (_fakeBoardCard != null)
         {
             Object.Destroy(_fakeBoardCard.GameObject);
             _fakeBoardCard = null;
         }
     }
 }
Beispiel #26
0
        private void RabiesAction(Player owner, BoardSkill boardSkill, HeroSkill skill, object target)
        {
            if (target != null && target is BoardUnit)
            {
                BoardUnit unit = target as BoardUnit;

                unit.SetAsFeralUnit();

                _vfxController.CreateVfx(
                    _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Skills/RabiesVFX"), unit);
                _soundManager.PlaySound(Enumerators.SoundType.OVERLORD_ABILITIES, skill.OverlordSkill.ToString().ToLower(),
                                        Constants.OverlordAbilitySoundVolume, Enumerators.CardSoundType.NONE);
            }
        }
Beispiel #27
0
        public BoardUnit CreateBoardUnit(Player owner, WorkingCard card)
        {
            GameObject playerBoard = owner.IsLocalPlayer ? PlayerBoardObject : OpponentBoardObject;

            BoardUnit boardUnit = new BoardUnit(playerBoard.transform);

            boardUnit.Transform.tag = owner.IsLocalPlayer ? SRTags.PlayerOwned : SRTags.OpponentOwned;
            boardUnit.Transform.SetParent(playerBoard.transform);
            boardUnit.Transform.position = new Vector2(1.9f * owner.BoardCards.Count, 0);
            boardUnit.OwnerPlayer        = owner;
            boardUnit.SetObjectInfo(card);

            boardUnit.PlayArrivalAnimation();

            return(boardUnit);
        }
        public void HoverPlayerCardOnBattleground(Player player, BoardCard card, HandBoardCard handCard)
        {
            Card libraryCard = card.WorkingCard.LibraryCard;

            if (libraryCard.CardKind == Enumerators.CardKind.CREATURE)
            {
                int   newIndexOfCard          = 0;
                float newCreatureCardPosition = card.Transform.position.x;

                // set correct position on board depends from card view position
                for (int i = 0; i < player.BoardCards.Count; i++)
                {
                    if (newCreatureCardPosition > player.BoardCards[i].Transform.position.x)
                    {
                        newIndexOfCard = i + 1;
                    }
                    else
                    {
                        break;
                    }
                }

                if (player.BoardCards.Count > 0 && _indexOfCard != newIndexOfCard)
                {
                    _indexOfCard = newIndexOfCard;

                    List <BoardUnit> playerCards   = _gameplayManager.CurrentPlayer.BoardCards;
                    List <BoardUnit> toArrangeList = new List <BoardUnit>();

                    for (int i = 0; i < playerCards.Count; i++)
                    {
                        toArrangeList.Add(playerCards[i]);
                    }

                    if (_fakeBoardCard != null)
                    {
                        Object.Destroy(_fakeBoardCard.GameObject);
                        _fakeBoardCard = null;
                    }

                    _fakeBoardCard = new BoardUnit(_playerBoard.transform);
                    toArrangeList.Insert(_indexOfCard, _fakeBoardCard);

                    _battlegroundController.UpdatePositionOfBoardUnitsOfPlayer(toArrangeList);
                }
            }
        }
Beispiel #29
0
        private void PushAction(Player owner, BoardSkill boardSkill, HeroSkill skill, object target)
        {
            BoardUnit   targetUnit    = target as BoardUnit;
            Player      unitOwner     = targetUnit.OwnerPlayer;
            WorkingCard returningCard = targetUnit.Card;

            returningCard.InitialCost = returningCard.LibraryCard.Cost;
            returningCard.RealCost    = returningCard.InitialCost;

            Vector3 unitPosition = targetUnit.Transform.position;

            _vfxController.CreateVfx(_loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Skills/PushVFX"),
                                     targetUnit);

            _soundManager.PlaySound(Enumerators.SoundType.OVERLORD_ABILITIES, skill.Skill.Trim().ToLower(),
                                    Constants.OverlordAbilitySoundVolume, Enumerators.CardSoundType.NONE);

            _timerManager.AddTimer(
                x =>
            {
                // STEP 1 - REMOVE UNIT FROM BOARD
                unitOwner.BoardCards.Remove(targetUnit);

                // STEP 2 - DESTROY UNIT ON THE BOARD OR ANIMATE;
                targetUnit.Die(true);
                Object.Destroy(targetUnit.GameObject);

                // STEP 3 - REMOVE WORKING CARD FROM BOARD
                unitOwner.RemoveCardFromBoard(returningCard);

                // STEP 4 - RETURN CARD TO HAND
                _cardsController.ReturnToHandBoardUnit(returningCard, unitOwner, unitPosition);

                // STEP 4 - REARRANGE HANDS
                _gameplayManager.RearrangeHands();

                _actionsQueueController.PostGameActionReport(_actionsQueueController.FormatGameActionReport(
                                                                 Enumerators.ActionType.RETURN_TO_HAND_CARD_SKILL, new object[]
                {
                    owner, skill, targetUnit
                }));

                // _gameplayManager.GetController<RanksController>().UpdateRanksBuffs(unitOwner);
            },
                null,
                2f);
        }
        public void HealUnitBySkill(Player healingPlayer, HeroSkill skill, BoardUnit healedCreature)
        {
            if (healedCreature != null)
            {
                healedCreature.CurrentHp += skill.Value;
                if (healedCreature.CurrentHp > healedCreature.MaxCurrentHp)
                {
                    healedCreature.CurrentHp = healedCreature.MaxCurrentHp;
                }
            }

            _actionsQueueController.PostGameActionReport(_actionsQueueController.FormatGameActionReport(
                                                             Enumerators.ActionType.HEAL_CREATURE_BY_SKILL, new object[]
            {
                healingPlayer, skill, healedCreature
            }));
        }