Commit 715ebe95fcae19725cee66f54ba5bafc7db6069e

Authored by yutio888
1 parent daccc078

Rework Step Up: Each kill provides a 2-turn buff that gives 1000% movement speed…

… for several moves, and any action other than moving will remove the buff.
Reasons:
1. removes raw talent level usage & removes old-fashioned callback in Actor.lua
2. makes it more predictable and reliable
3. talent level above 5 gives small bonus
... ... @@ -3344,10 +3344,6 @@ function _M:die(src, death_note)
3344 3344 p.kills = p.kills + 1
3345 3345 end
3346 3346
3347   - if src and src.knowTalent and src:knowTalent(src.T_STEP_UP) and rng.percent(src:getTalentLevelRaw(src.T_STEP_UP) * 20) then
3348   - game:onTickEnd(function() src:setEffect(self.EFF_STEP_UP, 1, {}) end)
3349   - end
3350   -
3351 3347 if src and self.reset_rush_on_death and self.reset_rush_on_death == src then
3352 3348 game:onTickEnd(function()
3353 3349 src:alterTalentCoolingdown(src.T_RUSH, -1000)
... ...
... ... @@ -40,16 +40,25 @@ newTalent{
40 40 end,
41 41 }
42 42
43   -newTalent{ -- Doesn't scale past level 5, could use some bonus for higher talent levels
  43 +newTalent{
44 44 name = "Step Up",
45 45 type = {"technique/battle-tactics", 2},
46 46 require = techs_req_high2,
47 47 mode = "passive",
48 48 points = 5,
  49 + getSteps = function(self, t)
  50 + local globalSpeedBonus = math.max(1, self.global_speed or 1)
  51 + return math.ceil(self:combatTalentScale(t, 1, 7) * globalSpeedBonus)
  52 + end,
  53 + callbackOnKill = function(self, t)
  54 + game:onTickEnd(function() self:setEffect(self.EFF_STEP_UP, 2, { nb = t.getSteps(self, t)}) end)
  55 + end,
49 56 info = function(self, t)
50   - return ([[After killing a foe, you have a %d%% chance to gain a 1000%% movement speed bonus for 1 game turn.
  57 + local steps = t.getSteps(self, t)
  58 + return ([[After killing a foe, you gain a 1000%% movement speed bonus in next %d steps for 2 turns.
51 59 The bonus disappears as soon as any action other than moving is done.
52   - Note: since you will be moving very fast, game turns will pass very slowly.]]):tformat(math.min(100, self:getTalentLevelRaw(t) * 20))
  60 + The maximum steps increases with your current global speed.
  61 + Note: since you will be moving very fast, game turns will pass very slowly.]]):tformat(steps)
53 62 end,
54 63 }
55 64
... ...
... ... @@ -1277,21 +1277,30 @@ newEffect{
1277 1277 newEffect{
1278 1278 name = "STEP_UP", image = "talents/step_up.png",
1279 1279 desc = _t"Step Up",
1280   - long_desc = function(self, eff) return ("Movement is %d%% faster."):tformat(eff.power) end,
  1280 + long_desc = function(self, eff) return ("Movement is 1000%% faster for next %d moves."):tformat(eff.nb or 1) end,
1281 1281 type = "physical",
1282 1282 subtype = { speed=true, tactic=true },
1283 1283 status = "beneficial",
1284 1284 parameters = {power=1000},
1285 1285 on_gain = function(self, err) return _t"#Target# prepares for the next kill!", _t"+Step Up" end,
1286 1286 on_lose = function(self, err) return _t"#Target# slows down.", _t"-Step Up" end,
  1287 + charges = function(self, eff) return eff.nb or 1 end,
1287 1288 get_fractional_percent = function(self, eff)
1288 1289 local d = game.turn - eff.start_turn
1289 1290 return util.bound(360 - d / eff.possible_end_turns * 360, 0, 360)
1290 1291 end,
1291 1292 lists = 'break_with_step_up',
  1293 + callbackOnMove = function(self, eff, moved, force, ox, oy)
  1294 + if not moved or force then return end
  1295 + if self:attr("free_movement") then return end
  1296 + eff.nb = (eff.nb or 1) - 1
  1297 + if eff.nb <= 0 then
  1298 + self:removeEffect(self.EFF_STEP_UP, false, true)
  1299 + end
  1300 + end,
1292 1301 activate = function(self, eff)
1293 1302 eff.start_turn = game.turn
1294   - eff.possible_end_turns = 10 * (eff.dur+1)
  1303 + eff.possible_end_turns = 10 * (eff.dur+2)
1295 1304 eff.tmpid = self:addTemporaryValue("step_up", 1)
1296 1305 eff.moveid = self:addTemporaryValue("movement_speed", eff.power/100)
1297 1306 -- should change priorities rather than forbid all talents
... ... @@ -1300,7 +1309,7 @@ newEffect{
1300 1309 deactivate = function(self, eff)
1301 1310 self:removeTemporaryValue("step_up", eff.tmpid)
1302 1311 if eff.aiid then self:removeTemporaryValue("ai_state", eff.aiid) end
1303   - self:removeTemporaryValue("movement_speed", eff.moveid)
  1312 + if eff.moveid then self:removeTemporaryValue("movement_speed", eff.moveid) end
1304 1313 end,
1305 1314 }
1306 1315
... ...