public void Create_a_fight() { // Create monster List <Monster> _monsters = new List <Monster>(); // Create monsters Monster m1 = new Monster("M1", 2, "slime", 5, 0, 100, 0, 5, 5); Monster m2 = new Monster("M2", 2, "slime", 5, 0, 100, 0, 5, 5); Monster m3 = new Monster("M3", 2, "slime", 5, 0, 100, 0, 5, 5); // Create members Character c1 = new Character("C1", "HUMAIN", false); Character c2 = new Character("C2", "ELF", false); Character c3 = new Character("C3", "NAIN", false); // Create team Team _team = new Team("MyTeam"); // Set positions to monsters m1.FrontPosition = true; m2.FrontPosition = false; m3.FrontPosition = false; // Set positions to members c1.IsMain = true; c1.FrontPosition = true; c2.FrontPosition = true; c3.FrontPosition = true; // Add monsters in list _monsters.Add(m1); _monsters.Add(m2); _monsters.Add(m3); // Add members in team, _team.AddMembers(c1); _team.AddMembers(c2); _team.AddMembers(c3); // Create a fight Fight fight = new Fight(_monsters, _team); // Test Console.WriteLine("Avant combat"); Console.WriteLine("Monstre 1, vie : {0}, position avant : {1}", _monsters[0].Health, _monsters[0].FrontPosition); Console.WriteLine("Monstre 2, vie : {0}, position avant : {1}", _monsters[1].Health, _monsters[1].FrontPosition); Console.WriteLine("Monstre 3, vie : {0}, position avant : {1}\n", _monsters[2].Health, _monsters[2].FrontPosition); Console.WriteLine("Membre 1, vie : {0}, position avant : {1}", _team.Members[0].HealthPoint, _team.Members[0].FrontPosition); Console.WriteLine("Membre 2, vie : {0}, position avant : {1}", _team.Members[1].HealthPoint, _team.Members[1].FrontPosition); Console.WriteLine("Membre 3, vie : {0}, position avant : {1} \n", _team.Members[2].HealthPoint, _team.Members[2].FrontPosition); //fight.gameLoop(); Console.WriteLine("Après combat"); Console.WriteLine("Monstre 1, vie : {0}, position avant : {1}", _monsters[0].Health, _monsters[0].FrontPosition); Console.WriteLine("Monstre 2, vie : {0}, position avant : {1}", _monsters[1].Health, _monsters[1].FrontPosition); Console.WriteLine("Monstre 3, vie : {0}, position avant : {1}\n", _monsters[2].Health, _monsters[2].FrontPosition); Console.WriteLine("Membre 1, vie : {0}, position avant : {1}", _team.Members[0].HealthPoint, _team.Members[0].FrontPosition); Console.WriteLine("Membre 2, vie : {0}, position avant : {1}", _team.Members[1].HealthPoint, _team.Members[1].FrontPosition); Console.WriteLine("Membre 3, vie : {0}, position avant : {1} \n", _team.Members[2].HealthPoint, _team.Members[2].FrontPosition); }
private void ok_Click(object sender, EventArgs e) { // Create monsters List <Monster> _monsters = new List <Monster>(); // Create monsters Monster m1 = new Monster("M1", 2, "slime", 5, 0, 100, 0, 5, 5); Monster m2 = new Monster("M2", 2, "slime", 5, 0, 100, 0, 5, 5); Monster m3 = new Monster("M3", 2, "slime", 5, 0, 100, 0, 5, 5); Monster m4 = new Monster("M4", 2, "slime", 5, 0, 100, 0, 5, 5); // Create members Character c1 = new Character("C1", "HUMAIN", false); Character c2 = new Character("C2", "ELF", false); Character c3 = new Character("C3", "NAIN", false); Character c4 = new Character("C4", "NAIN", false); // Create team Team _team = new Team("MyTeam"); // Set positions to monsters m1.FrontPosition = true; m2.FrontPosition = false; m3.FrontPosition = false; m4.FrontPosition = false; // Set positions to members c1.IsMain = true; c1.FrontPosition = true; c2.FrontPosition = false; c3.FrontPosition = false; c4.FrontPosition = false; // Add monsters in list _monsters.Add(m1); _monsters.Add(m2); _monsters.Add(m3); _monsters.Add(m4); // Add members in team, _team.AddMembers(c1); _team.AddMembers(c2); _team.AddMembers(c3); _team.AddMembers(c4); // CREATE POTION ITEM TO ADD IN THE INVENTORY AND USE IN THE FIGHT Item item2 = new Item("Bandage", 1, 5, "Bandage rudimentaire permettant d'arreter un saignement", "consommable"); item2.AddStats("vie", 10); _team.Invent.AddItem(item2, 5); // ok.Visible = false; // TEST //FightUserControl fightIG = new FightUserControl(_monsters, _team, _contextForm); FightUserControl fightIG = new FightUserControl(_monsters, _w.Team, _contextForm); _contextForm.ToMenu(fightIG, false); }
public void Test_to_remove_members_in_the_team() { Team team = new Team("Team1"); Character c1 = new Character("Character1", "Geant", false); Character c2 = new Character("Character2", "Geant", false); team.AddMembers(c1); team.AddMembers(c2); Assert.AreEqual(2, team.Members.Count); team.RemoveMembers(c1); Assert.AreEqual(1, team.Members.Count); }
public void Test_to_verify_we_cant_add_members_if_the_team_is_full() { Team team = new Team("Team1"); Character c1 = new Character("c1", "humain", false); Character c2 = new Character("c2", "humain", false); Character c3 = new Character("c3", "humain", false); Character c4 = new Character("c4", "humain", false); Character c5 = new Character("c5", "humain", false); team.AddMembers(c1); team.AddMembers(c2); team.AddMembers(c3); team.AddMembers(c4); team.AddMembers(c5); // this member wil not be in the team because the mamximum member is 4 Assert.AreEqual(4, team.Members.Count); }
public void Test_to_add_members_in_the_team() { Team team = new Team("Team1"); Character memberToAdd = new Character("memberAdded", "Geant", false); team.AddMembers(memberToAdd); Assert.AreEqual(memberToAdd, team.Members[0]); Assert.AreEqual(1, team.Members.Count); }
public void Test_we_cant_remove_the_main_character() { Team team = new Team("Team1"); Character c1 = new Character("c1", "humain", false); c1.IsMain = true; // set the member to main character team.AddMembers(c1); team.RemoveMembers(c1); Assert.AreEqual("c1", team.Members[0].Name); }
public void Test_to_change_the_position_of_a_character() { Character character = new Character("Character1", "Geant", false); Team team = new Team("Team1"); team.AddMembers(character); // Change the position of the main character with "True" team.ChangePositionMember(character, true); Assert.AreEqual(true, team.Members[0].FrontPosition); }
private void engageMembre(object sender, EventArgs e) { Button button = ((Button)sender); string name = button.Parent.Controls.Find(button.Name, false)[0].Text; Character member; bool find = false; for (int i = 0; i < _randomCharacterList.Count; i++) { member = _randomCharacterList[i]; if (member.Name == name && find == false) { if (t.Invent.GetGold >= member.Level * 50) { t.Invent.RemoveGold(member.Level * 50); find = true; if (t.Members.Count < 4) { _randomCharacterList.Remove(member); t.AddMembers(member); } else { LError.Visible = true; LError.Text = "Votre équipe est pleine, vous ne pouvez plus engager de membre"; LError.Left = LError.Parent.Width / 2 - LError.Width / 2; } } else { LError.Visible = true; LError.Text = "Vous n'avez pas suffisamment de fonds"; LError.Left = LError.Parent.Width / 2 - LError.Width / 2; } } } ReloadTavern(); }