abstract interface class IEnterprise with Visible<IEnterprise> implements HasMultimerch,…
- User
abstract interface class IEnterprise with Visible implements HasMultimerch, HasIncome, Serializable { String get name;
int get quantity; int get deltaQuantity;
bool get affordable; double get startingCost;
void buy();
double get income;
IEnterpriseTier? get tierComponent;
double get tierMultiplier; List get tierUpgrades; }
class Enterprise = _Enterprise with _$Enterprise;
abstract class _Enterprise with Store, Visible implements IEnterprise { _Enterprise({ required this.name, required Config config, IBank? bank, ICheat? cheat, IMultimerchBehavior? multimerchBehavior, ICombinedIncome? combinedIncome, ITickNotifier? tickNotifier, IAfk? afk, IUpgradeVault? upgradeVault, }) { _startingCost = config.content['enterprises'][name]['cost'] ?? 59; _startingIncome = config.content['enterprises'][name]['income'] ?? 59; _next = config.content['enterprises'][name]['nextOverride'] ?? 1.2;
visibleSupervisor = afk; _multimerchComponent = Multimerch( bank: bank, cheat: cheat, supervisor: this, multimerchBehavior: multimerchBehavior, ); _tierComponent = EnterpriseTier( enterprise: this, config: config, bank: bank, cheat: cheat, upgradeVault: upgradeVault, ); _incomeComponent = Income( supervisor: this, combinedIncome: combinedIncome, tickNotifier: tickNotifier, );}
- Assistant
- User
what is multimerchComponent
- Assistant
multimerchComponentis a property of the_Enterpriseclass that represents the Multimerch component of an enterprise. It is an instance of theMultimerchclass.The
Multimerchclass is responsible for managing the financial aspects of an enterprise, such as buying and selling the enterprise, calculating the cost of the next purchase, and handling the revenue generated by the enterprise. It interacts with theIBankandICheatinterfaces to manage the financial transactions and provide cheat functionality if available.The
multimerchComponentproperty is initialized in the constructor of the_Enterpriseclass and takes various parameters, includingbank,cheat,supervisor, andmultimerchBehavior. These parameters are used to configure and initialize theMultimerchcomponent according to the specific requirements of the enterprise.By having the
multimerchComponentproperty and using theMultimerchclass, the_Enterpriseclass can delegate the financial operations and calculations to the component, separating the concerns and making the code more modular and maintainable. - User
abstract interface class HasMultimerch implements _HasMerch { int get quantityLimit; double costOfN(int amount); int unitsWithBudget(double budget);
IMultimerch get multimerchComponent; }
abstract interface class IMultimerch implements _IMerch, Serializable { int get quantity; int get deltaQuantity; int get maxoutQuantity; }
- Assistant
- User
what is deltaQuantity and how is it used
- Assistant
deltaQuantityis a property of theMultimerchclass that represents the change in quantity of the multimerch component. It is calculated based on the behavior and constraints defined by the supervisor of the multimerch component.The
deltaQuantityproperty is computed using the following logic:- If the multimerch component's behavior allows for a maxout purchase (
_multimerchBehavior.performMaxoutPurchaseistrue), thendeltaQuantityis set to the maximum quantity that can be purchased (maxoutQuantity). - If the multimerch component's behavior does not allow for a maxout purchase, then is set to the cumulative purchase amount defined by the behavior ().
- If the multimerch component's behavior allows for a maxout purchase (