Permalink
Browse files

Merge branch 'master' of gitorious.org:t-engine-modules/fae

  • Loading branch information...
eriknw committed May 8, 2012
2 parents f67142e + 009dfa5 commit a2ff6664251d2eb19433556c97403266e7e686cf
View
@@ -47,28 +47,32 @@ module(..., package.seeall, class.inherit(
))
function _M:init(t, no_default)
+ -- define some base values
+ self.energyBase = 0
+
-- Stat and Resource dice sides and target modifiers
self.offense_sides = 10
- self.offense_target_modifier = 0
+ self.offense_modifier = 0
self.defense_sides = 10
- self.defense_target_modifier = 0
+ self.defense_modifier = 0
self.damage_sides = 10
- self.damage_target_modifier = 0
+ self.damage_modifier = 0
self.armor_sides = 10
- self.armor_target_modifier = 0
+ self.armor_modifier = 0
self.dreaming_sides = 10
- self.dreaming_target_modifier = 0
+ self.dreaming_modifier = 0
self.reason_sides = 10
- self.reason_target_modifier = 0
+ self.reason_modifier = 0
-- Resources
- t.max_dreaming = t.max_dreaming or 5
- t.max_reason = t.max_reason or 5
+ t.max_dreaming = t.max_dreaming or 1
+ t.max_reason = t.max_reason or 1
+ t.max_actions = t.max_actions or 2
-- Default regen
t.life_regen = t.life_regen or 0.1
t.life_regen_pool = t.life_regen_pool or 0
- t.draming_regen = t.dreaming_regen or 1
+ t.dreaming_regen = t.dreaming_regen or 1
t.reason_regen = t.reason_regen or 1
@@ -84,25 +88,32 @@ function _M:init(t, no_default)
engine.interface.ActorFOV.init(self, t)
end
-function _M:act()
- if not engine.Actor.act(self) then return end
-
- self.changed = true
-
+function _M:actBase()
+ self.energyBase = self.energyBase - game.energy_to_act
-- Cooldown talents
self:cooldownTalents()
-- Regen life
if self.life < self.max_life and self.life_regen > 0 then
self:regenLife()
end
- -- Regen Resources?? May remove this later
+ -- Regen Resources??
self:regenResources()
+ -- Action points reset to full each turn
+ self:regenActions()
-- Compute timed effects
self:timedEffects()
+
+ self.changed = true
+end
+
+function _M:act()
+ if not engine.Actor.act(self) then return end
+
+ self.changed = true
-- Still enough energy to act ?
if self.energy.value < game.energy_to_act then return false end
-
+
return true
end
@@ -111,12 +122,41 @@ function _M:move(x, y, force)
local ox, oy = self.x, self.y
if force or self:enoughEnergy() then
moved = engine.Actor.move(self, x, y, force)
- if not force and moved and (self.x ~= ox or self.y ~= oy) and not self.did_energy then self:useEnergy() end
+ if not force and moved and (self.x ~= ox or self.y ~= oy) and not self.did_energy then
+ -- Spend actions
+ self:incActions(-1)
+ -- If we've used all our actions end our turn
+ if self:getActions() == 0 then
+ self:useEnergy()
+ end
+ self.changed = true
+ end
+ end
+ -- smooth movement
+ if moved and not force and ox and oy and (ox ~= self.x or oy ~= self.y) and config.settings.fae.smooth_move > 0 then
+ local blur = 0
+ if self:getActions() < self:getMaxActions() then
+ blur = blur + (self:getMaxActions() - self:getActions())
+ end
+ self:setMoveAnim(ox, oy, config.settings.fae.smooth_move, blur)
end
self.did_energy = nil
return moved
end
+--- Call when added to a level
+-- Ensures nothing bizzare happens from our life regen method and allows us to do neat things with NPCs
+function _M:addedToLevel(level, x, y)
+ if not self._rst_full then self:resetToFull() self._rst_full = true end -- Only do it once, the first time we come into being
+ self:check("on_added_to_level", level, x, y)
+end
+
+function _M:resetToFull()
+ if self.dead then return end
+ self.life = self.max_life
+ self.actions = self.max_actions
+end
+
--- Regenerate life
-- Life regen only ticks when the life_regen_pool is a whole number
-- This is mostly because I'm OCD and want whole numbers!!
@@ -134,6 +174,12 @@ function _M:regenLife()
end
end
+-- Actions resets to full each turn
+function _M:regenActions()
+ if self.dead then return end
+ self.actions = self.max_actions
+end
+
-- Colorizes the Life display as Life goes down
function _M:colorLife()
local missing_life = self.max_life - self.life
@@ -161,7 +207,8 @@ Offense %s
Defense %s
Damage %s
Armor %s
-Life %s/%s]]):format(self:colorLife(), self.name, self:getOffense(), self:getDefense(), self:getDamage(), self:getArmor(), self.life, self.max_life)
+Life %s/%s
+actions %s/%s]]):format(self:colorLife(), self.name, self:getOffense(), self:getDefense(), self:getDamage(), self:getArmor(), self.life, self.max_life, self:getActions(), self:getMaxActions())
-- self:getDisplayString(),
-- self.level,
-- self.life, self.life * 100 / self.max_life,
@@ -190,8 +237,6 @@ end
function _M:levelup()
self.max_life = self.max_life + 2
--- self:incMaxReason(3)
-
-- Heal upon new level
self.life = self.max_life
end
@@ -400,16 +445,4 @@ function _M:defineDisplayCallback()
end
return true
end)
-end
-
---- Call when added to a level
--- Ensures nothing bizzare happens from our life regen method and allows us to do neat things with NPCs
-function _M:addedToLevel(level, x, y)
- if not self._rst_full then self:resetToFull() self._rst_full = true end -- Only do it once, the first time we come into being
- self:check("on_added_to_level", level, x, y)
-end
-
-function _M:resetToFull()
- if self.dead then return end
- self.life = self.max_life
end
View
@@ -123,7 +123,10 @@ function _M:newGame()
self.creating_player = false
print("[PLAYER BIRTH] resolved!")
self.player.changed = true
- self:registerBirthProfile()
+ -- don't ask for a profile while developing
+ if not config.settings.cheat then
+ self:registerBirthProfile()
+ end
end)
self:registerDialog(birth)
end
@@ -532,7 +535,9 @@ function _M:setupCommands()
-- Lua console, you probably want to disable it for releases
LUA_CONSOLE = function()
- self:registerDialog(DebugConsole.new())
+ if config.settings.cheat then
+ self:registerDialog(DebugConsole.new())
+ end
end,
-- Toggle monster list
View
@@ -39,7 +39,7 @@ function _M:act()
-- Let the AI think .... beware of Shub !
-- If AI did nothing, use energy anyway
self:doAI()
- if not self.energy.used then self:useEnergy() end
+ if not self.energy.used and self:getActions() == self:getMaxActions() then self:useEnergy() end
end
--- Called by ActorLife interface
View
@@ -63,6 +63,9 @@ function _M:init(t, no_default)
t.lite = t.lite or 0
t.old_life = 0
+
+ t.max_dreaming = 5
+ t.max_reason = 5
mod.class.Actor.init(self, t, no_default)
engine.interface.PlayerHotkeys.init(self, t)
View
@@ -104,6 +104,8 @@ function _M:display()
self:makeTexture(("#AQUAMARINE#Dreaming: #LAST#%d/%d "):format(player.dreaming, player.max_dreaming), w * 0.03, h * 0.05)
self:makeTexture(("#STEEL_BLUE#Reason: #LAST#%d/%d "):format(player.reason, player.max_reason), w * 0.03, h * 0.09)
+
+ self:makeTexture(("#YELLOW#Action Points: #LAST#%d/%d "):format(player:getActions(), player:getMaxActions()), w * 0.4, h * 0.01)
-- TODO: Colored Zone Names for this display
self:makeTexture(("%s"):format(game.zone.name), w * 0.8, h * 0.01, 240, 240, 120)
Oops, something went wrong.

0 comments on commit a2ff666

Please sign in to comment.