Advertisement
Guest User

Untitled

a guest
Feb 7th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 10.84 KB | None | 0 0
  1. using Amplitude.Framework.Simulation;
  2. using Amplitude.Framework.Simulation.Attributes;
  3. using Amplitude.Mercury.Data.AI;
  4. using Amplitude.Mercury.Data.Simulation;
  5. using Amplitude.Mercury.Interop;
  6. using Amplitude.Serialization;
  7.  
  8. namespace Amplitude.Mercury.Simulation
  9. {
  10.     internal class DiplomaticAmbassy : SimulationEntity
  11.     {
  12.         [PropertyDefinition(BaseValue = 0.8f)]
  13.         public Property LesserTradeCostMultiplier;
  14.  
  15.         [PropertyDefinition(BaseValue = 0.5f)]
  16.         public Property GreaterTradeCostMultiplier;
  17.  
  18.         [PropertyDefinition(BaseValue = 50f, MaxValue = 100f, MinValue = 0f)]
  19.         public Property BaseMoral;
  20.  
  21.         public EditableProperty NumberOfAgreementSigned;
  22.  
  23.         [PropertyDefinition(BaseValue = -5f)]
  24.         public Property BaseMoralPerAgreementSigned;
  25.  
  26.         [PropertyDefinition(BaseValue = 0f)]
  27.         public Property OnGoingDemandMoralGain;
  28.  
  29.         [PropertyDefinition(BaseValue = 0f)]
  30.         public Property OnGoingTheirCityOccupiedByUsMoralGain;
  31.  
  32.         [PropertyDefinition(BaseValue = -4f)]
  33.         public Property OnGoingOurCityOccupiedByThemMoralGain;
  34.  
  35.         [PropertyDefinition(BaseValue = 0f)]
  36.         public Property OnGoingWarAgainstPacifistMoralGain;
  37.  
  38.         [PropertyDefinition(BaseValue = 0f)]
  39.         public Property OnGoingMyWarMoralGainFromMyStabilityMoralGain;
  40.  
  41.         [PropertyDefinition(BaseValue = 0f)]
  42.         public Property OnGoingTheirTerritoryIsUnderOurInfluence;
  43.  
  44.         [PropertyDefinition(BaseValue = 0f)]
  45.         public Property OnGoingOurTerritoryIsUnderTheirInfluence;
  46.  
  47.         [PropertyDefinition(BaseValue = 0f)]
  48.         public Property OnGoingThisJustWarWasTheirFaultMoralGain;
  49.  
  50.         [PropertyDefinition(BaseValue = -2f)]
  51.         public Property OnGoingThisUnjustWarWasOurFaultMoralGain;
  52.  
  53.         [PropertyDefinition(BaseValue = -1f)]
  54.         public Property OnGoingThisJustWarWasOurFaultMoralGain;
  55.  
  56.         [PropertyDefinition(BaseValue = 0f)]
  57.         public Property OnGoingThisUnjustWarWasTheirFaultMoralGain;
  58.  
  59.         [PropertyDefinition(BaseValue = 0f)]
  60.         public Property OnGoingProximityStateThisWarWasOurFaultMoralGain;
  61.  
  62.         [PropertyDefinition(BaseValue = 0f)]
  63.         public Property OnGoingProximityStateThisWarWasTheirFaultMoralGain;
  64.  
  65.         [PropertyDefinition(BaseValue = 0f)]
  66.         public Property OnGoingTheirEmpireHasNoCapital;
  67.  
  68.         [PropertyDefinition(BaseValue = -5f)]
  69.         public Property OnGoingOurEmpireHasNoCapital;
  70.  
  71.         [PropertyDefinition(BaseValue = 0f)]
  72.         public Property NoWarAndTheyHaveMoreOngoingDemands;
  73.  
  74.         [PropertyDefinition(BaseValue = 3f)]
  75.         public Property NoWarAndWeHaveMoreOngoingDemands;
  76.  
  77.         [PropertyDefinition(BaseValue = 2f)]
  78.         public Property NoWarAndWeHaveLessThanBaseMoral;
  79.  
  80.         [PropertyDefinition(BaseValue = -1f)]
  81.         public Property NoWarAndWeHaveMoreThanBaseMoral;
  82.  
  83.         [PropertyDefinition(BaseValue = 5f)]
  84.         public Property InstantGrievanceMoralGain;
  85.  
  86.         [PropertyDefinition(BaseValue = 8f)]
  87.         public Property InstantBattleWonMoralGain;
  88.  
  89.         [PropertyDefinition(BaseValue = -8f)]
  90.         public Property InstantBattleLostMoralGain;
  91.  
  92.         [PropertyDefinition(BaseValue = -5f)]
  93.         public Property InstantMyEmpireRetreatedMoralGain;
  94.  
  95.         [PropertyDefinition(BaseValue = 5f)]
  96.         public Property InstantOtherEmpireRetreatedMoralGain;
  97.  
  98.         [PropertyDefinition(BaseValue = 5f)]
  99.         public Property InstantMyExtensionHasBeenDamagedMoralGain;
  100.  
  101.         [PropertyDefinition(BaseValue = 10f)]
  102.         public Property InstantMyAdministrativeCentreHasBeenDamaged;
  103.  
  104.         [PropertyDefinition(BaseValue = 0f)]
  105.         public Property InstantDamageEnemyExtensionMoralGain;
  106.  
  107.         [PropertyDefinition(BaseValue = 0f)]
  108.         public Property InstantDamageEnemyAdministrativeCentreMoralGain;
  109.  
  110.         [PropertyDefinition(BaseValue = 0f)]
  111.         public Property InstantMyEmpireCapturedCityMoralGain;
  112.  
  113.         [PropertyDefinition(BaseValue = 0f)]
  114.         public Property InstantOtherEmpireCapturedCityMoralGain;
  115.  
  116.         [PropertyDefinition(BaseValue = 5f)]
  117.         public Property InstantMyEmpireCapturedCampMoralGain;
  118.  
  119.         [PropertyDefinition(BaseValue = -5f)]
  120.         public Property InstantOtherEmpireCapturedCampMoralGain;
  121.  
  122.         [PropertyDefinition(BaseValue = 0f)]
  123.         public Property InstantRefuseOtherDemandMoralGain;
  124.  
  125.         [PropertyDefinition(BaseValue = 20f)]
  126.         public Property InstantOtherRefusedOurSurrenderMoralGain;
  127.  
  128.         [PropertyDefinition(BaseValue = -10f)]
  129.         public Property InstantIRefusedOtherSurrenderMoralGain;
  130.  
  131.         [PropertyDefinition(BaseValue = 0f)]
  132.         public Property InstantDeclareEndOfAllianceMoralGain;
  133.  
  134.         [PropertyDefinition(BaseValue = 0f)]
  135.         public Property InstantBreakAgreementMoralGain;
  136.  
  137.         [PropertyDefinition(BaseValue = 5f)]
  138.         public Property InstantWithdrawMyDemandMoralGain;
  139.  
  140.         [PropertyDefinition(BaseValue = 10f)]
  141.         public Property InstantAcceptOtherDemandMoralGain;
  142.  
  143.         [PropertyDefinition(BaseValue = 0f)]
  144.         public Property InstantProposeEndWarTreatyMoralGain;
  145.  
  146.         [PropertyDefinition(BaseValue = 0f)]
  147.         public Property InstantProposeEndCrisisTreatyMoralGain;
  148.  
  149.         [PropertyDefinition(BaseValue = 0f)]
  150.         public Property InstantCreateDemandsMoralGain;
  151.  
  152.         [PropertyDefinition(BaseValue = 0f)]
  153.         public Property InstantWarStartsMoralGain;
  154.  
  155.         [PropertyDefinition(BaseValue = 0f)]
  156.         public Property InstantDeclareWarMoralGain;
  157.  
  158.         [PropertyDefinition(BaseValue = -5f)]
  159.         public Property InstantWhitePeaceGotRefusedMoralGain;
  160.  
  161.         [PropertyDefinition(BaseValue = 0f)]
  162.         public Property OnGoingOtherEmpireWarMoralGainFromMyStability;
  163.  
  164.         [PropertyDefinition(BaseValue = 20f)]
  165.         public Property InstantOtherEmpireDeclaredEndOfAlliance;
  166.  
  167.         [PropertyDefinition(BaseValue = 10f)]
  168.         public Property InstantOtherEmpireBrokeAgreement;
  169.  
  170.         [PropertyDefinition(BaseValue = 10f)]
  171.         public Property InstantOtherEmpireRefusedDemands;
  172.  
  173.         [PropertyDefinition(BaseValue = -5f)]
  174.         public Property MyEmpireAbandonedSiegeMoralGain;
  175.  
  176.         [PropertyDefinition(BaseValue = 5f)]
  177.         public Property OtherEmpireAbandonedSiegeMoralGain;
  178.  
  179.         [PropertyDefinition(BaseValue = 1f)]
  180.         public Property OnGoingWarWithNoDemandsAgainstMeMoralMultiplier;
  181.  
  182.         [PropertyDefinition(BaseValue = 5f)]
  183.         public Property NumberOfTurnTimeoutOnDiplomaticAction;
  184.  
  185.         [PropertyDefinition(BaseValue = 0f)]
  186.         public EditableProperty NumberOfOverrideSinceLastNaturalTimeout;
  187.  
  188.         [PropertyDefinition(BaseValue = 80f)]
  189.         public Property DeclareFormalWarMoralThreshold;
  190.  
  191.         [PropertyDefinition(BaseValue = 20f)]
  192.         public Property DeclareSurpriseWarMoralThreshold;
  193.  
  194.         [PropertyDefinition(BaseValue = 25f)]
  195.         public Property LowMoralNotificationThreshold;
  196.  
  197.         public Reference<MajorEmpire> MyEmpire = new Reference<MajorEmpire>();
  198.  
  199.         public Reference<MajorEmpire> OtherEmpire = new Reference<MajorEmpire>();
  200.  
  201.         public Reference<DiplomaticAmbassy> OtherAmbassy = new Reference<DiplomaticAmbassy>();
  202.  
  203.         public Reference<DiplomaticRelation> DiplomaticRelation = new Reference<DiplomaticRelation>();
  204.  
  205.         internal AvailableGrievanceCollection AvailableGrievances = AvailableGrievanceCollection.Default;
  206.  
  207.         internal OnGoingDemandCollection OnGoingDemands = OnGoingDemandCollection.Default;
  208.  
  209.         internal AIBehaviourState PreviousAIBehaviourState = AIBehaviourState.Unknown;
  210.  
  211.         internal AIBehaviourState CurrentAIBehaviourState = AIBehaviourState.Unknown;
  212.  
  213.         internal int AIBehaviourStateChangeDate;
  214.  
  215.         internal int AITransitioningStates;
  216.  
  217.         internal float AIRapportScore;
  218.  
  219.         internal float AISuperiorityScore;
  220.  
  221.         internal DiplomaticScoreModifierEntry[] AIFeedbackEntries;
  222.  
  223.         internal AIMoodMessage AIMoodMessage;
  224.  
  225.         internal int AIMoodMessageTurn;
  226.  
  227.         internal RelationTendency AIRelationTendency;
  228.  
  229.         internal DiplomaticMoral EmpireMoral = DiplomaticMoral.Default;
  230.  
  231.         internal int CurrentSurrenderToOtherProposition = -1;
  232.  
  233.         internal int ForcedOtherToSurrenderProposition = -1;
  234.  
  235.         internal DiplomaticAbility CurrentAbilities;
  236.  
  237.         internal int TurnNumberAtWhichTimeoutEnds;
  238.  
  239.         internal bool HasStalled;
  240.  
  241.         public override void Serialize(Serializer serializer)
  242.         {
  243.             MyEmpire.Serialize("MyEmpire", serializer);
  244.             OtherEmpire.Serialize("OtherEmpire", serializer);
  245.             OtherAmbassy.Serialize("OtherAmbassy", serializer);
  246.             DiplomaticRelation.Serialize("DiplomaticRelation", serializer);
  247.             base.Serialize(serializer);
  248.             AvailableGrievances = serializer.SerializeElement("AvailableGrievances", AvailableGrievances);
  249.             OnGoingDemands = serializer.SerializeElement("OnGoingDemands", OnGoingDemands);
  250.             PreviousAIBehaviourState = (AIBehaviourState)serializer.SerializeElement("PreviousAIBehaviourState", (int)PreviousAIBehaviourState);
  251.             CurrentAIBehaviourState = (AIBehaviourState)serializer.SerializeElement("CurrentAIBehaviourState", (int)CurrentAIBehaviourState);
  252.             AIBehaviourStateChangeDate = serializer.SerializeElement("AIBehaviourStateChangeDate", AIBehaviourStateChangeDate);
  253.             EmpireMoral = serializer.SerializeElement("EmpireMoral", EmpireMoral);
  254.             CurrentAbilities = (DiplomaticAbility)serializer.SerializeElement("CurrentAbilities", (int)CurrentAbilities);
  255.             CurrentSurrenderToOtherProposition = serializer.SerializeElement("CurrentSurrenderToOtherProposition", CurrentSurrenderToOtherProposition);
  256.             ForcedOtherToSurrenderProposition = serializer.SerializeElement("ForcedOtherToSurrenderProposition", ForcedOtherToSurrenderProposition);
  257.             TurnNumberAtWhichTimeoutEnds = serializer.SerializeElement("TurnNumberAtWhichTimeoutEnds", TurnNumberAtWhichTimeoutEnds);
  258.             AIRapportScore = serializer.SerializeElement("RapportScore", AIRapportScore);
  259.             AISuperiorityScore = serializer.SerializeElement("SuperiorityScore", AISuperiorityScore);
  260.             AITransitioningStates = serializer.SerializeElement("TransitioningStates", AITransitioningStates);
  261.             AIFeedbackEntries = serializer.SerializeElement("AIFeedbackEntries", AIFeedbackEntries);
  262.             AIMoodMessage = (AIMoodMessage)serializer.SerializeElement("AIMoodMessage", (int)AIMoodMessage);
  263.             AIMoodMessageTurn = serializer.SerializeElement("AIMoodMessageTurn", AIMoodMessageTurn);
  264.         }
  265.  
  266.         internal void Load()
  267.         {
  268.         }
  269.  
  270.         internal void Initialize(MajorEmpire myEmpire, MajorEmpire otherEmpire, DiplomaticRelation relation, DiplomaticAmbassy otherAmbassy)
  271.         {
  272.             MyEmpire.SetEntity(myEmpire);
  273.             OtherEmpire.SetEntity(otherEmpire);
  274.             OtherAmbassy.SetEntity(otherAmbassy);
  275.             DiplomaticRelation.SetEntity(relation);
  276.             EmpireMoral.Reset();
  277.             CurrentSurrenderToOtherProposition = -1;
  278.             ForcedOtherToSurrenderProposition = -1;
  279.             TurnNumberAtWhichTimeoutEnds = 0;
  280.         }
  281.  
  282.         protected override void OnFreeing()
  283.         {
  284.             base.OnFreeing();
  285.             AvailableGrievances.Clear();
  286.             OnGoingDemands.Clear();
  287.             PreviousAIBehaviourState = AIBehaviourState.Unknown;
  288.             CurrentAIBehaviourState = AIBehaviourState.Unknown;
  289.             AIBehaviourStateChangeDate = 0;
  290.             AITransitioningStates = 0;
  291.             AIRapportScore = 0f;
  292.             AISuperiorityScore = 0f;
  293.             AIFeedbackEntries = null;
  294.             AIMoodMessage = AIMoodMessage.None;
  295.             AIMoodMessageTurn = 0;
  296.             AIRelationTendency = RelationTendency.DeterioratingRapidly;
  297.             EmpireMoral.Empty();
  298.             CurrentSurrenderToOtherProposition = -1;
  299.             ForcedOtherToSurrenderProposition = -1;
  300.             CurrentAbilities = DiplomaticAbility.None;
  301.             TurnNumberAtWhichTimeoutEnds = 0;
  302.             HasStalled = false;
  303.         }
  304.     }
  305. }
  306.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement