// Ajout de l'experience et modification relié public string add_xp(int xp_add, Aventure parti) { if (niveauExp < 5) //Si le pokémon n'a pas atteint le level maximal { int reference = parti.joueur.trouver_monstre_listeCapture(this); //------> permet de trouver l'index du pokémon qui recoit l'xp this.pointExp = this.pointExp + xp_add; parti.joueur.monstreCapture[reference].pointExp = this.pointExp; int x = this.pointExp; if (x == 150 || x == 250 || x == 400 || x == 600) // Si le pokémon a assez XP pour passer au level 2, 3, 4 ou 5 { this.niveauExp++; this.calcul_caract(); parti.joueur.monstreCapture[reference].calcul_caract();// Calculation des nouvelles caractéristiques // Ajout d'une habilete Habilete[] liste_possible = Habilete.Charger_Liste_Habilete_Element(typeMonstre); // Assigner l'habileter listeHabilete[niveauExp - 1] = liste_possible[niveauExp - 1]; return("\n" + nomMonstre + " a passé au level " + niveauExp + " et \na appris l'habilete " + liste_possible[niveauExp - 1].nom); } return("\nAjout de " + xp_add + " point d'exp. !"); } else { return("\n" + nomMonstre + " est déja au level maximum !"); } }
//------------------------------------------------------------------------------- //############################################################################### //# Panel Nouveau Joueur # //############################################################################### // Fait une vérification des entrés de l'utilisateur durant la création du joueur et créer une nouvelle aventure et ouvre une fenetre Map private void button_creer_Click(object sender, RoutedEventArgs e) { // Exception sur input try { if (string.IsNullOrWhiteSpace(textBox_nickname.Text)) { throw new Exception("Veuillez entrer un nom de joueur !"); } if (string.IsNullOrWhiteSpace(textBox_nickname.Text)) { throw new Exception("Veuillez entrer un surnom de pokémon !"); } if (inconnu.equipe[0] == null) { throw new NoPokemonException(); } } catch (Exception lol) { textBox_newName.SelectAll(); MessageBox.Show(lol.Message); return; } Aventure nouveau = creer_aventure(); Map newMap = new Map(nouveau); newMap.Show(); this.Close(); }
public Combat(Aventure parti, TypeElement element) { InitializeComponent(); fenetre_difficulty.Visibility = System.Windows.Visibility.Visible; this.parti = parti; this.element = element; selectionne = parti.joueur.equipe[0]; init_interface(); }
// Fonction utilisé dans la fonction ci-dessus pour créer l'aventure en tant que tel public Aventure creer_aventure() { //Nom inconnu.nomJoueur = textBox_newName.Text; //Sexe if (radioButton_homme.IsChecked == true) { inconnu.sexe = Sexe.homme; } else { inconnu.sexe = Sexe.homme; } // Nickname du Monstre inconnu.equipe[0].aliasMonstre = textBox_nickname.Text; Aventure nouvelle = new Aventure(inconnu); return(nouvelle); }
//############################################################################### //# Panel Charger # //############################################################################### // Chargement d'une partie private void button_enregistrer_Click(object sender, RoutedEventArgs e) { // Exception sur input try { if (textBox_enregistrement.Text == "") { throw new Exception("Veuillez entrer un nom d'aventure !"); } } catch (Exception lol) { textBox_newName.SelectAll(); MessageBox.Show(lol.Message); return; } string aventure = textBox_enregistrement.Text; // Exception sur le chargement de l'aventure Aventure chargement; try { chargement = Aventure.Charger_Aventure(aventure); } catch (Exception lol) { MessageBox.Show(lol.Message + "\nVeuillez entrer un nom d'aventure valide !"); return; } Map newMap = new Map(chargement); newMap.Show(); this.Close(); }
public Shop(Aventure parti) { InitializeComponent(); textBox_argent.Text = parti.joueur.argent.ToString(); this.parti = parti; }
public Map(Aventure aventure) { InitializeComponent(); parti = aventure; }