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 CastedSpellDto(Spell spell, SpellTarget target) { Spell = spell; Target = target; }
void AddSpell(int spellSlotLevel, Character player, Spell spell) { Spell = spell.Clone(player, spellSlotLevel); Dice = Spell.DieStr; Part = DndUtils.ToTurnPart(Spell.CastingTime); }