def buildAttackFromDB(cursor, name): """ Build an Attack from a Database connection """ attack = Attack() cursor.execute("SELECT Type.name from Attack, Type where Attack.name = ? and Attack.type_id = Type.id", (name,)) type = cursor.fetchone()[0] attack.name = name attack.type = type # Delegates for delegateCategory in AttackFactory.factories.keys(): delegate = AttackFactory.getDelegateDB(cursor, delegateCategory, attack) attack.addDelegate(delegateCategory, delegate) attack.effectDelegates = EffectDelegateFactory.loadAllEffectsFromDB(cursor, attack) return attack