Combat additions

Added formulas for base EXP gain and chain experience
Added basic scripts for most player abilities and effects
Added stat gains for some abilities
Changed status flags
Fixed bug with player death
Fixed bug where auto attacks didnt work when not locked on
Added traits
This commit is contained in:
yogurt 2018-04-18 16:06:41 -05:00
parent b8d6a943aa
commit c5ce2ec771
239 changed files with 5125 additions and 1237 deletions

View file

@ -0,0 +1,51 @@
require("global")
require("modifiers")
require("hiteffect")
require("battleutils")
require("utils")
parryPerDT = 20;
delayMsPerDT = 100;
function onGain(owner, effect)
owner.statusEffects.RemoveStatusEffect(223207);
end
--Increases parry rating and attack speed for each hit. (Need more info)
function onDamageTaken(effect, attacker, defender, action, actionContainer)
--Assuming 20 parry rating every time you're hit up to 200
--Delay is more complicated. Most axes are around 4 seconds, so i'm gonna assume it cuts off a full second at max
if (effect.GetExtra() < 10) then
effect.SetExtra(effect.GetExtra() + 1);
attacker.AddMod(modifiersGlobal.Parry, parryPerDT);
attacker.SubtractMod(modifiersGlobal.Delay, delayMsPerDT);
end
end
--Heals for 50% of damage dealt on crits with a maximum of 20% of max hp
--Also only heals for as much hp as you're missing at most
function onCrit(effect, attacker, defender, action, actionContainer)
local healAmount = math.Clamp(action.amount * 0.50, 0, defender.GetMaxHP() * 0.20);
healAmount = math.Clamp(healAmount, 0, defender.GetMaxHP() - defender.GetHP());
defender.AddHP(healAmount);
--33012: You recover [healAmount] HP.
actionContainer.AddHPAction(owner.actorId, 33008, healAmount);
end;
--"Effect fades over time"
function onTick(owner, effect)
--Enduring march prevents fading of rampage effect
if not owner.statusEffects.HasStatusEffect(223078) and (effect.GetExtra() > 0) then
--Going to assume that every 5 seconds a single hits worth of rampage is lost.
attacker.SubtractMod(modifiersGlobal.Parry, parryPerDT);
attacker.AddMod(modifiersGlobal.Delay, delayMsPerDT);
effect.SetExtra(effect.GetExtra() - 1);
end
end
function onLose(owner, effect)
attacker.SubtractMod(modifiersGlobal.Parry, effect.GetExtra() * parryPerDT);
attacker.AddMod(modifiersGlobal.Delay, effect.GetExtra() * delayMsPerDT);
end