public void Launch_randomEvent() { MapIsland islandtest = new MapIsland(null, "islandTest"); MapZone zoneTest = new MapZone(null, false, 2); List <MapZone> list = new List <MapZone>(); list.Add(zoneTest); MapInstance instanceTest = new MapInstance(null, "test"); instanceTest.listZones = list; Console.WriteLine("visited"); for (int i = 0; i < 10; i++) { Console.Write(instanceTest.EventRandom(true)); } Console.WriteLine(Environment.NewLine + "No island, not visited"); list.Remove(zoneTest); instanceTest.listZones = list; for (int i = 0; i < 10; i++) { Console.Write(instanceTest.EventRandom(false)); } Console.WriteLine(Environment.NewLine + "Island, not visited"); for (int i = 0; i < 10; i++) { Console.Write(instanceTest.EventRandom(false)); } }
public void OnClick(object sender, EventArgs e) { if (_world.ActualPosition is MapZone) { if ((MapZone)_world.ActualPosition != ((MapZone)((Button)sender).Tag)) { foreach (MapZone zone in _instance.listZones) { if (zone == ((MapZone)((Button)sender).Tag)) { if (_instance.ChangeActualZone(zone)) { Reload(); Meet uc = new Meet(_instance.EventRandom(zone.Visited), _contextForm, _world, zone); zone.Visited = true; //Racial bonus elf int count = 0; foreach (Character c in _world.Team.Members) { if (c.Race == "ELFE") { count++; } } foreach (Character c in _world.Team.Members) { c.Heal((c.Health / 100) * count); } _contextForm.ToMenu(uc, false); } } } } } else { if (((MapZone)((Button)sender).Tag) == _instance.listZones[0]) { _world.ActualPosition = ((MapZone)((Button)sender).Tag); Reload(); } } }