Author Topic: Faulty Battle Allegiances  (Read 7964 times)

Andrew

  • M&F's Anaris
  • Administrator
  • Noble Lord
  • *
  • Posts: 324
  • Sometimes, With A Bopping Stick
    • View Profile
Re: Faulty Battle Allegiances
« Topic Start: July 13, 2018, 02:54:12 PM »
Alright, since I was kind of working on modernizing the combat code anyways, I sat down and took a look. This is exactly how the game figures out who is on what side of a battle, and any later step includes all factoring from earlier steps (1 comes before 2, 9 comes after 1-8, etc.), taking into account ~260 lines of code. For the purposes of rogue forces, those without realms, they are treated as their own realm, rather than being realm-less. The process for regular battles (not rebellion related):
  • Determines Region ownership.
  • Ignores any Units that have no combat capable men and declares those units 'Neutral'
  • Figures out whether any Units set to 'Evade' do so or not. If they do, they are declared 'Neutral'. If not, they're left in the calculation.
  • Figures out what Realms still have forces left.
  • If only a single realm is present (rogue forces, in this case), it looks for any non-human (Monsters, Undead, or Daimons), and assigns all human forces to attack them. The already present larger force controls the battlefield. If no force was already present, non-humans control the battlefield.
  • If no non-humans, looks for any ongoing TakeOver. TakeOver forces controls defenses.
  • If no TakeOver running, looks for any Realm allied or federated with the region owner that are already present or dug-in and are not peasants. These realms control the battlefield.
  • If no allied or federated realms of region owner, looks to see if only peasants of the owning realm or allies are already present. If only peasants of owning or allied realms are present, they take control of the battlefield.
  • If no allied or federated realms are present whatsoever, looks to see who else was already present in the region. If someone was already present (that is, someone who didn't arrive to the region this turn), the realm with the largest strength controls the battlefield.
  • If no realm was already here, the realm arriving with the strongest army controls the battlefield.
  • By this point, the battlefield controller (henceforth: Defender A) should be determined. If not, no battle happens.
  • All remaining realms (those not assigned a role in battle yet) in a federation with Defender A are Defenders.
  • All remaining realms at War or Hatred with ALL Defenders (A and Confederates) are determined to be Attackers.
  • All remaining realms at War/Hatred with some Defenders (A and Confederates) and Allied with other Defenders (A and Confederates) remain neutral, and the game questions what their ruler was thinking.
  • Units not assigned a role with Murderous settings not Allied to any Defenders (A and Confederates) ignore Peace and are determined to be Attackers.
  • If for some reason no attackers have been determined (that is, no non-Defenders/non-Neutral realms present), no battle happens.
  • All remaining realms in a federation with Attackers are determined to be Attackers.
  • All remaining realms allied to an Attacker and NOT allied or peace with any Defender are determined to be Attackers.
  • All remaining realms allied to a Defender and NOT allied or Peace with an Attacker are determined to be Defenders.
  • All remaining realms that are both allied/peace with any Defender AND allied/peace with any Attacker are determined to be Neutral.
  • All remaining realms "don't know what to do" and are determined to be Neutral.
Shorter version:
  • Units not combat capable are ignored.
  • Units that are Evading attempt to do so, and are ignored if they do.
  • Monsters, Undead, and Daimons will always be the opponent for humans when only rogues are present. If more than a single realm is present, this is skipped. Larger present force controls battlefield. If all forces just arrived, larger force controls battlefield.
  • No non-humans? Any Realm running a takeover controls battlefield.
  • No TakeOver? Owern, Allies, and Federation partners of region owner control battlefield if present, even if just with Peasants.
  • Still no defender? Whoever was already present with the largest force controls the battlefield.
  • Still no one? Realm arriving with the strongest force controls battle.
  • If we have a defender, figure out attackers. If not, no battle.
So, what does this mean:
  • Step 1: Highmarch owns region.
  • Steps 2-6: Not noteworthy, as Highmarch, the owner, has no already present forces.
  • Step 7: Redhaven takes up defense of region as the only already present force. Forces arriving this turn do not count, only those previously present.
  • Steps 8-12: We already have a defender.
  • Step 13: Vix Tiramora is determined to be an attacker.
  • Steps 14-18: No change.
  • Step 19: No change. As Highmarch is not allied to Redhaven, they do not join the Defense.
  • Step 20: No change.
  • Step 21: Highmarch, having not yet found a role, is assigned Neutral.
I suspect this was setup the way it was, so if you and an enemy are traveling through a third, neutral country, you don't just start murdering each other in their capital, as said third country would safely be assumed to have some token militia force in their regions that'd grant them battlefield control and stop the other two from being fighting as they'd not be assigned as attackers.
« Last Edit: July 13, 2018, 03:43:44 PM by Andrew »
Like my programming? Become my patron!