renamed tables for consistency

- added magic.lua (todo: enumerate modifiers and stuff)
- moved aggro handling to session position update
- some cleanup
This commit is contained in:
Tahir Akhlaq 2017-08-29 01:15:12 +01:00
parent 6c74222b68
commit f4016e1a12
25 changed files with 539 additions and 442 deletions

View file

@ -1,3 +1,6 @@
require("global");
require("magic");
function onMagicPrepare(caster, target, spell)
return 0;
end;
@ -8,13 +11,16 @@ end;
function onMagicFinish(caster, target, spell, action)
local damage = math.random(10, 100);
print("fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuckkk")
action.param = damage;
-- todo: populate a global script with statuses and modifiers
action.worldMasterTextId = 0x765D;
-- todo: populate a global script with statuses and modifiers
-- magic.HandleAttackMagic(caster, target, spell, action)
-- action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636);
action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636);
if target.hateContainer then
target.hateContainer.AddBaseHate(caster);
target.hateContainer.UpdateHate(caster, damage);
end;
return damage;

View file

@ -1,3 +1,5 @@
require("magic");
function onMagicPrepare(caster, target, spell)
return 0;
end;
@ -8,11 +10,14 @@ end;
function onMagicFinish(caster, target, spell, action)
local damage = math.random(10, 100);
print("fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuckkk")
action.worldMasterTextId = 0x765D;
-- todo: populate a global script with statuses and modifiers
-- magic.HandleAttackMagic(caster, target, spell, action)
action.effectId = bit32.bxor(0x8000000, spell.effectAnimation, 15636);
if target.hateContainer then
target.hateContainer.AddBaseHate(caster);
target.hateContainer.UpdateHate(caster, damage);
end;
return damage;

41
data/scripts/magic.lua Normal file
View file

@ -0,0 +1,41 @@
-- todo: add enums for status effects in global.lua
require("global")
magic =
{
};
--[[
modifier - Modifier.Intelligence, Modifier.Mind (see Modifier.cs)
multiplier -
]]
function magic.HandleHealingMagic(caster, target, spell, action, modifierId, multiplier, baseAmount)
potency = potency or 1.0;
healAmount = baseAmount;
-- todo: shit based on mnd
local mind = caster.GetMod(Modifier.Mind);
end;
function magic.HandleAttackMagic(caster, target, spell, action, modifierId, multiplier, baseAmount)
-- todo: actually handle this
damage = baseAmount or math.random(1,10) * 10;
return damage;
end;
function magic.HandleEvasion(caster, target, spell, action, modifierId)
return false;
end;
function magic.HandleStoneskin(caster, target, spell, action, modifierId, damage)
--[[
if target.statusEffects.HasStatusEffect(StatusEffect.Stoneskin) then
-- todo: damage reduction
return true;
end;
]]
return false;
end;