private IEnumerator ActivateEffects(string activation) { if (fighter1Properties.action == "Block") { fighter1Properties.parry += 2; } if (fighter2Properties.action == "Block") { fighter2Properties.parry += 2; } //set the pointers to fighter 1 and 2 _cardEffects.player = fighter1; _cardEffects.opponent = fighter2; for (int i = 0; i < fighter1Properties.numberOfCards; i++) { //if the current card is supposed to activate now and is not nullified and has a nullification effect if (fighter1Properties.cardsInPlay[i].activation == activation && !fighter1Properties.nullifiedCards[i] && fighter1Properties.cardsInPlay[i].priority == 1) { //set the current card position _cardEffects.currentCardPosition = i; //play the animanition if needed if (fighter1Properties.cardsInPlay[i].effect[0]()) { Transform cardslot = fighter1.Find("Cardslot" + i.ToString()); cardslot.GetComponent <Animator>().Play("EffectActivated"); yield return(new WaitForSeconds(0.5f)); } } } //set the pointers to fighter 2 and 1 _cardEffects.player = fighter2; _cardEffects.opponent = fighter1; for (int i = 0; i < fighter2Properties.numberOfCards; i++) { //if the current card is supposed to activate now and is not nullified and has a nullification effect if (fighter2Properties.cardsInPlay[i].activation == activation && !fighter2Properties.nullifiedCards[i] && fighter2Properties.cardsInPlay[i].priority == 1) { //set the current card position _cardEffects.currentCardPosition = i; //play the animanition if needed if (fighter2Properties.cardsInPlay[i].effect[0]()) { Transform cardslot = fighter2.Find("Cardslot" + i.ToString()); cardslot.GetComponent <Animator>().Play("EffectActivated"); yield return(new WaitForSeconds(0.5f)); } } } //start the nullification _cardEffects.StartNullify(fighter1); _cardEffects.StartNullify(fighter2); //set the pointers to fighter 1 and 2 _cardEffects.player = fighter1; _cardEffects.opponent = fighter2; for (int i = 0; i < fighter1Properties.numberOfCards; i++) { //if the current card is supposed to activate now and is not nullified and has normal priority if (fighter1Properties.cardsInPlay[i].activation == activation && !fighter1Properties.nullifiedCards[i] && fighter1Properties.cardsInPlay[i].priority == 0) { //set the current card position _cardEffects.currentCardPosition = i; //play the animanition if needed if (fighter1Properties.cardsInPlay[i].effect[0]()) { Transform cardslot = fighter1.Find("Cardslot" + i.ToString()); cardslot.GetComponent <Animator>().Play("EffectActivated"); yield return(new WaitForSeconds(0.5f)); } } } //set the pointers to fighter 2 and 1 _cardEffects.player = fighter2; _cardEffects.opponent = fighter1; for (int i = 0; i < fighter2Properties.numberOfCards; i++) { //if the current card is supposed to activate now and is not nullified and has normal priority if (fighter2Properties.cardsInPlay[i].activation == activation && !fighter2Properties.nullifiedCards[i] && fighter2Properties.cardsInPlay[i].priority == 0) { //set the current card position _cardEffects.currentCardPosition = i; //play the animanition if needed if (fighter2Properties.cardsInPlay[i].effect[0]()) { Transform cardslot = fighter2.Find("Cardslot" + i.ToString()); cardslot.GetComponent <Animator>().Play("EffectActivated"); yield return(new WaitForSeconds(0.5f)); } } } if (_cardEffects.ApplyDamageModifier(fighter1) | _cardEffects.ApplyDamageModifier(fighter2)) { yield return(new WaitForSeconds(0.5f)); } //discard in the after phase if player striked if (activation == "After") { if (fighter1.GetComponent <Properties>().action == "Strike") { _cardEffects.Discard(fighter1, 0, 4); } if (fighter2.GetComponent <Properties>().action == "Strike") { _cardEffects.Discard(fighter2, 0, 4); } } //activate discard effects if (_cardEffects.StartDiscarding(fighter1) | _cardEffects.StartDiscarding(fighter2)) { yield return(new WaitForSeconds(0.25f)); } //check for mutation if (_cardEffects.JinMutation(fighter1) | _cardEffects.JinMutation(fighter2)) { yield return(new WaitForSeconds(0.5f)); } //draw cards if (activation == "Pre") { foreach (string card in fighter1Properties.cardsToDrawPreFight) { _cardEffects.DrawCardById(fighter1, card); } foreach (string card in fighter2Properties.cardsToDrawPreFight) { _cardEffects.DrawCardById(fighter2, card); } PreFight(); } else { foreach (string card in fighter1Properties.cardsToDrawAfterFight) { _cardEffects.DrawCardById(fighter1, card); } foreach (string card in fighter2Properties.cardsToDrawAfterFight) { _cardEffects.DrawCardById(fighter2, card); } AfterFight(); } }