public static Card arqueiro() { Card card = new global::Card(13, "Arqueiro", "Personagem", 3, 2, 1, 1, 0); card.setRanged(true); return(card); }
public static Card covarde() { Card card = new global::Card(17, "Covarde", "Personagem", 3, 5, 5, 1, 0); card.onTriggerEffect = new TriggerEffects(1, 1); return(card); }
//throw a card //if no card return color and function equal to None public Card Card(){ if (game.nowCard.function == global::Card.CardFunction.free) { Debug.Log("free now"); int i=0; while(hands[i].function==global::Card.CardFunction.WildDrawFour) i++; Card Y = hands[i]; hands.RemoveAt(i); Debug.Log(Y.function); return Y; }if (game.nowCard.function == global::Card.CardFunction.DrawTwo & game.nextDraw != 0 ) { if (hands.Exists (x=>x.function == game.nowCard.function)) { int Z = hands.FindIndex (x=>x.function == game.nowCard.function); Card Tk2 = hands[Z]; hands.RemoveAt(Z); Debug.Log(Tk2.function); return Tk2; } else { Card T = new global::Card (); T.function = global::Card.CardFunction.None; T.color = global::Card.CardColor.None; return T; } } else { if(game.nowCard.function == global::Card.CardFunction.free & hands.Exists (x => x.color == game.nowCard.color)){ int Z = hands.FindIndex (x => x.color == game.nowCard.color||x.function==global::Card.CardFunction.Wild); Card Tk = hands[Z]; hands.RemoveAt(Z); return Tk; } else if (hands.Exists (x => x.color == game.nowCard.color||x.function == game.nowCard.function||x.function==global::Card.CardFunction.Wild)) { int Z = hands.FindIndex (x => x.color == game.nowCard.color||x.function == game.nowCard.function||x.function==global::Card.CardFunction.Wild); Card Tk = hands[Z]; hands.RemoveAt(Z); Debug.Log(Tk.function); return Tk; } else if(hands.Exists (x => x.function == global::Card.CardFunction.WildDrawFour)){ int Z = hands.FindIndex (x => x.function == global::Card.CardFunction.WildDrawFour); Card Tk = hands[Z]; hands.RemoveAt(Z); Debug.Log(Tk.function); return Tk; } else { Card T = new global::Card (); T.function = global::Card.CardFunction.None; T.color = global::Card.CardColor.None; return T; } } }
public static global::Card Create( string cardNumber_s, string pin_s1, DateTime expiryDate_dt, int cvc_i, global::CardType type_i1_, Account account_account ) { global::Card card = new global::Card (cardNumber_s, pin_s1, expiryDate_dt, cvc_i, type_i1_, account_account); return(card); // TODO: Edit factory method of Card // This method should be able to configure the object in all possible ways. // Add as many parameters as needed, // and assign their values to each field by using the API. }
public Card Card(){ if (buttons.Count == 0) { createButton (); hands.Sort((s1,s2)=> s1.CardID.CompareTo(s2.CardID)); } //selectCard (); if (cardSelected == 110) { deleteButton (); Card tempCard = new global::Card (); tempCard.color = global::Card.CardColor.None; tempCard.function = global::Card.CardFunction.None; return tempCard; } else if (cardSelected != 109) { if(hands[cardSelected].color==global::Card.CardColor.Black & hasColor == false){ hasColor = false; if (hasColorButton == false) { createColorButton (); hasColorButton = true; } Card newcard = new global::Card(); newcard.function = global::Card.CardFunction.zero; newcard.color = global::Card.CardColor.Black; return newcard; } else{ deleteButton (); Card tempCard = hands [cardSelected]; hands.RemoveAt(cardSelected); return tempCard ; } } else { Card newcard = new global::Card(); newcard.function = global::Card.CardFunction.zero; newcard.color = global::Card.CardColor.Black; //Debug.Log ("wait"); return newcard; } }
int _GetNextDraw(){return game.nextDraw;} //count of next draw Card _NoCard(){ //no card to card Card T = new global::Card (); T.function = global::Card.CardFunction.None; T.color = global::Card.CardColor.None; return T; }
} //pick a Card to Card float search(List<Card> sHands, Card sCard,int deep){ if (deep == 1) { float total = 0; int index = sHands.FindIndex (x => x.function == sCard.function & x.color == sCard.color); Card temp = sHands [index]; sHands.RemoveAt (index); recordDiscord (sCard); Card sNowcard = new global::Card (); float nocolorcount; if (sHands.Count == 0){ total = 100; } else{ for(int i=0;i<sHands.Count;i++){ recordDiscord(sHands[i]); } for (int i=0; i<4; i++) { nocolorcount = 0; for (int j=0; j<4; j++) { if (j == _GetNowPlayer () - Game.Player.player1) continue; if (player_no_color [j, i] == 1) nocolorcount++; } for (int j=0; j<15; j++) { sNowcard.color = global::Card.CardColor.Red + i; sNowcard.function = global::Card.CardFunction.zero + j; int x = (j == 0) ? 2 : 4; float ca = cal (sHands, sNowcard); if (x - dis_function_count [i, j] != 0) total += ca * ((float)(x - dis_function_count [i, j]) / (108 - (float)game.deckcount () - 1)) * (float)((3 - nocolorcount) / 3); //Debug.Log(ca+","+(float)(x - dis_function_count [i, j]) + "," + (float)((3 - nocolorcount) / 3)); //Debug.Log(ca+","+((float)(x-dis_function_count[i,j])/(108-(float)game.deckcount()-1))+","+(float)((3-nocolorcount)/3)+","+total); } } for(int i=0;i<sHands.Count;i++){ RerecordDiscord(sHands[i]); } } sHands.Insert (index, temp); RerecordDiscord (sCard); return total; } else { float total = 0; int index = sHands.FindIndex (x => x.function == sCard.function & x.color == sCard.color); Card temp = sHands [index]; sHands.RemoveAt (index); if (sHands.Count == 0){ sHands.Insert (index, temp); return 100; } recordDiscord (sCard); Card sNowcard = new global::Card (); float nocolorcount; for (int i=0; i<4; i++) { nocolorcount = 0; for (int j=0; j<4; j++) { if (j == _GetNowPlayer () - Game.Player.player1) continue; if (player_no_color [j, i] == 1) nocolorcount++; } for (int j=0; j<15; j++) { sNowcard.color = global::Card.CardColor.Red + i; sNowcard.function = global::Card.CardFunction.zero + j; int x = (j == 0) ? 2 : 4; if (x - dis_function_count [i, j] != 0) for(int z=0;z<sHands.Count;z++) total += search(sHands,sHands[z],deep-1) * ((float)(x - dis_function_count [i, j]) / (108 - (float)game.deckcount () - 1)) * (float)((3 - nocolorcount) / 3); //Debug.Log(ca+","+(float)(x - dis_function_count [i, j]) + "," + (float)((3 - nocolorcount) / 3)); //Debug.Log(ca+","+((float)(x-dis_function_count[i,j])/(108-(float)game.deckcount()-1))+","+(float)((3-nocolorcount)/3)+","+total); } } sHands.Insert (index, temp); RerecordDiscord (sCard); return total; } }
} //pick a Card to Card float search(List<Card> sHands, Card sCard){ float total = 0; int index = sHands.FindIndex(x=>x.function ==sCard.function & x.color == sCard.color); Card temp = sHands [index]; sHands.RemoveAt(index); reduceColorCount(sCard); Card sNowcard = new global::Card (); float nocolorcount; for (int i=0; i<4; i++) { nocolorcount =0; for(int j=0;j<4;j++){ if(j==_GetNowPlayer()-Game.Player.player1) continue; if(player_no_color[j,i] == 1) nocolorcount++; } for(int j=0;j<15;j++){ sNowcard.color = global::Card.CardColor.Red + i ; sNowcard.function = global::Card.CardFunction.zero + j ; int x = (j==0)?2:4; float ca = cal (sHands, sNowcard); if(x-dis_function_count[i,j]!=0) total += ca*((float)(x-dis_function_count[i,j])/(108-(float)game.deckcount()-1))*(float)((3-nocolorcount)/3); //Debug.Log(ca+","+((float)(x-dis_function_count[i,j])/(108-(float)game.deckcount()-1))+","+(float)((3-nocolorcount)/3)+","+total); } } /* sNowcard.color = global::Card.CardColor.Red; total += cal (sHands, sNowcard)*((25-(float)dis_color_count_red)/(108-(float)game.deckcount()-1)); //Debug.Log(((25-(float)dis_color_count_red)/(108-(float)game.deckcount()-1))); Debug.Log("total =" + total); sNowcard.color = global::Card.CardColor.Blue; for (int i=0; i<15; i++) { sNowcard.function = global::Card.CardFunction.zero+i; } total += cal (sHands, sNowcard)*((25-(float)dis_color_count_blue)/(108-(float)game.deckcount()-1)); Debug.Log("total =" + total); sNowcard.color = global::Card.CardColor.Green; total += cal (sHands, sNowcard)*((25-(float)dis_color_count_green)/(108-(float)game.deckcount()-1)); Debug.Log("total =" + total); sNowcard.color = global::Card.CardColor.Yellow; total += cal (sHands, sNowcard)*((25-(float)dis_color_count_yellow)/(108-(float)game.deckcount()-1)); Debug.Log("total =" + total);*/ sHands.Insert (index, temp); increaseColorCount (sCard); return total; }