public Attack(string name, int damage, pokeType type) { Name = name; Type = type; Damage = damage; switch (this.Type) { case pokeType.Feu: color = ConsoleColor.Red; break; case pokeType.Eau: color = ConsoleColor.Blue; break; case pokeType.Plante: color = ConsoleColor.Green; break; case pokeType.Ultime: color = ConsoleColor.Yellow; break; default: break; } }
// Fonction statique pour pouvoir l'utiliser sans instancier de Type // Elle calcule le coefficient des attaques Pokémon en fonction des types public static double retrieveCM(pokeType atckType, pokeType targetType) { double cm = 1; // On crée une liste qui associe à un type en particulier une liste de type contre // qui il est faible en cas d'attaque IDictionary <pokeType, pokeType[]> weakTypes = new Dictionary <pokeType, pokeType[]>() { { pokeType.Feu, new pokeType[] { pokeType.Eau, pokeType.Feu, pokeType.Ultime } }, { pokeType.Eau, new pokeType[] { pokeType.Plante, pokeType.Eau, pokeType.Ultime } }, { pokeType.Plante, new pokeType[] { pokeType.Feu, pokeType.Plante, pokeType.Ultime } }, { pokeType.Normal, new pokeType[] { pokeType.Normal, pokeType.Ultime } }, { pokeType.Ultime, new pokeType[] { pokeType.Ultime } } }; // On crée une liste qui associe à un type en particulier une liste de type contre // qui il est fort en cas d'attaque IDictionary <pokeType, pokeType[]> strongTypes = new Dictionary <pokeType, pokeType[]>() { { pokeType.Feu, new pokeType[] { pokeType.Plante, pokeType.Ultime } }, { pokeType.Eau, new pokeType[] { pokeType.Feu, pokeType.Ultime } }, { pokeType.Plante, new pokeType[] { pokeType.Eau, pokeType.Ultime } }, { pokeType.Normal, new pokeType[] { pokeType.Ultime } }, { pokeType.Ultime, new pokeType[] { pokeType.Normal, pokeType.Eau, pokeType.Feu, pokeType.Plante } } }; // On parcourt les listes associées au type de l'attaque pour calculer le // coefficient multiplicateur déclaré au préalable en tant que double foreach (pokeType wType in strongTypes[atckType]) { if (wType == targetType) { cm = 2; break; } } if (cm != 2) { foreach (pokeType sType in weakTypes[atckType]) { if (sType == targetType) { cm = 0.5; } } } return(cm); }
public override Attack[] getAttacks() { Attack[] a_Attacks = new Attack[2]; string[] AttackName = new string[2]; pokeType[] AttackType = new pokeType[] { pokeType.Normal, pokeType.Feu }; int attackValue; switch (s_evolve_state) { case 0: attackValue = 30; AttackName[0] = "Charge"; AttackName[1] = "Flammèche"; break; case 1: attackValue = 50; AttackName[0] = "Combo-griffe"; AttackName[1] = "Poing de feu"; break; case 2: attackValue = 70; AttackName[0] = "Tranche"; AttackName[1] = "Lance-flamme"; break; default: attackValue = 0; break; } for (int i = 0; i < a_Attacks.Length; i++) { a_Attacks[i] = new Attack(AttackName[i], attackValue, AttackType[i]); } return(a_Attacks); }
public override Attack[] getAttacks() { Attack[] a_Attacks = new Attack[2]; string[] AttackName = new string[2]; pokeType[] AttackType = new pokeType[] { pokeType.Normal, pokeType.Plante }; int attackValue; switch (s_evolve_state) { case 0: attackValue = 30; AttackName[0] = "Charge"; AttackName[1] = "Vol-vie"; break; case 1: attackValue = 50; AttackName[0] = "Vive-attaque"; AttackName[1] = "Tranch'herbe"; break; case 2: attackValue = 70; AttackName[0] = "Force"; AttackName[1] = "Danse-fleur"; break; default: attackValue = 0; break; } for (int i = 0; i < a_Attacks.Length; i++) { a_Attacks[i] = new Attack(AttackName[i], attackValue, AttackType[i]); } return(a_Attacks); }
public override Attack[] getAttacks() { Attack[] a_Attacks = new Attack[2]; string[] AttackName = new string[2]; pokeType[] AttackType = new pokeType[] { pokeType.Normal, pokeType.Eau }; int attackValue; switch (s_evolve_state) { case 0: attackValue = 30; AttackName[0] = "Charge"; AttackName[1] = "Pistolet a O"; break; case 1: attackValue = 50; AttackName[0] = "Ecras-face"; AttackName[1] = "Cascade"; break; case 2: attackValue = 70; AttackName[0] = "Plaquage"; AttackName[1] = "Surf"; break; default: attackValue = 0; break; } for (int i = 0; i < a_Attacks.Length; i++) { a_Attacks[i] = new Attack(AttackName[i], attackValue, AttackType[i]); } return(a_Attacks); }
public override Attack[] getAttacks() { Attack[] a_Attacks = new Attack[2]; string[] AttackName = new string[2]; AttackName[0] = "Damocles"; AttackName[1] = "Hydro-Canon"; pokeType[] AttackType = new pokeType[] { pokeType.Normal, pokeType.Eau }; int attackValue; switch (nb_Fight) { case 0: attackValue = 30; break; case 1: attackValue = 50; break; case 2: attackValue = 60; break; default: attackValue = 0; break; } for (int i = 0; i < a_Attacks.Length; i++) { a_Attacks[i] = new Attack(AttackName[i], attackValue, AttackType[i]); } return(a_Attacks); }