private void Search(int index) { Objects.Handicap handicap = CurrentReelSet.Reels[(index - 1) / 3].Handicaps[(index - 1) % 3]; if (index == 1) { foreach (Objects.ReelSet set in Controller.ReelSetsUnique) { if (set.Reels[0].Handicaps.Contains(handicap)) { SearchResults.Add(set); } } } else { foreach (Objects.ReelSet set in SearchResults.ToList()) { if (!set.Reels[(index - 1) / 3].Handicaps.Contains(handicap)) { SearchResults.Remove(set); } } } }
private void Gambler_KeyDown(object sender, KeyEventArgs e) { Objects.Handicap handicap = Objects.Handicap.UNKNOWN; switch (e.KeyCode) { case Keys.G: handicap = Objects.Handicap.GreenMateria; break; case Keys.R: handicap = Objects.Handicap.RedMateria; break; case Keys.B: handicap = Objects.Handicap.BlueMateria; break; case Keys.P: handicap = Objects.Handicap.PurpleMateria; break; case Keys.Y: handicap = Objects.Handicap.YellowMateria; break; case Keys.N: handicap = Objects.Handicap.AllMateria; break; case Keys.X: handicap = Objects.Handicap.Accessory; break; case Keys.I: handicap = Objects.Handicap.Item; break; case Keys.A: handicap = Objects.Handicap.Armor; break; case Keys.W: handicap = Objects.Handicap.Weapon; break; case Keys.V: handicap = Objects.Handicap.Speed; break; //case Keys.U: // handicap = Objects.Handicap.Accuracy; // break; case Keys.S: handicap = Objects.Handicap.Mini; break; case Keys.O: handicap = Objects.Handicap.Poison; break; case Keys.F: handicap = Objects.Handicap.Toad; break; case Keys.T: handicap = Objects.Handicap.TimeDamage; break; case Keys.D5: handicap = Objects.Handicap.FiveLevels; break; case Keys.D1: handicap = Objects.Handicap.TenLevels; break; case Keys.H: handicap = Objects.Handicap.HP; break; case Keys.M: handicap = Objects.Handicap.MP; break; case Keys.J: handicap = Objects.Handicap.HPMP; break; case Keys.Z: handicap = Objects.Handicap.ZeroMP; break; case Keys.D7: handicap = Objects.Handicap.Lucky7; break; case Keys.C: handicap = Objects.Handicap.Cure; break; default: //neither break; } if (handicap != Objects.Handicap.UNKNOWN && (SearchResults.Count > 0 || CountHandicaps == 0)) { bool inserted = false; if (CountHandicaps < 21 && CurrentReelSet.Reels[CountHandicaps / 3].Handicaps[CountHandicaps % 3] == Objects.Handicap.UNKNOWN) { CurrentReelSet.Reels[CountHandicaps / 3].Handicaps[CountHandicaps % 3] = handicap; ((PictureBox)this.Controls["pictureBox" + (CountHandicaps + 1)]).Image = Image.FromFile(String.Format(@"{0}\{1}", AppDomain.CurrentDomain.BaseDirectory, Objects.Reel.HandicapFilename(handicap))); inserted = true; CountHandicaps++; } if (inserted) { Search(CountHandicaps); if (SearchResults.Count == 1) { CountHandicaps = 21; } if (SearchResults.Count == 0) { MessageBox.Show("Invalid reel combination"); } } } btnUndo.Enabled = true; UpdateReels(); }