public static PlayerActionShortcut FromSpell(PlayerActionShortcutDto shortcutDto, Character player, Spell spell, int slotLevelOverride = 0, string damageStr = null, string suffix = "") { PlayerActionShortcut result = FromAction(shortcutDto, damageStr, suffix, slotLevelOverride, player); result.ProficiencyBonus = (int)Math.Round(player.proficiencyBonus); result.ProcessDieStr(shortcutDto, damageStr); result.Type = GetDiceRollType(GetDiceRollTypeStr(spell)); result.UsesMagic = true; int spellSlotLevel = spell.Level; if (slotLevelOverride > 0) { spellSlotLevel = slotLevelOverride; } result.AddSpell(spellSlotLevel, player, spell); result.Description = spell.Description; result.AttackingAbility = player == null ? Ability.none : player.spellCastingAbility; result.ProcessDieStr(shortcutDto, damageStr); bool mustRollDiceToCast = result.Spell.MustRollDiceToCast(); bool isWindup = result.Spell != null && !result.Spell.Duration.HasValue() && mustRollDiceToCast; result.AddEffect(shortcutDto, SpellWindupPrefix, player, spellSlotLevel, isWindup); if (!mustRollDiceToCast) { result.Type = DiceRollType.CastSimpleSpell; } if (player != null) { result.AttackingAbilityModifier = player.GetSpellcastingAbilityModifier(); } return(result); }
public Spell Clone(Character player, int spellSlotLevel) { Spell result = new Spell(); RecalculateDiceAndAmmo(spellSlotLevel, player.level, player.SpellcastingAbilityModifier); result.BonusPerLevel = BonusPerLevel; result.BonusThreshold = BonusThreshold; result.BonusMax = BonusMax; result.CastingTime = CastingTime; result.Components = Components; result.Description = Description; result.DieStr = DieStr; result.Duration = Duration; result.Level = Level; result.Material = Material; result.Name = Name; result.Index = Index; result.OnCast = OnCast; result.OnValidate = OnValidate; result.OnReceived = OnReceived; result.OnPreparing = OnPreparing; result.OnPreparationComplete = OnPreparationComplete; result.OnTargetFailsSave = OnTargetFailsSave; result.OnGetAttackAbility = OnGetAttackAbility; result.OnDispel = OnDispel; result.OnPlayerPreparesAttack = OnPlayerPreparesAttack; result.OnDieRollStopped = OnDieRollStopped; result.OnPlayerAttacks = OnPlayerAttacks; result.OnPlayerHitsTarget = OnPlayerHitsTarget; result.OriginalDieStr = OriginalDieStr; result.OriginalAmmoCount = OriginalAmmoCount; result.AmmoCount = AmmoCount; result.PerLevelBonus = PerLevelBonus; result.Range = Range; result.RangeType = RangeType; result.RequiresConcentration = RequiresConcentration; result.SavingThrowAbility = SavingThrowAbility; result.AvailableWhen = AvailableWhen; result.SpellCasterLevel = SpellCasterLevel; result.SpellType = SpellType; result.SchoolOfMagic = SchoolOfMagic; result.CastingTimeStr = CastingTimeStr; result.DurationStr = DurationStr; result.RangeStr = RangeStr; result.ComponentsStr = ComponentsStr; result.Bright1 = Bright1; result.Bright2 = Bright2; result.Hue1 = Hue1; result.Hue2 = Hue2; // Override... result.OwnerId = player != null ? player.playerID : -1; result.SpellSlotLevel = spellSlotLevel; result.RecalculateDiceAndAmmo(spellSlotLevel, player.level, player.GetSpellcastingAbilityModifier()); return(result); }
public static List <Spell> GetAll(string spellName, Character character, int spellSlotLevel = 0) { int spellLevel = 0; int spellcastingAbilityModifier = 0; if (character != null) { spellLevel = character.GetSpellcastingLevel(); spellcastingAbilityModifier = character.GetSpellcastingAbilityModifier(); } return(GetAll(spellName, spellSlotLevel, spellLevel, spellcastingAbilityModifier)); }
public static Spell Get(string spellName, Character character, int spellSlotLevel = 0) { return(Get(spellName, spellSlotLevel, character.GetSpellcastingLevel(), character.GetSpellcastingAbilityModifier())); }