From 63f814c695ae5a2cdaf6806f4c688b692f1db6d6 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 14 Mar 2013 21:49:44 +0000
Subject: [PATCH] [Fix] Fleet balancing, minor ai fix and removed obsolete ai.

---
 dat/ssys.xml              |  9 +++-
 scripts/ai/collective.lua |  2 +
 scripts/ai/test.lua       | 90 ---------------------------------------
 3 files changed, 9 insertions(+), 92 deletions(-)
 delete mode 100644 scripts/ai/test.lua

diff --git a/dat/ssys.xml b/dat/ssys.xml
index 17dd0b8..e2fa781 100644
--- a/dat/ssys.xml
+++ b/dat/ssys.xml
@@ -93,8 +93,13 @@
 		<planets>
 		</planets>
 		<fleets>
-			<fleet chance="80">Merchant Ship</fleet>
-			<fleet chance="60">Merchant Mule</fleet>
+			<fleet chance="60">Empire Lancer</fleet>
+			<fleet chance="40">Empire Lancer</fleet>
+			<fleet chance="80">Collective Drone</fleet>
+			<fleet chance="80">Collective Drone</fleet>
+			<fleet chance="60">Collective Drone</fleet>
+			<fleet chance="60">Collective Sml Swarm</fleet>
+
 		</fleets>
     <jumps>
 			<jump>NCG-7291</jump>
diff --git a/scripts/ai/collective.lua b/scripts/ai/collective.lua
index 6bdc98a..8637c72 100644
--- a/scripts/ai/collective.lua
+++ b/scripts/ai/collective.lua
@@ -6,6 +6,8 @@ function control()
 		enemy = ai.getenemy()
 
 		if enemey ~= 0 then
+			-- Make hostile to enemy (mainly player).
+			ai.hostile(enemy)
 			ai.pushtask(0, "attack", enemy)
 		end
 	end
diff --git a/scripts/ai/test.lua b/scripts/ai/test.lua
deleted file mode 100644
index 0e36b60..0000000
--- a/scripts/ai/test.lua
+++ /dev/null
@@ -1,90 +0,0 @@
--- Required control rate.
-control_rate = 2
-
--- Required "control" function.
-function control()
-  if ai.taskname() == "none" then
-    ai.pushtask(0, "fly")
-  end
-end
-
--- Required "attacked" function.
-function attacked(attacker)
-  task = ai.taskname()
-  if task ~= "attack" and task ~= "runaway" then
-    -- Let's have some taunts.
-    taunt(attacker)
-
-    -- Now pilot fights back.
-    ai.pushtask(0, "attack", attacker)
-  elseif task == "attack" then
-    if ai.targetid() ~= attacker then
-      ai.pushtask(0, "attack", attacker)
-    end
-  end
-end
-
--- Taunts.
-function taunt(target)
-  num = ai.rnd(0,4)
-  if num == 0 then msg = "You will never kill me!"
-  elseif num == 1 then msg = "DIE!"
-  elseif num == 2 then msg = "You won't survive!"
-  elseif num == 3 then msg = "I hate you!"
-  end
-  if msg then ai.comm(attacker, msg) end
-end
-
--- Runs away.
-function runaway()
-  target = ai.targetid()
-
-  -- Make sure pilot exists.
-  if not ai.exists(target) then
-    ai.poptask()
-    return
-  end
-
-  dir = ai.face(target, 1)
-  ai.accel()
-end
-
--- Attack
-function attack()
-  target = ai.targetid()
-
-  -- Make sure target exists.
-  if not ai.exists(target) then
-    ai.poptask()
-    return
-  end
-
-  dir = ai.face(target)
-  dist = ai.dist(ai.pos(target))
-  second = ai.secondary()
-
-  if ai.secondary() == "Launcher" then
-    ai.settarget(target)
-    ai.shoot(2)
-  end
-
-  if ai.parmour() < 70 then
-    ai.poptask()
-    ai.pushtask(0, "runaway", target)
-  elseif dir < 10 and dist > 300 then
-    ai.accel()
-  elseif dir < 10 and dist < 300 then
-    ai.shoot()
-  end
-end
-
--- Fly to the player.
-function fly()
-  target = player
-  dir = ai.face(target)
-  dist = ai.dist(ai.pos(target))
-  if dir < 10 and dist > 300 then
-    ai.accel()
-  end
-end
-