Can A Spell With An Attack Roll Be Used As The Attack - Traps 5e

Can A Spell With An Attack Roll Be Used As The Attack - Traps 5e, transparent png