local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) -- Lembrar de alterar o elemento quando for duplicar.
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, false)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE6, AREADIAGONAL_WAVE6))
local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, false)
combat2:setParameter(COMBAT_PARAM_USECHARGES, true)
combat2:setArea(createCombatArea(AREA_WAVE6, AREADIAGONAL_WAVE6))
local combat3 = Combat()
combat3:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat3:setParameter(COMBAT_PARAM_BLOCKARMOR, false)
combat3:setParameter(COMBAT_PARAM_USECHARGES, true)
combat3:setArea(createCombatArea(AREA_WAVE6, AREADIAGONAL_WAVE6))
local combat4 = Combat()
combat4:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat4:setParameter(COMBAT_PARAM_BLOCKARMOR, false)
combat4:setParameter(COMBAT_PARAM_USECHARGES, true)
combat4:setArea(createCombatArea(AREA_WAVE6, AREADIAGONAL_WAVE6))
function onGetFormulaValues(player, skill, attack, skill, factor)
local maxHealth = player:getMaxHealth()
local maxMana = player:getMaxMana()
local playlvl = player:getLevel()
if (playlvl<300) then
local min = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
else
local min = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
end
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onGetFormulaValues2(player, skill, attack, skill, factor)
local maxHealth = player:getMaxHealth()
local maxMana = player:getMaxMana()
local playlvl = player:getLevel()
if (playlvl<300) then
local min = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
else
local min = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
end
end
combat2:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues2")
function onGetFormulaValues3(player, skill, attack, skill, factor)
local maxHealth = player:getMaxHealth()
local maxMana = player:getMaxMana()
local playlvl = player:getLevel()
if (playlvl<300) then
local min = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
else
local min = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
end
end
combat3:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues3")
function onGetFormulaValues4(player, skill, attack, skill, factor)
local maxHealth = player:getMaxHealth()
local maxMana = player:getMaxMana()
local playlvl = player:getLevel()
if (playlvl<300) then
local min = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((player:getLevel()) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
else
local min = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,5
local max = ((300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,0
return -min, -max
end
end
combat4:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues4")
function onCastSpell(creature, variant, player)
local weapons = {26238, 26240, 26328, 26330, 26329, 26239, 26331, 26158, 26159, 26136, 26145, 26218, 26302, 26303, 26300, 26301, 26219, 26162, 26217, 26163,
26215, 26298, 26299, 26296, 26297, 26216, 26214, 26227, 26314, 26315, 26312, 26313, 26228, 26226, 26221, 26306, 26307, 26304, 26305, 26222, 26220, 26224,
26310, 26311, 26308, 26309, 26225, 26128, 26223, 26230, 26318, 26319, 26316, 26317, 26231, 26166, 26229, 26194, 26268, 26269, 26266, 26267, 26195, 26126,
26193, 26254, 26350, 26351, 26105, 26348, 26349, 26255, 26134, 26160, 26253, 26236, 26326, 26165, 26327, 26324, 26325, 26237, 26127, 26235, 26245, 26338,
26339, 26336, 26337, 26246, 26149, 26244, 26251, 26346, 26347, 26344, 26345, 26252, 26150, 26250, 26191, 26108, 26151, 26131, 26133, 26103, 26146, 26156,
26212, 26294, 26295, 26292, 26293, 26213, 26179, 26107, 26211, 26233, 26322, 26323, 26320, 26321, 26234, 26232, 26242, 26334, 26157, 26335, 26332, 26333,
26243, 26115, 26241, 26260, 26358, 26359, 26356, 26357, 26261, 26142, 26259, 26263, 26362, 26363, 26360, 26361, 26264, 26155, 26262, 26197, 26274, 26275,
26272, 26273, 26198, 26175, 26196, 26201, 26278, 26279, 26276, 26277, 26199, 26177, 26135, 26176, 26200, 26154, 26119, 26172, 26138, 26148, 26161, 26169,
26257, 26354, 26355, 26352, 26353, 26258, 26256, 26203, 26282, 26283, 26280, 26281, 26204, 26102, 26202, 26180, 26124, 26116, 26141, 26152, 26144, 26167,
26209, 26290, 26291, 26288, 26289, 26210, 26208, 26147, 26248, 26342, 26343, 26340, 26341, 26249, 26247, 26114, 26189, 26171, 26132, 26178, 26164, 26174,
26153, 26117, 26270, 26265, 26139, 26123, 26104, 26192, 26206, 26286, 26287, 26284, 26285, 26207, 26205, 26182, 26111, 26190, 26143, 26140, 26113, 26122,
26118, 26181, 26129, 26173, 26271, 26137, 26121, 26168, 26106, 26110, 26112, 26109, 26120, 26130, 26170, 26186, 26183, 26185, 26184, 26187, 26125, 26188} -- axe weapons
local shields = {27213, 27204, 27211, 27208, 27187, 27219, 27252, 27218, 27225, 27254, 27230, 27232, 27198, 27197, 27245, 27174, 27256, 27239, 27222,
27206, 27246, 27205, 27176, 27240, 27192, 27250, 27175, 27257, 27221, 27190, 27260, 27251, 27223, 27200, 27195, 27199, 27231, 27266, 27193, 27264, 27185,
27268, 27210, 27181, 27173, 27220, 27234, 27184, 27258, 27249, 27201, 27233, 27217, 27235, 27265, 27186, 27237, 27248, 27196, 27267, 27189, 27209, 27270,
27259, 27238, 27183, 27271, 27263, 27236, 27191, 27215, 27224, 27228, 27243, 27269, 27226, 27202, 27188, 27194, 27182, 27261, 27253, 27247, 27262, 27229,
27177}
local slotWeapon = CONST_SLOT_LEFT
local slotShield = CONST_SLOT_RIGHT
local playerWeapon = creature:getSlotItem(slotWeapon)
local playerShield = creature:getSlotItem(slotShield)
local creatureDirection = creature:getDirection()
local creaturePos = creature:getPosition()
if creatureDirection== DIRECTION_SOUTH then
if playerWeapon and table.contains(weapons, playerWeapon:getId()) then
if playerShield and table.contains(shields, playerShield:getId()) then
creaturePos.x = creaturePos.x
creaturePos.y = creaturePos.y +1
creaturePos:sendMagicEffect(5)
combat:execute(creature, variant)
end
end
elseif creatureDirection == DIRECTION_NORTH then
if playerWeapon and table.contains(weapons, playerWeapon:getId()) then
if playerShield and table.contains(shields, playerShield:getId()) then
creaturePos.x = creaturePos.x +1
creaturePos.y = creaturePos.y -1
creaturePos:sendMagicEffect(5)
return combat2:execute(creature, variant)
end
end
elseif creatureDirection == DIRECTION_WEST then
if playerWeapon and table.contains(weapons, playerWeapon:getId()) then
if playerShield and table.contains(shields, playerShield:getId()) then
creaturePos.x = creaturePos.x -1
creaturePos.y = creaturePos.y
creaturePos:sendMagicEffect(6)
return combat3:execute(creature, variant)
end
end
elseif creatureDirection == DIRECTION_EAST then
if playerWeapon and table.contains(weapons, playerWeapon:getId()) then
if playerShield and table.contains(shields, playerShield:getId()) then
creaturePos.x = creaturePos.x +1
creaturePos.y = creaturePos.y
creaturePos:sendMagicEffect(6)
return combat4:execute(creature, variant)
end
else creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You need an axe and a shield to cast this spell.")
end
end
end