dnd logic