Skip to content
Snippets Groups Projects
Commit 13b1bc6d authored by dg's avatar dg
Browse files

tweak tactical ai

git-svn-id: http://svn.net-core.org/repos/t-engine4@3339 51575b47-30f0-44d4-a5cc-537603b46e54
parent 63c64345
No related branches found
No related tags found
No related merge requests found
......@@ -167,7 +167,7 @@ function _M:checkFilter(e, filter, type)
if not filter then return true end
if filter.ignore and self:checkFilter(e, filter.ignore, type) then return false end
-- print("Checking filter", filter.type, filter.subtype)
forceprint("Checking filter", filter.type, filter.subtype, "::", e.type,e.subtype,e.name)
if filter.type and filter.type ~= e.type then return false end
if filter.subtype and filter.subtype ~= e.subtype then return false end
if filter.name and filter.name ~= e.name then return false end
......
......@@ -279,22 +279,22 @@ newAI("use_tactical", function(self)
if avail.attack and self.ai_target.actor then
-- Use the foe/ally ratio from the best attack talent
table.sort(avail.attack, function(a,b) return a.val > b.val end)
want.attack = (avail.attack[1].nb_foes_hit or 1) - ally_compassion * (avail.attack[1].nb_allies_hit or 0) - self_compassion * (avail.attack[1].nb_self_hit or 0)
want.attack = avail.attack[1].val
end
if avail.disable and self.ai_target.actor then
-- Use the foe/ally ratio from the best disable talent
table.sort(avail.disable, function(a,b) return a.val > b.val end)
want.disable = (want.attack or 0) + (avail.disable[1].nb_foes_hit or 1) - ally_compassion * (avail.disable[1].nb_allies_hit or 0) - self_compassion * (avail.disable[1].nb_self_hit or 0)
want.disable = (want.attack or 0) + avail.disable[1].val
end
if avail.attackarea and self.ai_target.actor then
-- Use the foe/ally ratio from the best attackarea talent
table.sort(avail.attackarea, function(a,b) return a.val > b.val end)
want.attackarea = (want.attack or 0) + (avail.attackarea[1].nb_foes_hit or nb_foes_seen) - ally_compassion * (avail.attackarea[1].nb_allies_hit or nb_allies_seen) - self_compassion * (avail.attackarea[1].nb_self_hit or 0)
want.attackarea = avail.attackarea[1].val
end
-- Need buffs
if avail.buff and want.attack and want.attack > 0 then
want.buff = math.max(0.01, want.attack - 1)
want.buff = math.max(0.01, want.attack + 0.5)
end
print("Tactical ai report for", self.name)
......
......@@ -949,7 +949,7 @@ function _M:entityFilter(zone, e, filter, type)
if not filter.ingore_material_restriction then
local min_mlvl = util.getval(zone.min_material_level)
local max_mlvl = util.getval(zone.max_material_level)
if min_mlvl then
if min_mlvl and not e.material_level_min_only then
if not e.material_level then return true end
if e.material_level < min_mlvl then return false end
end
......
......@@ -478,7 +478,7 @@ function _M:generateOne(e)
end
else
m.on_added = function (self)
if m.on_added_orig then m.on_added_orig(self) end
if self.on_added_orig then self.on_added_orig(self) end
game.level.arena.danger = game.level.arena.danger + self.arenaPower
end
end
......
......@@ -42,7 +42,7 @@ newEntity{
open_door = true,
resolvers.sustains_at_birth(),
resolvers.inscriptions(2, "infusion"),
-- resolvers.inscriptions(2, "infusion"),
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=3, },
......@@ -55,6 +55,17 @@ newEntity{
end,
}
newEntity{ base = "BASE_NPC_ORC_GORBAT",
name = "orc TEST", color=colors.YELLOW,
desc = [[A fierce orc attuned to the wilds.]],
level_range = {30, nil}, exp_worth = 1,
rarity = 1,
ai = "tactical",
ai_state = { talent_in=1, },
rank=3,
resolvers.inscriptions(1, {"speed rune"}),
}
newEntity{ base = "BASE_NPC_ORC_GORBAT",
name = "orc summoner", color=colors.YELLOW,
desc = [[A fierce orc attuned to the wilds.]],
......@@ -110,7 +121,7 @@ newEntity{ base = "BASE_NPC_ORC_GORBAT",
resolvers.racial(),
}
newEntity{ base = "BASE_NPC_ORC",
newEntity{ base = "BASE_NPC_ORC_GORBAT",
name = "orc master wyrmic", color=colors.LIGHT_STEEL_BLUE,
desc = [[A fierce soldier-orc highly trained in the discipline of dragons.]],
level_range = {30, nil}, exp_worth = 1,
......@@ -143,7 +154,7 @@ newEntity{ base = "BASE_NPC_ORC",
resolvers.racial(),
}
newEntity{ base = "BASE_NPC_ORC",
newEntity{ base = "BASE_NPC_ORC_GORBAT",
name = "orc mage-hunter", color=colors.HONEYDEW,
desc = [[An orc clad in massive armour, magic seems to die down all around him.]],
level_range = {30, nil}, exp_worth = 1,
......
......@@ -46,6 +46,7 @@ newEntity{
fire_destroy = {{100,1}, {200,2}, {400,5}, {600,10}, {1200,20}},
desc = [[Natural infusions may be grafted onto your body, granting you an on-demand ability.]],
egos = "/data/general/objects/egos/infusions.lua", egos_chance = resolvers.mbonus(30, 5),
material_level_min_only = true,
power_source = {nature=true},
use_simple = { name="inscribe your skin with the infusion.", use = function(self, who, inven, item)
......@@ -68,6 +69,7 @@ newEntity{
fire_destroy = {{10,1}, {20,2}, {40,5}, {60,10}, {120,20}},
desc = [[Magical runes may be inscribed onto your body, granting you an on-demand ability.]],
egos = "/data/general/objects/egos/infusions.lua", egos_chance = resolvers.mbonus(30, 5),
material_level_min_only = true,
power_source = {arcane=true},
use_simple = { name="inscribe your skin with the rune.", use = function(self, who, inven, item)
......@@ -356,7 +358,7 @@ newEntity{ base = "BASE_RUNE",
dur = resolvers.mbonus_level(4, 3),
power = resolvers.mbonus_level(30, 30, function(e, v) return v * 0.3 end),
use_stat_mod = 0.3,
nb_uses = resolvers.mbonus_level(7, 4),
nb_uses = 2, --resolvers.mbonus_level(7, 4),
},
inscription_talent = "RUNE:_SPEED",
}
......
......@@ -410,7 +410,7 @@ newInscription{
type = {"inscriptions/runes", 1},
points = 1,
is_spell = true,
tactical = { DEFEND = 1, ESCAPE = 1 },
tactical = { DEFEND = 3, ESCAPE = 2 },
action = function(self, t)
local data = self:getInscriptionData(t.short_name)
self:setEffect(self.EFF_INVISIBILITY, data.dur, {power=data.power + data.inc_stat})
......@@ -434,7 +434,7 @@ newInscription{
points = 1,
is_spell = true,
no_energy = true,
tactical = { BUFF = 2 },
tactical = { BUFF = 4 },
action = function(self, t)
local data = self:getInscriptionData(t.short_name)
self:setEffect(self.EFF_SPEED, data.dur, {power=(data.power + data.inc_stat) / 100})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment