public void InitialisteurDeVieMechant(int nb, int Numennemi) { switch (Numennemi) { case 1: //initialisateur de vie mechant + graphique m_VieMechant = ((cMonstre)TabMonstre[nb]).m_Vie; pbMechant.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant.Step = m_VieMechant; BarreVieMechant.Maximum = m_VieMechant; BarreVieMechant.PerformStep(); LbVieMechant.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); LbMechant.Text = ((cMonstre)TabMonstre[nb]).m_nom; break; case 2: m_VieMechant2 = ((cMonstre)TabMonstre[nb]).m_Vie; pbNextEnnemi.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant2.Step = m_VieMechant; BarreVieMechant2.Maximum = m_VieMechant; BarreVieMechant2.PerformStep(); lbViemechant2.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); lbNextEnnemi.Text = ((cMonstre)TabMonstre[nb]).m_nom + " (mini)"; break; case 3: m_VieMechant3 = ((cMonstre)TabMonstre[nb]).m_Vie; pbMiniBoss3.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant3.Step = m_VieMechant; BarreVieMechant3.Maximum = m_VieMechant; BarreVieMechant3.PerformStep(); lbVieMechant3.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); lbMiniboss3.Text = ((cMonstre)TabMonstre[nb]).m_nom + " (mini)"; break; } }
public void InitialisteurDeVieMechant(int nb, int Monstre1ou2) { if (Monstre1ou2 == 1) { //initialisateur de vie mechant m_VieMechant = ((cMonstre)TabMonstre[nb]).m_Vie; pbMechant.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant.Step = m_VieMechant; BarreVieMechant.Maximum = m_VieMechant; BarreVieMechant.PerformStep(); lbVieMechant.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); lbMechant.Text = ((cMonstre)TabMonstre[nb]).m_nom; } else { //initialisateur de vie mechant2 m_VieMechant2 = ((cMonstre)TabMonstre[nb]).m_Vie; pbMechant2.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant2.Step = m_VieMechant2; BarreVieMechant2.Maximum = m_VieMechant2; BarreVieMechant2.PerformStep(); lbVieMechant2.Text = m_VieMechant2.ToString() + "/" + m_VieMechant2.ToString(); lbMechant2.Text = ((cMonstre)TabMonstre[nb]).m_nom; } }
public void InitialisteurDeVieMechant(int nb) { //initialisateur de vie mechant m_VieMechant = ((cMonstre)TabMonstre[nb]).m_Vie; BarreVieMechant.Step = m_VieMechant; BarreVieMechant.Maximum = m_VieMechant; BarreVieMechant.PerformStep(); LbVieMechant.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); LbMechant.Text = ((cMonstre)TabMonstre[nb]).m_nom; }
public void InitialisteurDeVieMechant(int nb, int Monstre1ou2ou3) { //+graphique dans pbImageMonstre switch (Monstre1ou2ou3) { case 1: #region initialisateur de vie mechant m_VieMechant = ((cMonstre)TabMonstre[nb]).m_Vie; pbMechant.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant.Step = m_VieMechant; BarreVieMechant.Maximum = m_VieMechant; BarreVieMechant.PerformStep(); lbVieMechant.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); lbMechant.Text = ((cMonstre)TabMonstre[nb]).m_nom; #endregion break; case 2: #region initialisateur de vie mechant2 m_VieMechant2 = ((cMonstre)TabMonstre[nb]).m_Vie; pbMechant2.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant2.Step = m_VieMechant2; BarreVieMechant2.Maximum = m_VieMechant2; BarreVieMechant2.PerformStep(); lbVieMechant2.Text = m_VieMechant2.ToString() + "/" + m_VieMechant2.ToString(); lbMechant2.Text = ((cMonstre)TabMonstre[nb]).m_nom; #endregion break; case 3: #region initialisateur de vie mechant3 m_VieMechant3 = ((cMonstre)TabMonstre[nb]).m_Vie; pbMechant3.Image = ((cMonstre)TabMonstre[nb]).m_ImageMonstre; BarreVieMechant3.Step = m_VieMechant3; BarreVieMechant3.Maximum = m_VieMechant3; BarreVieMechant3.PerformStep(); lbVieMechant3.Text = m_VieMechant3.ToString() + "/" + m_VieMechant3.ToString(); lbMechant3.Text = ((cMonstre)TabMonstre[nb]).m_nom; #endregion break; } }
public int ChoisirHasardMechant() { //choix au hasard du monstre int nb = 0; Random r = new Random(); nb = r.Next(0, 4); //Affichement dun monstre different obligatoire if (nb == m_Nbchoisideja) { while (nb == m_Nbchoisideja) { nb = r.Next(0, 4); } } m_Nbchoisideja = nb; switch (nb) { case 0: pbMechant.Image = global::Jeu.Properties.Resources.Mechant1; break; case 1: pbMechant.Image = global::Jeu.Properties.Resources.Mechant2; break; case 2: pbMechant.Image = global::Jeu.Properties.Resources.Mechant3; break; case 3: pbMechant.Image = global::Jeu.Properties.Resources.Mechant4; break; } //initialisateur de vie mechant m_VieMechant = ((cMonstre)TabMonstre[nb]).m_Vie; BarreVieMechant.Step = m_VieMechant; BarreVieMechant.Maximum = m_VieMechant; BarreVieMechant.PerformStep(); LbVieMechant.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); LbMechant.Text = ((cMonstre)TabMonstre[nb]).m_nom; return(nb); }
private void btnAttack_Click(object sender, EventArgs e) { //Action aleatoire mechant #region Action Choisi 2 monstre if (!MechantMort) { NumAction = ActionMechatHasard(); } else { NumAction = -1; } if (!MechantMort2) { NumActionMechant2 = ActionMechatHasard(); } else { NumActionMechant2 = -1; } #endregion //texte selon choix de ladversaire #region texte Thread.Sleep(800); #region Mechant1 if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else if (NumAction == 1) { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Cyan; lbActionMechant.Visible = true; } #endregion #region Mechant2 if (NumActionMechant2 == 0) { lbActionMechant2.Text = "Attack"; lbActionMechant2.ForeColor = Color.Red; lbActionMechant2.Visible = true; } else if (NumActionMechant2 == 1) { lbActionMechant2.Text = "Defense"; lbActionMechant2.ForeColor = Color.Cyan; lbActionMechant2.Visible = true; } Thread.Sleep(1000); #endregion #endregion //Selon lactionchoisi #region Point dattack et de defense 2 monstre if (!MechantMort) { ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; } if (!MechantMort2) { ActionAttackmechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Domm; ActionDefensemechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Protection; } #endregion //selon larme choisi du perso Attack = ((cArme)TabArmes[choixArme]).DommageMax; //Calcul ds letat de vie (mechant) #region Calcul etat de vie mechant if (!MechantMort) { #region Monstre 1 if (m_MonstreaAttaquer == 1) { BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; Thread.Sleep(500); } #endregion } if (!MechantMort2) { #region Monstre 2 if (m_MonstreaAttaquer == 2) { BarreVieMechant2.Step = -Attack + ActionDefensemechant2; m_VieMechant2 += BarreVieMechant2.Step; Thread.Sleep(500); } #endregion } #endregion //changement graphique apres attack contre mechant #region changementGraphMechant #region Monstre 1 if (m_MonstreaAttaquer == 1) { BarreVieMechant.PerformStep(); lbDomMechant.Text = BarreVieMechant.Step.ToString(); } #endregion #region Monstre 2 else { BarreVieMechant2.PerformStep(); lbDomMechant2.Text = BarreVieMechant2.Step.ToString(); } #endregion //texte vie mechant lbVieMechant.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); lbVieMechant2.Text = m_VieMechant2 + "/" + m_monstreChoisi2.m_Vie.ToString(); #endregion //Si la vie du montre tombe a zero(et celle du boss) #region SI Monstre 0 HP + desactivation de lattack pour continuer string cs = ""; #region si Monstre 1 battu (boss inclus dedans) if (m_VieMechant <= 0 && MechantMort == false) { MechantMort = true; #region Mise a zero du monstre 1 m_VieMechant = 0; lbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; lbActionMechant.Text = ""; pbMechant.Enabled = false; lbMechant.Enabled = false; pbMechant.Image = null; #endregion #region passe a lennemi 2 if (!MechantMort2) { pbMechant2_Click(sender, e); } #endregion m_Argent += m_monstreChoisi.m_ArgentRecu; //AFFICHAGE DE Largent ACQUISE #region si Boss Vaincu if (m_NbrestantMonstreBoss == 0) //SI BOSS VAINCU { PLanete3Permise = true; cs = String.Format("VOUS AVEZ VAINCU LE BOSS alias ({0}) \n \n {1}\n\n ARGENT RECU {2}", m_monstreChoisi.m_nom, m_persoChoisi.nom, m_monstreChoisi.m_ArgentRecu); this.Close(); } #endregion else { cs = String.Format("{0}\n\n ARGENT RECU {1}", m_persoChoisi.nom, m_monstreChoisi.m_ArgentRecu); MessageBox.Show(cs); } } #endregion #region si Monstre 2 battu if (m_VieMechant2 <= 0 && MechantMort2 == false) { MechantMort2 = true; #region mise a zero du monstre 2 pbMechant2.Enabled = false; pbMechant2.Image = null; lbMechant2.Enabled = false; m_VieMechant2 = 0; lbVieMechant2.Text = m_VieMechant2 + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre2]).m_Vie.ToString(); lbDomMechant2.Text = "0"; lbActionMechant2.Text = ""; #endregion #region passe a l'ennemi 1 if (!MechantMort) { pbMechant_Click(sender, e); } #endregion m_Argent += m_monstreChoisi2.m_ArgentRecu; //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}", m_persoChoisi.nom, m_monstreChoisi2.m_ArgentRecu); MessageBox.Show(cs); } #endregion lbArgent.Text = m_Argent.ToString(); #region Si les 2 monstres sont battus if (m_VieMechant <= 0 && m_VieMechant2 <= 0) { //desactivation du bouton dattack btnAttack.Enabled = false; btnContinue.Enabled = true; return; } #endregion #endregion //calcul de vie perso (attack des 2 monstre) if (MechantMort == true) { ActionAttackmechant = 0; } if (MechantMort2 == true) { ActionAttackmechant2 = 0; } BarreVie.Step = -(ActionAttackmechant + ActionAttackmechant2); m_ViePerso += BarreVie.Step; //Si la vie du perso tombe a zero #region SI Perso 0 HP+desactivation de lattack if (m_ViePerso <= 0) { m_ViePerso = 0; lbViePerso.Text = m_ViePerso + "/" + m_persoChoisi.Vie.ToString(); lbDomPerso.Text = "0"; BarreVie.Step = -400; BarreVie.PerformStep(); //AFFICHAGE Du MESSAGE DE LA MORT cs = ""; cs = String.Format("{0}\n\n VOUS ETES MORT ", m_persoChoisi.nom); this.Close(); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } #endregion //Changement graphique vie perso #region changementGraphPerso BarreVie.PerformStep(); if (ActionAttackmechant == 0 && ActionAttackmechant2 == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = BarreVie.Step.ToString(); } lbViePerso.Text = m_ViePerso + "/" + m_persoChoisi.Vie.ToString(); #endregion }
private void btnAttack_Click(object sender, EventArgs e) { //decrementation variable Soin #region Rune de soin - Utilisation Soin--; if (!SoinActif) { lbSoin.Visible = false; lbSoin.Enabled = false; } if (Soin <= 0) { btnSoin.Enabled = true; } #endregion //Action aleatoire mechant si NON PARALYSÉ #region Action Choisi par les 3 monstre #region si monstre 1 est pas paralysée et pas mort if (!MechantMort && !MonstreParalysé) { NumAction = ActionMechatHasard(); } else { NumAction = -1; } #endregion if (BossActivate) { #region si monstre 2 est pas paralysé et pas mort if (!MechantMort2) { NumActionMechant2 = ActionMechatHasard(); } else { NumActionMechant2 = -1; } #endregion #region si monstre 3 est pas paralysé et pas mort if (!MechantMort3) { NumActionMechant3 = ActionMechatHasard(); } else { NumActionMechant3 = -1; } #endregion } #endregion #region Point dattack et de defense 3 monstre #region Monstre 1 if (!MechantMort && !MonstreParalysé) { ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; } #endregion if (BossActivate) { #region Monstre 2 if (!MechantMort2) { ActionAttackmechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Domm; ActionDefensemechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Protection; } #endregion #region Monstre 3 if (!MechantMort3) { ActionAttackmechant3 = ((cActionMechant)TabActionsMechant3[NumActionMechant3]).Domm; ActionDefensemechant3 = ((cActionMechant)TabActionsMechant3[NumActionMechant3]).Protection; } #endregion } #endregion //Texte selon Lattaque du monstre #region texte Thread.Sleep(500); #region Mechant1 if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else if (NumAction == 1) { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Cyan; lbActionMechant.Visible = true; } #endregion if (BossActivate) { #region Mechant2 if (NumActionMechant2 == 0) { lbActionMechant2.Text = "Attack"; lbActionMechant2.ForeColor = Color.Red; lbActionMechant2.Visible = true; } else if (NumActionMechant2 == 1) { lbActionMechant2.Text = "Defense"; lbActionMechant2.ForeColor = Color.Cyan; lbActionMechant2.Visible = true; } #endregion #region Mechant3 if (NumActionMechant3 == 0) { lbActionMechant3.Text = "Attack"; lbActionMechant3.ForeColor = Color.Red; lbActionMechant3.Visible = true; } else if (NumActionMechant3 == 1) { lbActionMechant3.Text = "Defense"; lbActionMechant3.ForeColor = Color.Cyan; lbActionMechant3.Visible = true; } #endregion } #endregion //selon larme choisi #region Attack du joueur si nest pas en mode Soin if (!SoinActif) { Attack = (cArme.Tabarme[ArmeChoisi]).DommageMax; } else { Attack = 0; } #endregion //Calcul ds letat de vie (mechant) #region Calcul etat de vie mechant if (!MechantMort) { #region Monstre 1 if (m_MonstreaAttaquer == 1) { if (!SoinActif) { BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; } else { BarreVieMechant.Step = 0; } } #endregion } if (BossActivate) { if (!MechantMort2) { #region Monstre 2 if (m_MonstreaAttaquer == 2) { if (!SoinActif) { BarreVieMechant2.Step = -Attack + ActionDefensemechant2; m_VieMechant2 += BarreVieMechant2.Step; } else { BarreVieMechant2.Step = 0; } } #endregion } if (!MechantMort3) { #region Monstre 3 if (m_MonstreaAttaquer == 3) { if (!SoinActif) { BarreVieMechant3.Step = -Attack + ActionDefensemechant3; m_VieMechant3 += BarreVieMechant3.Step; } else { BarreVieMechant3.Step = 0; } } #endregion } } Thread.Sleep(500); #endregion //changement graphique apres attack contre mechant #region changementGraphMechant if (m_MonstreaAttaquer == 1) { #region Monstre 1 BarreVieMechant.PerformStep(); if (!MonstreParalysé) { lbDomMechant.Text = BarreVieMechant.Step.ToString(); } LbVieMechant.Text = m_VieMechant.ToString() + "/" + (TabMonstre[m_NumeroMonstre].m_Vie).ToString(); #endregion } if (BossActivate) { if (m_MonstreaAttaquer == 2) { #region Monstre 2 BarreVieMechant2.PerformStep(); lbDomMechant2.Text = BarreVieMechant2.Step.ToString(); lbViemechant2.Text = m_VieMechant2.ToString() + "/" + (TabMonstre[16].m_Vie).ToString(); #endregion } else { #region Monstre 3 BarreVieMechant3.PerformStep(); lbDomMechant3.Text = BarreVieMechant3.Step.ToString(); lbVieMechant3.Text = m_VieMechant3.ToString() + "/" + (TabMonstre[16].m_Vie).ToString(); #endregion } } #endregion //Si la vie du montre tombe a zero(et celle du boss) #region SI Monstre 0 HP + desactivation de lattack pour continuer string cs = ""; #region si Monstre 1 battu (boss inclus dedans) if (m_VieMechant <= 0 && MechantMort == false) { MechantMort = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; } #endregion #region Mise a zero du monstre 1 m_VieMechant = 0; LbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; lbActionMechant.Text = ""; LbMechant.Text += " (MORT)"; pbMechant.Enabled = false; LbVieMechant.Enabled = false; pbMechant.Image = null; #endregion #region passe a lennemi 2 ou 3 tout dependant s'il est mort if (BossActivate) { if (!MechantMort2) { pbNextEnnemi_Click(sender, e); } else if (!MechantMort3) { pbMiniBoss3_Click(sender, e); } } #endregion m_Argent += m_monstreChoisi.m_ArgentRecu; m_Experience++; lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); MessageBox.Show(cs); } #endregion if (BossActivate) { #region si Monstre 2 battu if (m_VieMechant2 <= 0 && MechantMort2 == false) { MechantMort2 = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; } #endregion #region mise a zero du monstre 2 pbNextEnnemi.Enabled = false; pbNextEnnemi.Image = null; pbNextEnnemi.Enabled = false; lbNextEnnemi.Text += " (MORT)"; m_VieMechant2 = 0; lbViemechant2.Text = m_VieMechant2 + "/" + ((cMonstre)TabMonstre[16]).m_Vie.ToString(); lbDomMechant2.Text = "0"; lbActionMechant2.Text = ""; // panMechant2.BackColor = Color.Black; #endregion #region passe a l'ennemi 1 ou 3 if (!MechantMort) { pbMechant_Click(sender, e); } else if (!MechantMort3) { pbMiniBoss3_Click(sender, e); } #endregion m_Argent += ((cMonstre)TabMonstre[16]).m_ArgentRecu; m_Experience++; lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], ((cMonstre)TabMonstre[16]).m_ArgentRecu, m_Experience); MessageBox.Show(cs); } #endregion #region si Monstre 3 battu if (m_VieMechant3 <= 0 && MechantMort3 == false) { MechantMort3 = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; } #endregion #region mise a zero du monstre 3 pbMiniBoss3.Enabled = false; pbMiniBoss3.Image = null; pbMiniBoss3.Enabled = false; lbMiniboss3.Text += " (MORT)"; m_VieMechant3 = 0; lbVieMechant3.Text = m_VieMechant3 + "/" + ((cMonstre)TabMonstre[16]).m_Vie.ToString(); lbDomMechant3.Text = "0"; lbActionMechant3.Text = ""; // panMechant3.BackColor = Color.Black; #endregion #region passe a l'ennemi 1 ou 2 if (!MechantMort) { pbMechant_Click(sender, e); } else if (!MechantMort2) { pbMiniBoss3_Click(sender, e); } #endregion m_Argent += ((cMonstre)TabMonstre[16]).m_ArgentRecu; m_Experience++; lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], ((cMonstre)TabMonstre[16]).m_ArgentRecu, m_Experience); MessageBox.Show(cs); } #endregion } #region Si les 3 monstres sont battus if (BossActivate) { if (m_VieMechant <= 0 && m_VieMechant2 <= 0 && m_VieMechant3 <= 0) { #region si Boss Vaincu FIN = true; MessageBox.Show("VOUS AVEZ VAINCU LE DERNIER ET ULTIME BOSS BRAVO", "fin du jeu", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); #endregion } } else if (!BossActivate && m_VieMechant <= 0) { //desactivation du bouton dattack btnAttack.Enabled = false; btnSoin.Enabled = false; btnContinue.Enabled = true; return; } #endregion #endregion //calcul de vie perso (attack des 3 monstre) #region calcul vie perso #region Si mechant 1 ou 2 ou 3 mort if (MechantMort == true || MonstreParalysé) { ActionAttackmechant = 0; } if (BossActivate) { if (MechantMort2 == true) { ActionAttackmechant2 = 0; } if (MechantMort3 == true) { ActionAttackmechant3 = 0; } BarreVie.Step = -(ActionAttackmechant + ActionAttackmechant2 + ActionAttackmechant3); } else { BarreVie.Step = -ActionAttackmechant; } #endregion m_ViePerso += BarreVie.Step; #endregion //Si la vie du perso tombe a zero #region SI Perso 0 HP+desactivation de lattack if (m_ViePerso <= 0) { m_ViePerso = 0; lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); lbDomPerso.Text = "0"; BarreVie.Step = -400; BarreVie.PerformStep(); //AFFICHAGE Du MESSAGE DE LA MORT cs = ""; cs = String.Format("{0}\n\n VOUS ETES MORT ", PersonnageComplet[1]); this.Close(); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } #endregion //Changement graphique vie perso #region changementGraphPerso BarreVie.PerformStep(); if (BossActivate) { if (ActionAttackmechant == 0 && ActionAttackmechant2 == 0 && ActionAttackmechant3 == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = BarreVie.Step.ToString(); } } else { if (ActionAttackmechant == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = BarreVie.Step.ToString(); } } lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); #endregion }
public Monde_1(int ChoixPerso) { InitializeComponent(); sp.PlayLooping(); m_choix = ChoixPerso; TabArmes = (object[])a.TableauDarme(); switch (m_choix) { case 0: pbPerso.Image = global::Jeu.Properties.Resources.AlienArmurelegerte; pbArme1.Image = global::Jeu.Properties.Resources.Zat; m_persoChoisi = new cPersonnage("Alien Armure legerte", 120); break; case 1: pbPerso.Image = global::Jeu.Properties.Resources.AlienHeavyWarrior; pbArme1.Image = global::Jeu.Properties.Resources.PlasmaGun; m_persoChoisi = new cPersonnage("Alien Armure lourde", 140); break; case 2: pbPerso.Image = global::Jeu.Properties.Resources.AlienIngenieur; pbArme1.Image = global::Jeu.Properties.Resources.PlasmaGun; m_persoChoisi = new cPersonnage("Alien Ingenieur", 130); break; case 3: pbPerso.Image = global::Jeu.Properties.Resources.AlienMedic; pbArme1.Image = global::Jeu.Properties.Resources.Zat; m_persoChoisi = new cPersonnage("Alien Medic", 120); break; case 4: pbPerso.Image = global::Jeu.Properties.Resources.AlienÉclaireur; pbArme1.Image = global::Jeu.Properties.Resources.Zat; m_persoChoisi = new cPersonnage("Alien eclaireur", 100); break; case 5: pbPerso.Image = global::Jeu.Properties.Resources.AlienSamourai; pbArme1.Image = global::Jeu.Properties.Resources.Zat; m_persoChoisi = new cPersonnage("Alien Samourai", 110); break; } //initialisateur de vie perso m_ViePerso = m_persoChoisi.Vie; BarreVie.Step = m_ViePerso; BarreVie.Maximum = m_ViePerso; BarreVie.PerformStep(); lbViePerso.Text = m_persoChoisi.Vie.ToString() + "/" + m_persoChoisi.Vie.ToString(); ///Choix mechant ///initialisateur TabMonstre[0] = new cMonstre("Alastor", 30, 40, 5, 40); //Vie- Attack++ defense- xp++ TabMonstre[1] = new cMonstre("Scorn", 50, 20, 5, 30); //Vie+ Attack+ defense- xp+ TabMonstre[2] = new cMonstre("Kragoth", 60, 15, 10, 20); //Vie++ Attack defense xp TabMonstre[3] = new cMonstre("Nasir", 40, 15, 5, 10); // Vie Attack defense- xp- //Sinon ^^ , Scythe, Scorn, Malakai, Akasha, //Ashnard; Nergal; Tibarn; Tormod; Devdan; Zihark; Haar; Lethe; Reyson; ; Caineghis; Kurthnaga ... m_NumeroMonstre = ChoisirHasardMechant(); m_monstreChoisi = ((cMonstre)TabMonstre[m_NumeroMonstre]); //initialisateur de vie mechant m_VieMechant = m_monstreChoisi.m_Vie; BarreVieMechant.Step = m_VieMechant; BarreVieMechant.Maximum = m_VieMechant; BarreVieMechant.PerformStep(); LbVieMechant.Text = m_VieMechant.ToString() + "/" + m_VieMechant.ToString(); //actions initialisateur /*ATTACK*/ TabActions[0] = new cActionMechant(m_monstreChoisi.m_Dommage, 0); /*DEFENSE*/ TabActions[1] = new cActionMechant(0, m_monstreChoisi.m_defense); }
private void btnAttack_Click(object sender, EventArgs e) { //Action aleatoire mechant NumAction = ActionMechatHasard(); //selon larme choisi Attack = ((cArme)TabArmes[0]).DommageMax; //Selon lactionchoisi ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; //Calcul ds letat de vie m_VieMechant -= Attack - ActionDefensemechant; m_ViePerso -= ActionAttackmechant; BarreVieMechant.Step = -Attack + ActionDefensemechant; BarreVie.Step = -ActionAttackmechant; Thread.Sleep(500); //changement graphique mechant BarreVieMechant.PerformStep(); lbDomMechant.Text = (-Attack + ActionDefensemechant).ToString(); //texte vie mechant LbVieMechant.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); //Si la vie du montre tombe a zero if (m_VieMechant <= 0) { m_VieMechant = 0; LbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; //AFFICHAGE DE LEXPERIENCE ACQUISE string cs = ""; cs = String.Format("{0}\n\n EXPERIENCE ACQUISE {1}", m_persoChoisi.nom, m_monstreChoisi.m_xp); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } //texte selon choix de ladversaire Thread.Sleep(800); if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Blue; lbActionMechant.Visible = true; } Thread.Sleep(1000); //Changement graphique vie perso BarreVie.PerformStep(); if (ActionAttackmechant == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = (-ActionAttackmechant).ToString(); } lbViePerso.Text = m_ViePerso + "/" + m_persoChoisi.Vie.ToString(); }
private void btnAttack_Click(object sender, EventArgs e) { //decrementation variable Soin #region Rune de soin - Utilisation Soin--; if (!SoinActif) { lbSoin.Visible = false; lbSoin.Enabled = false; } if (Soin <= 0) { btnSoin.Enabled = true; } #endregion //Action aleatoire mechant et si NON PARALYSÉ #region Action si non paralysé avec dommage dattack et point def mechant if (Paralysie != 0) { NumAction = ActionMechatHasard(); //Selon lactionchoisi ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; } #endregion //selon larme choisi #region Attack du joueur si nest pas en mode Soin if (!SoinActif) { Attack = (cArme.Tabarme[ArmeChoisi]).DommageMax; } else { Attack = 0; } #endregion //Calcul ds letat de vie (mechant) #region Calcul etat de vie mechant si nest pas en Mode soin if (!SoinActif) { BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; } else { BarreVieMechant.Step = 0; } Thread.Sleep(500); #endregion //changement graphique mechant #region changementGraphMechant BarreVieMechant.PerformStep(); if (Paralysie != 0)/*si Non Paralysé*/ { lbDomMechant.Text = BarreVieMechant.Step.ToString(); } //texte vie mechant LbVieMechant.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); #endregion //Si la vie du montre tombe a zero(et celle du boss) #region SI Monstre 0 HP + desactivation de lattack pour continuer if (m_VieMechant <= 0) { m_VieMechant = 0; LbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; m_Argent += m_monstreChoisi.m_ArgentRecu; m_Experience++; //AFFICHAGE DE Largent ACQUISE #region si Boss Vaincu string cs = ""; if (m_NbrestantMonstreBoss == 0)//SI BOSS VAINCU { PLanete2Permise = true; m_Experience += 2; cs = String.Format("VOUS AVEZ VAINCU {0} \n \n {1}\n\n ARGENT RECU {2}\n\n Experience en main {3}\n\n***PLANETE 2 Débloquée***", m_monstreChoisi.m_nom, PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); this.Close(); } #endregion else { cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); } MessageBox.Show(cs); lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //desactivation du bouton dattack btnAttack.Enabled = false; btnSoin.Enabled = false; btnContinue.Enabled = true; return; } #endregion //calcul de vie perso si ENNEMI NON PARALYSÉ #region calcul vie perso else if (Paralysie != 0) { m_ViePerso -= ActionAttackmechant; BarreVie.Step = -ActionAttackmechant; } #endregion //Si la vie du perso tombe a zero #region SI Perso 0 HP+desactivation de lattack if (m_ViePerso <= 0) { m_ViePerso = 0; lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); lbDomPerso.Text = "0"; BarreVie.Step = -400; BarreVie.PerformStep(); //AFFICHAGE Du MESSAGE DE LA MORT string cs = ""; cs = String.Format("{0}\n\n VOUS ETES MORT ", PersonnageComplet[1]); this.Close(); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } #endregion //texte selon choix de ladversaire si ENNEMI NON PARALYSÉ #region texte if (Paralysie != 0) { if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Blue; lbActionMechant.Visible = true; } } Thread.Sleep(1000); #endregion //Changement graphique vie perso si ENNEMI NON PARALYSÉ #region changementGraphPerso if (Paralysie != 0) { BarreVie.PerformStep(); if (ActionAttackmechant == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = (-ActionAttackmechant).ToString(); } lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); } #endregion }
private void btnAttack_Click(object sender, EventArgs e) { #region si le boss est là debut de l'operation mise en place graphique //choix du boss (deplacement) if (BossActivate) { GoodSelection = b.Next(1, 4); RemiseFormDurantBoss(); switch (GoodSelection) { case 1: pbMechant.Image = ((cMonstre)TabMonstre[5]).m_ImageMonstre; pbMechant2.Image = (Image)TabMonstre[6]; pbMechant3.Image = (Image)TabMonstre[6]; BarreVieMechant.Value = m_VieMechant; break; case 2: pbMechant.Image = (Image)TabMonstre[6]; pbMechant2.Image = ((cMonstre)TabMonstre[5]).m_ImageMonstre; pbMechant3.Image = (Image)TabMonstre[6]; BarreVieMechant2.Value = m_VieMechant; break; case 3: pbMechant.Image = (Image)TabMonstre[6]; pbMechant2.Image = (Image)TabMonstre[6]; pbMechant3.Image = ((cMonstre)TabMonstre[5]).m_ImageMonstre; BarreVieMechant3.Value = m_VieMechant; break; } } #endregion //decrementation variable Soin #region Rune de soin - Utilisation Soin--; if (Soin <= 0) { btnSoin.Enabled = true; } if (!SoinActif) { lbSoin.Visible = false; } #endregion //Action aleatoire mechant si NON PARALYSÉ #region Action Choisi par les 3 monstre #region si monstre 1 est pas paralysée et pas mort if (Monstre1paralyser == false) { if (!MechantMort) { NumAction = ActionMechatHasard(); } else { NumAction = -1; } } #endregion #region si monstre 2 est pas paralysé et pas mort if (Monstre2Paralyser == false) { if (!MechantMort2) { NumActionMechant2 = ActionMechatHasard(); } else { NumActionMechant2 = -1; } } #endregion #region si monstre 3 est pas paralysé et pas mort if (Monstre3Paralyser == false) { if (!MechantMort3) { NumActionMechant3 = ActionMechatHasard(); } else { NumActionMechant3 = -1; } } #endregion #endregion //Selon lactionchoisi si NON PARALYSÉ ET VIVANT #region Point dattack et de defense 3 monstre #region Monstre 1 if (Monstre1paralyser == false) { if (!MechantMort) { ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; } } #endregion #region Monstre 2 if (Monstre2Paralyser == false) { if (!MechantMort2) { ActionAttackmechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Domm; ActionDefensemechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Protection; } } #endregion #region Monstre 3 if (Monstre3Paralyser == false) { if (!MechantMort3) { ActionAttackmechant3 = ((cActionMechant)TabActionsMechant3[NumActionMechant3]).Domm; ActionDefensemechant3 = ((cActionMechant)TabActionsMechant3[NumActionMechant3]).Protection; } } #endregion #endregion //texte selon choix de ladversaire Si NON PARALYSÉ #region texte Thread.Sleep(500); #region Mechant1 if (Monstre1paralyser == false) { if (!BossActivate) { if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else if (NumAction == 1) { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Cyan; lbActionMechant.Visible = true; } } else { if (NumAction == 0) { lbActionBoss.Text = "Attack"; lbActionBoss.ForeColor = Color.Red; } else if (NumAction == 1) { lbActionBoss.Text = "Defense"; lbActionBoss.ForeColor = Color.Cyan; } } } #endregion #region Mechant2 if (Monstre2Paralyser == false) { if (NumActionMechant2 == 0) { lbActionMechant2.Text = "Attack"; lbActionMechant2.ForeColor = Color.Red; lbActionMechant2.Visible = true; } else if (NumActionMechant2 == 1) { lbActionMechant2.Text = "Defense"; lbActionMechant2.ForeColor = Color.Cyan; lbActionMechant2.Visible = true; } } #endregion #region Mechant3 if (Monstre3Paralyser == false) { if (NumActionMechant3 == 0) { lbActionMechant3.Text = "Attack"; lbActionMechant3.ForeColor = Color.Red; lbActionMechant3.Visible = true; } else if (NumActionMechant3 == 1) { lbActionMechant3.Text = "Defense"; lbActionMechant3.ForeColor = Color.Cyan; lbActionMechant3.Visible = true; } } #endregion #endregion //selon larme choisi #region Attack si nest pas en mode Soin if (!SoinActif) { Attack = (cArme.Tabarme[ArmeChoisi]).DommageMax; } else { Attack = 0; } #endregion // Calcul ds letat de vie (mechant) if (!BossActivate) { #region Calcul etat de vie mechant if (!MechantMort) { #region Monstre 1 if (m_MonstreaAttaquer == 1) { if (!SoinActif) { BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; } else { BarreVieMechant.Step = 0; } } #endregion } if (!MechantMort2) { #region Monstre 2 if (m_MonstreaAttaquer == 2) { if (!SoinActif) { BarreVieMechant2.Step = -Attack + ActionDefensemechant2; m_VieMechant2 += BarreVieMechant2.Step; } else { BarreVieMechant2.Step = 0; } } #endregion } if (!MechantMort3) { #region Monstre 3 if (m_MonstreaAttaquer == 3) { if (!SoinActif) { BarreVieMechant3.Step = -Attack + ActionDefensemechant3; m_VieMechant3 += BarreVieMechant3.Step; } else { BarreVieMechant3.Step = 0; } } #endregion } Thread.Sleep(500); #endregion } //Calcul de vie boss else { #region bossLifeCalcul #region GoodSelection1 if (m_MonstreaAttaquer == 1 && GoodSelection == 1) { if (!SoinActif) { BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; } else { BarreVieMechant.Step = 0; } } #endregion else #region GoodSelection 2 if (m_MonstreaAttaquer == 2 && GoodSelection == 2) { if (!SoinActif) { BarreVieMechant2.Step = -Attack + ActionDefensemechant2; m_VieMechant += BarreVieMechant2.Step; } else { BarreVieMechant2.Step = 0; } } #endregion else #region GoodSelection 3 if (m_MonstreaAttaquer == 3 && GoodSelection == 3) { if (!SoinActif) { BarreVieMechant3.Step = -Attack + ActionDefensemechant3; m_VieMechant3 += BarreVieMechant3.Step; if (GoodSelection == 3) { m_VieMechant += BarreVieMechant3.Step; } } else { BarreVieMechant3.Step = 0; } } #endregion #endregion } Thread.Sleep(500); //changement graphique apres attack contre mechant #region changementGraphMechant if (m_MonstreaAttaquer == 1) { #region Monstre 1 BarreVieMechant.PerformStep(); if (Monstre1paralyser == false) { lbDomMechant.Text = BarreVieMechant.Step.ToString(); } if (GoodSelection != 1 && GoodSelection != -1) { lbDomMechant.Text = "Manqué"; } #endregion } else if (m_MonstreaAttaquer == 2) { #region Monstre 2 BarreVieMechant2.PerformStep(); if (Monstre2Paralyser == false) { lbDomMechant2.Text = BarreVieMechant2.Step.ToString(); } if (GoodSelection != 2 && GoodSelection != -1) { lbDomMechant2.Text = "Manqué"; } #endregion } else { #region Monstre 3 BarreVieMechant3.PerformStep(); if (Monstre3Paralyser == false) { lbDomMechant3.Text = BarreVieMechant3.Step.ToString(); } if (GoodSelection != 3 && GoodSelection != -1) { lbDomMechant3.Text = "Manqué"; } #endregion } //texte vie mechant(scene du boss incluse) if (GoodSelection == -1) { lbVieMechant.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); lbVieMechant2.Text = m_VieMechant2 + "/" + m_monstreChoisi2.m_Vie.ToString(); lbVieMechant3.Text = m_VieMechant3 + "/" + m_monstreChoisi3.m_Vie.ToString(); } else { lbBossLife.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); } #endregion //Si la vie du montre tombe a zero(et celle du boss) #region SI Monstre 0 HP + desactivation de lattack pour continuer string cs = ""; #region si Monstre 1 battu (boss inclus dedans) if (m_VieMechant <= 0 && MechantMort == false) { MechantMort = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; } #endregion #region Mise a zero du monstre 1 m_VieMechant = 0; lbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; lbActionMechant.Text = ""; pbMechant.Enabled = false; lbMechant.Enabled = false; pbMechant.Image = null; panMechant1.BackColor = Color.Black; #endregion #region passe a lennemi 2 ou 3 tout dependant s'il est mort if (!MechantMort2) { pbMechant2_Click(sender, e); } else if (!MechantMort3) { pbMechant3_Click(sender, e); } #endregion m_Argent += m_monstreChoisi.m_ArgentRecu; m_Experience++; lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //AFFICHAGE DE Largent ACQUISE #region si Boss Vaincu if (m_NbrestantMonstreBoss == 0)//SI BOSS VAINCU { PLanete4Permise = true; pbMechant2.Image = null; pbMechant3.Image = null; m_Experience += 2; m_Argent += m_monstreChoisi.m_ArgentRecu; cs = String.Format("VOUS AVEZ VAINCU LE BOSS {0} \n \n {1}\n\n ARGENT RECU {2}\n\n Experience en main {3} \n ***Derniere planète débloqué***", m_monstreChoisi.m_nom, PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); MessageBox.Show(cs); this.Close(); } #endregion else { cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); MessageBox.Show(cs); } } #endregion #region si Monstre 2 battu if (m_VieMechant2 <= 0 && MechantMort2 == false) { MechantMort2 = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; } #endregion #region mise a zero du monstre 2 pbMechant2.Enabled = false; pbMechant2.Image = null; lbMechant2.Enabled = false; m_VieMechant2 = 0; lbVieMechant2.Text = m_VieMechant2 + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre2]).m_Vie.ToString(); lbDomMechant2.Text = "0"; lbActionMechant2.Text = ""; panMechant2.BackColor = Color.Black; #endregion #region passe a l'ennemi 1 ou 3 if (!MechantMort) { pbMechant_Click(sender, e); } else if (!MechantMort3) { pbMechant3_Click(sender, e); } #endregion m_Argent += m_monstreChoisi2.m_ArgentRecu; m_Experience++; lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi2.m_ArgentRecu, m_Experience); MessageBox.Show(cs); } #endregion #region si Monstre 3 battu if (m_VieMechant3 <= 0 && MechantMort3 == false) { MechantMort3 = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; } #endregion #region mise a zero du monstre 3 pbMechant3.Enabled = false; pbMechant3.Image = null; lbMechant3.Enabled = false; m_VieMechant3 = 0; lbVieMechant3.Text = m_VieMechant3 + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre3]).m_Vie.ToString(); lbDomMechant3.Text = "0"; lbActionMechant3.Text = ""; panMechant3.BackColor = Color.Black; #endregion #region passe a l'ennemi 1 ou 2 if (!MechantMort) { pbMechant_Click(sender, e); } else if (!MechantMort2) { pbMechant2_Click(sender, e); } #endregion m_Argent += m_monstreChoisi3.m_ArgentRecu; m_Experience++; lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi3.m_ArgentRecu, m_Experience); MessageBox.Show(cs); } #endregion #region Si les 3 monstres sont battus if (m_VieMechant <= 0 && m_VieMechant2 <= 0 && m_VieMechant3 <= 0) { //desactivation du bouton dattack btnAttack.Enabled = false; btnSoin.Enabled = false; btnContinue.Enabled = true; panMechant1.BackColor = Color.Black; panMechant2.BackColor = Color.Black; panMechant3.BackColor = Color.Black; return; } #endregion #endregion //calcul de vie perso (attack des 3 monstre) #region calcul vie perso #region Si mechant 1 ou 2 ou 3 mort if (MechantMort == true) { ActionAttackmechant = 0; } if (MechantMort2 == true) { ActionAttackmechant2 = 0; } if (MechantMort3 == true) { ActionAttackmechant3 = 0; } #endregion #region Si Monstre 1 paralyse ou monstre 2 ou 3 ou aucun if (Monstre1paralyser == true) { BarreVie.Step = -(ActionAttackmechant2 + ActionAttackmechant3); } else if (Monstre2Paralyser == true) { BarreVie.Step = -(ActionAttackmechant + ActionAttackmechant3); } else if (Monstre3Paralyser == true) { BarreVie.Step = -(ActionAttackmechant + ActionAttackmechant2); } else if (Monstre1paralyser == false && Monstre2Paralyser == false && Monstre3Paralyser == false) { BarreVie.Step = -(ActionAttackmechant + ActionAttackmechant2 + ActionAttackmechant3); } #endregion m_ViePerso += BarreVie.Step; #endregion //Si la vie du perso tombe a zero #region SI Perso 0 HP+desactivation de lattack if (m_ViePerso <= 0) { m_ViePerso = 0; lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); lbDomPerso.Text = "0"; BarreVie.Step = -400; BarreVie.PerformStep(); //AFFICHAGE Du MESSAGE DE LA MORT cs = ""; cs = String.Format("{0}\n\n VOUS ETES MORT ", PersonnageComplet[1]); this.Close(); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } #endregion //Changement graphique vie perso #region changementGraphPerso BarreVie.PerformStep(); if (ActionAttackmechant == 0 && ActionAttackmechant2 == 0 && ActionAttackmechant3 == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = BarreVie.Step.ToString(); } lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); #endregion }
private void btnAttack_Click(object sender, EventArgs e) { //Action aleatoire mechant NumAction = ActionMechatHasard(); //selon larme choisi Attack = ((cArme)TabArmes[choixArme]).DommageMax; //Selon lactionchoisi ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; //Calcul ds letat de vie (mechant) #region Calcul etat de vie mechant BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; Thread.Sleep(500); #endregion //changement graphique mechant #region changementGraphMechant BarreVieMechant.PerformStep(); lbDomMechant.Text = BarreVieMechant.Step.ToString(); //texte vie mechant LbVieMechant.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); #endregion //Si la vie du montre tombe a zero(et celle du boss) #region SI Monstre 0 HP + desactivation de lattack pour continuer if (m_VieMechant <= 0) { m_VieMechant = 0; LbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; m_Argent += m_monstreChoisi.m_ArgentRecu; //AFFICHAGE DE Largent ACQUISE #region si Boss Vaincu string cs = ""; if (m_NbrestantMonstreBoss == 0)//SI BOSS VAINCU { PLanete2Permise = true; cs = String.Format("VOUS AVEZ VAINCU LE BOSS alias ({0}) \n \n {1}\n\n ARGENT RECU {2}", m_monstreChoisi.m_nom, m_persoChoisi.nom, m_monstreChoisi.m_ArgentRecu); this.Close(); } #endregion else { cs = String.Format("{0}\n\n ARGENT RECU {1}", m_persoChoisi.nom, m_monstreChoisi.m_ArgentRecu); } MessageBox.Show(cs); lbArgent.Text = m_Argent.ToString(); //desactivation du bouton dattack btnAttack.Enabled = false; btnContinue.Enabled = true; return; } #endregion //calcul de vie perso else { m_ViePerso -= ActionAttackmechant; } BarreVie.Step = -ActionAttackmechant; //Si la vie du perso tombe a zero #region SI Perso 0 HP+desactivation de lattack if (m_ViePerso <= 0) { m_ViePerso = 0; lbViePerso.Text = m_ViePerso + "/" + m_persoChoisi.Vie.ToString(); lbDomPerso.Text = "0"; BarreVie.Step = -400; BarreVie.PerformStep(); //AFFICHAGE Du MESSAGE DE LA MORT string cs = ""; cs = String.Format("{0}\n\n VOUS ETES MORT ", m_persoChoisi.nom); this.Close(); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } #endregion //texte selon choix de ladversaire #region texte Thread.Sleep(800); if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Blue; lbActionMechant.Visible = true; } Thread.Sleep(1000); #endregion //Changement graphique vie perso #region changementGraphPerso BarreVie.PerformStep(); if (ActionAttackmechant == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = (-ActionAttackmechant).ToString(); } lbViePerso.Text = m_ViePerso + "/" + m_persoChoisi.Vie.ToString(); #endregion }
private void btnAttack_Click(object sender, EventArgs e) { //decrementation variable Soin #region Rune de soin - Utilisation Soin--; if (Soin <= 0) { btnSoin.Enabled = true; } if (!SoinActif) { lbSoin.Visible = false; } #endregion //Action aleatoire mechant si NON PARALYSÉ #region Action Choisi par les 2 monstre #region si monstre 1 est pas paralysée et pas mort if (Monstre1paralyser == false) { if (!MechantMort) { NumAction = ActionMechatHasard(); } else { NumAction = -1; } } #endregion #region si monstre 2 est pas paralysé et pas mort if (Monstre2Paralyser == false) { if (!MechantMort2) { NumActionMechant2 = ActionMechatHasard(); } else { NumActionMechant2 = -1; } } #endregion #endregion //Selon lactionchoisi si NON PARALYSÉ ET VIVANT #region Point dattack et de defense 2 monstre if (Monstre1paralyser == false) { if (!MechantMort) { ActionAttackmechant = ((cActionMechant)TabActions[NumAction]).Domm; ActionDefensemechant = ((cActionMechant)TabActions[NumAction]).Protection; } } if (Monstre2Paralyser == false) { if (!MechantMort2) { ActionAttackmechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Domm; ActionDefensemechant2 = ((cActionMechant)TabActionsMechant2[NumActionMechant2]).Protection; } } #endregion //texte selon choix de ladversaire Si NON PARALYSÉ #region texte Thread.Sleep(500); #region Mechant1 if (Monstre1paralyser == false) { if (NumAction == 0) { lbActionMechant.Text = "Attack"; lbActionMechant.ForeColor = Color.Red; lbActionMechant.Visible = true; } else if (NumAction == 1) { lbActionMechant.Text = "Defense"; lbActionMechant.ForeColor = Color.Cyan; lbActionMechant.Visible = true; } } #endregion #region Mechant2 if (Monstre2Paralyser == false) { if (NumActionMechant2 == 0) { lbActionMechant2.Text = "Attack"; lbActionMechant2.ForeColor = Color.Red; lbActionMechant2.Visible = true; } else if (NumActionMechant2 == 1) { lbActionMechant2.Text = "Defense"; lbActionMechant2.ForeColor = Color.Cyan; lbActionMechant2.Visible = true; } } #endregion #endregion //selon larme choisi #region Attack si nest pas en mode Soin if (!SoinActif) { Attack = (cArme.Tabarme[ArmeChoisi]).DommageMax; } else { Attack = 0; } #endregion //Calcul ds letat de vie (mechant) #region Calcul etat de vie mechant if (!MechantMort) { #region Monstre 1 if (m_MonstreaAttaquer == 1) { if (!SoinActif) { BarreVieMechant.Step = -Attack + ActionDefensemechant; m_VieMechant += BarreVieMechant.Step; } else { BarreVieMechant.Step = 0; } } #endregion } if (!MechantMort2) { #region Monstre 2 if (m_MonstreaAttaquer == 2) { if (!SoinActif) { BarreVieMechant2.Step = -Attack + ActionDefensemechant2; m_VieMechant2 += BarreVieMechant2.Step; } else { BarreVieMechant2.Step = 0; } } #endregion } Thread.Sleep(500); #endregion //changement graphique apres attack contre mechant #region changementGraphMechant #region Monstre 1 if (m_MonstreaAttaquer == 1) { BarreVieMechant.PerformStep(); if (Monstre1paralyser == false) { lbDomMechant.Text = BarreVieMechant.Step.ToString(); } } #endregion #region Monstre 2 else { BarreVieMechant2.PerformStep(); if (Monstre2Paralyser == false) { lbDomMechant2.Text = BarreVieMechant2.Step.ToString(); } } #endregion //texte vie mechant lbVieMechant.Text = m_VieMechant + "/" + m_monstreChoisi.m_Vie.ToString(); lbVieMechant2.Text = m_VieMechant2 + "/" + m_monstreChoisi2.m_Vie.ToString(); #endregion //Si la vie du montre tombe a zero(et celle du boss) #region SI Monstre 0 HP + desactivation de lattack pour continuer string cs = ""; #region si Monstre 1 battu (boss inclus dedans) if (m_VieMechant <= 0 && MechantMort == false) { MechantMort = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; if (Paralysie == 0) { lbDomMechant2.Text = "ENNEMI \n PARALYSÉ"; lbActionMechant2.Text = ""; ActionDefensemechant2 = 0; Monstre2Paralyser = true; } else { Monstre2Paralyser = false; } } #endregion #region Mise a zero du monstre 1 m_VieMechant = 0; lbVieMechant.Text = m_VieMechant + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre]).m_Vie.ToString(); lbDomMechant.Text = "0"; lbActionMechant.Text = ""; pbMechant.Enabled = false; lbMechant.Enabled = false; pbMechant.Image = null; #endregion #region passe a lennemi 2 if (!MechantMort2) { pbMechant2_Click(sender, e); } #endregion m_Argent += m_monstreChoisi.m_ArgentRecu; m_Experience++; //AFFICHAGE DE Largent ACQUISE #region si Boss Vaincu if (m_NbrestantMonstreBoss == 0) //SI BOSS VAINCU { PLanete3Permise = true; m_Experience += 2; cs = String.Format("VOUS AVEZ VAINCU LE BOSS {0} \n \n {1}\n\n ARGENT RECU {2}\n\n Experience en main {3} \n ***Magasin artefact débloqué***", m_monstreChoisi.m_nom, PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); MessageBox.Show(cs); this.Close(); } #endregion else { cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi.m_ArgentRecu, m_Experience); MessageBox.Show(cs); } if (Paralysie == 0) { cMonstre[] TabCMonstre = new cMonstre[1]; TabCMonstre[0] = m_monstreChoisi2; dChoixEnnemiAParalyser ChoixEnnemi = new dChoixEnnemiAParalyser(TabCMonstre); ChoixEnnemi.ShowDialog(); } } #endregion #region si Monstre 2 battu if (m_VieMechant2 <= 0 && MechantMort2 == false) { MechantMort2 = true; #region Compteur pour paralysie(si Rune 2 acquise) if (Rune2 == 1) { Paralysie--; if (Paralysie == 0) { lbDomMechant.Text = "ENNEMI \n PARALYSÉ"; Monstre1paralyser = true; lbActionMechant.Text = ""; ActionDefensemechant = 0; } else { Monstre1paralyser = false; } } #endregion #region mise a zero du monstre 2 pbMechant2.Enabled = false; pbMechant2.Image = null; lbMechant2.Enabled = false; m_VieMechant2 = 0; lbVieMechant2.Text = m_VieMechant2 + "/" + ((cMonstre)TabMonstre[m_NumeroMonstre2]).m_Vie.ToString(); lbDomMechant2.Text = "0"; lbActionMechant2.Text = ""; #endregion #region passe a l'ennemi 1 if (!MechantMort) { pbMechant_Click(sender, e); } #endregion m_Argent += m_monstreChoisi2.m_ArgentRecu; m_Experience++; //AFFICHAGE DE Largent ACQUISE cs = String.Format("{0}\n\n ARGENT RECU {1}\n\n Experience en main {2}", PersonnageComplet[1], m_monstreChoisi2.m_ArgentRecu, m_Experience); MessageBox.Show(cs); if (Paralysie == 0) { cMonstre[] TabCMonstre = new cMonstre[1]; TabCMonstre[0] = m_monstreChoisi; dChoixEnnemiAParalyser ChoixEnnemi = new dChoixEnnemiAParalyser(TabCMonstre); ChoixEnnemi.ShowDialog(); } } #endregion lbArgent.Text = m_Argent.ToString(); lbExperience.Text = m_Experience.ToString(); #region Si les 2 monstres sont battus if (m_VieMechant <= 0 && m_VieMechant2 <= 0) { //desactivation du bouton dattack btnAttack.Enabled = false; btnSoin.Enabled = false; btnContinue.Enabled = true; panMechant1.BackColor = Color.DarkRed; panMechant2.BackColor = Color.DarkRed; return; } #endregion #endregion //calcul de vie perso (attack des 2 monstre) #region calcul vie perso #region Si mechant 1 ou 2 mort if (MechantMort == true) { ActionAttackmechant = 0; } if (MechantMort2 == true) { ActionAttackmechant2 = 0; } #endregion #region Si Monstre 1 paralyse ou monstre 2 ou aucun if (Monstre1paralyser == true) { BarreVie.Step = -ActionAttackmechant2; } else if (Monstre2Paralyser == true) { BarreVie.Step = -ActionAttackmechant; } else if (Monstre1paralyser == false && Monstre2Paralyser == false) { BarreVie.Step = -(ActionAttackmechant + ActionAttackmechant2); } #endregion m_ViePerso += BarreVie.Step; #endregion //Si la vie du perso tombe a zero #region SI Perso 0 HP+desactivation de lattack if (m_ViePerso <= 0) { m_ViePerso = 0; lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); lbDomPerso.Text = "0"; BarreVie.Step = -400; BarreVie.PerformStep(); //AFFICHAGE Du MESSAGE DE LA MORT cs = ""; cs = String.Format("{0}\n\n VOUS ETES MORT ", PersonnageComplet[1]); this.Close(); MessageBox.Show(cs); //desactivation du bouton dattack btnAttack.Enabled = false; return; } #endregion //Changement graphique vie perso #region changementGraphPerso BarreVie.PerformStep(); if (ActionAttackmechant == 0 && ActionAttackmechant2 == 0) { lbDomPerso.Text = "0"; } else { lbDomPerso.Text = BarreVie.Step.ToString(); } lbViePerso.Text = m_ViePerso + "/" + PersonnageComplet[4].ToString(); #endregion }