private static IEnumerable <string> ChooseSpells(BossSaffron boss) { if (USE_TESTING_SPELL_LIST) { return(TESTING_SPELL_LIST); } IEnumerable <string> newSpellsForMod = EXTRA_SPELLS; if (boss.tier > 2) { Debug.Log("Adding 'hard spells' to Saffron's possible spells."); newSpellsForMod = newSpellsForMod.Concat(HARD_SPELLS); } List <string> spells = boss.ctrl.itemMan.saffronBossSpellList.Select(s => s.itemID) .Concat(newSpellsForMod) .Distinct() // Proceed sensibly if someone else adds SaffronBoss tags to a spell we added .ToList(); // This - 1 thing is copied from the base code, but I'm not sure it actually makes any sense List <int> intList = Utils.RandomList(spells.Count - 1, false, true); return(intList .Take(5 + boss.tier) .Select(i => spells[i]) .ToList()); }
private static void nerfSpell(SpellObject spell, BossSaffron boss) { if (!SPELLS_TO_NERF.Contains(spell.itemID)) { return; } spell.damage *= nerfValue(boss.tier); }
// Load spells // Does not modify boss.randSpells private static List <SpellObject> LoadSpells(BossSaffron boss) { List <SpellObject> spells = ChooseSpells(boss) .Select((spellId) => boss.ctrl.deCtrl.CreateSpellBase(spellId, (Being)boss, true)) .ToList(); foreach (SpellObject spell in spells) { nerfSpell(spell, boss); } return(spells); }
static bool DoAllExpectedSpellsExist(BossSaffron boss) { bool ok = true; foreach (string spellId in TESTING_SPELL_LIST.Concat(EXTRA_SPELLS).Concat(HARD_SPELLS)) { if (!boss.ctrl.itemMan.spellDictionary.ContainsKey(spellId)) { Debug.LogWarning($"Spell ID {spellId} does not correspond to a real spell."); ok = false; } } return(ok); }
private static void ReplacementLoadSpells(BossSaffron boss) { Debug.Log("Reloading spells for SuperSaffron."); if (!DoAllExpectedSpellsExist(boss)) { Debug.LogWarning("Ran into trouble. SuperSaffron doing nothing."); return; } List <SpellObject> newSpells = LoadSpells(boss); boss.randSpells.Clear(); boss.randSpells.AddRange(newSpells); string spellIds = boss.randSpells.Select(s => s.itemID).Join(); Debug.Log($"Successfully reloaded spells for SuperSaffron: {spellIds}"); }
static void Postfix(BossSaffron __instance) { ReplacementLoadSpells(__instance); }