Space Combat - Fighter Wings

From PlanetsWiki

Jump to: navigation, search

Contents

[edit] Overview

This page shows pseudo-code that has been deduced from the original combat code related to fighters (Host 197?).
There have been some changes in recent Host versions (Host 198), so some details may have changed!
Details should now be updated to Host 208. Take care that these algorithms are from "the old" space combat system prior to Host 213 and are likely to be outdated.

[edit] Wing vs.

For each Fighter Type in wing (loop 3 times):

  ' BEGIN BEAM
  If Fighter Type has Beam and there is enough energy (>10) to fire.

    Acquire target (loop 10 times)

      Confirm target is enemy

      If target disabled:
        Disengage and Acquire new target if "Do Not Fire on Disabled" is On

      Confirm within Beam Range
        If Range >= 100, only 5% likely to fire
          If Range >= 60 and Anti-Fighter Computer active, only 30% likely to fire ' {{{1}}}
            Repeat once for each fighter of this type in wing:
              If there is enough energy to fire:
                Each fighter only has a 5% chance of firing
                  FIRE BEAM  ' vs. Ship, Base, Wing, Soft Target
                  Energy of Fighter Type reduced by 10
              Repeat until out of Fighters.

      If fighter is S/Ai-383 Wraith and FighterCount > 40.  ' Still within 10x loop
        If Holo Decoy count < 250
          Holo Decoy count is increased by FighterCount / 40


  ' BEGIN MISSILE
  If Fighter Type has Missile and there is enough Energy (>100) and Ord (>1) to fire.

    Acquire target (loop 10 times)

      Confirm target is enemy

      If target disabled:
        Disengage and Acquire new target if "Do Not Fire on Disabled" is On

      Confirm within Missile Range
        If Range >= 120 and Anti-Fighter Computer active, only 10% likely to fire.
          Repeat once for each fighter of this type in wing:
            If there is enough energy to fire:  (doesn’t check Ord, bug)
              Each fighter only has a 5% change of firing
                FIRE MISSILE  ' vs. Ship, Base, Wing, Soft Target
                Energy of Fighter Type reduced by 100
                Ord of Fighter Type reduced by 1
            Repeat until out of Fighters.

[edit] Wing vs. Ship

[edit] Fire Beam

rOdds = BeamOdds
If High Guard present on Wing, increase rOdds by 40

If fighter count (of type) > 200
  Then rOdds increased by 20
If fighter count (of type) > 400
  Then rOdds increased by 10 (30)
If fighter count (of type) > 500
  Then rOdds increased by 5 (35)

