public void Afficher(Tile tile_, SystemeDeJeu gameplay_) { tile_.pointeurUnite = numeroUnite; tile_.pointeurArmee = numeroArmee; tile_.textureUnite = image; tile_.presence = true; tile_.estAccessible = false; tile_.dessinTomb = false; tile_.pourcentageDePv = (100 * pvactuel) / pvmax; tile_.mouvUnite = mouvement; tile_.mouvUniteMax = (mouvement * 40) / mouvementmax; tile_.xpUnite = (xp); Anim += vitesseAnim; tile_.jDepart = jDepart; tile_.iDepart = iDepart; if (Anim > 1) { #region anim Anim = 0; switch (state) { case e_EtatAnim.mouvement1: state = e_EtatAnim.mouvement2; sousrect.Y = 0; break; case e_EtatAnim.mouvement2: state = e_EtatAnim.mouvement3; sousrect.Y = 3 * 128; break; case e_EtatAnim.mouvement3: state = e_EtatAnim.repos1; sousrect.Y = 0; vitesseAnim = 0.025f; break; case e_EtatAnim.repos1: state = e_EtatAnim.repos2; sousrect.Y = 128; ivirtuel = i; jvirtuel = j; break; case e_EtatAnim.repos2: state = e_EtatAnim.repos1; sousrect.Y = 0; break; default: break; } #endregion } tile_.state = state; tile_.sousRectUnite = sousrect; tile_.AttaqOrNot = attaqOrNot; tile_.aura = profiteDuneAura; tile_.heros = typeUnite == e_typeUnite.Heros; tile_.cachette = e_Cache.Visible; if (estInvisible) { if (gameplay_.tourencours == numeroArmee) { tile_.cachette = e_Cache.InvisibleAmi; } else { tile_.cachette = e_Cache.Invisible; } } }
public Unite(e_classe c_,e_typeUnite typeUnite_, Pouvoir SHORYUKEN_, Aura aura_, string nom_, int force_, int dexterite_, int constitution_, int defense_, int esprit_, int chance_, int vitesse_, int[] portee_, bool[] typedAttaque_, int numeroUnite_, int numeroArmee_, int mouvement_, int ia_ = 0, e_typeDePartie etat_ = e_typeDePartie.Joute) { metier = c_; debug = 0; nom = nom_; typeUnite = typeUnite_; SHORYUKEN = SHORYUKEN_; aura = aura_; profiteDuneAura = false; #region Carac force = force_; dexterite = dexterite_; constitution = constitution_; defense = defense_; esprit = esprit_; chance = chance_; vitesse = vitesse_; lvl = 1; xp = 0; mouvement = mouvement_; mouvementmax = mouvement_; CaracFromStats(); portee = portee_; typedAttaque = typedAttaque_; points = 6 * defense + 5 * dexterite + 5 * chance + 3 * vitesse + 6 * constitution; bool attaP = false; bool attaM = false; float moy = 0; for (int po = 0; po < portee.Length; po++) { attaP = attaP || typedAttaque[po]; attaM = attaM || (!typedAttaque[po] && portee[po] != 0); moy += portee[po]; } moy /= 20f; if (attaM) { points += (int)(esprit * 7 * moy); } else { points += esprit * 3; } if (typeUnite == e_typeUnite.Elite) { points += 2 * esprit; } if (attaP) { points += (int)(force * 7 * moy); } else { points += force * 3; } points = (points * mouvementmax) / 80; #endregion mouvOrNot = true; attaqOrNot = true; numeroArmee = numeroArmee_; numeroUnite = numeroUnite_; i = 5 + numeroUnite; ivirtuel = i; j = 6 + numeroArmee; jvirtuel = j; r = new Random(); alive = true; sousrect = new Rectangle(0, 0, 128, 128); Anim = 0; vitesseAnim = 0.025f; state = e_EtatAnim.repos1; jDepart = 0; iDepart = 0; estPasseParLa = new bool[32, 32]; fileDeMouvements = new List<mouv>(); nombreDeRotations = 0; een = true; image = c_.ToString(); IA = new IntelligenceArtificielle(ia_, this); //Console.WriteLine(nom + " : " + points); porteTresor = false; estInvisible = false; }
public bool goSud(MoteurGraphique moteurgraphique_, Armee armee_, SystemeDeJeu gameplay_) { if (j + 1 < moteurgraphique_.largeur && moteurgraphique_.map[i, j + 1].estAccessible && mouvement >= moteurgraphique_.map[i, j + 1].coutEnMouvement) { mouvOrNot = false; debug = 0; if (aura != null) { aura.ActiverAura(this, moteurgraphique_, gameplay_, -1); } moteurgraphique_.map[i, j].pointeurUnite = 0; moteurgraphique_.map[i, j].pointeurArmee = 0; moteurgraphique_.map[i, j].presence = false; moteurgraphique_.map[i, j].estAccessible = true; jDepart = 0; iDepart = 0; j++; if (aura != null) { aura.ActiverAura(this, moteurgraphique_, gameplay_, 1); } mouvement -= moteurgraphique_.map[i, j].coutEnMouvement; sousrect.X = 128; tourner(); state = e_EtatAnim.mouvement1; sousrect.Y = 256; vitesseAnim = 0.2f; jDepart = -1; iDepart = 1; moteurgraphique_.viderChemin(); lookAtCheminsInitialize(moteurgraphique_); armee_.soeurAnne(moteurgraphique_, gameplay_); armee_.auras(moteurgraphique_, gameplay_); return true; } else { mouvOrNot = false; return false; } }