private void CardWasInBattle(ServerActions.CardChanges cardChanges, bool isAttacker) { var cardTransform = cardIdToCards[cardChanges.id]; CardDisplay cardDisplay = cardTransform.GetComponent <CardDisplay>(); this.ApplyChangesToCard(cardChanges); if (isAttacker) { Unibus.Dispatch(CardManager.CARD_ATTACKED, cardDisplay); } }
private void ApplyChangesToCard(ServerActions.CardChanges cardChanges) { var cardTransform = cardIdToCards[cardChanges.id]; CardDisplay cardDisplay = cardTransform.GetComponent <CardDisplay>(); if (cardChanges.isTapped) { cardDisplay.Tap(); } // Это не баг, что сразу и тап и антап. Потому что в дальнейшем должна быть анимация тапа, а потом антапа. if (cardChanges.isUntapped) { cardDisplay.Untap(); } if (cardChanges.newHp != null && cardChanges.hpAuraBuffChange != null) { cardDisplay.ChangeHpByHPAura((int)cardChanges.newHp, (int)cardChanges.hpAuraBuffChange); } else if (cardChanges.newHp != null) { cardDisplay.CurrentHp = (int)cardChanges.newHp; } if (cardChanges.damage != null) { cardDisplay.Damage = (int)cardChanges.damage; } if (cardChanges.killed) { this.KillUnit(cardDisplay); } if (cardChanges.currentMovingPoints != null) { cardDisplay.CurrentMovingPoints = (int)cardChanges.currentMovingPoints; } if (cardChanges.pushedTo != null) { boardCreator.PushUnit(cardDisplay, cardChanges.pushedTo); } if (cardChanges.usedInThisTurnBlockAbility != null) { cardDisplay.UsedInThisTurnBlockAbility = (bool)cardChanges.usedInThisTurnBlockAbility; } if (cardChanges.usedInThisTurnEvasionAbility != null) { cardDisplay.UsedInThisTurnEvasionAbility = (bool)cardChanges.usedInThisTurnEvasionAbility; } if (cardChanges.isPoisoned != null) { if ((bool)cardChanges.isPoisoned) { cardDisplay.PoisonedDamage = (int)cardChanges.poisonDamage; } else { cardDisplay.PoisonedDamage = 0; } } if (cardChanges.isDamageCursed != null) { if ((bool)cardChanges.isDamageCursed) { cardDisplay.DamageCursedDamage = (int)cardChanges.damageCursedDamageReduction; } else { cardDisplay.DamageCursedDamage = 0; } } if (cardChanges.blockedRangeAbilityInBeginningOfTurn != null) { cardTransform.GetComponent <CardDisplay>().BlockedInBeginningOfTurn = (bool)cardChanges.blockedRangeAbilityInBeginningOfTurn; } if (cardChanges.numberOfAiming != null) { cardTransform.GetComponent <CardDisplay>().NumberOfAiming = (int)cardChanges.numberOfAiming; } }