private void GetSummons(ISlotHolder sh, List <Summon> list) { for (int i = 0; i < sh.Links; i++) { Materia left = sh.Slots[i * 2]; Materia right = sh.Slots[(i * 2) + 1]; if (left is SummonMateria && right is SupportMateria) { Materia temp = left; left = right; right = temp; } if (right is SummonMateria && left is SupportMateria) { bool replace = false; for (int j = 0; j < list.Count; j++) { if (list[j].Name == right.Name) { replace = true; Summon ss = list[j]; ss.AddAbility((SupportMateria)left); list[j] = ss; } } if (!replace) { Summon t = new Summon(right.Name, ((SummonMateria)right)); t.AddAbility((SupportMateria)left); list.Add(t); } } else { if (right is SummonMateria) { list.Add(new Summon(right.Name, ((SummonMateria)right))); } if (left is SummonMateria) { list.Add(new Summon(left.Name, ((SummonMateria)left))); } } } for (int j = sh.Links * 2; j < sh.Slots.Length; j++) { Materia m = sh.Slots[j]; if (m is SummonMateria) { list.Add(new Summon(m.Name, (SummonMateria)m)); } } }
private void GetMagicSpells(ISlotHolder sh, List <MagicSpell> list) { for (int i = 0; i < sh.Links; i++) { Materia left = sh.Slots[i * 2]; Materia right = sh.Slots[(i * 2) + 1]; if (left is MagicMateria && right is SupportMateria) { Materia temp = left; left = right; right = temp; } if (right is MagicMateria && left is SupportMateria) { foreach (Spell s in ((MagicMateria)right).GetSpells) { bool replace = false; for (int j = 0; j < list.Count; j++) { if (list[j].ID == s.ID) { replace = true; MagicSpell ms = list[j]; ms.AddAbility((SupportMateria)left); list[j] = ms; } } if (!replace) { MagicSpell t = new MagicSpell(s); t.AddAbility((SupportMateria)left); list.Add(t); } } } else { if (right is MagicMateria) { foreach (Spell s in ((MagicMateria)right).GetSpells) { list.Add(new MagicSpell(s)); } } if (left is MagicMateria) { foreach (Spell s in ((MagicMateria)left).GetSpells) { list.Add(new MagicSpell(s)); } } } } for (int j = sh.Links * 2; j < sh.Slots.Length; j++) { Materia m = sh.Slots[j]; if (m is MagicMateria) { foreach (Spell s in ((MagicMateria)m).GetSpells) { list.Add(new MagicSpell(s)); } } } }