rOdds reduced by (# of Enemy Holo Decoys / 30)
Range Modifier = (MaxRange – Range) / MaxRange * 0.4 + 0.6
  Minimum of 0.1

If Aczanny ECM Jammer active:
  rOdds reduced by 15

Evasion Modifier = (100 – target’s evasive mod + fighter’s attack mod) / 100
  Minimum of 0.1

rOdds = rOdds * Range Modifier * Evasion Modifier
  Minimum of 10

If target Experience > 100:
  r = 1 – (Experience * 0.001)
    Minimum of 0.3
  rOdds = rOdds * r

If Wing experience > 100:
  r = 1 + (Experience * 0.001)
    Maximum of 1.7
  rOdds = rOdds * r

Check for HIT, (Rnd * 100) < rOdds

If HIT:

  ' Shield Drain
  If NOT flag Emp:
    Shield = Shield – fighterBeam
      Minimum of 0
  ' Thunder Dancers inflict control damage on unshielded or EE ships
  If Shield = 0 OR flag Emp:
    If flag Rebel:
      If Type 3 Fighter:
        DamageSys increased by 5
          Maximum of 5000

  ' Armor Drain
  If NOT flag EmpHit:
    Armor = Armor – fighterBeam/2 – 1
    If Rnd < 0.5:
      Armor = Armor – 1
    If High Guard on Wing:
      Armor = Armor – Rnd * 10
    Minimum armor of 0

  ' Hull
  If Armor < 1 OR flag EmpHit:

  (1 vH point = 1/10 damage unit)

    ' HULL DAMAGE
    vD = fighterBeam + 1
    If HighGuard on Wing:
    vD = vD + 2
    vS = target’s parts modifier
    vH = ((vD*(vS/100))*(Rnd*0.25+1.25))*(100/hullmass + 50) + 5
    DamageHull = DamageHull + vH
      Maximum of 5000

    ' ENGINE DAMAGE
    vD = 30 * Rnd
    vS = target’s engine modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 5
    DamageEngine = DamageEngine + vH
      Maximum of 5000

    ' HYPERDRIVE DAMAGE
    Check if ship has HyperDrive:
      vD = 15 * Rnd
      vS = target’s hyperdrive modifier
      vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 10
      DamageHyp = DamageHyp + vH
        Maximum of 5000

    ' SYSTEM DAMAGE
    vD = Rnd * 30
    vS = target’s system modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 1.5
    DamageSys = DamageSys + vH
      Maximum of 5000

   ' LIFE DAMAGE
    vD = Rnd * 30
    vS = enemy’s life modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 0.5
    DamageLife = DamageLife + vH
      Maximum of 5000

    ' SHIELD GENERATOR AND WEAPONS
    vD = Rnd * 60
    vS = enemy’s parts modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 3
    DamageShield = DamageShield + vH
      Maximum of 5000
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 3
    DamageWeapons = DamageWeapons + vH
      Maximum of 5000

    ' CRITICAL HIT?
    If Rnd*1500 < SoftSpot:
      DamageHull = DamageHull + 500 + Rnd * 2000

[edit] Fire Missile

rOdds = MissileOdds
If High Guard present on Wing, increase rOdds by 60
rOdds reduced by (# of enemy Holo Decoys / 30)

Range Modifier = (MaxRange – Range) / MaxRange * 0.4 + 0.6
  Minimum of 0.1

If Aczanny ECM Jammer active:
  rOdds reduced by 15

Evasion Modifier = (100 – target’s evasive mod + fighter’s attack mod) / 100
  Minimum of 0.1

rOdds = rOdds * Range Modifier * Evasion Modifier
  Minimum of 5

If target experience > 100:
  r = 1 – (Experience * 0.001)
    Minimum of 0.3
  rOdds = rOdds * r

If Wing experience > 100:
  r = 1 + (Experience * 0.001)
    Maximum of 1.7
  rOdds = rOdds * r

If fighter count (of type) > 200
  Then rOdds increased by 40
If fighter count (of type) > 400
  Then rOdds increased by 30 (70)
If fighter count (of type) > 500
  Then rOdds increased by 15 (85)
 
Check for HIT, (Rnd * 100) < rOdds

If HIT:

  ' Shield Drain
  If NOT flag Emp:
    Shield = Shield – fighterMissile -2
      Minimum of 0

  ' Armor Drain
  If Shield = 0 OR flag Emp:
    If NOT flag EmpHit:
      Armor = Armor – fighterMissile/2 – 2
      If Rnd < 0.1:
        Armor = Armor – 5
      If High Guard on Wing:
        Armor = Armor – Rnd * 10
      Minimum armor of 0
 
  If Armor < 1 OR flag EmpHit:

    ' HULL DAMAGE
    vD = fighterMissile + 1
    If High Guard on Wing:
      vD = vD + 2
    vS = target’s parts modifier
    vH = ((vD*(vS/100))*(Rnd*0.75+1.25))*(300/hullmass + 250) + 5
    DamageHull = DamageHull + vH
      Maximum of 5000

    ' ENGINE DAMAGE
    vD = 30 * Rnd
    vS = target’s engine modifier
    vH = ((vD*(vS/100))*(Rnd*0.25+1.25))*(100/hullmass+50)) + 7
    DamageEngine = DamageEngine + vH
      Maximum of 5000

    ' HYPERDRIVE DAMAGE
    Check if ship has HyperDrive:
      vD = 15 * Rnd
      vS = target’s hyperdrive modifier
      vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 10
      DamageHyp = DamageHyp + vH
        Maximum of 5000

    ' SYSTEM DAMAGE
    vD = Rnd * 30
    vS = target’s system modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 0.5
    DamageSys = DamageSys + vH
      Maximum of 5000

    ' LIFE DAMAGE
    vD = Rnd * 30
    vS = enemy’s life modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 0.5
    DamageLife = DamageLife + vH
      Maximum of 5000

    ' SHIELD GENERATOR AND WEAPONS
    vD = Rnd * 60
    vS = enemy’s parts modifier
    vH = ((vD*(vS/100))*Rnd)*(100/hullmass+50)) + 2
    DamageShield = DamageShield + vH
      Maximum of 5000
    vH = ((vD*(vS*100))*Rnd)*(100/hullmass+50)) + 2
    DamageWeapons = DamageWeapons + vH
      Maximum of 5000

    ' CRITICAL HIT?
    If Rnd*500 < SoftSpot:
      DamageHull = DamageHull + 500 + Rnd * 2000

