I am assuming from what you said that you may have taken this as a loss under the casualty and theft loss rules
which would allow you a larger deduction
. Whatever type of deduction you claimed, if you received a tax benefit as a result of this judgement, then all or part of that tax benefit may need to reduce your basis.
You said originally that when all of this first started you gave some money directly to your friends and you also paid money directly to the builder and directly to purchase materials. The amount that you gave to your friends would not be considered in this situation as part of your basis. Only the amounts which you gave directly to the builder or amounts you paid directly for the purchase of materials.
Of those amounts, you would need to deduct any tax refunds that you received as a result of amending your returns to claim a casualty/theft deduction. But you would not need to reclaim any tax refund that was for the money you personally paid to your friends.
You have a rather uncommon situation which is going to be a little more complex to figure your basis. But basically your basis is going to be your total out of pocket expense in acquiring this property. But that would not include amounts you paid personally to your friends, as there is no way to tie that money to the cost of the home, as they could have used that money for anything.
Let's just take this as an example. Suppose you gave $100,000 directly to the builder and another $100,000 directly to your friends. Now if the court gave you a judgement for the entire $200,000 and you deducted all of that on your tax returns, let's say that resulted in tax refunds to you of $50,000. You would figure your starting basis by taking the $100,000 you paid the builder directly, minus $25,000 (half of the tax refund you received which was attributable to the portion paid to the builder). So you now have a starting basis of $75,000 in the property. You would then add to that the cost of any additional money you paid to complete the house after the court awarded you ownership of the property. That will be the basis you use in determining any taxable gain you had from this sale.