/*void GiveNewCards() * { * * * }*/ public void CardsFight(CardControllerScript attacker, CardControllerScript defender) { attacker.OnDamageDeal(); defender.OnTakeDamage(); attacker.OnTakeDamage(); defender.thisCard.GetDamage(attacker.thisCard.attack); attacker.thisCard.GetDamage(defender.thisCard.attack); defender.CheckForAlive(); attacker.CheckForAlive(); }
public void UseSpell(CardControllerScript target) { var spellCard = (SpellCard)thisCard; switch (spellCard.spell) { case SpellCard.SpellType.ADD_PROVOCATION: //добавление провокиции if (!target.thisCard.isProvocation) { target.thisCard.abilities.Add(Card.AbilityType.PROVOCATION); target.ability.provocation.SetActive(true); } break; case SpellCard.SpellType.DAMAGE_CARD: //урон одной карте GiveDamageTo(target, spellCard.spellValue); break; case SpellCard.SpellType.DAMAGE_CARDS: //урон всем картам соперника var enemyCards = isPlayerCard ? new List <CardControllerScript>(gameManager.enemyFieldCards): new List <CardControllerScript>(gameManager.playerFieldCards); foreach (var card in enemyCards) { GiveDamageTo(card, spellCard.spellValue); } break; case SpellCard.SpellType.DAMAGE_HERO: //урон герою if (isPlayerCard) { gameManager.enemyHP -= spellCard.spellValue; } else { gameManager.playerHP -= spellCard.spellValue; } gameManager.ShowHP(); gameManager.CheckForResult(); break; case SpellCard.SpellType.DESTROY_CARD: //уничтожение карты GiveDamageTo(target, target.thisCard.helth); break; case SpellCard.SpellType.HEAL_CARD: //хилл одной карты target.thisCard.helth += spellCard.spellValue; break; case SpellCard.SpellType.HEAL_CARDS: //хилл всех своих карт var allyCards = isPlayerCard ? gameManager.playerFieldCards : gameManager.enemyFieldCards; foreach (var card in allyCards) { card.thisCard.helth += spellCard.spellValue; card.info.RefreshData(); } break; case SpellCard.SpellType.HEAL_HERO: //хилл героя if (isPlayerCard) { gameManager.playerHP += spellCard.spellValue; } else { gameManager.enemyHP += spellCard.spellValue; } gameManager.ShowHP(); break; } if (target != null) { target.ability.OnCast(); target.CheckForAlive(); } DestroyCard(); }
void GiveDamageTo(CardControllerScript card, int damage) { card.thisCard.GetDamage(damage); card.CheckForAlive(); card.OnTakeDamage(); }