public void OnEventAboutToTrigger(RuleApplyMetamagic evt) { var spell = this.Param?.Blueprint as BlueprintAbility; if (spell == null) { return; } bool same_spells = SpellDuplicates.isDuplicateOrParent(spell, evt.Spell); if (!same_spells) { return; } var spellbook = evt.Spellbook; if (spellbook == null || spellbook.GetSpellLevel(spell) > max_spell_level) { return; } if (evt.AppliedMetamagics.Count == 0) { return; } int reduction = evt.AppliedMetamagics.Max(m => m == Metamagic.Heighten ? 0 : m.DefaultCost()); evt.ReduceCost(reduction); }
public void OnEventAboutToTrigger(RuleApplyMetamagic evt) { var spell = this.Param?.Blueprint as BlueprintAbility; if (spell == null) { return; } var spellbook = evt.Spellbook; if (spellbook == null || !SpellDuplicates.isDuplicateOrParent(spell, evt.Spell)) { return; } if (evt.AppliedMetamagics.Count == 0) { return; } evt.ReduceCost(reduction); }