diff --git a/bonemarketsolver/data/buyers.py b/bonemarketsolver/data/buyers.py index a1060b9..b202485 100644 --- a/bonemarketsolver/data/buyers.py +++ b/bonemarketsolver/data/buyers.py @@ -153,6 +153,10 @@ class Buyer(Enum): "Sell the Diplomat a fossil insect", cost = Cost.ACTION.value ) + THE_TRIFLING_DIPLOMAT_REPTILE = Action( + "Sell the Diplomat a fossil reptile", + cost = Cost.ACTION.value + ) THE_TRIFLING_DIPLOMAT_SKULLS = Action( "Sell the Diplomat a skeleton with multiple heads", cost = Cost.ACTION.value diff --git a/bonemarketsolver/data/costs.py b/bonemarketsolver/data/costs.py index 19bd7bd..8649805 100644 --- a/bonemarketsolver/data/costs.py +++ b/bonemarketsolver/data/costs.py @@ -87,6 +87,10 @@ class Cost(Enum): # Various opportunity cards HELL_FAVOURS = ACTION + # Infiltrating... + # Khan's Heart, 10 at a time + INFILTRATING = ACTION/10 + # Volume of Collated Research # Hurlers statue, 10 at a time COLLATED_RESEARCH = (ACTION + 4*HELL_FAVOURS)/10 @@ -171,7 +175,8 @@ class Cost(Enum): SCINTILLACK = 250 # Searing Enigma - SEARING_ENIGMA = 6250 + # Khan's Heart + SEARING_ENIGMA = 2*ACTION + 130*INFILTRATING # Carved Ball of Stygian Ivory STYGIAN_IVORY = 250 diff --git a/bonemarketsolver/solve.py b/bonemarketsolver/solve.py index 59305d5..c523b8e 100644 --- a/bonemarketsolver/solve.py +++ b/bonemarketsolver/solve.py @@ -1182,6 +1182,37 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non del non_negative_amalgamy, non_negative_menace, non_negative_antiquity, compromising_documents, value_remainder, derived_exhaustion + # The Trifling Diplomat - Reptile + model.AddLinearExpressionInDomain(skeleton_in_progress, cp_model.Domain.FromFlatIntervals([160, 169])).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_REPTILE]) + + non_negative_amalgamy = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_REPTILE.name, 'non-negative amalgamy')) + model.AddMaxEquality(non_negative_amalgamy, [amalgamy, 0]) + + non_negative_menace = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_REPTILE.name, 'non-negative menace')) + model.AddMaxEquality(non_negative_menace, [menace, 0]) + + non_negative_antiquity = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_REPTILE.name, 'non-negative antiquity')) + model.AddMaxEquality(non_negative_antiquity, [antiquity, 0]) + + compromising_documents = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_REPTILE.name, 'compromising documents')) + model.AddGeneralMultiplicationEquality(compromising_documents, non_negative_amalgamy, non_negative_menace, non_negative_antiquity) + + value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_REPTILE.name, 'value remainder')) + model.AddModuloEquality(value_remainder, value, 50) + + model.Add(primary_revenue == value - value_remainder + 50).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_REPTILE]) + model.Add(secondary_revenue == 50*compromising_documents).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_REPTILE]) + + model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_REPTILE]) + + # The indirection is necessary for applying an enforcement literal + derived_exhaustion = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_REPTILE.name, 'derived exhaustion')) + model.AddDivisionEquality(derived_exhaustion, compromising_documents, 100) + model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_REPTILE]) + + del non_negative_amalgamy, non_negative_menace, non_negative_antiquity, compromising_documents, value_remainder, derived_exhaustion + + # The Trifling Diplomat - Skulls model.Add(skeleton_in_progress >= 100).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_SKULLS]) model.Add(skulls >= 5).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_SKULLS])