private void GenerateCard() { // Empty list // Add 2 random attack cards to list // Add 1/2 counter card to list // Add healing or no action card to list _generatedCardList[0] = new AttackCard(id); _generatedCardList[1] = new AttackCard(id); _generatedCardList[2] = new CounterCard(id); if (Utilities.IsLessThanPercentage(COUNTER_CHANCE)) { _generatedCardList[3] = new CounterCard(id); } else { _generatedCardList[3] = new NoActionCard(id); } if (Utilities.IsLessThanPercentage(HEALING_CHANCE)) { _generatedCardList[4] = new HealCard(id); } else { _generatedCardList[4] = new NoActionCard(id); } }
public Sprite counterBallSprite; //行动点球 public CounterCard(CounterCard card) { counterCardNo = card.counterCardNo; CardName = card.CardName; CardIntroduction = card.CardIntroduction; CardEffect = card.CardEffect; counterAttribute = card.counterAttribute; ActionPoint = card.ActionPoint; counterSprite = card.counterSprite; counterBallSprite = card.counterBallSprite; }
//改变卡的反击面 public void counterAssignment(GameObject card1, CounterCard card2) { card1.GetComponent <CardManager>().counterCard.counterCardNo = card2.counterCardNo; card1.GetComponent <CardManager>().counterCard.CardName = card2.CardName; card1.GetComponent <CardManager>().counterCard.CardIntroduction = card2.CardIntroduction; card1.GetComponent <CardManager>().counterCard.CardEffect = card2.CardEffect; card1.GetComponent <CardManager>().counterCard.counterAttribute = card2.counterAttribute; card1.GetComponent <CardManager>().counterCard.ActionPoint = card2.ActionPoint; card1.GetComponent <CardManager>().counterCard.counterSprite = card2.counterSprite; card1.GetComponent <CardManager>().counterCard.counterBallSprite = card2.counterBallSprite; }
public void ActionEffect(AttackCard aCard, CounterCard cCard, bool isMyAction) { print(aCard.CardName + " " + cCard.CardName); int damage = aCard.Damage; //伤害 int backDamage = 0; //反击伤害 Attribute backAttribute = Attribute.Physical; //反击伤害类型 PlayerManager user; //进攻方 PlayerManager opposite; //反击方 Transform userHead; //进攻方动画播放位置 Transform oppositeHead; //反击方动画播放位置 float r_miss = 0; //闪避值,超过500闪避成功 if (isMyAction) { user = myPlayer; opposite = enemyPlayer; userHead = myHeadPosition; oppositeHead = enemyHeadPosition; } else { user = enemyPlayer; opposite = myPlayer; userHead = enemyHeadPosition; oppositeHead = myHeadPosition; } //反击牌效果 switch (cCard.counterCardNo) { case 5: //暗器 backDamage = 1; break; case 6: //幸运牌 if (isMyAction) { enemyHCurved.HCNumChange(2); } else { cardCurved.GetCards(); cardCurved.GetCards(); cardCurved.AddCardAnimations(); } break; case 7: //停战号令 roundManager.AbandonmentRoundStart(); break; case 8: //气流吸纳 opposite.saveAp++; break; } //进攻牌效果 switch (aCard.attackCardNo) { case 4: //魔力引爆 opposite.burnDamage += 2; break; case 5: //恢复魔法 user.HpChange(3, 0); break; case 7: //正义审判 if (user.HP > opposite.HP) { damage++; } break; case 8: //结晶风暴 opposite.saveAp--; break; case 9: //黑炎仪式 user.darkfire = true; break; } //黑炎Buff生效 if (user.darkfire) { damage *= 2; if (aCard.attackCardNo != 9) { user.darkfire = false; } } //反击牌改变伤害效果 switch (cCard.counterCardNo) { case 1: //钢盾 if (aCard.damageAttribute == Attribute.Physical) { damage = 1; } break; case 2: //图纹盾 damage -= 1; break; case 3: //闪避 r_miss = Random.Range(0, 1000f); if (r_miss > 500) { damage = 0; } break; case 4: //魔法反射 if (aCard.damageAttribute == Attribute.Magic) { backDamage = damage; backAttribute = Attribute.Magic; damage = 0; } break; } if (r_miss > 500) { //闪避 ShowEffect(effect_C[2], userHead); } else { //没有闪避,播放进攻牌动画 switch (aCard.attackCardNo) { case 1: float r_color = Random.Range(0, 1000f); if (r_color < 200) { ShowEffect(effect_A[0], oppositeHead); } else if (r_color < 400) { ShowEffect(effect_A[1], oppositeHead); } else if (r_color < 600) { ShowEffect(effect_A[2], oppositeHead); } else if (r_color < 800) { ShowEffect(effect_A[3], oppositeHead); } else { ShowEffect(effect_A[4], oppositeHead); } break; case 2: ShowEffect(effect_A[5], oppositeHead); break; case 3: ShowEffect(effect_A[6], oppositeHead); break; case 4: ShowEffect(effect_A[7], oppositeHead); break; case 5: ShowEffect(effect_A[9], userHead); break; case 6: ShowEffect(effect_A[10], oppositeHead); break; case 7: ShowEffect(effect_A[11], oppositeHead); break; case 8: ShowEffect(effect_A[12], oppositeHead); break; case 9: ShowEffect(effect_A[13], userHead); break; case 10: ShowEffect(effect_A[14], oppositeHead); break; } attackJustOver = true; effect_cCard = cCard.counterCardNo; effect_isMyAction = isMyAction; } user.HpChange(-backDamage, 2); opposite.HpChange(-damage, 2); }