From 92923111e11459d0c907ea6efde23d30190e91b8 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Fri, 6 Dec 2013 20:25:59 +0000
Subject: [PATCH] [Add] Fleets and ai for Detour Liberation Front, along with a
 few generic ai changes.

---
 dat/fleet.xml         | 56 ++++++++++++++++++++++++++++++++++++++++++-
 scripts/ai/dlf.lua    | 35 +++++++++++++++++++++++++++
 scripts/ai/empire.lua | 27 +++++++++++++++------
 3 files changed, 110 insertions(+), 8 deletions(-)
 create mode 100644 scripts/ai/dlf.lua

diff --git a/dat/fleet.xml b/dat/fleet.xml
index ddf1a75..ef35075 100644
--- a/dat/fleet.xml
+++ b/dat/fleet.xml
@@ -30,7 +30,61 @@
    <pilot chance="80">Mule</pilot>
    <pilot chance="80">Mule</pilot>
   </pilots>
- </fleet>
+</fleet>
+  <fleet name="DLF Pacifier">
+    <ai>dlf</ai>
+    <faction>DLF</faction>
+    <pilots>
+      <pilot chance="100">Pacifier</pilot>
+    </pilots>
+  </fleet>
+  <fleet name="DLF Vendetta">
+    <ai>dlf</ai>
+    <faction>DLF</faction>
+    <pilots>
+      <pilot chance="100">Vendetta</pilot>
+    </pilot>
+  </fleet>
+  <fleet name="DLF Sml Force">
+    <ai>dlf</ai>
+    <faction>DLF</faction>
+    <pilots>
+      <pilot chance="100">Hyena</pilot>
+      <pilot chance="80">Hyena</pilot>
+      <pilot chance="60">Admonisher</pilot>
+      <pilot chance="80">Vandetta</pilot>
+    </pilot>
+  </fleet>
+  <fleet name="DLF Med Force">
+    <ai>dlf</ai>
+    <faction>DLF</faction>
+    <pilots>
+      <pilot chance="100">Hyena</pilot>
+      <pilot chance="80">Hyena</pilot>
+      <pilot chance="60">Hyena</pilot>
+      <pilot chance="60">Admonisher</pilot>
+      <pilot chance="80">Vendetta</pilot>
+      <pilot chance="60">Vendetta</pilot>
+      <pilot chance="40">Pacifier</pilot>
+    </pilots>
+  </fleet>
+  <fleet name="DLF Lge Force">
+    <ai>dlf></ai>
+    <faction>DLF</faction>
+    <pilots>
+      <pilot chance="100">Hyena</pilot>
+      <pilot chance="80">Hyena</pilot>
+      <pilot chance="60">Hyena</pilot>
+      <pilot chance="40">Hyena</pilot>
+      <pilot chance="60">Admonisher</pilot>
+      <pilot chance="40">Admonisher</pilot>
+      <pilot chance="80">Vendetta</pilot>
+      <pilot chance="60">Vendetta</pilot>
+      <pilot chance="40">Vendetta</pilot>
+      <pilot chance="40">Pacifier</pilot>
+      <pilot chance="40">Hawking</pilot>
+    </pilots>
+  </fleet>
  <fleet name="Pirate Hyena">
   <ai>pirate</ai>
   <faction>Pirate</faction>
diff --git a/scripts/ai/dlf.lua b/scripts/ai/dlf.lua
new file mode 100644
index 0000000..1971996
--- /dev/null
+++ b/scripts/ai/dlf.lua
@@ -0,0 +1,35 @@
+include("../scripts/ai/tpl/generic.lua")
+
+-- Settings.
+aggressive      = true
+safe_distance   = 300
+armour_run      = 100
+shield_return   = 20
+land_planet     = false
+
+function create()
+  ai.setcredits(ai.shipprice()/1000, ai.shipprice()/100)
+end
+
+function taunt(target, offence)
+  -- Only 50% of actual taunting.
+  if rnd.int(0, 1) == 0 then
+    return
+  end
+
+  -- Taunt.
+  if offence then
+    taunts = {
+      "For the Frontiier!",
+      "You'll make great target practice!",
+      "Purge the oppressors!"
+    } else
+    taunts = {
+      "You are no match for the DLF!",
+      "I've killed scum much more dangerous than you!"
+    }
+  end
+
+  ai.comm(target, taunts[rnd.int(1, #taunts)])
+end
+
diff --git a/scripts/ai/empire.lua b/scripts/ai/empire.lua
index c7901f1..9b43c36 100644
--- a/scripts/ai/empire.lua
+++ b/scripts/ai/empire.lua
@@ -12,13 +12,26 @@ function create()
  end
 end
 
-function taunt(target)
-  taunts = {
-    "How dare you attack me!?",
-    "You can not defeat the Empire!",
-    "You will hang for this!",
-    "DIE!!"
-  }
+function taunt(target, offence)
+  -- Only 50% of actual taunting.
+  if rnd.int(0, 1) == 0 then
+    return
+  end
+
+  -- Taunt.
+  if offence then
+    taunts = {
+      "There is no room in this universe for scum like you!",
+      "The Empire will enjoy your death!",
+      "Your head will make a fine gift for the Emperor!"
+    } else
+    taunts = {
+      "You dare attack me!"
+      "You are no match for the Empire!",
+      "You'll regret this!"
+    }
+  end
+
   ai.comm(target, taunts[rnd.int(1, #taunts)])
 end