Example #1
0
        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);
        }
Example #2
0
        private static PlayerActionShortcut FromSpell(PlayerActionShortcutDto shortcutDto, Character player, Spell spell, int slotLevelOverride = 0, string damageStr = null, string suffix = "")
        {
            PlayerActionShortcut result = FromAction(shortcutDto, damageStr, suffix, slotLevelOverride);

            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 isWindup = result.Spell != null && !result.Spell.Duration.HasValue() && result.Spell.MustRollDiceToCast();

            result.AddEffect(shortcutDto, SpellWindupPrefix, player, spellSlotLevel, isWindup);
            return(result);
        }