[edit] Wing vs. Base

[edit] Fire Beam

If "Ground Strike" is On:

  If there is no Base Shield:
    vBOdd = 100 + (# of Anti-Aircraft Guns)
    Maximum of 1000

  If there is a Base Shield:
    vBOdd = 3000 + (# of Anti-Aircraft Guns) * 30
    Maximum of 20,000

  rOdds = BeamOdds * 2
  Check for HIT, (Rnd * vBOdd) < rOdds:

    If HIT:
      Incoming Fire = Incoming Fire + (Rnd * BeamPower)
      If there are Ion Cannons AND BeamPower >= 3:
        If (Rnd * 3000) < Incoming Fire:
          10% chance 1 Ion Cannon destroyed
      If there are Anti-Aircraft Guns:
        If (Rnd * 3000) < Incoming Fire:
          30% chance 1 Anti-Aircraft Gun destroyed
 
  ShieldHit = 0.001    (0.1%)
  If UEA:
    ShieldHit = 0.005  (0.5%)
  If Rnd < ShieldHit:
    Base Shield destroyed

[edit] Fire Missile

If "Ground Strike" is On:

  If there is no Base Shield:
    vBOdd = 100 + (# of Anti-Aircraft Guns)
    Maximum of 600

  If there is a Base Shield:
    vBOdd = 500 + (# of Anti-Aircraft Guns) * 5
    Maximum of 6,500

  rOdds = MissileOdds * 2
  Check for HIT, (Rnd * vBOdd) < rOdds:

    If HIT:
      Incoming Fire = Incoming Fire + (Rnd * MissilePower * 10)
      If there are Ion Cannons AND MissilePower >= 2:
        If (Rnd * 3000) < Incoming Fire:
          15% chance 1 Ion Cannon destroyed
      If there are Anti-Aircraft Guns:
        If (Rnd * 3000) < Incoming Fire
          50% chance that 1 Anti-Aircraft Gun destroyed.

    ShieldHit = 0.01     (1%)
    If Enforcers:
      ShieldHit = 0.03   (3%)
    If Rnd < ShieldHit:
      Base Shield Destroyed

I believe "Incoming Fire" contantly increases (never decreasing) over the duration of the combat.

[edit] Wing vs. Wing

[edit] Fire Beam

rOdds = BeamOdds
If High Guard present in Wing, increase rOdds by 40

MaxRange = Maxrange * 1.5
Range Modifier = (MaxRange – Range) / MaxRange * 0.2 + 0.8
  Minimum of 0.1

Target Fighter Type Selected
  60% Type 1
  25% Type 2
  15% Type 3
  If no Type 1's, select Type 2
  If no Type 2's, select Type 3
  If no Type 3's, select Type 1

  Evasion Modifier = (200-EvasiveMod)/100		(Attack mod = 100)
  If High Guard present, increase Evasion Modifier by 0.4  (another HG bonus to hit)
    Minimum of 0.1
  rOdds = rOdds * Range Modifier * Evasion Modifier
    Minimum of 5

  If fighter count(of firing type) >= 200:
   rOdds = rOdds + 30
  If fighter count(of firing type) >= 400:
   rOdds = rOdds + 20 (50)
  If fighter count(of firing type) >= 500:
   rOdds = rOdds + 15 (65)
  If fighter count(of firing type) >= 1000:
   rOdds = rOdds + 10 (75)

  If Robot fighter attacking CoM Wing:
    rOdds = rOdds / 3
    If target is V15 Viper:
      rOdds = rOdds / 2     (total of rOdds / 6)

  If non-CoM fighter attacking Robot Wing:
    rOdds = rOdds / 1.3
    If target is R27 Raider:
      rOdds = rOdds / 2  (total of rOdds / 2.6)

  Check for HIT, (Rnd * 100) < rOdds:
    If HIT:
      Beam = BeamPower (own)
      Beam = Beam * Rnd + 0.5
      If High Guard on Wing (own)
        Beam = Beam + 1

      Armor = fighterArmor (enemy)
      Armor = Armor * Rnd

      If (Beam > Armor) OR ((Rnd * 30) < fighterSoftSpot (enemy):
        Enemy fighter count decreased by 1

      If fighter count(of firing type) > fighter count(target type) * 2
        Enemy fighter count decreased by 1 (2)
      If fighter count(of firing type) > fighter count(target type) * 3
        Enemy fighter count decreased by 1 (3)
      If fighter count(of firing type) > fighter count(target type) * 4
        Enemy fighter count decreased by 1 (4)
      If fighter count(of firing type) > fighter count(target type) * 5
        Enemy fighter count decreased by 3 (7)

[edit] Fire Missile

rOdds = MissileOdds
If High Guard present in Wing, increase rOdds by 40

If Quasar (Solorian Type 1 Fighter)
  MaxRange = MaxRange * 2

Range Modifier = (MaxRange – Range) / MaxRange * 0.9 + 0.9
  Minimum of 0.1
If at point blank or at maximum range
  Range Modifier = 0.5   (unsure of my interpretation of this bit)

Target Fighter Type Selected
  60% Type 1
  25% Type 2
  15% Type 3
  If no Type 1's, select Type 2
  If no Type 2's, select Type 3
  If no Type 3's, select Type 1

  Evasion Modifier = (200-EvasiveMod)/100             (Attack mod = 100)
  If High Guard present, increase Evasion Modifier by 0.4  (another HG bonus to hit)
    Minimum of 0.1
  rOdds = rOdds * Range Modifier * Evasion Modifier
    Minimum of 8

  If target is Fusion (Solorian Type 2 Fighter)
    rOdds = 0		

  If Robot fighter attacking CoM Wing:
    rOdds = rOdds / 3

  If non-CoM fighter attacking Robot Wing:
    rOdds = rOdds / 2
    If target is R27 Raider:
      rOdds = 0

  ' The following doesn't increase rOdds against Fusion and R27 Raider (Host 210 Patch1)
  If fighter count(of firing type) >= 200:
   rOdds = rOdds + 40
  If fighter count(of firing type) >= 400 Then 
   rOdds = rOdds + 30 (70)
  If fighter count(of firing type) >= 500 Then 
   rOdds = rOdds + 15 (85)
  ' NOTE: No bonus for 1000 fighters

  Check for HIT, (Rnd * 100) < rOdds:
    If HIT:
      Missile = MissilePower (own)
      Missile = Missile * Rnd + 0.5
      If High Guard on Wing (own)
        Missile = Missile + 10

      Armor = fighterArmor (enemy)
      Armor = Armor * Rnd

      If (Missile > Armor) OR ((Rnd * 20) < fighterSoftSpot (enemy):
        Enemy fighter count decreased by 1
        ' NOTE: No extra kills for outnumbering target like beams have

[edit] Wing vs. Soft Target

[edit] Fire Beam

Check for HIT, (Rnd * 100) < BeamOdds:
  If HIT:
    Destroy target

[edit] Fire Missile

Check for HIT, (Rnd * 100) < MissileOdds:
  If HIT:
    Destroy target

[edit] PD vs. Wing

[edit] Sand Caster vs. Wing

Personal tools