TITLE SubAtkSurf ; Timer 1 : TMA Leg timer ; Var 1 : Min firing range ; Var 2 : Store speed before changing it ; Var 3 : Closing speed calculation ; Var 4 : 0 = Closing target, 1 = Receding target ; Var 5 : Oblique approach angle ; Var 6 : priority of sub action ; Var 7 : have we shot at a contact that is active? RULE Store Attack Range for this contact IF INIT = 1 THEN VAR_SET 1 ATTACKRNG DEBUG "Max Attack Rng:" DEBUG VAR1 VAR_SET 3 OWNSPD VAR_SET 6 200 VAR_SET 7 0 ELSE DEBUG "entering surf attack mode" RULE let sub engage IF VAR6 > 0 THEN RULE Avoid Friendly IF ID = FRIEND OR ID = UAF THEN DONE DEBUG "Avoid friendly" TACTIC SubAvoidSurf END ;if we are beyond 20000 yrds then let code take over- just drive to target ;OR ( VAR1 > 20000 AND RNG < VAR1 ) RULE Check Range IF RNG < 20000 THEN ;if the guy is actively pinging us, then lets waste him! RULE attack active intercept IF SOURCE = "Active Intercept" AND VAR7 = 0 THEN DEBUG "Attacking Active Ping" ATTACK_BEST VAR_SET 7 1 ELSE DEBUG "Executing Attack Doctrine" DEBUG "RNG" DEBUG RNG DEBUG "VAR1" DEBUG VAR1 RULE ID UPD IF ID = UPD THEN VAR_SET 5 BRG RULE New Leg IF TIMER3 = -1 THEN DEBUG "Silos:" DEBUG SILOS RULE Approaching? IF SILOS > 0 OR RNG > VAR1 THEN DEBUG "UPD Opening Pursuit" VAR_SET 4 1 VAR_SET 3 OWNSPD VAR_ADD 3 SILOS VAR_ADD 3 {3,5} ELSE DEBUG "UPD Approaching Leg" VAR_SET 4 0 VAR_SET 3 {6,8} VAR_SET 5 BRG RULE Compute oblique angle for leg IF AOB < 0 THEN VAR_SUB 5 {50,70} ELSE VAR_ADD 5 {50,70} END END SET_TIMER 3 {300,420} END RULE Proceed on leg, or pursue IF VAR4 = 0 THEN DEBUG "proceed on leg" DEBUG "Setting course:" DEBUG VAR5 DEBUG VAR6 PRIORITY VAR6 SETCRS VAR5 ELSE DEBUG "pursuing" DEBUG VAR6 PRIORITY VAR6 STEER_TO END RULE Minimum speed IF VAR3 < 4 THEN DEBUG "min speed" VAR_SET 3 4 END PRIORITY VAR6 SETSPD VAR3 END RULE ID Hostile IF ID = HOSTILE OR ID = UAE THEN DEBUG "New Closing Leg" DEBUG "Timer1: " DEBUG TIMER1 DEBUG "RNG : " DEBUG RNG DEBUG "VAR1" DEBUG VAR1 VAR_SET 5 BRG RULE New Closing Leg ;RNG range to solution is greater than max attack range and no timer is running... IF RNG > VAR1 AND TIMER1 = -1 THEN RULE Approaching? IF SILOS > 0 THEN DEBUG "Hostile Opening Pursuit" VAR_SET 4 1 VAR_SET 3 OWNSPD VAR_ADD 3 SILOS VAR_ADD 3 {3,5} ELSE DEBUG "Hostile Approaching Leg" VAR_SET 4 0 VAR_SET 3 {6,8} VAR_SET 5 BRG RULE Compute oblique angle for leg IF AOB < 0 THEN VAR_SUB 5 {50,70} ELSE VAR_ADD 5 {50,70} END END SET_TIMER 1 {480,600} END RULE Proceed on leg, or pursue IF VAR4 = 0 THEN DEBUG "proceed on leg" DEBUG "course :" DEBUG VAR5 DEBUG VAR6 PRIORITY VAR6 SETCRS VAR5 ELSE DEBUG "pursuing" PRIORITY VAR6 STEER_TO END RULE Minimum speed IF VAR3 < 4 THEN DEBUG "min speed" VAR_SET 3 4 END PRIORITY VAR6 SETSPD VAR3 RULE Attack IF RNG < VAR1 AND CONF > 70 THEN DEBUG "attack best" DEBUG VAR6 PRIORITY VAR6 ATTACK_BEST END END RULE PostLaunch IF WEAPON_AWAY = 1 THEN DEBUG "sub avoiding after shot" TACTIC SubAvoidSurf END END ;if not active END ;if rng END ;let sub prosecute END ;else