public SummonAction(IScope scope, ICost cost, UnitData unit, IScreenEffect screenEffect) { _scope = scope; _cost = cost; _unit = unit; _screenEffect = screenEffect; }
void IPayabilityObserver.NotifyPayable(bool payable, ICost source) { foreach (var observer in impactObservers) { observer.NotifyImpact(payable, this); } }
protected CostBatch addAssocCost(ICost cost) { CostBatch deltas = new CostBatch(); bool containsItem = assocCostDictionary.ContainsKey(cost.Guid); if (containsItem) { CostSummaryItem item = assocCostDictionary[cost.Guid]; CostBatch delta = item.AddQuantity(1); AssocTECCostTotal += delta.GetCost(CostType.TEC); AssocTECLaborTotal += delta.GetLabor(CostType.TEC); AssocElecCostTotal += delta.GetCost(CostType.Electrical); AssocElecLaborTotal += delta.GetLabor(CostType.Electrical); deltas += delta; } else { CostSummaryItem item = new CostSummaryItem(cost); assocCostDictionary.Add(cost.Guid, item); if (cost.Type == CostType.TEC) { _assocTECItems.Add(item); AssocTECCostTotal += item.TotalCost; AssocTECLaborTotal += item.TotalLabor; } else if (cost.Type == CostType.Electrical) { _assocElecItems.Add(item); AssocElecCostTotal += item.TotalCost; AssocElecLaborTotal += item.TotalLabor; } deltas += new CostBatch(item.TotalCost, item.TotalLabor, cost.Type); } return(deltas); }
public ResourceCost(ICost cost, ICost overtime) { if (cost == null) { throw new ArgumentNullException("cost"); } if (cost.TableNameOrDescription != "ToolCost") { throw new ArgumentException($"Incorrect TableNameOrDescription: Expected ToolCost, got {cost.TableNameOrDescription}", "cost"); } if (overtime == null) { throw new ArgumentNullException("overtime"); } if (overtime.TableNameOrDescription != "ToolOvertimeCost") { throw new ArgumentException($"Incorrect TableNameOrDescription: Expected ToolOvertimeCost, got {overtime.TableNameOrDescription}", "overtime"); } if (cost.ChargeTypeID != overtime.ChargeTypeID) { throw new ArgumentException($"ChargeTypeID mismatch: cost.ChargeTypeID = {cost.ChargeTypeID}, overtime.ChargeTypeID = {overtime.ChargeTypeID}"); } ResourceID = cost.RecordID.GetValueOrDefault(); ChargeTypeID = cost.ChargeTypeID; AcctPer = cost.AcctPer; AddVal = cost.AddVal; MulVal = cost.MulVal; OvertimeMultiplier = overtime.MulVal; }
public GiveAbnormalConditionAction(IScope scope, ICost cost, IScreenEffect screenEffect, IAbnormalCondition cond) { _scope = scope; _cost = cost; _screenEffect = screenEffect; _cond = cond; }
public MagicAction(IScope scope, ICost cost, int power, AttackType attackType, IScreenEffect screenEffect) { _scope = scope; _cost = cost; _power = power; _attackType = attackType; _screenEffect = screenEffect; }
public WallCrashAction(IScope scope, ICost cost, IScreenEffect screenEffect, int power, AttackType attackType) { _scope = scope; _cost = cost; _screenEffect = screenEffect; _power = power; _attackType = attackType; }
public ActivatedAbilityBase(ICondition condition, ICost cost, IEffect effect) { Condition = condition; Condition.Ability = this; Cost = cost; Cost.Ability = this; Effect = effect; Effect.Ability = this; }
public DelugeAction(IScope scope, ICost cost, IScreenEffect screenEffect, int power, AttackType attackType, Landform waterLandform) { _scope = scope; _cost = cost; _screenEffect = screenEffect; _brinkLandform = waterLandform; _power = power; _attackType = attackType; }
void IPayabilityObserver.NotifyPayable(bool payable, ICost source) { payabilities[source] = payable; var allPayable = payabilities.All(payability => payability.Value); foreach (var observer in observers) { observer.NotifyPayable(allPayable, this); } }
public void RemoveCost(ICost cost) { if (typeDictionary.ContainsKey(cost.Type)) { typeDictionary[cost.Type] -= new CostObject(cost); } else { typeDictionary.Add(cost.Type, (new CostObject(cost) * -1)); } }
public void AddCost(ICost cost) { if (typeDictionary.ContainsKey(cost.Type)) { typeDictionary[cost.Type] += new CostObject(cost); } else { typeDictionary.Add(cost.Type, new CostObject(cost)); } }
public SkillAction(IScope scope, ICost cost, int power, int maxTimes, AttackType attackType, AttackDependency atkDependency, DefenseDependency defDependency, IScreenEffect screenEffect) { _scope = scope; _cost = cost; _power = power; _maxTimes = Math.Max(1, maxTimes); _attackType = attackType; _atkDependency = atkDependency; _defDependency = defDependency; _screenEffect = screenEffect; }
public CostSummaryItem(ICost cost) : base(Guid.NewGuid()) { _cost = cost; if (cost is TECMisc misc) { _quantity = misc.Quantity; } else { _quantity = 1; } updateTotals(); }
public static void AssignRandomCostProperties(this ICost cost, TECCatalogs catalogs, Random rand) { if (cost is TECScope scope) { scope.AssignRandomScopeProperties(catalogs, rand); } else if (cost is TECTagged tagged) { tagged.AssignRandomTaggedProperties(catalogs, rand); } cost.Cost = (rand.NextDouble() * 100); cost.Labor = (rand.NextDouble() * 100); }
void IPayabilityObserver.NotifyPayable(bool payable, ICost source) { if (payable && !card.Faceup) { foreach (var observer in observers) { observer.NotifyRezzable(this); } } else { foreach (var observer in observers) { observer.NotifyNotRezzable(); } } }
protected CostBatch removeRatedCost(ICost cost, double length) { if (length > 0) { bool containsItem = ratedCostDictionary.ContainsKey(cost.Guid); if (containsItem) { RatedCostSummaryItem item = ratedCostDictionary[cost.Guid]; CostBatch delta = item.RemoveLength(length); if (cost.Type == CostType.TEC) { RatedTECCostTotal += delta.GetCost(CostType.TEC); RatedTECLaborTotal += delta.GetLabor(CostType.TEC); } else if (cost.Type == CostType.Electrical) { RatedElecCostTotal += delta.GetCost(CostType.Electrical); RatedElecLaborTotal += delta.GetLabor(CostType.Electrical); } if (item.Length <= 0) { ratedCostDictionary.Remove(cost.Guid); if (cost.Type == CostType.TEC) { _ratedTECItems.Remove(item); } else if (cost.Type == CostType.Electrical) { _ratedElecItems.Remove(item); } } return(delta); } else { logger.Error("Rated cost not found. Cannot remove rated cost length. Cost: {0}", cost.Name); return(new CostBatch()); } } else { return(new CostBatch()); } }
public void Load_Templates_AssociatedCosts() { Guid expectedTECGuid = new Guid("1c2a7631-9e3b-4006-ada7-12d6cee52f08"); string expectedTECName = "Test TEC Associated Cost"; double expectedICost = 31; double expectedTECLabor = 13; CostType expectedTECType = CostType.TEC; Guid expectedElectricalGuid = new Guid("63ed1eb7-c05b-440b-9e15-397f64ff05c7"); string expectedElectricalName = "Test Electrical Associated Cost"; double expectedElectricalCost = 42; double expectedElectricalLabor = 24; CostType expectedElectricalType = CostType.Electrical; ICost actualICost = null; ICost actualElectricalCost = null; foreach (ICost cost in actualTemplates.Catalogs.AssociatedCosts) { if (cost.Guid == expectedTECGuid) { actualICost = cost; } else if (cost.Guid == expectedElectricalGuid) { actualElectricalCost = cost; } if (actualICost != null && actualElectricalCost != null) { break; } } //Assert Assert.AreEqual(expectedTECName, actualICost.Name, "TEC cost name didn't load properly."); Assert.AreEqual(expectedICost, actualICost.Cost, "TEC cost cost didn't load properly."); Assert.AreEqual(expectedTECLabor, actualICost.Labor, "TEC cost labor didn't load properly."); Assert.AreEqual(expectedTECType, actualICost.Type, "TEC cost type didn't load properly."); Assert.AreEqual(expectedElectricalName, actualElectricalCost.Name, "Electrical cost name didn't load properly."); Assert.AreEqual(expectedElectricalCost, actualElectricalCost.Cost, "Electrical cost cost didn't load properly."); Assert.AreEqual(expectedElectricalLabor, actualElectricalCost.Labor, "Electrical cost labor didn't load properly."); Assert.AreEqual(expectedElectricalType, actualElectricalCost.Type, "Electrical cost type didn't load properly."); }
public decimal Calculate(Ride ride) { cost = CostFactory.GetRateInstance(ride.State); var timed = ride.Minutes / cost.PerMinute; var traveled = ride.Miles / cost.PerDistance; var total = cost.BaseFee + cost.Tax + ((timed + traveled) * cost.Rate); if (ride.StartDateTime.IsPeakHour()) { total += cost.PeakCost; } if (ride.StartDateTime.IsNight()) { total += cost.NightTimeRate; } return(total); }
protected CostBatch addRatedCost(ICost cost, double length) { bool containsItem = ratedCostDictionary.ContainsKey(cost.Guid); if (containsItem) { RatedCostSummaryItem item = ratedCostDictionary[cost.Guid]; CostBatch delta = item.AddLength(length); if (cost.Type == CostType.TEC) { RatedTECCostTotal += delta.GetCost(CostType.TEC); RatedTECLaborTotal += delta.GetLabor(CostType.TEC); } else if (cost.Type == CostType.Electrical) { RatedElecCostTotal += delta.GetCost(CostType.Electrical); RatedElecLaborTotal += delta.GetLabor(CostType.Electrical); } return(delta); } else { RatedCostSummaryItem item = new RatedCostSummaryItem(cost, length); ratedCostDictionary.Add(cost.Guid, item); if (cost.Type == CostType.TEC) { _ratedTECItems.Add(item); RatedTECCostTotal += item.TotalCost; RatedTECLaborTotal += item.TotalLabor; } else if (cost.Type == CostType.Electrical) { _ratedElecItems.Add(item); RatedElecCostTotal += item.TotalCost; RatedElecLaborTotal += item.TotalLabor; } return(new CostBatch(item.TotalCost, item.TotalLabor, cost.Type)); } }
private static double GetCost(ResourceUsage resource, Meter meter) { ICost costImplementation = null; if (meter.MeterRates.Count() == 1) { costImplementation = new DirectCost(); } else if (meter.MeterRates.Count() > 1) { if (resource.Type == StorageAccountType) { costImplementation = new BracketCost(); } else { costImplementation = new ScaledCost(); } } return(costImplementation.CalculateCosts(resource, meter)); }
public CostBatch RemoveCost(ICost cost) { bool containsItem = assocCostDictionary.ContainsKey(cost.Guid); if (containsItem) { CostSummaryItem item = assocCostDictionary[cost.Guid]; CostBatch delta = item.RemoveQuantity(1); if (cost.Type == CostType.TEC) { AssocTECCostTotal += delta.GetCost(CostType.TEC); AssocTECLaborTotal += delta.GetLabor(CostType.TEC); } else if (cost.Type == CostType.Electrical) { AssocElecCostTotal += delta.GetCost(CostType.Electrical); AssocElecLaborTotal += delta.GetLabor(CostType.Electrical); } if (item.Quantity < 1) { assocCostDictionary.Remove(cost.Guid); if (cost.Type == CostType.TEC) { _assocTECItems.Remove(item); } else if (cost.Type == CostType.Electrical) { _assocElecItems.Remove(item); } } return(delta); } else { logger.Error("Cost not found. Cannot remove cost. Cost: {0}", cost.Name); return(new CostBatch()); } }
public CostBatch(ICost cost) : this() { typeDictionary.Add(cost.Type, new CostObject(cost)); }
public PayToTrash(ICost cost, Card card) { this.cost = cost; this.card = card; }
public AI(ICost cost, uint depth, Player player) { _cost = cost; _player = player; _depth = depth; }
public Cost(ICost strategy) { _strategy = strategy; }
public Ability(ICost cost, IEffect effect) { this.cost = cost; this.effect = effect; }
void IPayabilityObserver.NotifyPayable(bool payable, ICost source) { this.payable = payable; Update(); }
public CostObject(ICost cost) { Cost = cost.Cost; Labor = cost.Labor; }
public ReportLogic(IInspections inspection, ICost cost) { _inspection = inspection; _cost = cost; }
public DrawCardActivatedAbility(ICost cost, IEffect effect) : base(new NoCondition(), cost, effect) { }
public DrawCardActivatedAbility(ICondition condition, ICost cost, IEffect effect) : base(condition, cost, effect) { }
internal Cost(CostType type) { TYPE = type; costFunction = costFunctions[type]; }
public ClearBadConditonAction(IScope scope, ICost cost, IScreenEffect screenEffect) { _scope = scope; _cost = cost; _screenEffect = screenEffect; }
private static (int nextRow, int nextColumn) addCostRow(IXLWorksheet worksheet, ICost cost, int startRow, int startColumn) { int x = startRow; int y = startColumn; worksheet.Cell(x, y).Value = cost.Name; y++; worksheet.Cell(x, y).Value = cost.Description; y++; worksheet.Cell(x, y).Value = cost.Cost; y++; worksheet.Cell(x, y).Value = cost.Labor; y++; worksheet.Cell(x, y).Value = cost.Type; y++; return(x + 1, y); }
//Constructor public RatedCostSummaryItem(ICost ratedCost, double length) : base(Guid.NewGuid()) { _ratedCost = ratedCost; _length = length; updateTotals(); }
public ShippingCostController(ICost cost) { _cost = cost; }