I do, I do. Let's see how 'simple' this is...akroma222 wrote:Thats sounds a lot better cameronC, do you volunteer for this??![]()
Code: Select all
defineTrait{
name = "woodcutter",
uiName = "Wood Cutter",
icon = 94,
description = "I like to chop the woods",
}
defineTrait{
name = "master_axeman",
uiName = "Axe Master",
icon = 94,
description = "So masterful with axes right now!",
}
defineTrait{
name = "grandmaster_axeman",
uiName = "Axe Grand Master",
icon = 94,
description = "So grandmasterful with axes right now!",
}
defineTrait{
name = "skullcrusher",
uiName = "Skull Crusher",
icon = 94,
description = "I like to crush the skulls",
}
defineTrait{
name = "master_maceman",
uiName = "Mace Master",
icon = 94,
description = "So masterful with maces right now!",
}
defineTrait{
name = "grandmaster_maceman",
uiName = "Mace Grand Master",
icon = 94,
description = "So grandmasterful with maces right now!",
}
Code: Select all
defineObject{
name = "hand_axe",
baseObject = "base_item",
tags = { "weapon", "axe" },
components = {
{
class = "Model",
model = "assets/models/items/hand_axe.fbx",
},
{
class ="Item",
uiName = "Hand Axe",
gfxAtlas = "assets/textures/gui/items.tga",
gfxIndex = 25,
weight = 2.6,
impactSound = "impact_blade",
traits = { "axe", "heavy_weapon"},
description = "A short but solid axe commonly used for chopping wood."
},
{
class = "MeleeAttack",
attackPower = 10,
accuracy = 0,
swipe = "horizontal",
attackSound = "swipe",
cooldown = 4.5,
pierce = 0,
baseDamageStat = "strength",
damageType = "physical",
onAttack = function(self, champion, action, slot)
weaponModManager.script.addWeaponModifiers(self, champion:getOrdinal(), "axe")
delayedCall("weaponModManager", 0.2, "removeWeaponModifiers", self, champion:getOrdinal(), "axe")
end,
},
}
}
defineObject{
name = "bone_club",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/bone_club.fbx",
},
{
class = "Item",
uiName = "Bone Club",
description = "A makeshift club made from the leg bone of an unknown beast.",
gfxIndex = 298,
impactSound = "impact_blunt",
weight = 1.2,
traits = { "heavy_weapon", "mace" },
},
{
class = "MeleeAttack",
attackPower = 4,
accuracy = 0,
pierce = 10,
cooldown = 3,
swipe = "vertical",
attackSound = "swipe",
onAttack = function(self, champion, action, slot)
weaponModManager.script.addWeaponModifiers(self, champion:getOrdinal(), "mace")
delayedCall("weaponModManager", 0.2, "removeWeaponModifiers", self, champion:getOrdinal(), "mace")
end,
},
},
tags = { "weapon" },
}
Code: Select all
-------------------------------------------------------- Trait lists
TRAIT_LIST = {
woodcutter = true,
master_axeman = true,
grandmaster_axeman = true,
skullcrusher = true,
master_maceman = true,
grandmaster_maceman = true
}
axe_TRAITS = {
woodcutter = true,
master_axeman = true,
grandmaster_axeman = true
}
mace_TRAITS = {
skullcrusher = true,
master_maceman = true,
grandmaster_maceman = true
}
--------------------------------------------------------- Modifier list
modList = {}
----------------------------------------------------------gatherModifierTraits(self, champion, weapontype)
function gatherModifierTraits(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
modList[c] = {}
if weapontype1 == "axe"
or weapontype2 == "axe" then
for trait,dummy in pairs(axe_TRAITS) do
if c:hasTrait(trait) then
modList[c][trait] = 1
--print(modList[c][trait])
else
modList[c][trait] = nil
--print(modList[c][trait])
end
end
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
for trait,dummy in pairs(mace_TRAITS) do
if c:hasTrait(trait) then
modList[c][trait] = 1
--print(modList[c][trait])
else
modList[c][trait] = nil
--print(modList[c][trait])
end
end
end
end
---------------------------------------------------------addWeaponModifiers(self, champion, weapontype)
trueAttack = 0
truePierce = 1
function addWeaponModifiers(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
trueAttack = self:getAttackPower()
truePierce = self:getPierce()
if truePierce == nil then
print("you must define weapon with 'pierce = 0'")
print("pierce = 1")
truePierce = 1
end
gatherModifierTraits(weaponName, champion, weapontype1, weapontype2)
if weapontype1 == "axe"
or weapontype2 == "axe" then
local cutterAttack = 0
local masterAttack = 0
local grandmasterAttack = 0
if modList[c]["woodcutter"] == 1 then
local dx,dy = getForward(party.facing)
for i in party.map:entitiesAt(party.x + dx,party.y + dy) do
if i and i.monster then
if i.monster:hasTrait("plant") then
cutterAttack = 100
self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
end
end
end
if modList[c]["master_axeman"] == 1 then
masterAttack = 20
self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
if modList[c]["grandmaster_axeman"] == 1 then
grandmasterAttack = 50
self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
local crusherPierce = 0
local masterPierce = 0
local grandmasterPierce = 0
if modList[c]["skullcrusher"] == 1 then
crusherPierce = 10
self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
if modList[c]["master_maceman"] == 1 then
masterPierce = 20
self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
if modList[c]["grandmaster_maceman"] == 1 then
grandmasterPierce = 50
self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
end
end
function removeWeaponModifiers(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
local aP = self:getAttackPower()
if weapontype1 == "axe"
or weapontype2 == "axe" then
for trait,dummy in pairs(axe_TRAITS) do
modList[c][trait] = nil
end
self:setAttackPower(trueAttack)
print(""..self:getAttackPower().."")
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
for trait,dummy in pairs(mace_TRAITS) do
modList[c][trait] = nil
end
self:setPierce(truePierce)
print(""..self:getPierce().."")
end
end
Code: Select all
onAttack = function(self, champion, action, slot)
weaponModManager.script.addWeaponModifiers(self, champion:getOrdinal(), "axe")
delayedCall("weaponModManager", 0.2, "removeWeaponModifiers", self, champion:getOrdinal(), "axe")
end,
Code: Select all
onAttack = function(self, champion, action, slot)
weaponModManager.script.addWeaponModifiers(self, champion:getOrdinal(), "mace")
delayedCall("weaponModManager", 0.2, "removeWeaponModifiers", self, champion:getOrdinal(), "mace")
end,
Code: Select all
defineSkill{
name = "axe_prof",
uiName = "Axe proficience",
priority = 10,
iconAtlas = "mod_assets/icons/testujuikony.tga",
icon = 0,
description = "Swinging the axe makes your character much stronger. Each point invested increases your Strength and Hit points. Third skill point also provide you with bonus +10 to attack power and finally on level 5 you gain ultimate bonus +20 to attack power with axes.",
traits = { [1] = "novice_axeman", [2] = "apprentice_axeman", [3] = "expert_axeman", [4] = "master_axeman", [5] = "grandmaster_axeman" },
}
defineSkill{
name = "mace_prof",
uiName = "Mace proficience",
priority = 10,
iconAtlas = "mod_assets/icons/testujuikony.tga",
icon = 0,
description = "You become more resistant on the battlefield while fighting with Mace. Each point invested increases your Vitality and Hit points. On Level 3 your attack with mace ignores 10 points of opponents armor and finally on level 5 your attack ignores 30 points of armor.",
traits = { [1] = "novice_mace", [2] = "apprentice_mace", [3] = "expert_mace", [4] = "master_mace", [5] = "grandmaster_mace" },
}
Code: Select all
defineTrait{
name = "novice_axeman",
uiName = "Novice Axeman",
icon = 94,
description = "You started to learn how cut the trees. Strength bonus +1, Health +5.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("strength", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "apprentice_axeman",
uiName = "Apprentice Axeman",
icon = 94,
description = "Cuting monster heads is much better than lumbering the woods. Strength bonus +1, Health +5.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("strength", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "expert_axeman",
uiName = "Expert Axeman",
icon = 94,
description = "You have learned how to use axe and there are scary rumors among the monsters. Strength bonus +1, Health +5. Attack power +10 while using axes.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("strength", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "master_axeman",
uiName = "Master Axeman",
icon = 94,
description = "You have mastered the axe. Only one final training is before you to reach the rank of Grandmaster. Bonus +1 Strength, Health +5.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("strength", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "grandmaster_axeman",
uiName = "Axe Grand Master",
icon = 94,
description = "Finally ! You are able to kill any monster with one mighty swing ! Bonus + 20 to attack power with axes !",
}
defineTrait{
name = "novice_mace",
uiName = "Mace Novice",
icon = 94,
description = "You can withstand some hard blows. Bonus +1 Vitality and + 5 Hit points.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("vitality", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "apprentice_mace",
uiName = "Mace Apprentice",
icon = 94,
description = "You are more resistant now. Bonus +1 Vitality and + 5 Hit points.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("vitality", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "expert_mace",
uiName = "Mace Expert",
icon = 94,
description = "You learned how to use mace properly. Bonus +1 Vitality and + 5 Hit points and you ignore 10 points of opponents armor with mace.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("vitality", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "master_mace",
uiName = "Mace Master",
icon = 94,
description = "Only one final training is before you to reach rank of the Granmaster. Bonus +1 Vitality and + 5 Hit points.",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
champion:addStatModifier("vitality", 1)
champion:addStatModifier("max_health", 5)
-- champion:addStatModifier("max_energy", 30 + (level-1) * 3)
end
end,
}
defineTrait{
name = "grandmaster_mace",
uiName = "Mace Grand Master",
icon = 94,
description = "Bash them hard, bash them good ! You ignore 30 points of opponents armor.",
}
Code: Select all
-------------------------------------------------------- Trait lists
TRAIT_LIST = {
-- woodcutter = true,
expert_axeman = true,
grandmaster_axeman = true,
-- skullcrusher = true,
expert_maceman = true,
grandmaster_maceman = true
}
axe_TRAITS = {
-- woodcutter = true,
expert_axeman = true,
grandmaster_axeman = true
}
mace_TRAITS = {
-- skullcrusher = true,
expert_maceman = true,
grandmaster_maceman = true
}
--------------------------------------------------------- Modifier list
modList = {}
----------------------------------------------------------gatherModifierTraits(self, champion, weapontype)
function gatherModifierTraits(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
modList[c] = {}
if weapontype1 == "axe"
or weapontype2 == "axe" then
for trait,dummy in pairs(axe_TRAITS) do
if c:hasTrait(trait) then
modList[c][trait] = 1
--print(modList[c][trait])
else
modList[c][trait] = nil
--print(modList[c][trait])
end
end
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
for trait,dummy in pairs(mace_TRAITS) do
if c:hasTrait(trait) then
modList[c][trait] = 1
--print(modList[c][trait])
else
modList[c][trait] = nil
--print(modList[c][trait])
end
end
end
end
---------------------------------------------------------addWeaponModifiers(self, champion, weapontype)
trueAttack = 0
truePierce = 1
function addWeaponModifiers(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
trueAttack = self:getAttackPower()
truePierce = self:getPierce()
if truePierce == nil then
print("you must define weapon with 'pierce = 0'")
print("pierce = 1")
truePierce = 1
end
gatherModifierTraits(weaponName, champion, weapontype1, weapontype2)
if weapontype1 == "axe"
or weapontype2 == "axe" then
-- local cutterAttack = 0
local expertAttack = 0
local grandmasterAttack = 0
-- if modList[c]["woodcutter"] == 1 then
-- local dx,dy = getForward(party.facing)
-- for i in party.map:entitiesAt(party.x + dx,party.y + dy) do
-- if i and i.monster then
-- if i.monster:hasTrait("plant") then
-- cutterAttack = 100
-- self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
-- print(""..self:getAttackPower().."")
-- end
-- end
-- end
-- end
if modList[c]["expert_axeman"] == 1 then
expertAttack = 10
self:setAttackPower(trueAttack + expertAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
if modList[c]["grandmaster_axeman"] == 1 then
grandmasterAttack = 20
self:setAttackPower(trueAttack + expertAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
-- local crusherPierce = 0
local expertPierce = 0
local grandmasterPierce = 0
-- if modList[c]["skullcrusher"] == 1 then
-- crusherPierce = 10
-- self:setPierce(truePierce + crusherPierce + grandmasterPierce)
-- print(""..self:getPierce().."")
-- end
if modList[c]["expert_maceman"] == 1 then
expertPierce = 10
self:setPierce(truePierce + expertPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
if modList[c]["grandmaster_mace"] == 1 then
grandmasterPierce = 30
self:setPierce(truePierce + expertPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
end
end
function removeWeaponModifiers(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
local aP = self:getAttackPower()
if weapontype1 == "axe"
or weapontype2 == "axe" then
for trait,dummy in pairs(axe_TRAITS) do
modList[c][trait] = nil
end
self:setAttackPower(trueAttack)
print(""..self:getAttackPower().."")
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
for trait,dummy in pairs(mace_TRAITS) do
modList[c][trait] = nil
end
self:setPierce(truePierce)
print(""..self:getPierce().."")
end
end
Code: Select all
defineSkill{
name = "athletics",
uiName = "Athletics",
priority = 20,
icon = 12,
description = "Increases your health by 20 for each skill point. At 3rd skill level your carrying capacity is increased by 15 kg.",
traits = { [3] = "pack_mule" },
onRecomputeStats = function(champion, level)
champion:addStatModifier("max_health", level*20)
end,
}
defineSkill{
name = "concentration",
uiName = "Concentration",
priority = 30,
icon = 26,
description = "Increases your energy by 20 for each skill point. At 3rd level your Energy regeneration rate is increased by 25% while resting.",
onRecomputeStats = function(champion, level)
champion:addStatModifier("max_energy", level*20)
end,
traits = { [3] = "meditation" },
}
Code: Select all
defineSkill{
name = "axe_prof",
uiName = "Axe proficiency",
priority = 10,
iconAtlas = "mod_assets/icons/testujuikony.tga",
icon = 0,
description = "Swinging the axe makes your character much stronger. Each point invested increases your Strength (+1) and Hit points (+5). At the 3rd skill level you gain the Expert Axeman trait (Attack Power +10) and at the 5th level you gain the Master Axeman trait (Attack Power +30).",
onRecomputeStats = function(champion, level)
if level > 0 then
level = champion:getLevel()
health = chamion::getMaxHealth()
champion:addStatModifier("strength", level)
champion:addStatModifier("max_health", health + level)
end
end,
traits = { [3] = "expert_axeman", [5] = "grandmaster_axeman" },
}
thanks for ideas and corrections. I will probably use the "original" system (no trait every level) but I have problem to define script for swords, where on level 1 and 3 you gain Dexterity+1 and energy +5, while on level 2 and 4 you gain +1 STR and +5hp and on level 5 you gain some trait. Are you able to script this skill ?akroma222 wrote:Hey Drakkan,
You will know once you and others start play testing your mod![]()
Code: Select all
defineSkill{
name = "sword_prof",
uiName = "Sword proficiency",
priority = 10,
iconAtlas = "mod_assets/icons/testujuikony.tga",
icon = 0,
description = "Mastering the sword requires both dexterity and Strength. Each point invested increases your Strength / Hit points or Dexterity / energy. On Level 5 any attack with sword is 20% faster.",
--lev1,3 = dex +1,+5 energy
--lev2,4 = str +1, +5 hp
--lev5 = only trait bonus
--traits = { [1] = "novice_sword", [2] = "apprentice_sword", [3] = "expert_sword", [4] = "master_sword", [5] = "grandmaster_sword" },
}
And a script entity (weaponModManager) with this:SpoilerShowCode: Select all
-------------------------------------------------------- Trait lists TRAIT_LIST = { woodcutter = true, master_axeman = true, grandmaster_axeman = true, skullcrusher = true, master_maceman = true, grandmaster_maceman = true } axe_TRAITS = { woodcutter = true, master_axeman = true, grandmaster_axeman = true } mace_TRAITS = { skullcrusher = true, master_maceman = true, grandmaster_maceman = true } --------------------------------------------------------- Modifier list modList = {} ----------------------------------------------------------gatherModifierTraits(self, champion, weapontype) function gatherModifierTraits(self, champion, weapontype1, weapontype2) local c = party.party:getChampion(champion) modList[c] = {} if weapontype1 == "axe" or weapontype2 == "axe" then for trait,dummy in pairs(axe_TRAITS) do if c:hasTrait(trait) then modList[c][trait] = 1 --print(modList[c][trait]) else modList[c][trait] = nil --print(modList[c][trait]) end end end if weapontype1 == "mace" or weapontype2 == "mace" then for trait,dummy in pairs(mace_TRAITS) do if c:hasTrait(trait) then modList[c][trait] = 1 --print(modList[c][trait]) else modList[c][trait] = nil --print(modList[c][trait]) end end end end ---------------------------------------------------------addWeaponModifiers(self, champion, weapontype) trueAttack = 0 truePierce = 1 function addWeaponModifiers(self, champion, weapontype1, weapontype2) local c = party.party:getChampion(champion) trueAttack = self:getAttackPower() truePierce = self:getPierce() if truePierce == nil then print("you must define weapon with 'pierce = 0'") print("pierce = 1") truePierce = 1 end gatherModifierTraits(weaponName, champion, weapontype1, weapontype2) if weapontype1 == "axe" or weapontype2 == "axe" then local cutterAttack = 0 local masterAttack = 0 local grandmasterAttack = 0 if modList[c]["woodcutter"] == 1 then local dx,dy = getForward(party.facing) for i in party.map:entitiesAt(party.x + dx,party.y + dy) do if i and i.monster then if i.monster:hasTrait("plant") then cutterAttack = 100 self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack) print(""..self:getAttackPower().."") end end end end if modList[c]["master_axeman"] == 1 then masterAttack = 20 self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack) print(""..self:getAttackPower().."") end if modList[c]["grandmaster_axeman"] == 1 then grandmasterAttack = 50 self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack) print(""..self:getAttackPower().."") end end if weapontype1 == "mace" or weapontype2 == "mace" then local crusherPierce = 0 local masterPierce = 0 local grandmasterPierce = 0 if modList[c]["skullcrusher"] == 1 then crusherPierce = 10 self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce) print(""..self:getPierce().."") end if modList[c]["master_maceman"] == 1 then masterPierce = 20 self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce) print(""..self:getPierce().."") end if modList[c]["grandmaster_maceman"] == 1 then grandmasterPierce = 50 self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce) print(""..self:getPierce().."") end end end function removeWeaponModifiers(self, champion, weapontype1, weapontype2) local c = party.party:getChampion(champion) local aP = self:getAttackPower() if weapontype1 == "axe" or weapontype2 == "axe" then for trait,dummy in pairs(axe_TRAITS) do modList[c][trait] = nil end self:setAttackPower(trueAttack) print(""..self:getAttackPower().."") end if weapontype1 == "mace" or weapontype2 == "mace" then for trait,dummy in pairs(mace_TRAITS) do modList[c][trait] = nil end self:setPierce(truePierce) print(""..self:getPierce().."") end end
Code: Select all
=== Software Failure ===
weaponModManager: cannot serialize table key of type table
stack traceback:
[C]: in function 'error'
[string "Script.lua"]: in function 'saveValue'
[string "Script.lua"]: in function 'saveState'
[string "GameObject.lua"]: in function 'saveState'
[string "Map.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "GameMode.lua"]: in function 'quickSave'
[string "GameMode.lua"]: in function 'keyPressed'
[string "Grimrock.lua"]: in function 'pollEvents'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk
Code: Select all
-------------------------------------------------------- Trait lists
TRAIT_LIST = {
woodcutter = true,
master_axeman = true,
grandmaster_axeman = true,
skullcrusher = true,
master_maceman = true,
grandmaster_maceman = true
}
axe_TRAITS = {
woodcutter = true,
master_axeman = true,
grandmaster_axeman = true
}
mace_TRAITS = {
skullcrusher = true,
master_maceman = true,
grandmaster_maceman = true
}
--------------------------------------------------------- Modifier list
modList = {}
----------------------------------------------------------gatherModifierTraits(self, champion, weapontype1, weapontype2)
function gatherModifierTraits(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
if weapontype1 == "axe"
or weapontype2 == "axe" then
for trait,dummy in pairs(axe_TRAITS) do
if c:hasTrait(trait) then
modList[trait] = 1
print(modList[trait])
else
modList[trait] = nil
print(modList[trait])
end
end
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
for trait,dummy in pairs(mace_TRAITS) do
if c:hasTrait(trait) then
modList[trait] = 1
print(modList[trait])
else
modList[trait] = nil
print(modList[trait])
end
end
end
end
---------------------------------------------------------addWeaponModifiers(self, champion, weapontype1, weapontype2)
trueAttack = 0
truePierce = 1
function addWeaponModifiers(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
trueAttack = self:getAttackPower()
truePierce = self:getPierce()
if truePierce == nil then
print("you must define weapon with 'pierce = 0'")
print("pierce = 1")
truePierce = 1
end
gatherModifierTraits(weaponName, champion, weapontype1, weapontype2)
if weapontype1 == "axe"
or weapontype2 == "axe" then
local cutterAttack = 0
local masterAttack = 0
local grandmasterAttack = 0
if modList["woodcutter"] == 1 then
local dx,dy = getForward(party.facing)
for i in party.map:entitiesAt(party.x + dx,party.y + dy) do
if i and i.monster then
if i.monster:hasTrait("plant") then
cutterAttack = 100
self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
end
end
end
if modList["master_axeman"] == 1 then
masterAttack = 20
self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
if modList["grandmaster_axeman"] == 1 then
grandmasterAttack = 50
self:setAttackPower(trueAttack + cutterAttack + masterAttack + grandmasterAttack)
print(""..self:getAttackPower().."")
end
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
local crusherPierce = 0
local masterPierce = 0
local grandmasterPierce = 0
if modList["skullcrusher"] == 1 then
crusherPierce = 10
self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
if modList["master_maceman"] == 1 then
masterPierce = 20
self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
if modList["grandmaster_maceman"] == 1 then
grandmasterPierce = 50
self:setPierce(truePierce + crusherPierce + masterPierce + grandmasterPierce)
print(""..self:getPierce().."")
end
end
end
function removeWeaponModifiers(self, champion, weapontype1, weapontype2)
local c = party.party:getChampion(champion)
local aP = self:getAttackPower()
if weapontype1 == "axe"
or weapontype2 == "axe" then
for trait,dummy in pairs(axe_TRAITS) do
modList[trait] = nil
end
self:setAttackPower(trueAttack)
print(""..self:getAttackPower().."")
end
if weapontype1 == "mace"
or weapontype2 == "mace" then
for trait,dummy in pairs(mace_TRAITS) do
modList[trait] = nil
end
self:setPierce(truePierce)
print(""..self:getPierce().."")
end
end
-------------------------------------------------------------------------------------stunstrikeCleanup(champion, weapon, stun, stunChance)
function stunstrikeCleanup(champion, weapon, stun, stunChance)
local tempStunChance = weapon.go.meleeattack:getConditionChance("stunned")
if stun == false then
weapon.go.meleeattack:setCauseCondition("")
weapon.go.meleeattack:setConditionChance(0)
--print(weapon.go.meleeattack:getConditionChance())
else
weapon.go.meleeattack:setCauseCondition("stunned")
weapon.go.meleeattack:setConditionChance(stunChance)
--print(weapon.go.meleeattack:getConditionChance())
end
end