internal Stack Satisfy(Stack stack, double quantity) { var deficit = MaxQuantity - CurrentQuantity; var normalizedQuantity = Math.Min(quantity, deficit); this.CurrentQuantity += normalizedQuantity; return(Stack.SplitStack(stack, normalizedQuantity).Item2); }
internal Stack TakeItemFrom(Good good, double quantity) { var sp = Stack.SplitStack(this.assets[good], quantity); if (sp.Item2 == null) { this.assets.Remove(good); } else { this.assets[good] = sp.Item2; } return(sp.Item1); }