diff --git a/scripts/actors/TomOfMastery.lua b/scripts/actors/TomOfMastery.lua index 12faa2b..ace4696 100644 --- a/scripts/actors/TomOfMastery.lua +++ b/scripts/actors/TomOfMastery.lua @@ -8,40 +8,29 @@ local RPD = require "scripts/lib/commonClasses" local actor = require "scripts/lib/actor" -local dungeonEntrance = {13, 4} -local shopEntrance = {18, 16} +local dungeonEntrance = { 13, 4 } +local shopEntrance = { 18, 16 } local lastWarningTime = 0 local time = 0 return actor.init({ - - act = function() - - local levelW = RPD.Dungeon.level:getWidth() - local levelH = RPD.Dungeon.level:getHeight() - - for i = 0, levelW do - for j = 0, levelH do - local cell = RPD.Dungeon.level:cell(i,j) - local enemy = RPD.Actor:findChar(cell) - end - end - + local hero = RPD.Dungeon.hero + if hero:getBelongings():getItem("TomeOfMastery") ~= nil then - hero:getBelongings():getItem("TomeOfMastery"):detach(hero:getBelongings().backpack) - end + hero:getBelongings():getItem("TomeOfMastery"):detach(hero:getBelongings().backpack) + end return true end, - - + + actionTime = function() return 1 end, - - + + activate = function() end }) \ No newline at end of file diff --git a/scripts/actors/town/Compass.lua b/scripts/actors/town/Compass.lua index 6eb0cf9..3c4308a 100644 --- a/scripts/actors/town/Compass.lua +++ b/scripts/actors/town/Compass.lua @@ -13,19 +13,19 @@ local Spells = require "scripts/spells/CustomSpellsList" local actor = require "scripts/lib/actor" -local dungeonEntrance = {13, 4} -local shopEntrance = {18, 16} +local dungeonEntrance = { 13, 4 } +local shopEntrance = { 18, 16 } local lastWarningTime = 0 local time = 0 return actor.init({ act = function() - local hero = RPD.Dungeon.hero + local hero = RPD.Dungeon.hero time = time + 1 - if hero:getItemFromSlot("WEAPON"):valid() or hero:getItemFromSlot("LEFT_HAND"):valid() then + if hero:getItemFromSlot("WEAPON"):valid() or hero:getItemFromSlot("LEFT_HAND"):valid() then RPD.Dungeon.level:setCompassTarget(table.unpack(dungeonEntrance)) else RPD.Dungeon.level:setCompassTarget(table.unpack(shopEntrance)) @@ -33,11 +33,11 @@ return actor.init({ if time - lastWarningTime > 10 then local heroPos = RPD.getXy(hero) - local d2 = (dungeonEntrance[1] - heroPos[1])^2 + (dungeonEntrance[2] - heroPos[2])^2 + local d2 = (dungeonEntrance[1] - heroPos[1]) ^ 2 + (dungeonEntrance[2] - heroPos[2]) ^ 2 if d2 < 9 then hero:interrupt() lastWarningTime = time - local wnd = RPD.new(RPD.Objects.Ui.WndQuest,hero,RPD.textById("TownScript_NeedWeapon")) + local wnd = RPD.new(RPD.Objects.Ui.WndQuest, hero, RPD.textById("TownScript_NeedWeapon")) RPD.GameScene:show(wnd) end end @@ -48,21 +48,23 @@ return actor.init({ return 1 end, activate = function() - local hero = RPD.Dungeon.hero - local Stats = storage.gameGet("") or {} - - if Stats.str == nil then - sMas = {"Stats","MagicBolt","ShadowClone","Chop"} - Que.pushMas("spelllist",sMas) - Spells["Combat"] = Que.getMas("spelllist") - - local ModWnd = RPD.new(RPD.Objects.Ui.WndStory,RPD.textById("ModWnd")) - RPD.GameScene:show(ModWnd) - - if hero:getBelongings():getItem("TomeOfMastery") ~= nil then - hero:getBelongings():getItem("TomeOfMastery"):detach(hero:getBelongings().backpack) - end - - end + local hero = RPD.Dungeon.hero + local Stats = storage.gameGet("") or {} + + if Stats.str == nil then + sMas = { "Stats", "MagicBolt", "ShadowClone", "Chop" } + Que.pushMas("spelllist", sMas) + Spells["Combat"] = Que.getMas("spelllist") + + local ModWnd = RPD.new(RPD.Objects.Ui.WndStory, RPD.textById("ModWnd")) + RPD.GameScene:show(ModWnd) + + if hero:getBelongings():getItem("TomeOfMastery") ~= nil then + hero:getBelongings():getItem("TomeOfMastery"):detach(hero:getBelongings().backpack) + end + end + + + end }) \ No newline at end of file diff --git a/scripts/buffs/ChopBuff.lua b/scripts/buffs/ChopBuff.lua index da438c9..0ef0d06 100644 --- a/scripts/buffs/ChopBuff.lua +++ b/scripts/buffs/ChopBuff.lua @@ -33,7 +33,7 @@ return buff.init{ Spell.lvl = Spell.lvl+1 end - if RPG.noBloodMobs[enemy:name()] ~= "false" then + if not RPG.noBloodMobs[enemy:name()] then local buffs = RPD.affectBuff(enemy,"FastBleeding",2) buffs:level( RPG.smartInt( RPG.physStr()*0.1) ) RPD.topEffect(enemy:getPos(),"bleeding_effect") diff --git a/scripts/buffs/PowerBuff.lua b/scripts/buffs/PowerBuff.lua index 1990dec..cec75ed 100644 --- a/scripts/buffs/PowerBuff.lua +++ b/scripts/buffs/PowerBuff.lua @@ -3,8 +3,8 @@ --- VK: mongolinsult --- -local RPD = require "scripts/lib/commonClasses" -local RPG = require "scripts/lib/Functions" +local RPD = require "scripts/lib/commonClasses" +local RPG = require "scripts/lib/Functions" local storage = require "scripts/lib/storage" local buff = require "scripts/lib/buff" @@ -12,185 +12,189 @@ local hero = RPD.Dungeon.hero local depth = RPD.Dungeon.depth local level + + +local dmgModifDefault = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" }, loot = {}, chance = {} } + local dmgModifs = { - BoneGolem_lvl1 = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""}, loot ={}, chance ={}}, - BoneGolem_lvl2 = {mod = 1, dmg = 5, type = {"phys","phys"}, element = {"crush","dark"}, loot ={}, chance ={}}, - BoneGolem_lvl3 = {mod = 0.25, dmg = 0, type = {"phys","phys"}, element = {"crush","dark"}, loot ={}, chance ={}}, - FireElemental = {mod = 3, dmg = 0, type = {"mag",""}, element = {"fire","" }, loot ={"materials/FireElmntCore"}, chance ={10} }, - MirrorImage = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""}, loot ={}, chance ={}}, - Statue = {mod = 0, dmg = 0, type={"phys",""}, element = {"",""}, loot ={}, chance ={}}, - Wraith = {mod = 3, dmg = 0.8, type = {"phys","mag"}, element = {"crush","dark"},loot ={}, chance ={}}, - Piranha = {mod = 0, dmg = 0, type = {"phys",""}, element = { {"cut","chop"} ,""},loot ={}, chance ={}}, - Mimic = {mod = 0, dmg = 0, type = {"phys",""}, element = { {"cut","chop"},""},loot ={}, chance ={}}, - MimicPie = {mod = 0, dmg = 0, type = {"phys",""}, element = { {"cut","chop"},""},loot ={}, chance ={}}, - IceElemental = {mod = 3, dmg = 0.2, type = {"mag","phys"}, element = {"ice","stab"},loot ={"materials/IceElmntCore"}, chance ={10}}, - WaterElemental = {mod = 0, dmg = 0, type = {"mag",""}, element = {"water",""},loot ={"materials/WaterElmntCore"}, chance ={10}}, - EarthElemental = {mod = 2, dmg = 5, type = {"phys","mag"}, element = {"crush","earth"},loot ={"materials/EarthElmntCore"}, chance ={10}}, - AirElemental = {mod = 0, dmg = 0, type = {"mag",""}, element = {"wind",""},loot ={"materials/WindElmntCore"}, chance ={10}}, - Crystal = {mod = 1, dmg = 5, type = {"","mag"}, element = {"","light"}, loot ={}, chance ={}}, - ArmoredStatue = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={}, chance ={}}, - GoldenStatue = {mod = 0, dmg = 0, type = {}, element = {"",""},loot ={}, chance ={}}, - FetidRat = {mod = 2, dmg = 3, type = {"phys","mag"}, element = {"cut","poison"},loot ={}, chance ={}}, - b= {mod = 0, dmg = 0, type = {"",""}, element = {"",""}}, - c= {mod = 0, dmg = 0, type = {"",""}, element = {"",""}}, - - Rat = {mod = 2, dmg = 2, type = {"phys","mag"}, element = {"cut","poison"},loot ={"materials/RatClaw"}, chance ={30}}, - Gnoll = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={"materials/GnollSkin"}, chance ={30}}, - Crab = {mod = 0, dmg = 0, type = {"phys",""}, element = {"chop",""},loot ={"materials/CrabClaw"}, chance ={20}}, - Albino = {mod = 2, dmg = 2, type = {"phys","mag"}, element = {"cut","poison"},loot ={"materials/AlbinoFang"}, chance ={50}}, - Woodlouise = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={"materials/WoodlouiseCarapace"}, chance ={20}}, - Goo = {mod = 3, dmg = 0.5, type = {"phys","mag"}, element = {"crush","poison"},loot ={"materials/PieceOfGoo"}, chance ={10}}, - RatKing = {mod = 2, dmg = 4, type = {"phys","mag"}, element = {"cut","poison"},loot ={}, chance ={}}, - - Thief = {mod = 0, dmg = 0, type = {"phys",""}, element = {"stab",""},loot ={"materials/PieceOfDagger"}, chance ={20}}, - Skeleton = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={"materials/SkeletonBone"}, chance ={60}}, - Swarm = {mod = 2, dmg = 3, type = {"phys","mag"}, element = {"cut","poison"},loot ={}, chance ={}}, - Shadow = {mod = 1, dmg = 5, type = {"phys","mag"}, element = {"crush","dark"},loot ={}, chance ={}}, - Bandit = {mod = 0, dmg = 0, type = {"phys",""}, element = {"stab",""},loot ={"materials/PieceOfDoug"}, chance ={50}}, - Tengu = {mod = 0, dmg = 0, type = {"phys",""}, element = {"stab",""},loot ={"materials/OldKunai"}, chance ={10}}, - - Bat = {mod = 0, dmg = 0, type = {"phys",""}, element = {"cut",""},loot ={"materials/BatWing"}, chance ={30}}, - Brute = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={"materials/BruteSkin"}, chance ={30}}, - Shaman = {mod = 0, dmg = 0, type = {"mag",""}, element = {"lightning",""},loot ={"materials/ShamanMask"}, chance ={30}}, - Spinner = {mod = 1, dmg = 6, type = {"phys","mag"}, element = {"cut","poison"},loot ={"materials/SpiderFang"}, chance ={30}}, - Shielded = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={"materials/PieceOfShield"}, chance ={50}}, - DM300 = {mod = 2, dmg = 8, type = {"phys","phys"}, element = {"stab","crush"},loot ={"materials/PieceOfDM300"}, chance ={10}}, - - Monk = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={"materials/MonkTooth"}, chance ={30}}, - Warlock = {mod = 0, dmg = 0, type = {"mag",""}, element = {"dark",""},loot ={"materials/WispOfBeard"}, chance ={30}}, - Golem = {mod = 1, dmg = 5, type = {"phys","mag"}, element = {"crush","earth"},loot ={"materials/PieceOfGolemCore"}, chance ={10}}, - Senior = {mod = 2, dmg = 5, type = {"phys","phys"}, element = {"crush","stab"},loot ={"materials/MentorTooth"}, chance ={40}}, - Undead = {mod = 2, dmg = 5, type = {"phys","mag"}, element = {"crush","dark"},loot ={}, chance ={}}, - King = {mod = 0, dmg = 0, type = {"phys",""}, element = {"chop",""},loot ={"materials/KingCrown"}, chance ={10}}, - - Succubus = {mod = 3, dmg = 0.5, type = {"phys","mag"}, element = {{"crush","stab"},"dark"},loot ={}, chance ={}}, - Eye = {mod = 0, dmg = 0, type = {"mag",""}, element = {{"dark","light"},""},loot ={"materials/EyeLens"}, chance ={10}}, - Scorpio = {mod = 3, dmg = 0.2, type = {"phys","mag"}, element = {"stab","poison"},loot ={"materials/ScorpionSting"}, chance ={20}}, - Acidic = {mod = 4, dmg = 0.2, type = {"phys","mag"}, element = {"stab","poison"},loot ={"materials/AcidicSting"}, chance ={50}}, - ShadowLord = {mod = 0, dmg = 0, type = {"mag",""}, element = {{"dark","stab"},""},loot ={"materials/PieceOFShadowLord"}, chance ={10}}, - - SuspiciousRat = {mod = 0, dmg = 0, type = {"",""}, element = {"",""},loot ={}, chance ={}}, - PseudoRat = {mod = 0, dmg = 0.5, type = {"phys",""}, element = {{"cut","chop"},""},loot ={"materials/PseudoRatFang"}, chance ={10}}, - ZombieGnoll = {mod = 2, dmg = 8, type = {"phys","mag"}, element = {"crush","poison"},loot ={"materials/ZombieGnollMeat"}, chance ={20}}, - Worm = {mod = 2, dmg = 12, type = {"phys","mag"}, element = {{"cut","chop"},"poison"},loot ={"materials/WormLeather"}, chance ={20}}, - TreacherousSpirit = {mod = 4, dmg = 0.2, type = {"phys","mag"}, element = {{"stab","chop"},"dark"},loot ={}, chance ={}}, - Nightmare = {mod = 0, dmg = 0, type = {"mag",""}, element = {"dark",""},loot ={}, chance ={}}, - MimicAmulet = {mod = 0, dmg = 0, type = {"phys",""}, element = {{"cut","chop"},""},loot ={}, chance ={}}, - SpiritOfPain = {mod = 4, dmg = 0.2, type = {"phys","mag"}, element = {{"stab","chop"},"dark"},loot ={}, chance ={}}, - YogsBrain = {mod = 0, dmg = 0, type = {"mag",""}, element = {"lightning",""},loot ={}, chance ={}}, - YogsEye = {mod = 1, dmg = 1, type = {"phys","mag"}, element = {"crush","dark"},loot ={}, chance ={}}, - Yog = {mod = 1, dmg = 1, type = {"phys","mag"}, element = {"crush","dark"},loot ={}, chance ={}}, - YogsHeart = {mod = 0, dmg = 0, type = {"phys",""}, element = {"crush",""},loot ={}, chance ={}}, - YogsTeeth = {mod = 0, dmg = 0, type = {"phys",""}, element = {{"stab","chop"},""},loot ={}, chance ={}}, - BurningFist = {mod = 4, dmg = 0.2, type = {"phys","mag"}, element = {"crush","fire" }, loot ={}, chance ={} }, - RottingFist = {mod = 4, dmg = 0.2, type = {"phys","mag"}, element = {"crush","poison"},loot ={}, chance ={}}, - Larva = {mod = 2, dmg = 5, type = {"phys","mag"}, element = {{"cut","chop"},"poison"},loot ={}, chance ={}}, - - SpiderServant = {mod = 1, dmg = 2, type = {"phys","mag"}, element = {{"cut","chop"},"poison"},loot ={"materials/SpiderCarapace"}, chance ={30}}, - SpiderGuard = {mod = 1, dmg = 4, type = {"phys","mag"}, element = {{"cut","chop"},"poison"},loot ={"materials/EliteSpiderCarapace"}, chance ={40}}, - SpiderExploding = {mod = 1, dmg = 4, type={"phys","mag"} , element = {"chop","earth"},loot ={}, chance ={}}, - SpiderMind = {mod = 0, dmg = 0, type = {"mag",""}, element = {"psy",""},loot ={}, chance ={}}, - SpiderMindAmber= {mod = 0, dmg = 0, type = {"mag",""}, element = {"psy",""},loot ={}, chance ={}}, - SpiderNest = {mod = 0, dmg = 0, type = {} , element = {"",""},loot ={}, chance ={}}, - SpiderEgg = {mod = 0, dmg = 0, type = {} , element = {"",""},loot ={}, chance ={}}, - f = {mod = 0, dmg = 0, type = {"",""}, element = {"",""}}, - SpiderQueen = {mod = 2, dmg = 6, type = {"phys","mag"}, element = {{"stab","chop"},"poison"},loot ={"materials/SpiderQueenMandible"}, chance ={10}}, - - Kobold = {mod = 2, dmg = 5, type = {"phys","mag"}, element = {"crush","ice"},loot ={"materials/KoboldSkin"}, chance ={30}}, - KoboldIcemancer= {mod = 0, dmg = 0, type = {"mag",""}, element = {"ice",""},loot ={"materials/IcemancerEye"}, chance ={30}}, - ColdSpirit = {mod = 4, dmg = 0.20, type = {"mag","phys"}, element = {"ice","stab"},loot ={"materials/MagicSnow"}, chance ={30}}, - IceGuardianCore= {mod = 4, dmg = 0.4, type = {"phys","mag"}, element = {"stab","ice"},loot ={"materials/IceElmntCore"}, chance ={50}}, - IceGuardian = {mod = 4, dmg = 0.4, type = {"phys","mag"}, element = {"stab","ice"},loot ={"materials/IceGuardianCore"}, chance ={10}}, - - DeathKnight = {mod = 1, dmg = 5, type = {"phys","mag"}, element = {{"cut","chop"},"dark"},loot ={"materials/DeathKnightSpaulder"}, chance ={30}}, - DreadKnight = {mod = 2, dmg = 6, type = {"phys","mag"}, element = {{"cut","chop"},"dark"},loot ={"materials/DreadKnightSpaulder"}, chance ={30}}, - EnslavedSoul = {mod = 0, dmg = 0, type = {"mag",""}, element = {{"dark","chop"},""},loot ={"materials/SoulEctoplasm"}, chance ={30}}, - ExplodingSkull = {mod = 3, dmg = 0.4, type = {"mag","phys"}, element = {"fire","crush"},loot ={"materials/SkullSharps"}, chance ={25}}, - JarOfSouls = {mod = 0, dmg = 0, type = {"",""}, element = {"",""},loot ={}, chance ={}}, - Zombie = {mod = 4, dmg = 0.2, type = {"phys","mag"}, element = {{"cut","chop"},"poison"},loot ={"materials/ZombieFinger"}, chance ={30}}, - RunicSkull = {mod = 0, dmg = 0, type = {"",""}, element = {"",""},loot ={}, chance ={}}, - Lich = {mod = 2, dmg = 5, type = {"mag",""}, element = {{"dark","earth"},"poison"},loot ={"materials/LichBone"}, chance ={10}}, - - a = {mod = 0, dmg = 0, type = {"",""}, element = {"",""}} - - } - -return buff.init{ - desc = function () + BoneGolem_lvl1 = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = {}, chance = {} }, + BoneGolem_lvl2 = { mod = 1, dmg = 5, type = { "phys", "phys" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + BoneGolem_lvl3 = { mod = 0.25, dmg = 0, type = { "phys", "phys" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + FireElemental = { mod = 3, dmg = 0, type = { "mag", "" }, element = { "fire", "" }, loot = { "materials/FireElmntCore" }, chance = { 10 } }, + MirrorImage = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = {}, chance = {} }, + Statue = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "", "" }, loot = {}, chance = {} }, + Wraith = { mod = 3, dmg = 0.8, type = { "phys", "mag" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + Piranha = { mod = 0, dmg = 0, type = { "phys", "" }, element = { { "cut", "chop" }, "" }, loot = {}, chance = {} }, + Mimic = { mod = 0, dmg = 0, type = { "phys", "" }, element = { { "cut", "chop" }, "" }, loot = {}, chance = {} }, + MimicPie = { mod = 0, dmg = 0, type = { "phys", "" }, element = { { "cut", "chop" }, "" }, loot = {}, chance = {} }, + IceElemental = { mod = 3, dmg = 0.2, type = { "mag", "phys" }, element = { "ice", "stab" }, loot = { "materials/IceElmntCore" }, chance = { 10 } }, + WaterElemental = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "water", "" }, loot = { "materials/WaterElmntCore" }, chance = { 10 } }, + EarthElemental = { mod = 2, dmg = 5, type = { "phys", "mag" }, element = { "crush", "earth" }, loot = { "materials/EarthElmntCore" }, chance = { 10 } }, + AirElemental = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "wind", "" }, loot = { "materials/WindElmntCore" }, chance = { 10 } }, + Crystal = { mod = 1, dmg = 5, type = { "", "mag" }, element = { "", "light" }, loot = {}, chance = {} }, + ArmoredStatue = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = {}, chance = {} }, + GoldenStatue = { mod = 0, dmg = 0, type = {}, element = { "", "" }, loot = {}, chance = {} }, + FetidRat = { mod = 2, dmg = 3, type = { "phys", "mag" }, element = { "cut", "poison" }, loot = {}, chance = {} }, + b = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" } }, + c = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" } }, + + Rat = { mod = 2, dmg = 2, type = { "phys", "mag" }, element = { "cut", "poison" }, loot = { "materials/RatClaw" }, chance = { 30 } }, + Gnoll = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = { "materials/GnollSkin" }, chance = { 30 } }, + Crab = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "chop", "" }, loot = { "materials/CrabClaw" }, chance = { 20 } }, + Albino = { mod = 2, dmg = 2, type = { "phys", "mag" }, element = { "cut", "poison" }, loot = { "materials/AlbinoFang" }, chance = { 50 } }, + Woodlouise = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = { "materials/WoodlouiseCarapace" }, chance = { 20 } }, + Goo = { mod = 3, dmg = 0.5, type = { "phys", "mag" }, element = { "crush", "poison" }, loot = { "materials/PieceOfGoo" }, chance = { 10 } }, + RatKing = { mod = 2, dmg = 4, type = { "phys", "mag" }, element = { "cut", "poison" }, loot = {}, chance = {} }, + + Thief = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "stab", "" }, loot = { "materials/PieceOfDagger" }, chance = { 20 } }, + Skeleton = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = { "materials/SkeletonBone" }, chance = { 60 } }, + Swarm = { mod = 2, dmg = 3, type = { "phys", "mag" }, element = { "cut", "poison" }, loot = {}, chance = {} }, + Shadow = { mod = 1, dmg = 5, type = { "phys", "mag" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + Bandit = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "stab", "" }, loot = { "materials/PieceOfDoug" }, chance = { 50 } }, + Tengu = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "stab", "" }, loot = { "materials/OldKunai" }, chance = { 10 } }, + + Bat = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "cut", "" }, loot = { "materials/BatWing" }, chance = { 30 } }, + Brute = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = { "materials/BruteSkin" }, chance = { 30 } }, + Shaman = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "lightning", "" }, loot = { "materials/ShamanMask" }, chance = { 30 } }, + Spinner = { mod = 1, dmg = 6, type = { "phys", "mag" }, element = { "cut", "poison" }, loot = { "materials/SpiderFang" }, chance = { 30 } }, + Shielded = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = { "materials/PieceOfShield" }, chance = { 50 } }, + DM300 = { mod = 2, dmg = 8, type = { "phys", "phys" }, element = { "stab", "crush" }, loot = { "materials/PieceOfDM300" }, chance = { 10 } }, + + Monk = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = { "materials/MonkTooth" }, chance = { 30 } }, + Warlock = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "dark", "" }, loot = { "materials/WispOfBeard" }, chance = { 30 } }, + Golem = { mod = 1, dmg = 5, type = { "phys", "mag" }, element = { "crush", "earth" }, loot = { "materials/PieceOfGolemCore" }, chance = { 10 } }, + Senior = { mod = 2, dmg = 5, type = { "phys", "phys" }, element = { "crush", "stab" }, loot = { "materials/MentorTooth" }, chance = { 40 } }, + Undead = { mod = 2, dmg = 5, type = { "phys", "mag" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + King = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "chop", "" }, loot = { "materials/KingCrown" }, chance = { 10 } }, + + Succubus = { mod = 3, dmg = 0.5, type = { "phys", "mag" }, element = { { "crush", "stab" }, "dark" }, loot = {}, chance = {} }, + Eye = { mod = 0, dmg = 0, type = { "mag", "" }, element = { { "dark", "light" }, "" }, loot = { "materials/EyeLens" }, chance = { 10 } }, + Scorpio = { mod = 3, dmg = 0.2, type = { "phys", "mag" }, element = { "stab", "poison" }, loot = { "materials/ScorpionSting" }, chance = { 20 } }, + Acidic = { mod = 4, dmg = 0.2, type = { "phys", "mag" }, element = { "stab", "poison" }, loot = { "materials/AcidicSting" }, chance = { 50 } }, + ShadowLord = { mod = 0, dmg = 0, type = { "mag", "" }, element = { { "dark", "stab" }, "" }, loot = { "materials/PieceOFShadowLord" }, chance = { 10 } }, + + SuspiciousRat = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" }, loot = {}, chance = {} }, + PseudoRat = { mod = 0, dmg = 0.5, type = { "phys", "" }, element = { { "cut", "chop" }, "" }, loot = { "materials/PseudoRatFang" }, chance = { 10 } }, + ZombieGnoll = { mod = 2, dmg = 8, type = { "phys", "mag" }, element = { "crush", "poison" }, loot = { "materials/ZombieGnollMeat" }, chance = { 20 } }, + Worm = { mod = 2, dmg = 12, type = { "phys", "mag" }, element = { { "cut", "chop" }, "poison" }, loot = { "materials/WormLeather" }, chance = { 20 } }, + TreacherousSpirit = { mod = 4, dmg = 0.2, type = { "phys", "mag" }, element = { { "stab", "chop" }, "dark" }, loot = {}, chance = {} }, + Nightmare = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "dark", "" }, loot = {}, chance = {} }, + MimicAmulet = { mod = 0, dmg = 0, type = { "phys", "" }, element = { { "cut", "chop" }, "" }, loot = {}, chance = {} }, + SpiritOfPain = { mod = 4, dmg = 0.2, type = { "phys", "mag" }, element = { { "stab", "chop" }, "dark" }, loot = {}, chance = {} }, + YogsBrain = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "lightning", "" }, loot = {}, chance = {} }, + YogsEye = { mod = 1, dmg = 1, type = { "phys", "mag" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + Yog = { mod = 1, dmg = 1, type = { "phys", "mag" }, element = { "crush", "dark" }, loot = {}, chance = {} }, + YogsHeart = { mod = 0, dmg = 0, type = { "phys", "" }, element = { "crush", "" }, loot = {}, chance = {} }, + YogsTeeth = { mod = 0, dmg = 0, type = { "phys", "" }, element = { { "stab", "chop" }, "" }, loot = {}, chance = {} }, + BurningFist = { mod = 4, dmg = 0.2, type = { "phys", "mag" }, element = { "crush", "fire" }, loot = {}, chance = {} }, + RottingFist = { mod = 4, dmg = 0.2, type = { "phys", "mag" }, element = { "crush", "poison" }, loot = {}, chance = {} }, + Larva = { mod = 2, dmg = 5, type = { "phys", "mag" }, element = { { "cut", "chop" }, "poison" }, loot = {}, chance = {} }, + + SpiderServant = { mod = 1, dmg = 2, type = { "phys", "mag" }, element = { { "cut", "chop" }, "poison" }, loot = { "materials/SpiderCarapace" }, chance = { 30 } }, + SpiderGuard = { mod = 1, dmg = 4, type = { "phys", "mag" }, element = { { "cut", "chop" }, "poison" }, loot = { "materials/EliteSpiderCarapace" }, chance = { 40 } }, + SpiderExploding = { mod = 1, dmg = 4, type = { "phys", "mag" }, element = { "chop", "earth" }, loot = {}, chance = {} }, + SpiderMind = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "psy", "" }, loot = {}, chance = {} }, + SpiderMindAmber = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "psy", "" }, loot = {}, chance = {} }, + SpiderNest = { mod = 0, dmg = 0, type = {}, element = { "", "" }, loot = {}, chance = {} }, + SpiderEgg = { mod = 0, dmg = 0, type = {}, element = { "", "" }, loot = {}, chance = {} }, + f = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" } }, + SpiderQueen = { mod = 2, dmg = 6, type = { "phys", "mag" }, element = { { "stab", "chop" }, "poison" }, loot = { "materials/SpiderQueenMandible" }, chance = { 10 } }, + + Kobold = { mod = 2, dmg = 5, type = { "phys", "mag" }, element = { "crush", "ice" }, loot = { "materials/KoboldSkin" }, chance = { 30 } }, + KoboldIcemancer = { mod = 0, dmg = 0, type = { "mag", "" }, element = { "ice", "" }, loot = { "materials/IcemancerEye" }, chance = { 30 } }, + ColdSpirit = { mod = 4, dmg = 0.20, type = { "mag", "phys" }, element = { "ice", "stab" }, loot = { "materials/MagicSnow" }, chance = { 30 } }, + IceGuardianCore = { mod = 4, dmg = 0.4, type = { "phys", "mag" }, element = { "stab", "ice" }, loot = { "materials/IceElmntCore" }, chance = { 50 } }, + IceGuardian = { mod = 4, dmg = 0.4, type = { "phys", "mag" }, element = { "stab", "ice" }, loot = { "materials/IceGuardianCore" }, chance = { 10 } }, + + DeathKnight = { mod = 1, dmg = 5, type = { "phys", "mag" }, element = { { "cut", "chop" }, "dark" }, loot = { "materials/DeathKnightSpaulder" }, chance = { 30 } }, + DreadKnight = { mod = 2, dmg = 6, type = { "phys", "mag" }, element = { { "cut", "chop" }, "dark" }, loot = { "materials/DreadKnightSpaulder" }, chance = { 30 } }, + EnslavedSoul = { mod = 0, dmg = 0, type = { "mag", "" }, element = { { "dark", "chop" }, "" }, loot = { "materials/SoulEctoplasm" }, chance = { 30 } }, + ExplodingSkull = { mod = 3, dmg = 0.4, type = { "mag", "phys" }, element = { "fire", "crush" }, loot = { "materials/SkullSharps" }, chance = { 25 } }, + JarOfSouls = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" }, loot = {}, chance = {} }, + Zombie = { mod = 4, dmg = 0.2, type = { "phys", "mag" }, element = { { "cut", "chop" }, "poison" }, loot = { "materials/ZombieFinger" }, chance = { 30 } }, + RunicSkull = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" }, loot = {}, chance = {} }, + Lich = { mod = 2, dmg = 5, type = { "mag", "" }, element = { { "dark", "earth" }, "poison" }, loot = { "materials/LichBone" }, chance = { 10 } }, + + a = { mod = 0, dmg = 0, type = { "", "" }, element = { "", "" } } + +} + +return buff.init { + desc = function() return { - icon = -1, - info = "", + icon = -1, + info = "", } end, - -attackProc = function(self,buff,enemy,damage) - depth = RPD.Dungeon.depth - local totalDmg = damage + RPG.smartInt(-0.8 +0.25*depth +2*(depth%5)) - - local mobModifs = dmgModifs[buff.target:getMobClassName()] - - --don't crash if no modifier defined - if not mobModifs then - return totalDmg - end - - local type = mobModifs["type"] - local element = mobModifs["element"] - - local mainElement = element[1] - local addElement = element[2] - - if type ~= nil then - totalDmg = RPG.getDamage(enemy,damage + RPG.smartInt(-0.8 +0.25*depth +2*(depth%5)),type[1],element[1]) - if mobModifs["mod"] == 1 then - totalDmg = totalDmg-mobModifs["dmg"] - RPG.damage(enemy,mobModifs["dmg"],type[2],element[2]) - - elseif mobModifs["mod"] == 2 then - RPG.damage(enemy,mobModifs["dmg"],type[2],element[2]) - - elseif mobModifs["mod"] == 3 then - totalDmg = totalDmg*(1-mobModifs["dmg"]) - RPG.damage(enemy,damage*mobModifs["dmg"],type[2],element[2]) - - elseif mobModifs["mod"] == 4 then - RPG.damage(enemy,damage*mobModifs["dmg"],type[2],element[2]) - end - end - - RPG.dmgText(type[1],mainElement,enemy) - return totalDmg -end, - -drBonus = function(self,buff) - depth = RPD.Dungeon.depth - return buff.target:dr() + math.ceil(-1 + 0.25*depth +2*(depth%5)) -end, - -detach = function(self,buff) - local pos = buff.target:getPos() - local mobModifs = dmgModifs[buff.target:getMobClassName()] - local level = RPD.Dungeon.level - local loot = mobModifs["loot"] or "" - local chance = mobModifs["chance"] - local countOfLoot - if loot ~= nil then - countOfLoot = #loot - else - countOfLoot = 0 - end - if countOfLoot ~= 0 then - for i = 1, countOfLoot do - local lootRan = math.random(1,100) - if lootRan <= chance[i]+RPG.AllLuck()*0.25 then - level:drop(RPD.ItemFactory:itemByName(loot[i]), pos) - end - end - end -end, - -speedMultiplier = function(self,buff) - depth = RPD.Dungeon.depth - return 1 -end + + attackProc = function(self, buff, enemy, damage) + depth = RPD.Dungeon.depth + local totalDmg = damage + RPG.smartInt(-0.8 + 0.25 * depth + 2 * (depth % 5)) + + local mobModifs = dmgModifs[buff.target:getMobClassName()] or dmgModifDefault + + --don't crash if no modifier defined + if not mobModifs then + return totalDmg + end + + local type = mobModifs["type"] + local element = mobModifs["element"] + + local mainElement = element[1] + local addElement = element[2] + + if type then + totalDmg = RPG.getDamage(enemy, damage + RPG.smartInt(-0.8 + 0.25 * depth + 2 * (depth % 5)), type[1], mainElement) + if mobModifs["mod"] == 1 then + totalDmg = totalDmg - mobModifs["dmg"] + RPG.damage(enemy, mobModifs["dmg"], type[2], addElement) + + elseif mobModifs["mod"] == 2 then + RPG.damage(enemy, mobModifs["dmg"], type[2], addElement) + + elseif mobModifs["mod"] == 3 then + totalDmg = totalDmg * (1 - mobModifs["dmg"]) + RPG.damage(enemy, damage * mobModifs["dmg"], type[2], addElement) + + elseif mobModifs["mod"] == 4 then + RPG.damage(enemy, damage * mobModifs["dmg"], type[2], addElement) + end + end + + RPG.dmgText(type[1], mainElement, enemy) + return totalDmg + end, + + drBonus = function(self, buff) + depth = RPD.Dungeon.depth + return buff.target:dr() + math.ceil(-1 + 0.25 * depth + 2 * (depth % 5)) + end, + + detach = function(self, buff) + local pos = buff.target:getPos() + local mobModifs = dmgModifs[buff.target:getMobClassName()] or dmgModifDefault + local level = RPD.Dungeon.level + local loot = mobModifs["loot"] or "" + local chance = mobModifs["chance"] + local countOfLoot + if loot ~= nil then + countOfLoot = #loot + else + countOfLoot = 0 + end + if countOfLoot ~= 0 then + for i = 1, countOfLoot do + local lootRan = math.random(1, 100) + if lootRan <= chance[i] + RPG.AllLuck() * 0.25 then + level:drop(RPD.ItemFactory:itemByName(loot[i]), pos) + end + end + end + end, + + speedMultiplier = function(self, buff) + depth = RPD.Dungeon.depth + return 1 + end } diff --git a/scripts/buffs/RPGbuff.lua b/scripts/buffs/RPGbuff.lua index 7bb5231..cf3f23f 100644 --- a/scripts/buffs/RPGbuff.lua +++ b/scripts/buffs/RPGbuff.lua @@ -41,7 +41,7 @@ return buff.init{ hero = RPD.Dungeon.hero level = RPD.Dungeon.level depth = RPD.Dungeon.depth - subClass = storage.gameGet("subClassNone") + subClass = storage.gameGet("subClassNone", {none = "", actv = 1}) local Spells = require "scripts/spells/CustomSpellsList" local weapon = hero:getBelongings().weapon local lefthand = hero:getBelongings().leftHand diff --git a/scripts/items/StudentStaff.lua b/scripts/items/StudentStaff.lua index 3f5bc4e..06f8e18 100644 --- a/scripts/items/StudentStaff.lua +++ b/scripts/items/StudentStaff.lua @@ -134,7 +134,7 @@ return item.init{ typicalSTR = function(self,item,user) str = math.max(stra-2*item:level(),1) - if self.data.level < item:level() then + if (self.data.level or 0) < item:level() then self.data.level = item:level() self.data.dstats[4] = self.data.dstats[4] +magAsLevel if self.data.equipped == 1 then diff --git a/scripts/lib/Functions.lua b/scripts/lib/Functions.lua index 0e1f986..8546d4c 100644 --- a/scripts/lib/Functions.lua +++ b/scripts/lib/Functions.lua @@ -3,1693 +3,1674 @@ local storage = require "scripts/lib/storage" local RPG +RPG = { + + forgedItem = forgedItem, + mainMatCount = 16, + materialsCount = 0, + + noBloodMobs = { + BoneGolem_lvl1 = true, + BoneGolem_lvl2 = true, + BoneGolem_lvl3 = true, + Skeleton = true, + DM300 = true, + Goo = true, + EarthElemental = true, + WaterElemental = true, + FireElemental = true, + AirElemental = true, + Golem = true, + SpiritOfPain = true, + Statue = true, + Wraith = true, + IceElemental = true, + Crystal = true, + ArmoredStatue = true, + GoldenStatue = true, + Shadow = true, + Undead = true, + ShadowLord = true, + TreacherousSpirit = true, + IceGuardianCore = true, + IceGuardian = true, + EnslavedSoul = true, + ExplodingSkull = true, + JarOfSouls = true, + Lich = true, + RunicSkull = true + }, + + Objects = { + Ui = { + WndInfoItem = luajava.bindClass("com.watabou.pixeldungeon.windows.WndInfoItem"), + DCellListener = luajava.bindClass("com.watabou.pixeldungeon.scenes.DefaultCellListener"), + WndBag = "com.watabou.pixeldungeon.windows.WndBag", + WndImageMessage = "com.watabou.pixeldungeon.windows.WndTitledMessage" + } + }, + + Image = luajava.bindClass("com.watabou.noosa.Image"), + + Buffs = { + Bleeding = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Bleeding"), + Terror = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Terror"), + Shadows = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Shadows"), + Amok = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Amok") + }, + + statsName = { + "Ht", + "Sp", + "physicStr", + "magicStr", + "fast", + "magDef", + "spRegen", + "luck", + "fire", + "lightning", + "water", + "ice", + "earth", + "poison", + "wind", + "psy", + "light", + "dark", + "cut", + "chop", + "stab", + "crush" }, + + strength = strength, + intelligence = intelligence, + dexterity = dexterity, + vitality = vitality, + wisdom = wisdom, + luck = luck, + physicStr = 1, + physicStrBerserk = 0, + magicStr = 1, + fast = 1, + spRegen = 1, + magDef = 1, + spellFast = 0, + sPoints = sPoints, + lvlToUp = 0, + triger = 0, + class = class, + subClass = subClass, + boneId = boneId, + smithLvl = smithLvl, + smithToUp = smithToUp, + smithExp = smithExp, + + updateStatsA = updateStatsA, + StatsA = { + luck = 0, + physicStr = 0, + magicStr = 0, + fast = 0, + magDef = 0, + spRegen = 0 + }, + updateStatsA2 = updateStatsA2, + StatsA2 = { + luck = 0, + physicStr = 0, + magicStr = 0, + fast = 0, + magDef = 0, + spRegen = 0 + }, + updateStatsB = updateStatsB, + StatsB = { + luck = 0, + physicStr = 0, + magicStr = 0, + fast = 0, + magDef = 0, + spRegen = 0, + fire = { 0, 0 }, + water = { 0, 0 }, + ice = { 0, 0 }, + earth = { 0, 0 }, + wind = { 0, 0 }, + lightning = { 0, 0 }, + poison = { 0, 0 }, + light = { 0, 0 }, + dark = { 0, 0 }, + psy = { 0, 0 }, + cut = { 0, 0 }, + chop = { 0, 0 }, + stab = { 0, 0 }, + crush = { 0, 0 } + }, + updateStatsArt = updateStatsArt, + StatsArt = { + luck = 0, + physicStr = 0, + magicStr = 0, + fast = 0, + magDef = 0, + spRegen = 0, + fire = { 0, 0 }, + water = { 0, 0 }, + ice = { 0, 0 }, + earth = { 0, 0 }, + wind = { 0, 0 }, + lightning = { 0, 0 }, + poison = { 0, 0 }, + light = { 0, 0 }, + dark = { 0, 0 }, + psy = { 0, 0 }, + cut = { 0, 0 }, + chop = { 0, 0 }, + stab = { 0, 0 }, + crush = { 0, 0 } + }, + updateStatsArt2 = updateStatsArt2, + StatsArt2 = { + luck = 0, + physicstr = 0, + magicstr = 0, + fast = 0, + magDef = 0, + spRegen = 0, + fire = { 0, 0 }, + water = { 0, 0 }, + ice = { 0, 0 }, + earth = { 0, 0 }, + wind = { 0, 0 }, + lightning = { 0, 0 }, + poison = { 0, 0 }, + light = { 0, 0 }, + dark = { 0, 0 }, + psy = { 0, 0 }, + cut = { 0, 0 }, + chop = { 0, 0 }, + stab = { 0, 0 }, + crush = { 0, 0 } + }, + + + defence = { + BoneGolem_lvl1 = { magDef = 2, fire = 1.2, water = 0.9, ice, earth = 0.9, wind = 0.9, lightning = 1.5, poison = 5, light = 0.5, dark = 1.5, cut = 1.5, chop = 0.7, stab = 0.8, crush = 0.6 }, + BoneGolem_lvl2 = { magDef = 5, fire = 1.2, water = 0.9, ice, earth = 0.9, wind = 0.9, lightning = 1.5, poison = 5, light = 0.5, dark = 1.5, cut = 1.5, chop = 0.7, stab = 0.8, crush = 0.6 }, + BoneGolem_lvl3 = { magDef = 8, fire = 1.2, water = 0.9, ice, earth = 0.9, wind = 0.9, lightning = 1.5, poison = 5, light = 0.5, dark = 1.5, cut = 1.5, chop = 0.7, stab = 0.8, crush = 0.6 }, + NecromancerNPC = { magDef = 2, fire = 1.2, water = 0.9, ice, earth = 0.9, wind = 0.9, lightning = 1.5, poison = 5, light = 0.5, dark = 1.5, cut = 1.5, chop = 0.7, stab = 0.8, crush = 0.6 }, + FireElemental = { magDef = 3, fire = 2, water = 0.7, ice = 0.2, earth, wind = 0.9, lightning = 1.1, poison, light, dark, psy, cut, chop, stab, crush = 0.8 }, + Statue = { magDef = 5, fire, water, ice, earth, wind = 0.8, lightning = 1.5, poison, light, dark, psy = 2, cut = 1.5, chop, stab = 0.85, crush = 0.6 }, + Wraith = { magDef = 5, fire, water, ice, earth, wind = 0.9, lightning = 0.6, crush = 1.5 }, + Piranha = { magDef = 4, fire = 0.5, water = 1.5, ice, earth = 0.9, wind = 0.9, lightning = 0.5, poison = 0.8, light, dark, psy, cut, chop = 0.9, stab = 0.8, crush = 0.9 }, + Mimic = { magDef = 4, fire = 0.9, water, ice, earth, wind, lightning = 0.8, poison = 0.8, light = 0.3, dark, psy, cut = 1.3, chop, stab = 0.8, crush }, + MimicPie = { magDef = 4, fire = 0.8, water = 0.9, ice, earth = 0.7, wind, lightning = 0.9, poison = 0.8, light = 0.3, dark, psy, cut = 0.5, chop = 0.5, stab = 0.7, crush = 0.8 }, + IceElemental = { magDef = 3, fire = 0.3, water = 1.3, ice, earth = 1.2, wind = 0.9, lightning = 0.9, poison = 1.5, light = 1.5, dark = 0.8, cut = 1.2, chop = 0.8, stab = 0.6, crush = 0.9 }, + WaterElemental = { magDef = 3, fire = 0.5, water = 1.5, ice, earth = 1.2, wind = 1.2, lightning = 0.3, poison = 0.5, light = 1.2, dark = 0.8, cut = 1.5, chop = 1.1, stab = 1.5, crush = 1.1 }, + EarthElemental = { magDef = 3, fire = 1.2, water = 0.3, ice, earth = 1.5, wind = 0.7, lightning = 1.5, poison = 0.8, light = 1.2, dark, cut = 1.1, chop = 0.9, stab = 0.8, crush = 1.1 }, + AirElemental = { magDef = 3, fire = 0.7, water = 1.5, ice, earth = 1.2, wind = 1.5, lightning = 0.3, poison = 0.9, light = 1.5, dark, cut = 1.5, chop = 1.2, stab = 1.5, crush = 0.9 }, + Crystal = { magDef = 3, fire = 1.2, water = 0.8, ice, earth = 1.5, wind = 0.8, lightning, poison = 1.5, light = 1.5, dark, cut = 1.2, chop = 0.5, stab = 0.3, crush = 0.3 }, + ArmoredStatue = { magDef = 5, fire = 1.5, water = 0.8, ice, earth = 1.5, wind = 0.8, lightning = 1.5, poison = 2.5, light, dark, cut = 1.5, chop = 1.2, stab = 0.5, crush = 0.7 }, + GoldenStatue = { magDef = 4, fire = 0.5, water = 0.7, ice, earth = 1.2, wind = 0.8, lightning = 1.5, poison = 1.5, light = 1.2, dark = 0.8, cut, chop = 0.9, stab = 0.8, crush = 0.9 }, + b = { magDef, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush }, + c = { magDef, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush }, + + Rat = { magDef = 1, fire = 0, water, ice, earth, wind, lightning = 0.5, poison = 0.8, light, dark, cut = 0.6, .65, chop = 0.6, stab = 0.7, crush = 0.6 }, + FetidRat = { magDef = 2, fire = 0, water = 0.3, ice, earth, wind, lightning = 0.8, poison = 1.5, light, dark, cut = 0.6, .65, chop = 0.6, stab = 0.7, crush = 0.6 }, + Gnoll = { magDef = 2.5, fire = 0.2, water, ice, earth, wind, lightning = 0.8, poison = 0.8, light, dark, cut = 0.8, chop = 0.8, stab = 0.8, crush = 0.8 }, + Crab = { magDef = 2.5, fire = 0.5, water = 1.5, ice, earth = 1.2, wind = 0.5, lightning = 0.5, poison = 0.8, light, dark, cut = 1.3, chop = 0.9, stab = 0.4, crush = 0.8 }, + Albino = { magDef = 3, fire = 0.2, water, ice, earth, wind, lightning = 0.8, poison, light = 0.5, dark, cut = 0.6, .65, chop = 0.6, stab = 0.7, crush = 0.6 }, + Woodlouise = { magDef = 2, fire = 0.5, water = 1.5, ice, earth = 1.2, wind, lightning = 0, poison = 1.1, light = 0.5, dark, cut = 1.2, chop, stab = 0.3, crush = 0.6 }, + Goo = { magDef = 5, fire = 0.6, water = 1.5, ice, earth = 1.5, wind = 1.5, lightning = 0.3, poison = 1.5, light = 0.3, dark = 1.5, cut = 1.2, chop = 0.9, stab = 1.2, crush = 0.9 }, + RatKing = { magDef = 4, fire = 0.2, water, ice, earth, wind, lightning = 0.8, poison, light, dark, cut = 0.6, .65, chop = 0.6, stab = 0.7, crush = 0.6 }, + + Thief = { magDef = 4, fire = 0.5, water, ice, earth = 0.8, wind, lightning = 0.5, poison = 0.8, light = 0.9, dark, psy = 1.5, cut = 0.8, chop = 0.8, stab = 0.7, crush = 0.8 }, + Skeleton = { magDef = 4.5, fire = 1.2, water = 0.9, ice, earth = 0.9, wind = 0.9, lightning = 1.5, poison = 5, light = 0.5, dark = 1.5, cut = 1.5, chop = 0.7, stab = 0.8, crush = 0.6 }, + Swarm = { magDef = 3, fire = 0.1, water = 0.5, ice, earth = 0.9, wind = 0.7, lightning = 0.1, poison = 0.5, light = 0.3, dark, cut = 0.9, chop = 0.9, stab = 1.1, crush = 0.8 }, + Shadow = { magDef = 5, fire = 1.5, water = 1.5, ice, earth = 1.5, wind = 1.5, lightning = 1.5, poison = 5, light = 0.5, dark = 1.5, cut = 1.5, chop = 1.5, stab = 1.5, crush = 1.5 }, + Bandit = { magDef = 4.5, fire = 0.5, water, ice, earth = 0.9, wind, lightning = 0.5, poison = 0.5, light = 0.3, dark = 1.5, cut = 0.8, psy = 1.5, chop = 0.8, stab = 0.7, crush = 0.9 }, + Tengu = { magDef = 6, fire = 0.8, water = 1.3, ice, earth = 0.9, wind = 1.2, lightning = 0.7, poison = 1.2, light = 0.8, dark = 1.5, psy = 0.8, cut = 1.2, chop = 0.9, stab = 0.8, crush = 0.9 }, + + Bat = { magDef = 3, fire = 0.2, water, ice, earth = 0.9, wind = 1.5, lightning = 0.8, poison = 1.2, light = 0.5, dark = 1.5, cut = 0.8, chop = 0.8, stab, crush = 0.8 }, + Brute = { magDef = 5, fire = 0.3, water, ice, earth, wind, lightning = 0.9, poison = 0.9, light, dark, cut = 0.9, chop = 0.8, stab = 0.9, crush = 1.2 }, + Shaman = { magDef = 4, fire = 0.3, water, ice, earth, wind = 0.8, lightning = 0.7, poison = 0.5, light, dark, cut = 0.8, psy, chop = 0.8, stab = 0.7, crush = 0.8 }, + Spinner = { magDef = 10, fire = 0.5, water, ice, earth = 0.8, wind, lightning = 0.8, poison = 1.5, light = 0.9, dark, cut = 0.7, psy = 0.75, chop = 0.7, stab = 0.8, crush = 0.6 }, + Shielded = { magDef = 7, fire = 0.3, water, ice, earth = 1.2, wind = 0.9, lightning = 0.3, poison = 1.2, light, dark, psy, cut = 1.3, chop = 1.2, stab = 0.3, crush = 0.9 }, + DM300 = { magDef = 5, fire = 1.5, water = 0.5, ice, earth = 1.5, wind = 0.9, lightning = 0.8, poison = 5, light, dark, cut = 1.5, chop = 1.3, stab = 0.8, crush }, + + Monk = { magDef = 4, fire = 0.5, water, ice, earth = 1.1, wind = 1.1, lightning = 0.5, poison = 1.2, light, dark, cut = 0.9, chop = 0.9, stab = 0.9, crush = 0.95 }, + Warlock = { magDef = 6, fire = 0.5, water, ice, earth = 0.8, wind = 0.8, lightning = 0.7, poison = 0.5, light = 0.3, dark = 1.5, cut = 0.8, .75, chop = 0.75, stab = 0.7, crush = 0.8 }, + Golem = { magDef = 5, fire = 1.5, water = 0.3, ice, earth = 1.5, wind = 0.6, lightning = 1.5, poison = 2.5, light, dark, cut = 1.1, psy, chop = 0.9, stab = 0.85, crush = 0.7 }, + Senior = { magDef = 5, fire = 0.5, water, ice, earth = 1.1, wind = 1.1, lightning = 0.8, poison = 1.2, light, dark, cut = 0.95, .95, chop, stab = 0.9, crush = 1.1 }, + Undead = { magDef = 4.5, fire, water = 0.8, ice, earth = 0.5, wind = 0.8, lightning = 1.5, poison = 1.5, light = 0.3, dark = 1.5, psy = 1.5, cut, chop = 0.6, stab = 1.2, crush = 0.3 }, + King = { magDef = 6, fire = 0.7, water, ice, earth = 1.1, wind = 0.9, lightning = 0.8, poison, light = 0.5, dark, cut = 0.8, psy = 0.75, chop = 0.8, stab = 0.75, crush = 0.9 }, + + Succubus = { magDef = 6, fire = 0.8, water = 0.8, ice, earth, wind, lightning = 0.9, poison = 1.2, light = 0.2, dark = 1.5, cut = 0.8, .75, chop = 0.8, stab = 0.7, crush = 0.8 }, + Eye = { magDef = 5, fire = 0.6, water = 1.1, ice, earth = 0.8, wind = 0.9, lightning = 0.7, poison = 0.7, light = 0.2, dark = 1.5, cut = 0.5, .45, chop = 0.6, stab = 0.4, crush = 0.8 }, + Scorpio = { magDef = 2, fire = 0.2, water, ice, earth = 0.7, wind = 0.8, lightning = 0.7, poison = 1.5, light = 0.2, dark = 1.5, cut = 0.7, chop = 0.65, stab = 0.5, crush = 0.4 }, + Acidic = { magDef = 3, fire = 0.2, water, ice, earth = 0.7, wind = 0.8, lightning = 0.7, poison = 1.5, light = 0.2, dark = 1.5, cut = 0.7, chop = 0.6, stab = 0.5, crush = 0.4 }, + ShadowLord = { magDef = 7, fire = 0.8, water, ice, earth, wind, lightning = 0.6, poison = 1.2, light = 0.3, dark = 1.5, cut = 1.2, chop = 1.1, stab = 1.2, crush = 0.9 }, + + SuspiciousRat = { magDef = 7, fire = 0.5, water, ice, earth, wind = 0.8, lightning = 0.6, poison = 0.5, light = 0.5, dark = 1.2, cut = 0.6, chop = 0.6, stab = 0.5, crush = 0.8 }, + PseudoRat = { magDef = 7, fire = 0.6, water, ice, earth, wind, lightning = 0.8, poison = 1.2, light = 0.4, dark = 1.5, cut = 1.2, chop = 1.2, stab = 0.9, crush }, + ZombieGnoll = { magDef = 5, fire = 0.6, water, ice, earth, wind, lightning = 0.8, poison = 1.5, light = 0.4, dark = 1.1, cut = 0.9, chop = 0.8, stab = 0.8, crush }, + Worm = { magDef = 6, fire = 0.4, water = 1.2, ice = 0.8, earth = 1.5, wind = 0.8, lightning = 1.2, poison = 1.5, light = 0.7, dark = 1.2, cut = 0.9, chop = 0.8, stab, crush }, + Nightmare = { magDef = 5, fire = 0.8, water, ice, earth, wind, lightning = 1.1, poison = 1.2, light = 0.3, dark = 1.5, cut = 1.1, chop, stab = 1.1, crush = 0.9 }, + MimicAmulet = { magDef = 6, fire = 0.8, water, ice, earth = 0.9, wind = 0.9, lightning = 0.8, poison = 0.9, light = 0.5, dark = 1.5, cut = 1.1, chop = 1.1, stab = 0.9, crush }, + TreacherousSpirit = { magDef = 6, fire = 0.8, water = 0.8, ice, earth, wind, lightning = 0.7, poison = 1.2, light = 0.2, dark = 1.5, cut = 1.1, chop, stab = 1.1, crush }, + SpiritOfPain = { magDef = 3, fire = 0.8, water = 0.8, ice, earth, wind, lightning = 0.7, poison = 1.2, light = 0.2, dark = 1.5, cut = 1.1, chop, stab = 1.1, crush }, + YogsBrain = { magDef = 3, fire = 0.8, water = 0.6, ice = 1.2, earth = 0.9, wind = 0.9, lightning = 1.5, poison = 0.8, light = 0.5, dark = 1.2, cut = 0.7, chop = 0.6, stab = 0.8, crush = 0.9 }, + YogsEye = { magDef = 7, fire = 0.7, water = 1.2, ice = 0.6, earth = 0.7, wind = 0.7, lightning = 0.7, poison = 0.6, light = 0.2, dark = 1.5, cut = 0.5, chop = 0.6, stab = 0.6, crush = 0.8 }, + YogsHeart = { magDef = 5, fire = 0.8, water, ice = 0.8, earth = 1.2, wind, lightning = 0.7, poison = 1.3, light = 0.5, dark = 1.5, cut = 0.9, chop = 0.9, stab = 0.8, crush = 1.1 }, + RottingFist = { magDef = 6, fire = 0.8, water, ice = 0.8, earth = 1.2, wind, lightning = 0.7, poison = 1.3, light = 0.5, dark = 1.5, cut = 0.9, chop = 0.9, stab = 0.8, crush = 1.1 }, + BurningFist = { magDef = 6, fire = 1.5, water = 0.8, ice = 0.5, earth, wind = 0.9, lightning = 0.85, poison, light, dark = 1.5, cut, chop = 0.9, stab = 0.8, crush = 0.7 }, + Yog = { magDef = 6, fire = 0.8, water = 1.2, ice = 0.6, earth = 0.7, wind = 0.7, lightning = 0.7, poison = 0.6, light = 0.2, dark = 1.5, cut = 0.5, chop = 0.6, stab = 0.6, crush = 0.8 }, + YogsTeeth = { magDef = 8, fire, water = 0.9, ice = 0.9, earth, wind, lightning = 0.85, poison, light = 0.5, dark = 1.5, cut, chop = 0.9, stab = 0.8, crush = 0.7 }, + Larva = { magDef = 3, fire = 0.8, water = 0.8, ice, earth, wind, lightning = 0.7, poison = 1.2, light = 0.3, dark = 1.5, cut = 0.8, chop = 0.8, stab, crush = 0.8 }, + + SpiderServant = { magDef = 4, fire = 0.7, water, ice, earth, wind, lightning = 0.8, poison = 1.2, light = 0.9, dark, cut = 1.15, chop = 0.8, stab = 0.7, crush }, + SpiderGuard = { magDef = 6, fire = 0.8, water, ice, earth, wind, lightning = 0.8, poison = 1.5, light, dark, cut = 1.3, chop, stab = 0.9, crush = 1.1 }, + SpiderExploding = { magDef = -5, fire = 0.5, water = 1.5, ice, earth = 1.1, wind, lightning, poison, light, dark, cut = 0.5, chop = 0.5, stab, crush = 0.8 }, + SpiderMind = { magDef = 2, fire = 0.6, water, ice = 0.8, earth, wind, lightning = 0.6, poison = 1.2, light, dark, cut = 0.7, chop = 0.7, stab = 0.7, crush = 0.9 }, + SpiderMindAmber = { magDef = 3, fire = 0.8, water, ice = 0.7, earth, wind, lightning = 0.6, poison = 1.2, light, dark, cut = 0.8, chop = 0.8, stab = 0.7, crush }, + SpiderNest = { magDef = 3, fire = 0.2, water, ice, earth, wind = 0.9, lightning = 0.8, poison = 1.2, light, dark, cut = 0.3, chop = 0.5, stab = 0.5, crush = 0.8 }, + SpiderEgg = { magDef = 1, fire = 0.2, water, ice = 0.2, earth = 0.2, wind = 0.2, lightning = 0.2, poison = 1.2, light, dark, cut = 0.2, chop = 0.2, stab = 0.2, crush = 0.2 }, + f = { magDef, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush }, + SpiderQueen = { magDef = 7, fire = 0.8, water, ice, earth, wind, lightning = 0.8, poison = 1.5, light = 0.9, dark = 1.2, cut = 1.2, chop = 1.1, stab = 0.8, crush }, + + Kobold = { magDef = 6, fire = 0.6, water = 1.5, ice = 2, earth, wind, lightning = 0.8, poison, light, dark, cut = 1.1, chop, stab = 0.9, crush }, + KoboldIcemancer = { magDef = 5, fire = 0.6, water = 1.5, ice = 2, earth, wind, lightning = 0.7, poison = 0.9, light = 0.9, dark, cut, chop = 0.9, stab = 0.8, crush = 0.9 }, + ColdSpirit = { magDef = 4, fire = 0.5, water = 1.5, ice = 2, earth, wind, lightning, poison, light = 1.2, dark, cut = 1.1, chop = 0.9, stab = 0.8, crush }, + IceGuardianCore = { magDef = 8, fire = 0.3, water = 1.5, ice = 2, earth, wind, lightning, poison = 1.2, light = 1.2, dark, cut = 1.1, chop = 0.9, stab = 0.5, crush }, + IceGuardian = { magDef = 7, fire = 0.3, water = 1.5, ice = 2, earth, wind, lightning, poison = 1.5, light = 1.3, dark, cut = 1.2, chop = 0.95, stab = 0.5, crush }, + + DeathKnight = { magDef = 6, fire, water = 0.9, ice, earth, wind, lightning = 0.7, poison = 1.2, light = 0.4, dark = 1.3, cut = 1.2, chop, stab = 0.9, crush }, + DreadKnight = { magDef = 7, fire, water = 0.9, ice, earth, wind, lightning = 0.7, poison, light = 0.3, dark = 1.5, cut = 1.2, chop = 1.1, stab = 0.95, crush }, + EnslavedSoul = { magDef = 4, fire, water, ice, earth, wind, lightning, poison = 1.5, light = 0.3, dark = 1.5, cut, chop, stab, crush }, + ExplodingSkull = { magDef = 2, fire = 1.5, water = 0.5, ice = 0.6, earth, wind = 0.8, lightning, poison = 1.5, light = 0.8, dark = 0.8, cut, chop = 0.95, stab = 0.8, crush = 0.7 }, + JarOfSouls = { magDef = 2, fire, water, ice, earth = 0.9, wind, lightning, poison, light = 0.4, dark = 1.2, cut, chop = 0.9, stab = 0.5, crush = 0.45 }, + Zombie = { magDef = 4, fire = 0.9, water, ice, earth, wind, lightning = 0.9, poison = 1.2, light = 0.3, dark = 1.2, cut = 0.9, chop = 0.85, stab = 0.85, crush }, + RunicSkull = { magDef = 3, fire, water, ice, earth, wind, lightning, poison = 1.5, light, dark, cut, chop = 0.9, stab = 0.8, crush = 0.75 }, + Lich = { magDef = 8, fire = 0.8, water, ice, earth = 1.2, wind, lightning, poison = 1.2, light = 0.4, dark = 1.5, cut, chop = 0.9, stab = 0.8, crush = 0.85 }, + + none = { magDef = 0, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush } - RPG = { - - forgedItem = forgedItem, - mainMatCount = 16, - materialsCount = 0, - - noBloodMobs = - { - BoneGolem_lvl1="false", - BoneGolem_lvl2="false", - BoneGolem_lvl3="false", - Skeleton = "false", - DM300 = "false", - Goo = "false", - EarthElemental = "false", - WaterElemental = false, - FireElemental = "false", - AirElemental = "false", - Golem = "false", - SpiritOfPain = "false", - Statue = "false", - Wraith = "false", - IceElemental = "false", - Crystal = "false", - ArmoredStatue = "false", - GoldenStatue = "false", - Shadow = "false", - Undead = "false", - ShadowLord = "false", - TreacherousSpirit = "false", - IceGuardianCore = "false", - IceGuardian = "false", - EnslavedSoul = "false", - ExplodingSkull = "false", - JarOfSouls = "false", - Lich = "false", - RunicSkull = "false" - }, - - Objects ={ - Ui={ - WndInfoItem = luajava.bindClass("com.watabou.pixeldungeon.windows.WndInfoItem"), - DCellListener = luajava.bindClass("com.watabou.pixeldungeon.scenes.DefaultCellListener"), - WndBag = "com.watabou.pixeldungeon.windows.WndBag", - WndImageMessage = "com.watabou.pixeldungeon.windows.WndTitledMessage" - } - }, - - Image = luajava.bindClass("com.watabou.noosa.Image"), - - Buffs = { - Bleeding = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Bleeding"), - Terror = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Terror"), - Shadows = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Shadows"), - Amok = luajava.bindClass("com.watabou.pixeldungeon.actors.buffs.Amok") - }, - - statsName = { - "Ht", - "Sp", - "physicStr", - "magicStr", - "fast", - "magDef", - "spRegen", - "luck", - "fire", - "lightning", - "water", - "ice", - "earth", - "poison", - "wind", - "psy", - "light", - "dark", - "cut", - "chop", - "stab", - "crush"}, - - strength = strength, - intelligence = intelligence, - dexterity = dexterity, - vitality = vitality, - wisdom = wisdom, - luck = luck, - physicStr = 1, - physicStrBerserk = 0, - magicStr = 1, - fast = 1, - spRegen = 1, - magDef = 1, - spellFast = 0, - sPoints = sPoints, - lvlToUp = 0, - triger = 0, - class = class, - subClass = subClass, - boneId = boneId, - smithLvl = smithLvl, - smithToUp = smithToUp, - smithExp = smithExp, - - updateStatsA = updateStatsA, - StatsA = { - luck = 0, - physicStr = 0, - magicStr = 0, - fast = 0, - magDef = 0, - spRegen = 0 - }, - updateStatsA2 = updateStatsA2, - StatsA2 = { - luck = 0, - physicStr = 0, - magicStr = 0, - fast = 0, - magDef = 0, - spRegen = 0 - }, - updateStatsB = updateStatsB, - StatsB = { - luck = 0, - physicStr = 0, - magicStr = 0, - fast = 0, - magDef = 0, - spRegen = 0, - fire={0,0}, - water={0,0}, - ice={0,0}, - earth={0,0}, - wind={0,0}, - lightning={0,0}, - poison={0,0}, - light={0,0}, - dark={0,0}, - psy={0,0}, - cut={0,0}, - chop={0,0}, - stab={0,0}, - crush={0,0} - }, - updateStatsArt = updateStatsArt, - StatsArt = { - luck = 0, - physicStr = 0, - magicStr = 0, - fast = 0, - magDef = 0, - spRegen = 0, - fire={0,0}, - water={0,0}, - ice={0,0}, - earth={0,0}, - wind={0,0}, - lightning={0,0}, - poison={0,0}, - light={0,0}, - dark={0,0}, - psy={0,0}, - cut={0,0}, - chop={0,0}, - stab={0,0}, - crush={0,0} - }, - updateStatsArt2 = updateStatsArt2, - StatsArt2 = { - luck = 0, - physicstr = 0, - magicstr = 0, - fast = 0, - magDef = 0, - spRegen = 0, - fire={0,0}, - water={0,0}, - ice={0,0}, - earth={0,0}, - wind={0,0}, - lightning={0,0}, - poison ={0,0}, - light={0,0}, - dark={0,0}, - psy={0,0}, - cut={0,0}, - chop={0,0}, - stab={0,0}, - crush={0,0} - }, - - - defence = { - BoneGolem_lvl1 = {magDef = 2, fire =1.2, water=0.9, ice, earth=0.9, wind=0.9, lightning=1.5, poison=5, light=0.5, dark=1.5, cut=1.5, chop=0.7, stab=0.8, crush=0.6}, - BoneGolem_lvl2 = {magDef = 5, fire =1.2, water=0.9, ice, earth=0.9, wind=0.9, lightning=1.5, poison=5, light=0.5, dark=1.5, cut=1.5, chop=0.7, stab=0.8, crush=0.6}, - BoneGolem_lvl3 = {magDef = 8, fire =1.2, water=0.9, ice, earth=0.9, wind=0.9, lightning=1.5, poison=5, light=0.5, dark=1.5, cut=1.5, chop=0.7, stab=0.8, crush=0.6}, - NecromancerNPC = {magDef = 2, fire =1.2, water=0.9, ice, earth=0.9, wind=0.9, lightning=1.5, poison=5, light=0.5, dark=1.5, cut=1.5, chop=0.7, stab=0.8, crush=0.6}, - FireElemental = {magDef = 3, fire=2, water=0.7, ice=0.2, earth, wind=0.9, lightning=1.1, poison, light, dark, psy, cut, chop, stab, crush=0.8}, - Statue = {magDef=5, fire, water, ice, earth, wind=0.8, lightning=1.5, poison, light, dark, psy=2, cut=1.5, chop, stab=0.85, crush=0.6}, - Wraith = {magDef=5, fire, water, ice, earth, wind=0.9, lightning=0.6, crush=1.5}, - Piranha = {magDef=4, fire=0.5, water=1.5, ice, earth=0.9, wind=0.9, lightning=0.5, poison=0.8, light, dark, psy, cut, chop=0.9, stab=0.8, crush=0.9}, - Mimic = {magDef = 4, fire=0.9, water, ice, earth, wind, lightning=0.8, poison=0.8, light=0.3, dark, psy, cut=1.3, chop, stab=0.8, crush}, - MimicPie = {magDef=4, fire=0.8, water=0.9, ice, earth=0.7, wind, lightning=0.9, poison=0.8, light=0.3, dark, psy, cut=0.5, chop=0.5, stab=0.7, crush=0.8}, - IceElemental = {magDef=3, fire=0.3, water=1.3, ice, earth=1.2, wind=0.9, lightning=0.9, poison=1.5, light=1.5, dark=0.8, cut=1.2, chop=0.8, stab=0.6, crush=0.9}, - WaterElemental = {magDef=3, fire=0.5, water=1.5, ice, earth=1.2, wind=1.2, lightning=0.3, poison=0.5, light=1.2, dark=0.8, cut=1.5, chop=1.1, stab=1.5, crush=1.1}, - EarthElemental = {magDef=3, fire=1.2, water=0.3, ice, earth=1.5, wind=0.7, lightning=1.5, poison=0.8, light=1.2, dark, cut=1.1, chop=0.9, stab=0.8, crush=1.1}, - AirElemental = {magDef=3, fire=0.7, water=1.5, ice, earth=1.2, wind=1.5, lightning=0.3, poison=0.9, light=1.5, dark, cut=1.5, chop=1.2, stab=1.5, crush=0.9}, - Crystal = {magDef=3, fire=1.2, water=0.8, ice, earth=1.5, wind=0.8, lightning, poison=1.5, light=1.5, dark, cut=1.2, chop=0.5, stab=0.3, crush=0.3}, - ArmoredStatue = {magDef=5, fire=1.5, water=0.8, ice, earth=1.5, wind=0.8, lightning=1.5, poison=2.5, light, dark, cut=1.5, chop=1.2, stab=0.5, crush=0.7}, - GoldenStatue = {magDef=4, fire=0.5, water=0.7, ice, earth=1.2, wind=0.8, lightning=1.5, poison=1.5, light=1.2, dark=0.8, cut, chop=0.9, stab=0.8, crush=0.9}, - b= {magDef, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush}, - c= {magDef, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush}, - - Rat = {magDef = 1, fire = 0, water, ice, earth, wind, lightning=0.5, poison=0.8, light, dark, cut=0.6, .65, chop=0.6, stab=0.7, crush=0.6}, - FetidRat= {magDef = 2, fire = 0, water=0.3, ice, earth, wind, lightning=0.8, poison=1.5, light, dark, cut=0.6, .65, chop=0.6, stab=0.7, crush=0.6}, - Gnoll = {magDef = 2.5, fire = 0.2, water, ice, earth, wind, lightning=0.8, poison=0.8, light, dark, cut=0.8, chop=0.8, stab=0.8, crush=0.8}, - Crab = {magDef = 2.5, fire = 0.5, water = 1.5, ice, earth = 1.2, wind = 0.5, lightning = 0.5, poison=0.8, light, dark, cut=1.3, chop=0.9, stab=0.4, crush=0.8}, - Albino = {magDef = 3, fire = 0.2, water, ice, earth, wind, lightning = 0.8, poison, light = 0.5, dark, cut=0.6, .65, chop=0.6, stab=0.7, crush=0.6}, - Woodlouise = {magDef = 2, fire = 0.5, water = 1.5, ice, earth = 1.2, wind, lightning = 0, poison = 1.1, light = 0.5, dark, cut=1.2, chop, stab=0.3, crush=0.6}, - Goo = {magDef=5, fire=0.6, water=1.5, ice, earth=1.5, wind=1.5, lightning=0.3, poison=1.5, light=0.3, dark=1.5, cut=1.2, chop=0.9, stab=1.2, crush=0.9}, - RatKing = {magDef = 4, fire = 0.2, water, ice, earth, wind, lightning = 0.8, poison, light, dark, cut=0.6, .65, chop=0.6, stab=0.7, crush=0.6}, - - Thief = {magDef = 4, fire = 0.5, water, ice, earth=0.8, wind, lightning=0.5, poison=0.8, light=0.9, dark, psy=1.5 , cut=0.8, chop=0.8, stab=0.7, crush=0.8}, - Skeleton = {magDef = 4.5, fire =1.2, water=0.9, ice, earth=0.9, wind=0.9, lightning=1.5, poison=5, light=0.5, dark=1.5, cut=1.5, chop=0.7, stab=0.8, crush=0.6}, - Swarm = {magDef = 3, fire = 0.1, water=0.5, ice, earth=0.9, wind=0.7, lightning=0.1, poison=0.5, light=0.3, dark, cut=0.9, chop=0.9, stab=1.1, crush=0.8}, - Shadow = {magDef = 5, fire = 1.5, water=1.5, ice, earth=1.5, wind=1.5, lightning=1.5, poison=5, light=0.5, dark=1.5, cut=1.5, chop=1.5, stab=1.5, crush=1.5}, - Bandit = {magDef = 4.5, fire = 0.5, water, ice, earth=0.9, wind, lightning=0.5, poison=0.5, light=0.3, dark=1.5, cut=0.8, psy =1.5, chop=0.8, stab=0.7, crush=0.9}, - Tengu = {magDef=6, fire=0.8, water=1.3, ice, earth=0.9, wind=1.2, lightning=0.7, poison=1.2, light=0.8, dark=1.5, psy = 0.8, cut=1.2, chop=0.9, stab=0.8, crush=0.9}, - - Bat = {magDef = 3, fire = 0.2, water, ice, earth=0.9, wind=1.5, lightning=0.8, poison=1.2, light=0.5, dark=1.5, cut=0.8, chop=0.8, stab, crush=0.8}, - Brute = {magDef = 5, fire = 0.3, water, ice, earth, wind, lightning=0.9, poison=0.9, light, dark, cut=0.9, chop=0.8, stab=0.9, crush=1.2}, - Shaman = {magDef = 4, fire = 0.3, water, ice, earth, wind=0.8, lightning=0.7, poison=0.5, light, dark, cut=0.8, psy, chop=0.8, stab=0.7, crush=0.8}, - Spinner = {magDef=10, fire=0.5, water, ice, earth=0.8, wind, lightning=0.8, poison=1.5, light=0.9, dark, cut=0.7, psy=0.75, chop=0.7, stab=0.8, crush=0.6}, - Shielded = {magDef=7, fire=0.3, water, ice, earth=1.2, wind=0.9, lightning=0.3, poison=1.2, light, dark, psy, cut=1.3, chop=1.2, stab=0.3, crush=0.9}, - DM300 = {magDef=5, fire=1.5, water=0.5, ice, earth=1.5, wind=0.9, lightning=0.8, poison=5, light, dark, cut=1.5, chop=1.3, stab=0.8, crush}, - - Monk = {magDef=4, fire=0.5, water, ice, earth=1.1, wind=1.1, lightning=0.5, poison=1.2, light, dark, cut=0.9, chop=0.9, stab=0.9, crush=0.95}, - Warlock = {magDef=6, fire=0.5, water, ice, earth=0.8, wind=0.8, lightning=0.7, poison=0.5, light=0.3, dark=1.5, cut=0.8, .75, chop=0.75, stab=0.7, crush=0.8}, - Golem = {magDef=5, fire=1.5, water=0.3, ice, earth=1.5, wind=0.6, lightning=1.5, poison=2.5, light, dark, cut=1.1, psy, chop=0.9, stab=0.85, crush=0.7}, - Senior = {magDef=5, fire=0.5, water, ice, earth=1.1, wind=1.1, lightning=0.8, poison=1.2, light, dark, cut=0.95, .95, chop, stab=0.9, crush=1.1}, - Undead = {magDef=4.5, fire, water=0.8, ice, earth=0.5, wind=0.8, lightning=1.5, poison=1.5, light=0.3, dark=1.5, psy=1.5, cut, chop=0.6, stab=1.2, crush=0.3}, - King = {magDef=6, fire=0.7, water, ice, earth=1.1, wind=0.9, lightning=0.8, poison, light=0.5, dark, cut=0.8, psy=0.75, chop=0.8, stab=0.75, crush=0.9}, - - Succubus = {magDef=6, fire=0.8, water=0.8, ice, earth, wind, lightning=0.9, poison=1.2, light=0.2, dark=1.5, cut=0.8, .75, chop=0.8, stab=0.7, crush=0.8}, - Eye = {magDef=5, fire=0.6, water=1.1, ice, earth=0.8, wind=0.9, lightning=0.7, poison=0.7, light=0.2, dark=1.5, cut=0.5, .45, chop=0.6, stab=0.4, crush=0.8}, - Scorpio = {magDef=2, fire=0.2, water, ice, earth=0.7, wind=0.8, lightning=0.7, poison=1.5, light=0.2, dark=1.5, cut=0.7, chop=0.65, stab=0.5, crush=0.4}, - Acidic = {magDef=3, fire=0.2, water, ice, earth=0.7, wind=0.8, lightning=0.7, poison=1.5, light=0.2, dark=1.5, cut=0.7, chop=0.6, stab=0.5, crush=0.4}, - ShadowLord = {magDef=7, fire=0.8, water, ice, earth, wind, lightning=0.6, poison=1.2, light=0.3, dark=1.5, cut=1.2, chop=1.1, stab=1.2, crush=0.9}, - - SuspiciousRat = {magDef=7, fire=0.5, water, ice, earth, wind=0.8, lightning=0.6, poison=0.5, light=0.5, dark=1.2, cut=0.6, chop=0.6, stab=0.5, crush=0.8}, - PseudoRat = {magDef=7, fire=0.6, water, ice, earth, wind, lightning=0.8, poison=1.2, light=0.4, dark=1.5, cut=1.2, chop=1.2, stab=0.9, crush}, - ZombieGnoll = {magDef=5, fire=0.6, water, ice, earth, wind, lightning=0.8, poison=1.5, light=0.4, dark=1.1, cut=0.9, chop=0.8, stab=0.8, crush}, - Worm = {magDef=6, fire=0.4, water=1.2, ice=0.8, earth=1.5, wind=0.8, lightning=1.2, poison=1.5, light=0.7, dark=1.2, cut=0.9, chop=0.8, stab, crush}, - Nightmare = {magDef=5, fire=0.8, water, ice, earth, wind, lightning=1.1, poison=1.2, light=0.3, dark=1.5, cut=1.1, chop, stab=1.1, crush=0.9}, - MimicAmulet = {magDef=6, fire=0.8, water, ice, earth=0.9, wind=0.9, lightning=0.8, poison=0.9, light=0.5, dark=1.5, cut=1.1, chop=1.1, stab=0.9, crush}, - TreacherousSpirit = {magDef=6, fire=0.8, water=0.8, ice, earth, wind, lightning=0.7, poison=1.2, light=0.2, dark=1.5, cut=1.1, chop, stab=1.1, crush}, - SpiritOfPain= {magDef=3, fire=0.8, water=0.8, ice, earth, wind, lightning=0.7, poison=1.2, light=0.2, dark=1.5, cut=1.1, chop, stab=1.1, crush}, - YogsBrain= {magDef=3, fire=0.8, water=0.6, ice=1.2, earth=0.9, wind=0.9, lightning=1.5, poison=0.8, light=0.5, dark=1.2, cut=0.7, chop=0.6, stab=0.8, crush=0.9}, - YogsEye= {magDef=7, fire=0.7, water=1.2, ice=0.6, earth=0.7, wind=0.7, lightning=0.7, poison=0.6, light=0.2, dark=1.5, cut=0.5, chop=0.6, stab=0.6, crush=0.8}, - YogsHeart= {magDef=5, fire=0.8, water, ice=0.8, earth=1.2, wind, lightning=0.7, poison=1.3, light=0.5, dark=1.5, cut=0.9, chop=0.9, stab=0.8, crush=1.1}, - RottingFist= {magDef=6, fire=0.8, water, ice=0.8, earth=1.2, wind, lightning=0.7, poison=1.3, light=0.5, dark=1.5, cut=0.9, chop=0.9, stab=0.8, crush=1.1}, - BurningFist= {magDef=6, fire=1.5, water=0.8, ice=0.5, earth, wind=0.9, lightning=0.85, poison, light, dark=1.5, cut, chop=0.9, stab=0.8, crush=0.7}, - Yog = {magDef=6, fire=0.8, water=1.2, ice=0.6, earth=0.7, wind=0.7, lightning=0.7, poison=0.6, light=0.2, dark=1.5, cut=0.5, chop=0.6, stab=0.6, crush=0.8}, - YogsTeeth= {magDef=8, fire, water=0.9, ice=0.9, earth, wind, lightning=0.85, poison, light=0.5, dark=1.5, cut, chop=0.9, stab=0.8, crush=0.7}, - Larva = {magDef=3, fire=0.8, water=0.8, ice, earth, wind, lightning=0.7, poison=1.2, light=0.3, dark=1.5, cut=0.8, chop=0.8, stab, crush=0.8}, - - SpiderServant = {magDef=4, fire=0.7, water, ice, earth, wind, lightning=0.8, poison=1.2, light=0.9, dark, cut=1.15, chop=0.8, stab=0.7, crush}, - SpiderGuard = {magDef=6, fire=0.8, water, ice, earth, wind, lightning=0.8, poison=1.5, light, dark, cut=1.3, chop, stab=0.9, crush=1.1}, - SpiderExploding = {magDef=-5, fire=0.5, water=1.5, ice, earth=1.1, wind, lightning, poison, light, dark, cut=0.5, chop=0.5, stab, crush=0.8}, - SpiderMind= {magDef=2, fire=0.6, water, ice=0.8, earth, wind, lightning=0.6, poison=1.2, light, dark, cut=0.7, chop=0.7, stab=0.7, crush=0.9}, - SpiderMindAmber= {magDef=3, fire=0.8, water, ice=0.7, earth, wind, lightning=0.6, poison=1.2, light, dark, cut=0.8, chop=0.8, stab=0.7, crush}, - SpiderNest= {magDef=3, fire=0.2, water, ice, earth, wind=0.9, lightning=0.8, poison=1.2, light, dark, cut=0.3, chop=0.5, stab=0.5, crush=0.8}, - SpiderEgg= {magDef=1, fire=0.2, water, ice=0.2, earth=0.2, wind=0.2, lightning=0.2, poison=1.2, light, dark, cut=0.2, chop=0.2, stab=0.2, crush=0.2}, - f = {magDef, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush}, - SpiderQueen = {magDef=7, fire=0.8, water, ice, earth, wind, lightning=0.8, poison=1.5, light=0.9, dark=1.2, cut=1.2, chop=1.1, stab=0.8, crush}, - - Kobold = {magDef=6, fire=0.6, water=1.5, ice=2, earth, wind, lightning=0.8, poison, light, dark, cut=1.1, chop, stab=0.9, crush}, - KoboldIcemancer= {magDef=5, fire=0.6, water=1.5, ice=2, earth, wind, lightning=0.7, poison=0.9, light=0.9, dark, cut, chop=0.9, stab=0.8, crush=0.9}, - ColdSpirit = {magDef=4, fire=0.5, water=1.5, ice=2, earth, wind, lightning, poison, light=1.2, dark, cut=1.1, chop=0.9, stab=0.8, crush}, - IceGuardianCore= {magDef=8, fire=0.3, water=1.5, ice=2, earth, wind, lightning, poison=1.2, light=1.2, dark, cut=1.1, chop=0.9, stab=0.5, crush}, - IceGuardian = {magDef=7, fire=0.3, water=1.5, ice=2, earth, wind, lightning, poison=1.5, light=1.3, dark, cut=1.2, chop=0.95, stab=0.5, crush}, - - DeathKnight = {magDef=6, fire, water=0.9, ice, earth, wind, lightning=0.7, poison=1.2, light=0.4, dark=1.3, cut=1.2, chop, stab=0.9, crush}, - DreadKnight = {magDef=7, fire, water=0.9, ice, earth, wind, lightning=0.7, poison, light=0.3, dark=1.5, cut=1.2, chop=1.1, stab=0.95, crush}, - EnslavedSoul = {magDef=4, fire, water, ice, earth, wind, lightning, poison=1.5, light=0.3, dark=1.5, cut, chop, stab, crush}, - ExplodingSkull = {magDef=2, fire=1.5, water=0.5, ice=0.6, earth, wind=0.8, lightning, poison=1.5, light=0.8, dark=0.8, cut, chop=0.95, stab=0.8, crush=0.7}, - JarOfSouls = {magDef=2, fire, water, ice, earth=0.9, wind, lightning, poison, light=0.4, dark=1.2, cut, chop=0.9, stab=0.5, crush=0.45}, - Zombie = {magDef=4, fire=0.9, water, ice, earth, wind, lightning=0.9, poison=1.2, light=0.3, dark=1.2, cut=0.9, chop=0.85, stab=0.85, crush}, - RunicSkull = {magDef=3, fire, water, ice, earth, wind, lightning, poison=1.5, light, dark, cut, chop=0.9, stab=0.8, crush=0.75}, - Lich = {magDef=8, fire=0.8, water, ice, earth=1.2, wind, lightning, poison=1.2, light=0.4, dark=1.5, cut, chop=0.9, stab=0.8, crush=0.85}, - - none = {magDef =0, fire, water, ice, earth, wind, lightning, poison, light, dark, cut, chop, stab, crush} - - }, - - - physStr = function() - return RPG.physicStr+RPG.StatsB["physicStr"] +RPG.StatsA["physicStr"] +RPG.StatsA2["physicStr"]+RPG.physicStrBerserk - end, - - - magStr = function() - return RPG.magicStr +RPG.StatsA["magicStr"] +RPG.StatsA2["magicStr"] +RPG.StatsB["magicStr"] - end, - - - AllFast = function() - return RPG.fast +RPG.StatsA["fast"] +RPG.StatsA2["fast"] +RPG.StatsB["fast"] - end, - - - AllMagDef = function() - return RPG.magDef +RPG.StatsB["magDef"] +RPG.StatsArt2["magDef"] +RPG.StatsArt["magDef"] +RPG.StatsA["magDef"] +RPG.StatsA2["magDef"] - end, - - - AllSpRegen = function() - return RPG.spRegen +RPG.StatsA["spRegen"] +RPG.StatsA2["spRegen"] +RPG.StatsB["spRegen"] +RPG.StatsArt["spRegen"] +RPG.StatsArt2["spRegen"] - end, - - - AllLuck = function() - local luck = 0 - if RPG.luck then - luck = RPG.luck - end - return luck +RPG.StatsA["luck"] +RPG.StatsA2["luck"] +RPG.StatsB["luck"] - end, - - - selectAmmo = function(mode,title) - - local hero = RPD.Dungeon.hero - local WndBag = RPG.Objects.Ui.WndBag - local listener = luajava.createProxy("com.watabou.pixeldungeon.windows.WndBag$Listener",{ - - onSelect = function(item,selector) - if item ~= nil then - local itemEK = item:getEntityKind() - local check = string.sub(itemEK,0,8) - if check == "missiles" then - local matFile = require("scripts/items/"..itemEK) - - storage.gamePut("choosedArrows",{is = itemEK}) - - else - RPD.playSound("snd_wrong.ogg") - RPG.selectAmmo(title) - + + + physStr = function() + return RPG.physicStr + RPG.StatsB["physicStr"] + RPG.StatsA["physicStr"] + RPG.StatsA2["physicStr"] + RPG.physicStrBerserk + end, + + + magStr = function() + return RPG.magicStr + RPG.StatsA["magicStr"] + RPG.StatsA2["magicStr"] + RPG.StatsB["magicStr"] + end, + + + AllFast = function() + return RPG.fast + RPG.StatsA["fast"] + RPG.StatsA2["fast"] + RPG.StatsB["fast"] + end, + + + AllMagDef = function() + return RPG.magDef + RPG.StatsB["magDef"] + RPG.StatsArt2["magDef"] + RPG.StatsArt["magDef"] + RPG.StatsA["magDef"] + RPG.StatsA2["magDef"] + end, + + + AllSpRegen = function() + return RPG.spRegen + RPG.StatsA["spRegen"] + RPG.StatsA2["spRegen"] + RPG.StatsB["spRegen"] + RPG.StatsArt["spRegen"] + RPG.StatsArt2["spRegen"] + end, + + + AllLuck = function() + local luck = 0 + if RPG.luck then + luck = RPG.luck + end + return luck + RPG.StatsA["luck"] + RPG.StatsA2["luck"] + RPG.StatsB["luck"] + end, + + + selectAmmo = function(mode, title) + + local hero = RPD.Dungeon.hero + local WndBag = RPG.Objects.Ui.WndBag + local listener = luajava.createProxy("com.watabou.pixeldungeon.windows.WndBag$Listener", { + + onSelect = function(item, selector) + if item ~= nil then + local itemEK = item:getEntityKind() + local check = string.sub(itemEK, 0, 8) + if check == "missiles" then + local matFile = require("scripts/items/" .. itemEK) + + storage.gamePut("choosedArrows", { is = itemEK }) + + else + RPD.playSound("snd_wrong.ogg") + RPG.selectAmmo(title) + + end + end + end }) + + RPD.GameScene:selectItem(hero, listener, mode, title) + end, + + + selectItemForSmithing = function(mode, title, index, quantity) + local smithy = require "scripts/lib/smithing" + local hero = RPD.Dungeon.hero + local Add = require "scripts/lib/AdditionalFunctions" + + local WndBag = RPG.Objects.Ui.WndBag + local finalGroup = smithy.finalMaterials[index] + + local listener = luajava.createProxy("com.watabou.pixeldungeon.windows.WndBag$Listener", { + onSelect = function(item, selector) + if item ~= nil then + local itemEK = item:getEntityKind() + + local check = false + local itemCheck = false + local changedIndex = { I1 = 2, I2 = 1 } + local matNumFromGroups = 0 + local finalGroupAnother = smithy.finalMaterials[changedIndex["I" .. tostring(index)]] + + for i = 1, #finalGroup do + local masFG = finalGroup[i] + if masFG[1] == itemEK then + matNumFromGroups = matNumFromGroups + masFG[2] + end + end + for i = 1, #finalGroupAnother do + local masFG = finalGroupAnother[i] + if masFG[1] == itemEK then + matNumFromGroups = matNumFromGroups + masFG[2] + end + end + + if string.sub(itemEK, 0, 9) == "materials" then + local matFile = require("scripts/items/" .. itemEK) + if index == 1 then + if matFile:desc().data[smithy.mode .. "Usable"] == true then + itemCheck = true + end + else + itemCheck = true + end + end + + for i = 1, #finalGroup do + local elements = finalGroup[i] + if itemEK == elements[1] then + check = i + RPD.glog(elements[2]) + end + end + + if itemCheck == true and hero:getBelongings():getItem(itemEK):quantity() - matNumFromGroups >= quantity then + smithy.allQuantity[index] = smithy.allQuantity[index] + quantity + if check == false then + finalGroup[#finalGroup + 1] = { itemEK, quantity } + else + local elements = finalGroup[check] + elements[2] = elements[2] + quantity + end + else + RPD.playSound("snd_wrong.ogg") + end + + Add.smithChooseMaterials(smithy.chooseMaterials) + end + end }) + + RPD.GameScene:selectItem(hero, listener, mode, title) + end, + + + statsFromMaterials = function(materials, mode) + local smithy = require "scripts/lib/smithing" + local hero = RPD.Dungeon.hero + local stats = { 0, 0, 0, 0, 0, 0, 0, 0 } + local wFix = { armor = 0, weapon = 14, magic = 14 } + local smithData = storage.gameGet("smithing") or {} + local smithScale = 0.7 + 0.15 * smithy.lvl + local rareName = "" + local rareScale = 0 + local exp = 0 + + local rareRandom = math.random(1, 15000) + if rareRandom <= 100 + RPG.AllLuck() * 2 then + smithScale = smithScale + 0.666 * smithy.lvl + rareName = "(" .. RPD.textById("Legendary") .. ")" + exp = exp + 12 + rareScale = 10 + + elseif rareRandom <= 800 + RPG.AllLuck() * 2 then + smithScale = smithScale + 0.3 * smithy.lvl + rareName = "(" .. RPD.textById("Epic") .. ")" + exp = exp + 5 + rareScale = 6 + + elseif rareRandom <= 3500 + RPG.AllLuck() * 2 then + smithScale = smithScale + 0.1 * smithy.lvl + rareName = "(" .. RPD.textById("Rare") .. ")" + exp = exp + 2 + rareScale = 2 + end - end - end}) - - RPD.GameScene:selectItem(hero,listener,mode,title) - end, - - - selectItemForSmithing = function(mode,title,index,quantity) - local smithy = require "scripts/lib/smithing" - local hero = RPD.Dungeon.hero - local Add = require "scripts/lib/AdditionalFunctions" - - - local WndBag = RPG.Objects.Ui.WndBag - local finalGroup = smithy.finalMaterials[index] - - local listener = luajava.createProxy("com.watabou.pixeldungeon.windows.WndBag$Listener",{ - onSelect = function(item,selector) - if item ~= nil then - local itemEK = item:getEntityKind() - - local check = false - local itemCheck = false - local changedIndex ={I1=2,I2=1} - local matNumFromGroups = 0 - local finalGroupAnother = smithy.finalMaterials[changedIndex["I"..tostring(index)]] - - for i = 1,#finalGroup do - local masFG = finalGroup[i] - if masFG[1] == itemEK then - matNumFromGroups = matNumFromGroups + masFG[2] + + local addStatsGroups = { + armor = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, + weapon = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, + magic = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } } + } + + local objectDmgType = { + Sword = { "phys", { "cut", "chop" } }, + Longsword = { "phys", { "cut", "chop" } }, + Axe = { "phys", "chop" }, + Hatchet = { "phys", "chop" }, + Halberd = { "phys", { "chop", "stab" } }, + Dagger = { "phys", { "cut", "stab" } }, + Mace = { "phys", "crush" }, + Hammer = { "phys", "crush" }, + Spear = { "phys", "stab" }, + Bow = { "phys", "stab" }, + Crossbow = { "phys", "stab" }, + MagicStaff = { "mag", "" }, + MagicWand = { "mag", "" } + } + + local objectDrType = { + LightArmor = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0.5, 0.05 }, { 1, 0.08 } }, + MediumArmor = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 1, 0.08 }, { 0.5, 0.05 } }, + HeavyArmor = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 1, 0.08 }, { 0.5, 0.08 }, { 0, 0 }, { 0.2, 0.02 } } + } + + local armorsFeatures = { + LightArmor = { 0.6, 1.2, 1.2, 1.2, 1.2, 0.6, 1.2, 1.2 }, + MediumArmor = { 1, 1, 1, 1, 1, 1, 1, 1 }, + HeavyArmor = { 1.35, 1, 0.8, 0.8, 0.8, 1.35, 1, 1 } + } + + local armorFeature = armorsFeatures[smithy.choosenObject] or { 1, 1, 1, 1, 1, 1, 1, 1 } + + local moreStr = 1 + if smithy.thisTwohanded == true then + if smithy.choosenObject == "Spear" then + moreStr = 1.25 + else + moreStr = 1.5 + end end - end - for i = 1,#finalGroupAnother do - local masFG = finalGroupAnother[i] - if masFG[1] == itemEK then - matNumFromGroups = matNumFromGroups + masFG[2] + + local allAdd = addStatsGroups[mode] + local info + local str = 0 + local minDmg = 0 + local maxDmg = 0 + local delayFactor = 1 + local accuracy = 1 + local range = 1 + local dr = 0 + local addStats + local plusStats + local groups = { + materials[1], + materials[2] + } + + if mode == "armor" then + plusStats = objectDrType[smithy.choosenObject] + for i = 1, 14 do + local stat = allAdd[i] + local plusStat = plusStats[i] + for j = 1, 2 do + stat[j] = stat[j] + plusStat[j] + end + end end - end - - - if string.sub(itemEK,0,9) == "materials" then - local matFile = require("scripts/items/"..itemEK) - if index == 1 then - if matFile:desc().data[smithy.mode.."Usable"] == true then - itemCheck = true - end - else - itemCheck = true - end - end - - for i = 1,#finalGroup do - local elements = finalGroup[i] - if itemEK == elements[1] then - check = i - RPD.glog(elements[2]) - end + + for g = 1, 2 do + local group = groups[g] + + for i = 1, #group do + + local material = group[i] + local matFile = require("scripts/items/" .. material[1]) + + local material1 = matFile:desc() + local mainStats = material1.data.stats + if mode == "magic" then + addStats = material1.data["weapon"] + else + addStats = material1.data[mode] + end + + hero:getBelongings():getItem(material[1]):detach(hero:getBelongings().backpack, material[2]) + + str = str + matFile:typicalStr() * material[2] * moreStr + minDmg = minDmg + material1.data.dmg[1] * material[2] * smithScale + maxDmg = maxDmg + material1.data.dmg[2] * material[2] * smithScale + delayFactor = delayFactor - material1.data.delay * material[2] + accuraty = accuracy + material1.data.accuracy * material[2] * smithScale + range = range + material1.data.range * material[2] + dr = dr + material1.data.dr * material[2] * smithScale + exp = RPG.smartInt(exp + material1.data.exp * material[2]) + + for j = 1, 8 do + + stats[j] = stats[j] + mainStats[j] * material[2] * smithScale * armorFeature[j] + + end + + for j = 1, 14 + wFix[mode] do + + local allStat = allAdd[j] + local modeStat = addStats[j] + + for jj = 1, 2 do + + allStat[jj] = allStat[jj] + modeStat[jj] * material[2] * smithScale + + end + + end + end end - - if itemCheck == true and hero:getBelongings():getItem(itemEK):quantity()-matNumFromGroups >= quantity then - smithy.allQuantity[index] = smithy.allQuantity[index] + quantity - if check == false then - finalGroup[#finalGroup+1] = {itemEK,quantity} - else - local elements = finalGroup[check] - elements[2] = elements[2] + quantity - end + + delayFactor = RPG.smartInt(delayFactor) + accuracy = RPG.smartInt(accuracy) + range = RPG.smartInt(range) + + if mode == "magic" then + stats[2] = stats[2] * 1.25 + stats[4] = stats[4] * 1.25 + end + + for i = 1, 8 do + stats[i] = RPG.smartInt(stats[i]) + end + for i = 1, 14 + wFix[mode] do + local stat = allAdd[i] + stat[1] = RPG.smartInt(stat[1]) + end + + local drOrDmg = { + armor = RPG.smartInt(dr), + weapon = { RPG.smartInt(minDmg), RPG.smartInt(maxDmg) }, + magic = { RPG.smartInt(minDmg), RPG.smartInt(maxDmg) } + } + + local itemInfo + if mode == "armor" then + itemInfo = RPG.getItemInfo(stats, allAdd) else - RPD.playSound("snd_wrong.ogg") + itemInfo = RPG.getWeaponInfo(stats, allAdd) end - - Add.smithChooseMaterials(smithy.chooseMaterials) - end - end}) - - RPD.GameScene:selectItem(hero,listener,mode,title) - end, - - - statsFromMaterials = function(materials,mode) - local smithy = require "scripts/lib/smithing" - local hero = RPD.Dungeon.hero - local stats = {0,0,0,0,0,0,0,0} - local wFix = {armor = 0, weapon = 14, magic = 14} - local smithData = storage.gameGet("smithing") or {} - local smithScale = 0.7 + 0.15*smithy.lvl - local rareName = "" - local rareScale = 0 - local exp = 0 - - local rareRandom = math.random(1,15000) - if rareRandom <= 100 +RPG.AllLuck()*2 then - smithScale = smithScale +0.666*smithy.lvl - rareName = "("..RPD.textById("Legendary")..")" - exp = exp + 12 - rareScale = 10 - - elseif rareRandom <= 800 +RPG.AllLuck()*2 then - smithScale = smithScale +0.3*smithy.lvl - rareName = "("..RPD.textById("Epic")..")" - exp = exp +5 - rareScale = 6 - - elseif rareRandom <= 3500 +RPG.AllLuck()*2 then - smithScale = smithScale +0.1*smithy.lvl - rareName = "("..RPD.textById("Rare")..")" - exp = exp+2 - rareScale = 2 - - end - - local addStatsGroups = - { - armor = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}, - weapon = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}, - magic = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}} - } - - local objectDmgType = { - Sword = {"phys",{"cut","chop"}}, - Longsword = {"phys",{"cut","chop"}}, - Axe = {"phys","chop"}, - Hatchet = {"phys","chop"}, - Halberd = {"phys",{"chop","stab"}}, - Dagger = {"phys",{"cut","stab"}}, - Mace = {"phys","crush"}, - Hammer = {"phys","crush"}, - Spear = {"phys","stab"}, - Bow = {"phys","stab"}, - Crossbow = {"phys","stab"}, - MagicStaff = {"mag",""}, - MagicWand = {"mag",""} - } - - local objectDrType = { - LightArmor = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0.5,0.05},{1,0.08}}, - MediumArmor = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{1,0.08},{0.5,0.05}}, - HeavyArmor = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{1,0.08},{0.5,0.08},{0,0},{0.2,0.02}} - } - - local armorsFeatures ={ - LightArmor = {0.6,1.2,1.2,1.2,1.2,0.6,1.2,1.2}, - MediumArmor = {1,1,1,1,1,1,1,1}, - HeavyArmor = {1.35,1,0.8,0.8,0.8,1.35,1,1} - } - - local armorFeature = armorsFeatures[smithy.choosenObject] or {1,1,1,1,1,1,1,1} - - local moreStr = 1 - if smithy.thisTwohanded == true then - if smithy.choosenObject == "Spear" then - moreStr = 1.25 - else - moreStr = 1.5 - end - end - - - local allAdd = addStatsGroups[mode] - local info - local str = 0 - local minDmg = 0 - local maxDmg = 0 - local delayFactor = 1 - local accuracy = 1 - local range = 1 - local dr = 0 - local addStats - local plusStats - local groups = - { - materials[1], - materials[2] - } - - if mode == "armor" then - plusStats = objectDrType[smithy.choosenObject] - for i =1,14 do - local stat = allAdd[i] - local plusStat = plusStats[i] - for j = 1,2 do - stat[j] = stat[j] + plusStat[j] - end - end - end - - for g = 1,2 do - local group = groups[g] - - for i = 1, #group do - - local material = group[i] - local matFile = require("scripts/items/"..material[1]) - - local material1 = matFile:desc() - local mainStats = material1.data.stats - if mode == "magic" then - addStats = material1.data["weapon"] - else - addStats = material1.data[mode] - end - - hero:getBelongings():getItem(material[1]):detach(hero:getBelongings().backpack,material[2]) - - - str = str + matFile:typicalStr()*material[2]*moreStr - minDmg = minDmg + material1.data.dmg[1]*material[2]*smithScale - maxDmg = maxDmg + material1.data.dmg[2]*material[2]*smithScale - delayFactor = delayFactor - material1.data.delay*material[2] - accuraty = accuracy + material1.data.accuracy*material[2]*smithScale - range = range + material1.data.range*material[2] - dr = dr + material1.data.dr*material[2]*smithScale - exp = RPG.smartInt(exp + material1.data.exp*material[2]) - - for j = 1, 8 do - - stats[j] = stats[j] + mainStats[j]*material[2]*smithScale*armorFeature[j] - - end - - for j = 1, 14 + wFix[mode] do - - local allStat = allAdd[j] - local modeStat = addStats[j] - - for jj = 1,2 do - - allStat[jj] = allStat[jj] + modeStat[jj]*material[2]*smithScale - - end - - end - end - end - - delayFactor = RPG.smartInt(delayFactor) - accuracy = RPG.smartInt(accuracy) - range = RPG.smartInt(range) - - if mode == "magic" then - stats[2] = stats[2]*1.25 - stats[4] = stats[4]*1.25 - end - - for i = 1, 8 do - stats[i] = RPG.smartInt(stats[i]) - end - for i = 1, 14 +wFix[mode] do - local stat = allAdd[i] - stat[1] = RPG.smartInt(stat[1]) - end - - local drOrDmg = - { - armor = RPG.smartInt(dr), - weapon = {RPG.smartInt(minDmg),RPG.smartInt(maxDmg)}, - magic = {RPG.smartInt(minDmg),RPG.smartInt(maxDmg)} - } - - local itemInfo - if mode == "armor" then - itemInfo = RPG.getItemInfo(stats,allAdd) - else - itemInfo = RPG.getWeaponInfo(stats,allAdd) - end - - local skip - local max ={} - local mat1 - local mat2 - local group1 = groups[1] - if #group1 > 1 then - - for i = 1,2 do - mat1 = group1[1] - - for ii = 2,#group1 do - mat2 = group1[ii] - - if (mat2[2] > mat1[2] and mat2[1] ~= max[1]) or mat1[1] == max[1] then - - mat1 = mat2 - end - end - - max[i] = mat1[1] - end - else - - mat1 = group1[1] - max[1] = mat1[1] - max[2] = max[1] - end - - local materialIcon = - { - iron = 1, - steel = 2, - leather = 3, - gold = 3, - cloth = 4, - bone = 4, - wood = 1, - runic = 2, - ruby = 3, - nephrite = 4 - } - local icon - max[1] = require("scripts/items/"..max[1]) - max[2] = require("scripts/items/"..max[2]) - icon = materialIcon[max[1]:desc().data.name]*RPG.mainMatCount + materialIcon[max[2]:desc().data.name] - - local weaponNames ={ - iron = { - Sword = "sword", - Longsword = "palash", - Dagger = "dagger", - Mace = "mace", - Hammer = "hammer", - Spear = "spear", - Axe = "axe", - Hatchet = "twohands_axe", - Halberd = "halberd", - Bow = "bow", - Crossbow = "crossbow" - }, - steel = { - Sword = "gladys", - Longsword = "espadon", - Dagger = "doug", - Mace = "pernach", - Hammer = "slander", - Spear = "rogatina", - Axe = "chekan", - Hatchet = "brodex", - Halberd = "pollaxe", - Bow = "long_bow", - Crossbow = "long_crossbow" - }, - gold = { - Sword = "katana", - Longsword = "estok", - Dagger = "stilleto", - Mace = "buzdyhan", - Hammer = "warhammer", - Spear = "protazan", - Axe = "berdysh", - Hatchet = "labris", - Halberd = "glaive", - Bow = "composite_bow", - Crossbow = "composite_crossbow" - }, - bone = { - Sword = "machete", - Longsword = "bigsword", - Dagger = "cris", - Mace = "morgenstern", - Hammer = "najak", - Spear = "peak", - Axe = "sagoris", - Hatchet = "cleaver", - Halberd = "voulge", - Bow = "big_bow", - Crossbow = "big_crossbow" - }, - wood ={ - MagicStaff = "crutch", - MagicWand = "stick" - }, - runic ={ - MagicStaff = "staff", - MagicWand = "wand" - }, - ruby ={ - MagicStaff = "scepter", - MagicWand = "wand" - }, - nephrite ={ - MagicStaff = "cane", - MagicWand = "rod" - } - - } - local armorNames = - { - iron="IronArmor", - steel="SteelArmor", - leather="LeatherArmor", - cloth="ClothArmor" - } - - local wEnds = - { - spear = {iron="ое",steel="ое",gold="ое",bone="ое"}, - machete = {iron="ое",steel="ое",gold="ое",bone="ое"}, - doug = {iron="ая",steel="ая",gold="ая",bone="ая"}, - rogatina = {iron="ая",steel="ая",gold="ая",bone="ая"}, - katana = {iron="ая",steel="ая",gold="ая",bone="ая"}, - twohands_axe = {iron="ая",steel="ая",gold="ая",bone="ая"}, - halberd = {iron="ая",steel="ая",gold="ая",bone="ая"}, - glaive = {iron="ая",steel="ая",gold="ая",bone="ая"}, - hammer = {iron="ая",steel="ая",gold="ая",bone="ая"}, - mace = {iron="ая",steel="ая",gold="ая",bone="ая"}, - peak = {iron="ая",steel="ая",gold="ая",bone="ая"}, - staff = {wood="ый",runic="ий",ruby="ый",nephrite="ый"}, - scepter = {wood="ый",runic="ий",ruby="ый",nephrite="ый"}, - crutch = {wood="ая",runic="ая",ruby="ая",nephrite="ая"}, - cane = {wood="ая",runic="ая",ruby="ая",nephrite="ая"}, - stick = {wood="ая",runic="ая",ruby="ая",nephrite="ая"}, - wand = {wood="ая",runic="ая",ruby="ая",nephrite="ая"}, - rod = {wood="ый",runic="ий",ruby="ый",nephrite="ый"} - - } - local aEnds1 = - { - iron = "ые", - steel = "ые", - leather = "ая", - cloth = "ая" - } - local aEnds2 = - { - LightArmor = {iron="ие",steel="ие",cloth="ая",leather="ая"}, - MediumArmor = {iron="ие",steel="ие",cloth="яя",leather="яя"}, - HeavyArmor = {iron="ые",steel="ые",cloth="ая",leather="ая"} - } - - local wTypes = - { - iron = {iron ="FullIron", steel="SemiIron", gold="Gilded", bone="Bony" }, - steel = {iron="SemiSteel", steel="FullSteel", gold="Gilded", bone="Bony" }, - gold = {iron="Spiky", steel="Sharp", gold="FullGold", bone="Bony" }, - bone = {iron="Spiky", steel="Sharp" , gold="Gilded", bone="FullBone" }, - - wood ={wood ="Wooden", runic ="Runic", ruby ="Precious", nephrite ="Elegant"}, - runic ={wood ="Comfort", runic ="Runic", ruby ="Precious", nephrite ="Elegant"}, - ruby ={wood ="Comfort", runic ="Runic", ruby ="Ruby", nephrite ="Elegant"}, - nephrite ={wood ="Comfort", runic ="Runic", ruby ="Precious", nephrite ="Jade"} - } - local aTypes = - { - iron = {iron="FullIron" ,steel="SemiIron" ,cloth="Clothy" ,leather="WithLeather" }, - steel = {iron="SemiSteel",steel="FullSteel",cloth="Clothy",leather="WithLeather"}, - cloth = {iron="IronMail",steel="SteelMail",cloth="Clothy",leather="WithLeather"}, - leather = {iron="SemiIron",steel="SemiSteel",cloth="Clothy",leather="FullLeather"} - } - - local name ="" - if mode == "weapon" or mode == "magic" then - local subTypes = wTypes[max[1]:desc().data.name] - local wType = subTypes[max[2]:desc().data.name] - local groupOfNames = weaponNames[max[1]:desc().data.name] - local uniqueName = groupOfNames[smithy.choosenObject] - local wordEnd = "ый" - local wordEndArmor1 = "ый" - local wordEndArmor2 = "ый" - - if wType == "FullSteel" or wType == "SemiSteel" or wType == "FullBone" then - wordEnd ="ой" - end - - if wEnds[uniqueName] ~= nil then - wordEnd = (wEnds[uniqueName])[max[2]:desc().data.name] - end - - name = RPD.textById(wType)..RPD.textById(wordEnd).." "..RPD.textById(uniqueName)..rareName - - else - - local subTypes = aTypes[max[1]:desc().data.name] - local aType = subTypes[max[2]:desc().data.name] - local uniqueName = armorNames[max[1]:desc().data.name] - - if aEnds1[max[1]:desc().data.name] ~= nil then - wordEndArmor1 = aEnds1[max[1]:desc().data.name] - end - - local aEnd2 = aEnds2[smithy.choosenObject] - wordEndArmor2 = aEnd2[max[1]:desc().data.name] - - name = RPD.textById(aType)..RPD.textById(wordEndArmor1).." "..RPD.textById(smithy.choosenObject)..RPD.textById(wordEndArmor2).." "..RPD.textById(uniqueName)..rareName - end - - - visualName = "forged_"..max[1]:desc().data.name - RPD.glog(visualName) - if max[2] ~= nil then - visualName = visualName..max[2]:desc().data.name + + local skip + local max = {} + local mat1 + local mat2 + local group1 = groups[1] + if #group1 > 1 then + + for i = 1, 2 do + mat1 = group1[1] + + for ii = 2, #group1 do + mat2 = group1[ii] + + if (mat2[2] > mat1[2] and mat2[1] ~= max[1]) or mat1[1] == max[1] then + + mat1 = mat2 + end + end + + max[i] = mat1[1] + end + else + + mat1 = group1[1] + max[1] = mat1[1] + max[2] = max[1] + end + + local materialIcon = { + iron = 1, + steel = 2, + leather = 3, + gold = 3, + cloth = 4, + bone = 4, + wood = 1, + runic = 2, + ruby = 3, + nephrite = 4 + } + local icon + max[1] = require("scripts/items/" .. max[1]) + max[2] = require("scripts/items/" .. max[2]) + icon = materialIcon[max[1]:desc().data.name] * RPG.mainMatCount + materialIcon[max[2]:desc().data.name] + + local weaponNames = { + iron = { + Sword = "sword", + Longsword = "palash", + Dagger = "dagger", + Mace = "mace", + Hammer = "hammer", + Spear = "spear", + Axe = "axe", + Hatchet = "twohands_axe", + Halberd = "halberd", + Bow = "bow", + Crossbow = "crossbow" + }, + steel = { + Sword = "gladys", + Longsword = "espadon", + Dagger = "doug", + Mace = "pernach", + Hammer = "slander", + Spear = "rogatina", + Axe = "chekan", + Hatchet = "brodex", + Halberd = "pollaxe", + Bow = "long_bow", + Crossbow = "long_crossbow" + }, + gold = { + Sword = "katana", + Longsword = "estok", + Dagger = "stilleto", + Mace = "buzdyhan", + Hammer = "warhammer", + Spear = "protazan", + Axe = "berdysh", + Hatchet = "labris", + Halberd = "glaive", + Bow = "composite_bow", + Crossbow = "composite_crossbow" + }, + bone = { + Sword = "machete", + Longsword = "bigsword", + Dagger = "cris", + Mace = "morgenstern", + Hammer = "najak", + Spear = "peak", + Axe = "sagoris", + Hatchet = "cleaver", + Halberd = "voulge", + Bow = "big_bow", + Crossbow = "big_crossbow" + }, + wood = { + MagicStaff = "crutch", + MagicWand = "stick" + }, + runic = { + MagicStaff = "staff", + MagicWand = "wand" + }, + ruby = { + MagicStaff = "scepter", + MagicWand = "wand" + }, + nephrite = { + MagicStaff = "cane", + MagicWand = "rod" + } + + } + local armorNames = { + iron = "IronArmor", + steel = "SteelArmor", + leather = "LeatherArmor", + cloth = "ClothArmor" + } + + local wEnds = { + spear = { iron = "ое", steel = "ое", gold = "ое", bone = "ое" }, + machete = { iron = "ое", steel = "ое", gold = "ое", bone = "ое" }, + doug = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + rogatina = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + katana = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + twohands_axe = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + halberd = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + glaive = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + hammer = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + mace = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + peak = { iron = "ая", steel = "ая", gold = "ая", bone = "ая" }, + staff = { wood = "ый", runic = "ий", ruby = "ый", nephrite = "ый" }, + scepter = { wood = "ый", runic = "ий", ruby = "ый", nephrite = "ый" }, + crutch = { wood = "ая", runic = "ая", ruby = "ая", nephrite = "ая" }, + cane = { wood = "ая", runic = "ая", ruby = "ая", nephrite = "ая" }, + stick = { wood = "ая", runic = "ая", ruby = "ая", nephrite = "ая" }, + wand = { wood = "ая", runic = "ая", ruby = "ая", nephrite = "ая" }, + rod = { wood = "ый", runic = "ий", ruby = "ый", nephrite = "ый" } + + } + local aEnds1 = { + iron = "ые", + steel = "ые", + leather = "ая", + cloth = "ая" + } + local aEnds2 = { + LightArmor = { iron = "ие", steel = "ие", cloth = "ая", leather = "ая" }, + MediumArmor = { iron = "ие", steel = "ие", cloth = "яя", leather = "яя" }, + HeavyArmor = { iron = "ые", steel = "ые", cloth = "ая", leather = "ая" } + } + + local wTypes = { + iron = { iron = "FullIron", steel = "SemiIron", gold = "Gilded", bone = "Bony" }, + steel = { iron = "SemiSteel", steel = "FullSteel", gold = "Gilded", bone = "Bony" }, + gold = { iron = "Spiky", steel = "Sharp", gold = "FullGold", bone = "Bony" }, + bone = { iron = "Spiky", steel = "Sharp", gold = "Gilded", bone = "FullBone" }, + + wood = { wood = "Wooden", runic = "Runic", ruby = "Precious", nephrite = "Elegant" }, + runic = { wood = "Comfort", runic = "Runic", ruby = "Precious", nephrite = "Elegant" }, + ruby = { wood = "Comfort", runic = "Runic", ruby = "Ruby", nephrite = "Elegant" }, + nephrite = { wood = "Comfort", runic = "Runic", ruby = "Precious", nephrite = "Jade" } + } + local aTypes = { + iron = { iron = "FullIron", steel = "SemiIron", cloth = "Clothy", leather = "WithLeather" }, + steel = { iron = "SemiSteel", steel = "FullSteel", cloth = "Clothy", leather = "WithLeather" }, + cloth = { iron = "IronMail", steel = "SteelMail", cloth = "Clothy", leather = "WithLeather" }, + leather = { iron = "SemiIron", steel = "SemiSteel", cloth = "Clothy", leather = "FullLeather" } + } + + local name = "" + if mode == "weapon" or mode == "magic" then + local subTypes = wTypes[max[1]:desc().data.name] + local wType = subTypes[max[2]:desc().data.name] + local groupOfNames = weaponNames[max[1]:desc().data.name] + local uniqueName = groupOfNames[smithy.choosenObject] + local wordEnd = "ый" + local wordEndArmor1 = "ый" + local wordEndArmor2 = "ый" + + if wType == "FullSteel" or wType == "SemiSteel" or wType == "FullBone" then + wordEnd = "ой" + end + + if wEnds[uniqueName] ~= nil then + wordEnd = (wEnds[uniqueName])[max[2]:desc().data.name] + end + + name = RPD.textById(wType) .. RPD.textById(wordEnd) .. " " .. RPD.textById(uniqueName) .. rareName + + else + + local subTypes = aTypes[max[1]:desc().data.name] + local aType = subTypes[max[2]:desc().data.name] + local uniqueName = armorNames[max[1]:desc().data.name] + + if aEnds1[max[1]:desc().data.name] ~= nil then + wordEndArmor1 = aEnds1[max[1]:desc().data.name] + end + + local aEnd2 = aEnds2[smithy.choosenObject] + wordEndArmor2 = aEnd2[max[1]:desc().data.name] + + name = RPD.textById(aType) .. RPD.textById(wordEndArmor1) .. " " .. RPD.textById(smithy.choosenObject) .. RPD.textById(wordEndArmor2) .. " " .. RPD.textById(uniqueName) .. rareName + end + + visualName = "forged_" .. max[1]:desc().data.name RPD.glog(visualName) - end - - if mode == "weapon" or mode == "magic" then - visualName = visualName..smithy.choosenObject - else - visualName = visualName.."Armor" - end - - - local tier - if mode == "weapon" then - tier = math.max(RPG.smartInt((RPG.smartInt(maxDmg))/3),1) - elseif mode == "magic" then - tier = 1+RPG.smartInt(stats[4]/8) - else - tier = 1+RPG.smartInt((RPG.smartInt(dr)-2)/2) - end - - - tier = smithy.lvl + RPG.smartInt(tier*0.25) - - if smithy.myself then - storage.gamePut("smithing", {lvl = smithData.lvl, expToUp = smithData.expToUp, exp = smithData.exp + exp}) - end - smithData = storage.gameGet("smithing") or {} - if smithData.exp >= smithData.expToUp then - storage.gamePut("smithing", {lvl = smithData.lvl+1, expToUp = smithData.expToUp +3*((smithData.lvl+1)%2)+smithData.lvl+2, exp = 0 +smithData.exp -smithData.expToUp}) - end - - if smithy.mode == "weapon" or smithy.mode == "magic" then - - return {str = RPG.smartInt(str),info = itemInfo, icon = icon, name = name, visualName = visualName, tier = tier, minDmg = RPG.smartInt(minDmg), maxDmg = RPG.smartInt(maxDmg), delay = delayFactor, accuracy = accuracy, range = range, dstats = stats, addStats = addStatsGroups[mode], type = table.unpack(objectDmgType[smithy.choosenObject],1), element = table.unpack(objectDmgType[smithy.choosenObject],2), rareScale = rareScale} - else - return {str = RPG.smartInt(str),name = name, visualName = visualName, info = itemInfo, icon = icon, tier = tier, dr = drOrDmg[mode], dstats = RPG.unpackAll({stats,allAdd}), rareScale = rareScale} - end - end, - - conversionStatsToGold = function(stats,addstats,delay,accuracy,range,mode) - local gold = 0 - local gAddStats= { 15, 500 } - local gStats ={ 2,2,2.5,2.5,2.5,3,2,5} - local gDelay = 10 - local gAccuracy = 25 - local gRange = 200 - - for i = 1, 8 do - - gold = gold +stats[i]*gStats[i] - - end - if mode == "armor" then - for j = 9,22 do - local modeStat = stats[j] - - for jj = 1,2 do - gold = gold + modeStat[jj]*gAddStats[jj] - end - end - else - for j = 1, 28 do - local modeStat = addstats[j] - - for jj = 1,2 do - gold = gold + modeStat[jj]*gAddStats[jj] - end - end - end - - gold = gold +delay*gDelay - gold = gold +accuracy*gAccuracy - gold = gold +(range-1)*gRange - - - return RPG.smartInt(gold) - end, - - - smartInt = function(int) - if int%1 >= 0.5 then - return math.ceil(int) - else - return math.floor(int) - end - end, - - - getElementCoef = function(element) - local percent = 0.5 - local fixed = 0 - - local art =RPG.StatsArt - local art2 =RPG.StatsArt2 - local b = RPG.StatsB - - local elmntCoefs = { - art[element[1] or element], - art2[element[1] or element], - b[element[1] or element] - } - local elmntCoefs2 = { - art[element[2]], - art2[element[2]], - b[element[2]] - } - for i = 1,3 do - local elmntCoef = elmntCoefs[i] - percent = percent + elmntCoef[1] - fixed = fixed + elmntCoef[2] - end - if element[2] ~= nil then - for i = 1,3 do - local elmntCoef = elmntCoefs2[i] - percent = percent + elmntCoef[1] - fixed = fixed + elmntCoef[2] - end - percent = percent/2 - fixed = math.ceil(fixed/2) - end - return {percent,fixed} - end, - - - handCheck = function(item) - if item:slotName() == "LEFT_HAND" then - return true - else - return false - end - end, - - - weaponOtherDmg = function(enemy, dmg, coefs) - - if enemy then - - for i = 1, 10 do - local dcoef = coefs[i] - local dmgPhys = 0 - - if dcoef[1] > 0 then - dmgPhys = dcoef[1] - end - - if dcoef[2] > 0 then - dmgPhys = dmgPhys +dmg*dcoef[2] - end - - if dmgPhys > 0 then - RPG.damage(enemy,dmgPhys,"phys",RPG.statsName[i+8]) - end - - end - - - for i = 15, 28 do - local dcoef = coefs[i] - local dmgMag = 0 - - if dcoef[1] > 0 then - dmgMag = dmgMag + dcoef[1] - end - - if dcoef[2] > 0 then - dmgMag = dmgMag + dmg*dcoef[2] - end - - if dmgMag > 0 then - RPG.damage(enemy,dmgMag, "mag", RPG.statsName[i-6]) - end + if max[2] ~= nil then + visualName = visualName .. max[2]:desc().data.name + RPD.glog(visualName) + end - end - - end - end, - - - flyText = function(enemy,text,color) - - if color == "red" then - enemy:getSprite():showStatus(0xf00000,text) + if mode == "weapon" or mode == "magic" then + visualName = visualName .. smithy.choosenObject + else + visualName = visualName .. "Armor" + end + + local tier + if mode == "weapon" then + tier = math.max(RPG.smartInt((RPG.smartInt(maxDmg)) / 3), 1) + elseif mode == "magic" then + tier = 1 + RPG.smartInt(stats[4] / 8) + else + tier = 1 + RPG.smartInt((RPG.smartInt(dr) - 2) / 2) + end + + tier = smithy.lvl + RPG.smartInt(tier * 0.25) + + if smithy.myself then + storage.gamePut("smithing", { lvl = smithData.lvl, expToUp = smithData.expToUp, exp = smithData.exp + exp }) + end + smithData = storage.gameGet("smithing") or {} + if smithData.exp >= smithData.expToUp then + storage.gamePut("smithing", { lvl = smithData.lvl + 1, expToUp = smithData.expToUp + 3 * ((smithData.lvl + 1) % 2) + smithData.lvl + 2, exp = 0 + smithData.exp - smithData.expToUp }) + end + + if smithy.mode == "weapon" or smithy.mode == "magic" then + + return { str = RPG.smartInt(str), info = itemInfo, icon = icon, name = name, visualName = visualName, tier = tier, minDmg = RPG.smartInt(minDmg), maxDmg = RPG.smartInt(maxDmg), delay = delayFactor, accuracy = accuracy, range = range, dstats = stats, addStats = addStatsGroups[mode], type = table.unpack(objectDmgType[smithy.choosenObject], 1), element = table.unpack(objectDmgType[smithy.choosenObject], 2), rareScale = rareScale } + else + return { str = RPG.smartInt(str), name = name, visualName = visualName, info = itemInfo, icon = icon, tier = tier, dr = drOrDmg[mode], dstats = RPG.unpackAll({ stats, allAdd }), rareScale = rareScale } + end + end, + + conversionStatsToGold = function(stats, addstats, delay, accuracy, range, mode) + local gold = 0 + local gAddStats = { 15, 500 } + local gStats = { 2, 2, 2.5, 2.5, 2.5, 3, 2, 5 } + local gDelay = 10 + local gAccuracy = 25 + local gRange = 200 + + for i = 1, 8 do + + gold = gold + stats[i] * gStats[i] + + end + if mode == "armor" then + for j = 9, 22 do + local modeStat = stats[j] + + for jj = 1, 2 do + gold = gold + modeStat[jj] * gAddStats[jj] + end + end + else + for j = 1, 28 do + local modeStat = addstats[j] + + for jj = 1, 2 do + gold = gold + modeStat[jj] * gAddStats[jj] + end + end + end + + gold = gold + delay * gDelay + gold = gold + accuracy * gAccuracy + gold = gold + (range - 1) * gRange + + return RPG.smartInt(gold) + end, + + + smartInt = function(int) + if int % 1 >= 0.5 then + return math.ceil(int) + else + return math.floor(int) + end + end, + + + getElementCoef = function(element) + local percent = 0.5 + local fixed = 0 + + local art = RPG.StatsArt + local art2 = RPG.StatsArt2 + local b = RPG.StatsB + + + local elmntCoefs = { + art[element[1] or element], + art2[element[1] or element], + b[element[1] or element] + } + local elmntCoefs2 = { + art[element[2] or element], + art2[element[2] or element], + b[element[2] or element] + } + + for i = 1, 3 do + local elmntCoef = elmntCoefs[i] + + percent = percent + elmntCoef[1] + fixed = fixed + elmntCoef[2] + end + if element[2] ~= nil then + for i = 1, 3 do + local elmntCoef = elmntCoefs2[i] + + percent = percent + elmntCoef[1] + fixed = fixed + elmntCoef[2] + end + percent = percent / 2 + fixed = math.ceil(fixed / 2) end - + return { percent, fixed } + end, + + + handCheck = function(item) + if item:slotName() == "LEFT_HAND" then + return true + else + return false + end + end, + + + weaponOtherDmg = function(enemy, dmg, coefs) + + if enemy then + + for i = 1, 10 do + local dcoef = coefs[i] + local dmgPhys = 0 + + if dcoef[1] > 0 then + dmgPhys = dcoef[1] + end + + if dcoef[2] > 0 then + dmgPhys = dmgPhys + dmg * dcoef[2] + end + + if dmgPhys > 0 then + RPG.damage(enemy, dmgPhys, "phys", RPG.statsName[i + 8]) + end + + end + + for i = 15, 28 do + local dcoef = coefs[i] + local dmgMag = 0 + + if dcoef[1] > 0 then + dmgMag = dmgMag + dcoef[1] + end + + if dcoef[2] > 0 then + dmgMag = dmgMag + dmg * dcoef[2] + end + + if dmgMag > 0 then + RPG.damage(enemy, dmgMag, "mag", RPG.statsName[i - 6]) + end + + end + + end + end, + + + flyText = function(enemy, text, color) + + if color == "red" then + enemy:getSprite():showStatus(0xf00000, text) + end + if color == "green" then - enemy:getSprite():showStatus(0x45db00,text) + enemy:getSprite():showStatus(0x45db00, text) end - + if color == "white" then - enemy:getSprite():showStatus(0xffffff,text) + enemy:getSprite():showStatus(0xffffff, text) end - + if color == "orange" then - enemy:getSprite():showStatus(0xf08000,text) + enemy:getSprite():showStatus(0xf08000, text) end - end, - - - dmgText = function(type,elmnt,enemy) - - color = 0xffffff - if type == "phys" then - color = 0xffff00 - elseif type == "mag" then - color = 0x33ccff - end - - if #elmnt == 2 then - - if type == "phys" then - enemy:getSprite():showStatus(0xffff00,(RPD.textById(elmnt[1])).."/"..(RPD.textById(elmnt[2]))..":") - elseif type == "mag" then - enemy:getSprite():showStatus(0x33ccff,(RPD.textById(elmnt[1])).."/"..(RPD.textById(elmnt[2]))..":") - else - enemy:getSprite():showStatus(0xffffff,(RPD.textById(elmnt[1])).."/"..(RPD.textById(elmnt[2]))..":") - end - - else - - if type == "phys" then - enemy:getSprite():showStatus(0xffff00,RPD.textById(elmnt)..":") - - elseif type == "mag" then - enemy:getSprite():showStatus(0x33ccff,RPD.textById(elmnt)..":") - - else - enemy:getSprite():showStatus(0xffffff,RPD.textById(elmnt)..":") - end - - end - end, - - - damage = function(enemy, dmg, type, element) - local RPG = require "scripts/lib/Functions" - local hero = RPD.Dungeon.hero - local def = RPG["defence"] - local depth = RPD.Dungeon.depth - local defstats - local name - local magRoll = 0 - local mag = 0 - local coef = 1 - local fCoef = 0 - local pCoef = 1 - local drRoll = 0 - local dr = 0 - local elmnt = element - - if enemy then - if enemy:name() == hero:name() or enemy:getMobClassName() == "MirrorImage" then - local coefs = RPG.getElementCoef(elmnt) - pCoef = coefs[1] - fCoef = coefs[2] - - mag = RPG.AllMagDef()*pCoef +fCoef - dr = enemy:dr()*pCoef+fCoef - else - name = enemy:getMobClassName() - defstats = def[name] or def["Rat"] - mag = (defstats["magDef"] or 0) + depth*0.8 - dr = enemy:dr() - - if elmnt then - coef = (defstats[elmnt[1] or elmnt] or 1) + (defstats[elmnt[2]] or 0) - if elmnt[2] ~= nil then - coef = coef/2 - end - else - elmnt = type - end - end - - - magRoll = math.floor(RPG.intRoll((mag*coef)*0.87,(mag*coef)*1.12)) - - drRoll = math.floor(RPG.intRoll((dr*coef)*0.87,(dr*coef)*1.12)) - - RPG.dmgText(type,elmnt,enemy) - - if type == "mag" then - enemy:damage(dmg-magRoll,hero) - - elseif type == "phys" then - enemy:damage(dmg-drRoll,hero) - - else - enemy:damage(dmg,hero) - end - end - - end, - - - getDamage = function(enemy, dmg, type,element) - local RPG = require "scripts/lib/Functions" - local hero = RPD.Dungeon.hero - local def = RPG["defence"] - local depth = RPD.Dungeon.depth - local defstats - local name - local mag = 0 - local magRoll = 0 - local coef = 1 - local fCoef = 0 - local pCoef = 1 - local dr =0 - local drRoll= 0 - local elmnt = element - - if enemy:invalid() ~= true then - if enemy:name() == hero:name() or enemy:getMobClassName() == "MirrorImage" then - local coefs = RPG.getElementCoef(elmnt) - pCoef = coefs[1] - fCoef = coefs[2] - mag = RPG.AllMagDef()*pCoef +fCoef - dr = enemy:dr()*pCoef+fCoef - else - name = enemy:getMobClassName() - defstats = def[name] or def["Rat"] - mag = (defstats["magDef"] or 0) + depth*1.2 - dr = enemy:dr() - coef = ((defstats[elmnt[1] or elmnt]) or 0) + (defstats[elmnt[2]] or 1) - if elmnt[2] ~= nil then - coef = coef/2 - end - end - end - - magRoll = math.floor(RPG.intRoll((mag*coef)*0.75,(mag*coef)*1.25)) - - drRoll = math.floor(RPG.intRoll((dr*coef)*0.75,(dr*coef)*1.25)) - - if type == "mag" then - return dmg-magRoll - elseif type == "phys" then - return dmg-drRoll - else - return dmg - end - - end, - - - itemStrBonus = function(str) - local hero = RPD.Dungeon.hero - return (RPG.physStr() -str)*0.02 - end, - - increaseHtSp = function(stats) - local hero = RPD.Dungeon.hero - hero:ht(hero:ht() + stats[1]) - hero:setMaxSkillPoints(hero:getSkillPointsMax() + stats[2]) - end, - - - decreaseHtSp = function(stats) - local hero = RPD.Dungeon.hero - hero:ht(hero:ht() - stats[1]) - if hero:hp() > hero:ht() then - hero:hp(hero:ht()) - end - hero:setMaxSkillPoints(hero:getSkillPointsMax() - stats[2]) - if hero:getSkillPoints() > hero:getSkillPointsMax() then - hero:setSkillPoints(hero:getSkillPointsMax()) - end - end, - - - addStats = function(stats, mas) - local ItemStats = RPG[mas] - - for i = 3, 8 do - ItemStats[RPG.statsName[i]] = stats[i] - end - - if #ItemStats > 8 then - for i = 9, 22 do - local twoItemStats = ItemStats[RPG.statsName[i]] - local twoStats = stats[i] - for ii = 1,2 do - twoItemStats[ii] = twoStats[ii] - end - end - end - end, - - - delStats = function(mas) - local ItemStats = RPG[mas] - for i = 3, 8 do - ItemStats[RPG.statsName[i]] = 0 - end - if #ItemStats > 6 then - for i = 9, 22 do - twoItemStats = ItemStats[RPG.statsName[i]] - for ii = 1,2 do - twoItemStats[ii] = 0 - end - end - end - end, - - - baseSpeed = function() - local hero = RPD.Dungeon.hero - local armor = hero:getBelongings().armor - local a =armor:requiredSTR()-1 - - return math.max(0.1, ((0.8 +RPG.AllFast()*0.04) -0.05*RPD.Dungeon.depth -0.025*(math.min(0,armor:requiredSTR()-RPG.physStr())) ))*math.pow(1.3,a) - end, - - plus = function(int) - local plus = "" - if int > 0 then - plus = "+" - end - return plus - end, - - - getItemInfo = function(stats, add) - local itStInfo = "" - local statsNames = { - RPD.textById("Hp"), - RPD.textById("Sp"), - RPD.textById("PhysStr"), - RPD.textById("MagStr"), - RPD.textById("Fast"), - RPD.textById("magDef"), - RPD.textById("SpRegen"), - RPD.textById("luck"), - RPD.textById("fireD"), - RPD.textById("lightningD"), - RPD.textById("waterD"), - RPD.textById("iceD"), - RPD.textById("earthD"), - RPD.textById("poisonD"), - RPD.textById("windD"), - RPD.textById("psyD"), - RPD.textById("lightD"), - RPD.textById("darkD"), - RPD.textById("cutD"), - RPD.textById("chopD"), - RPD.textById("stabD"), - RPD.textById("crushD") - } - for i = 1,8 do - if stats[i] ~= 0 then - - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(stats[i])..tostring(stats[i]).."\n" - end - end - - if add ~= nil then - for i = 9, 22 do - local twoStats = add[i-8] - if twoStats[1] ~= 0 then - - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(twoStats[1])..tostring(twoStats[1]) - if twoStats[2] ~= 0 then - itStInfo = itStInfo..", "..RPG.plus(twoStats[2])..tostring(twoStats[2]*100).."%\n" - else - itStInfo = itStInfo.."\n" + end, + + + dmgText = function(type, elmnt, enemy) + + color = 0xffffff + if type == "phys" then + color = 0xffff00 + elseif type == "mag" then + color = 0x33ccff end - elseif twoStats[2] > 0 then - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(twoStats[2])..tostring(twoStats[2]*100).."%\n" - end - end - end - - return itStInfo - end, - - - getWeaponInfo = function(stats,addStats) - local itStInfo = "" - local statsNames = { - RPD.textById("Hp"), - RPD.textById("Sp"), - RPD.textById("PhysStr"), - RPD.textById("MagStr"), - RPD.textById("Fast"), - RPD.textById("magDef"), - RPD.textById("SpRegen"), - RPD.textById("luck"), - RPD.textById("firePhys"), - RPD.textById("lightningPhys"), - RPD.textById("waterPhys"), - RPD.textById("icePhys"), - RPD.textById("earthPhys"), - RPD.textById("poisonPhys"), - RPD.textById("windPhys"), - RPD.textById("psyPhys"), - RPD.textById("lightPhys"), - RPD.textById("darkPhys"), - RPD.textById("cutPhys"), - RPD.textById("chopPhys"), - RPD.textById("stabPhys"), - RPD.textById("crushPhys"), - RPD.textById("fireMag"), - RPD.textById("lightningMag"), - RPD.textById("waterMag"), - RPD.textById("iceMag"), - RPD.textById("earthMag"), - RPD.textById("poisonMag"), - RPD.textById("windMag"), - RPD.textById("psyMag"), - RPD.textById("lightMag"), - RPD.textById("darkMag"), - RPD.textById("cutMag"), - RPD.textById("chopMag"), - RPD.textById("stabMag"), - RPD.textById("crushMag") - } - if stats ~= nil then - for i = 1,8 do - if stats[i] ~= 0 then - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(stats[i])..tostring(stats[i]).."\n" + + if #elmnt == 2 then + + if type == "phys" then + enemy:getSprite():showStatus(0xffff00, (RPD.textById(elmnt[1])) .. "/" .. (RPD.textById(elmnt[2])) .. ":") + elseif type == "mag" then + enemy:getSprite():showStatus(0x33ccff, (RPD.textById(elmnt[1])) .. "/" .. (RPD.textById(elmnt[2])) .. ":") + else + enemy:getSprite():showStatus(0xffffff, (RPD.textById(elmnt[1])) .. "/" .. (RPD.textById(elmnt[2])) .. ":") + end + + else + + if type == "phys" then + enemy:getSprite():showStatus(0xffff00, RPD.textById(elmnt) .. ":") + + elseif type == "mag" then + enemy:getSprite():showStatus(0x33ccff, RPD.textById(elmnt) .. ":") + + else + enemy:getSprite():showStatus(0xffffff, RPD.textById(elmnt) .. ":") + end + end - end - end - - for i = 9,12 do - local twoStats = addStats[i-8] - if twoStats[1] ~= 0 then - - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(twoStats[1])..tostring(twoStats[1]) - if twoStats[2] ~= 0 then - itStInfo = itStInfo..", "..RPG.plus(twoStats[2])..tostring(twoStats[2]*100).."%\n" - else - itStInfo = itStInfo.."\n" + end, + + + damage = function(enemy, dmg, type, element) + local RPG = require "scripts/lib/Functions" + local hero = RPD.Dungeon.hero + local def = RPG["defence"] + local depth = RPD.Dungeon.depth + local defstats + local name + local magRoll = 0 + local mag = 0 + local coef = 1 + local fCoef = 0 + local pCoef = 1 + local drRoll = 0 + local dr = 0 + local elmnt = element + + if enemy then + if enemy:name() == hero:name() or enemy:getMobClassName() == "MirrorImage" then + local coefs = RPG.getElementCoef(elmnt) + pCoef = coefs[1] + fCoef = coefs[2] + + mag = RPG.AllMagDef() * pCoef + fCoef + dr = enemy:dr() * pCoef + fCoef + else + name = enemy:getMobClassName() + defstats = def[name] or def["Rat"] + mag = (defstats["magDef"] or 0) + depth * 0.8 + dr = enemy:dr() + + if elmnt then + coef = (defstats[elmnt[1] or elmnt] or 1) + (defstats[elmnt[2]] or 0) + if elmnt[2] ~= nil then + coef = coef / 2 + end + else + elmnt = type + end + end + + magRoll = math.floor(RPG.intRoll((mag * coef) * 0.87, (mag * coef) * 1.12)) + + drRoll = math.floor(RPG.intRoll((dr * coef) * 0.87, (dr * coef) * 1.12)) + + RPG.dmgText(type, elmnt, enemy) + + if type == "mag" then + enemy:damage(dmg - magRoll, hero) + + elseif type == "phys" then + enemy:damage(dmg - drRoll, hero) + + else + enemy:damage(dmg, hero) + end end - elseif twoStats[2] > 0 then - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(twoStats[2])..tostring(twoStats[2]*100).."%\n" - end - end - - for i = 13, 36 do - local twoStats = addStats[i-8] - if twoStats[1] > 0 then - - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(twoStats[1])..tostring(twoStats[1]) - if twoStats[2] > 0 then - itStInfo = itStInfo..", "..RPG.plus(twoStats[2])..tostring(twoStats[2]*100).."%\n" - else - itStInfo = itStInfo.."\n" + + end, + + + getDamage = function(enemy, dmg, type, element) + local RPG = require "scripts/lib/Functions" + local hero = RPD.Dungeon.hero + local def = RPG["defence"] + local depth = RPD.Dungeon.depth + local defstats + local name + local mag = 0 + local magRoll = 0 + local coef = 1 + local fCoef = 0 + local pCoef = 1 + local dr = 0 + local drRoll = 0 + local elmnt = element + + if enemy:valid() then + if enemy:name() == hero:name() or enemy:getMobClassName() == "MirrorImage" then + local coefs = RPG.getElementCoef(elmnt) + pCoef = coefs[1] + fCoef = coefs[2] + mag = RPG.AllMagDef() * pCoef + fCoef + dr = enemy:dr() * pCoef + fCoef + else + name = enemy:getMobClassName() + defstats = def[name] or def["Rat"] + mag = (defstats["magDef"] or 0) + depth * 1.2 + dr = enemy:dr() + coef = ((defstats[elmnt[1] or elmnt]) or 0) + (defstats[elmnt[2]] or 1) + if elmnt[2] ~= nil then + coef = coef / 2 + end + end end - elseif twoStats[2] > 0 then - itStInfo = itStInfo.." "..statsNames[i]..": "..RPG.plus(twoStats[2])..tostring(twoStats[2]*100).."%\n" - end - end - - return itStInfo - end, - - - getMaterialsInfo = function(stats,armorS,weaponS,dmg,dr,delay,acc,range,str) - local itStInfo = "\n" - local plus - local switch - local statsNames = { - RPD.textById("Hp"), - RPD.textById("Sp"), - RPD.textById("PhysStr"), - RPD.textById("MagStr"), - RPD.textById("Fast"), - RPD.textById("magDef"), - RPD.textById("SpRegen"), - RPD.textById("luck") - } - local armorStNames = { - RPD.textById("fireD"), - RPD.textById("lightningD"), - RPD.textById("waterD"), - RPD.textById("iceD"), - RPD.textById("earthD"), - RPD.textById("poisonD"), - RPD.textById("windD"), - RPD.textById("psyD"), - RPD.textById("lightD"), - RPD.textById("darkD"), - RPD.textById("cutD"), - RPD.textById("chopD"), - RPD.textById("stabD"), - RPD.textById("crushD") - } - local weaponStNames = { - RPD.textById("firePhys"), - RPD.textById("lightningPhys"), - RPD.textById("waterPhys"), - RPD.textById("icePhys"), - RPD.textById("earthPhys"), - RPD.textById("poisonPhys"), - RPD.textById("windPhys"), - RPD.textById("psyPhys"), - RPD.textById("lightPhys"), - RPD.textById("darkPhys"), - RPD.textById("cutPhys"), - RPD.textById("chopPhys"), - RPD.textById("stabPhys"), - RPD.textById("crushPhys"), - RPD.textById("fireMag"), - RPD.textById("lightningMag"), - RPD.textById("waterMag"), - RPD.textById("iceMag"), - RPD.textById("earthMag"), - RPD.textById("poisonMag"), - RPD.textById("windMag"), - RPD.textById("psyMag"), - RPD.textById("lightMag"), - RPD.textById("darkMag"), - RPD.textById("cutMag"), - RPD.textById("chopMag"), - RPD.textById("stabMag"), - RPD.textById("crushMag") - } - - for i = 1,8 do - if stats[i] ~= 0 then - plus = "" - if stats[i] > 0 then + + magRoll = math.floor(RPG.intRoll((mag * coef) * 0.75, (mag * coef) * 1.25)) + + drRoll = math.floor(RPG.intRoll((dr * coef) * 0.75, (dr * coef) * 1.25)) + + if type == "mag" then + return dmg - magRoll + elseif type == "phys" then + return dmg - drRoll + else + return dmg + end + + end, + + + itemStrBonus = function(str) + local hero = RPD.Dungeon.hero + return (RPG.physStr() - str) * 0.02 + end, + + increaseHtSp = function(stats) + local hero = RPD.Dungeon.hero + hero:ht(hero:ht() + stats[1]) + hero:setMaxSkillPoints(hero:getSkillPointsMax() + stats[2]) + end, + + + decreaseHtSp = function(stats) + local hero = RPD.Dungeon.hero + hero:ht(hero:ht() - stats[1]) + if hero:hp() > hero:ht() then + hero:hp(hero:ht()) + end + hero:setMaxSkillPoints(hero:getSkillPointsMax() - stats[2]) + if hero:getSkillPoints() > hero:getSkillPointsMax() then + hero:setSkillPoints(hero:getSkillPointsMax()) + end + end, + + + addStats = function(stats, mas) + local ItemStats = RPG[mas] + + for i = 3, 8 do + ItemStats[RPG.statsName[i]] = stats[i] + end + + if #ItemStats > 8 then + for i = 9, 22 do + local twoItemStats = ItemStats[RPG.statsName[i]] + local twoStats = stats[i] + for ii = 1, 2 do + twoItemStats[ii] = twoStats[ii] + end + end + end + end, + + + delStats = function(mas) + local ItemStats = RPG[mas] + for i = 3, 8 do + ItemStats[RPG.statsName[i]] = 0 + end + if #ItemStats > 6 then + for i = 9, 22 do + twoItemStats = ItemStats[RPG.statsName[i]] + for ii = 1, 2 do + twoItemStats[ii] = 0 + end + end + end + end, + + + baseSpeed = function() + local hero = RPD.Dungeon.hero + local armor = hero:getBelongings().armor + local a = armor:requiredSTR() - 1 + + return math.max(0.1, ((0.8 + RPG.AllFast() * 0.04) - 0.05 * RPD.Dungeon.depth - 0.025 * (math.min(0, armor:requiredSTR() - RPG.physStr())))) * math.pow(1.3, a) + end, + + plus = function(int) + local plus = "" + if int > 0 then plus = "+" - end - itStInfo = itStInfo.." "..statsNames[i]..": "..plus..tostring(stats[i]).."\n" end - end - - if itStInfo ~= "\n" then - itStInfo = itStInfo.."\n" + return plus + end, + + + getItemInfo = function(stats, add) + local itStInfo = "" + local statsNames = { + RPD.textById("Hp"), + RPD.textById("Sp"), + RPD.textById("PhysStr"), + RPD.textById("MagStr"), + RPD.textById("Fast"), + RPD.textById("magDef"), + RPD.textById("SpRegen"), + RPD.textById("luck"), + RPD.textById("fireD"), + RPD.textById("lightningD"), + RPD.textById("waterD"), + RPD.textById("iceD"), + RPD.textById("earthD"), + RPD.textById("poisonD"), + RPD.textById("windD"), + RPD.textById("psyD"), + RPD.textById("lightD"), + RPD.textById("darkD"), + RPD.textById("cutD"), + RPD.textById("chopD"), + RPD.textById("stabD"), + RPD.textById("crushD") + } + for i = 1, 8 do + if stats[i] ~= 0 then + + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(stats[i]) .. tostring(stats[i]) .. "\n" + end end - - itStInfo = itStInfo.." "..RPD.textById("DmgStat")..": "..tostring(dmg[1]).." — "..tostring(dmg[2]).."\n" - - if dr ~= 0 then - plus = "" - if dr > 0 then - plus = "+" + + if add ~= nil then + for i = 9, 22 do + local twoStats = add[i - 8] + if twoStats[1] ~= 0 then + + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(twoStats[1]) .. tostring(twoStats[1]) + if twoStats[2] ~= 0 then + itStInfo = itStInfo .. ", " .. RPG.plus(twoStats[2]) .. tostring(twoStats[2] * 100) .. "%\n" + else + itStInfo = itStInfo .. "\n" + end + elseif twoStats[2] > 0 then + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(twoStats[2]) .. tostring(twoStats[2] * 100) .. "%\n" + end + end end - itStInfo = itStInfo.." "..RPD.textById("DrStat")..": "..plus..tostring(dr).."\n" - end - - if delay ~= 0 then - plus = "" - if delay > 0 then - plus = "+" + + return itStInfo + end, + + + getWeaponInfo = function(stats, addStats) + local itStInfo = "" + local statsNames = { + RPD.textById("Hp"), + RPD.textById("Sp"), + RPD.textById("PhysStr"), + RPD.textById("MagStr"), + RPD.textById("Fast"), + RPD.textById("magDef"), + RPD.textById("SpRegen"), + RPD.textById("luck"), + RPD.textById("firePhys"), + RPD.textById("lightningPhys"), + RPD.textById("waterPhys"), + RPD.textById("icePhys"), + RPD.textById("earthPhys"), + RPD.textById("poisonPhys"), + RPD.textById("windPhys"), + RPD.textById("psyPhys"), + RPD.textById("lightPhys"), + RPD.textById("darkPhys"), + RPD.textById("cutPhys"), + RPD.textById("chopPhys"), + RPD.textById("stabPhys"), + RPD.textById("crushPhys"), + RPD.textById("fireMag"), + RPD.textById("lightningMag"), + RPD.textById("waterMag"), + RPD.textById("iceMag"), + RPD.textById("earthMag"), + RPD.textById("poisonMag"), + RPD.textById("windMag"), + RPD.textById("psyMag"), + RPD.textById("lightMag"), + RPD.textById("darkMag"), + RPD.textById("cutMag"), + RPD.textById("chopMag"), + RPD.textById("stabMag"), + RPD.textById("crushMag") + } + if stats ~= nil then + for i = 1, 8 do + if stats[i] ~= 0 then + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(stats[i]) .. tostring(stats[i]) .. "\n" + end + end end - itStInfo = itStInfo.." "..RPD.textById("DelayStat")..": "..plus..tostring(delay).."\n" - end - - if acc ~= 0 then - plus = "" - if acc > 0 then - plus = "+" + + for i = 9, 12 do + local twoStats = addStats[i - 8] + if twoStats[1] ~= 0 then + + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(twoStats[1]) .. tostring(twoStats[1]) + if twoStats[2] ~= 0 then + itStInfo = itStInfo .. ", " .. RPG.plus(twoStats[2]) .. tostring(twoStats[2] * 100) .. "%\n" + else + itStInfo = itStInfo .. "\n" + end + elseif twoStats[2] > 0 then + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(twoStats[2]) .. tostring(twoStats[2] * 100) .. "%\n" + end end - itStInfo = itStInfo.." "..RPD.textById("AccuracyStat")..": "..plus..tostring(acc).."\n" - end - - if range ~= 0 then - plus = "" - if range > 0 then - plus = "+" + + for i = 13, 36 do + local twoStats = addStats[i - 8] + if twoStats[1] > 0 then + + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(twoStats[1]) .. tostring(twoStats[1]) + if twoStats[2] > 0 then + itStInfo = itStInfo .. ", " .. RPG.plus(twoStats[2]) .. tostring(twoStats[2] * 100) .. "%\n" + else + itStInfo = itStInfo .. "\n" + end + elseif twoStats[2] > 0 then + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. RPG.plus(twoStats[2]) .. tostring(twoStats[2] * 100) .. "%\n" + end end - itStInfo = itStInfo.." "..RPD.textById("RangeStat")..": "..plus..tostring(range).."\n" - end - - switch = true - for i = 1,14 do - local twoStats = armorS[i] - if twoStats[1] ~= 0 or twoStats[2] ~= 0 then - if switch == true then - switch = false - itStInfo = itStInfo.."\n" + + return itStInfo + end, + + + getMaterialsInfo = function(stats, armorS, weaponS, dmg, dr, delay, acc, range, str) + local itStInfo = "\n" + local plus + local switch + local statsNames = { + RPD.textById("Hp"), + RPD.textById("Sp"), + RPD.textById("PhysStr"), + RPD.textById("MagStr"), + RPD.textById("Fast"), + RPD.textById("magDef"), + RPD.textById("SpRegen"), + RPD.textById("luck") + } + local armorStNames = { + RPD.textById("fireD"), + RPD.textById("lightningD"), + RPD.textById("waterD"), + RPD.textById("iceD"), + RPD.textById("earthD"), + RPD.textById("poisonD"), + RPD.textById("windD"), + RPD.textById("psyD"), + RPD.textById("lightD"), + RPD.textById("darkD"), + RPD.textById("cutD"), + RPD.textById("chopD"), + RPD.textById("stabD"), + RPD.textById("crushD") + } + local weaponStNames = { + RPD.textById("firePhys"), + RPD.textById("lightningPhys"), + RPD.textById("waterPhys"), + RPD.textById("icePhys"), + RPD.textById("earthPhys"), + RPD.textById("poisonPhys"), + RPD.textById("windPhys"), + RPD.textById("psyPhys"), + RPD.textById("lightPhys"), + RPD.textById("darkPhys"), + RPD.textById("cutPhys"), + RPD.textById("chopPhys"), + RPD.textById("stabPhys"), + RPD.textById("crushPhys"), + RPD.textById("fireMag"), + RPD.textById("lightningMag"), + RPD.textById("waterMag"), + RPD.textById("iceMag"), + RPD.textById("earthMag"), + RPD.textById("poisonMag"), + RPD.textById("windMag"), + RPD.textById("psyMag"), + RPD.textById("lightMag"), + RPD.textById("darkMag"), + RPD.textById("cutMag"), + RPD.textById("chopMag"), + RPD.textById("stabMag"), + RPD.textById("crushMag") + } + + for i = 1, 8 do + if stats[i] ~= 0 then + plus = "" + if stats[i] > 0 then + plus = "+" + end + itStInfo = itStInfo .. " " .. statsNames[i] .. ": " .. plus .. tostring(stats[i]) .. "\n" + end end - end - if twoStats[1] ~= 0 then - plus = "" - if twoStats[1] > 0 then - plus = "+" + + if itStInfo ~= "\n" then + itStInfo = itStInfo .. "\n" end - - itStInfo = itStInfo.." "..armorStNames[i]..": "..plus..tostring(twoStats[1]) - if twoStats[2] ~= 0 then + + itStInfo = itStInfo .. " " .. RPD.textById("DmgStat") .. ": " .. tostring(dmg[1]) .. " — " .. tostring(dmg[2]) .. "\n" + + if dr ~= 0 then plus = "" - if twoStats[2] > 0 then - plus = "+" - end - itStInfo = itStInfo.." / "..plus..tostring(twoStats[2]*100).."%\n" - else - itStInfo = itStInfo.."\n" - end - elseif twoStats[2] ~= 0 then - plus = "" - if twoStats[2] > 0 then - plus = "+" + if dr > 0 then + plus = "+" + end + itStInfo = itStInfo .. " " .. RPD.textById("DrStat") .. ": " .. plus .. tostring(dr) .. "\n" end - itStInfo = itStInfo.." "..armorStNames[i]..": "..plus..tostring(twoStats[2]*100).."%\n" - end - end - - switch = true - for i = 1, 28 do - local twoStats = weaponS[i] - if twoStats[1] ~= 0 or twoStats[2] ~= 0 then - if switch == true then - switch = false - itStInfo = itStInfo.."\n" + + if delay ~= 0 then + plus = "" + if delay > 0 then + plus = "+" + end + itStInfo = itStInfo .. " " .. RPD.textById("DelayStat") .. ": " .. plus .. tostring(delay) .. "\n" end - end - if twoStats[1] ~= 0 then - plus = "" - if twoStats[1] > 0 then - plus = "+" + + if acc ~= 0 then + plus = "" + if acc > 0 then + plus = "+" + end + itStInfo = itStInfo .. " " .. RPD.textById("AccuracyStat") .. ": " .. plus .. tostring(acc) .. "\n" end - - itStInfo = itStInfo.." "..weaponStNames[i]..": "..plus..tostring(twoStats[1]) - if twoStats[2] ~= 0 then + + if range ~= 0 then plus = "" - if twoStats[2] > 0 then - plus = "+" + if range > 0 then + plus = "+" end - itStInfo = itStInfo.." / "..plus..tostring(twoStats[2]*100).."%\n" - else - itStInfo = itStInfo.."\n" + itStInfo = itStInfo .. " " .. RPD.textById("RangeStat") .. ": " .. plus .. tostring(range) .. "\n" end - elseif twoStats[2] ~= 0 then - plus = "" - if twoStats[2] > 0 then - plus = "+" + + switch = true + for i = 1, 14 do + local twoStats = armorS[i] + if twoStats[1] ~= 0 or twoStats[2] ~= 0 then + if switch == true then + switch = false + itStInfo = itStInfo .. "\n" + end + end + if twoStats[1] ~= 0 then + plus = "" + if twoStats[1] > 0 then + plus = "+" + end + + itStInfo = itStInfo .. " " .. armorStNames[i] .. ": " .. plus .. tostring(twoStats[1]) + if twoStats[2] ~= 0 then + plus = "" + if twoStats[2] > 0 then + plus = "+" + end + itStInfo = itStInfo .. " / " .. plus .. tostring(twoStats[2] * 100) .. "%\n" + else + itStInfo = itStInfo .. "\n" + end + elseif twoStats[2] ~= 0 then + plus = "" + if twoStats[2] > 0 then + plus = "+" + end + itStInfo = itStInfo .. " " .. armorStNames[i] .. ": " .. plus .. tostring(twoStats[2] * 100) .. "%\n" + end end - itStInfo = itStInfo.." "..weaponStNames[i]..": "..plus..tostring(twoStats[2]*100).."%\n" - end - end - - itStInfo = itStInfo.." "..RPD.textById("Weight")..": "..str.."\n" - - return itStInfo - - end, - - - getItemStats = function(cycles, statMax) - local statsList = {0, 0, 0, 0, 0, 0, 0, 0} - local stats = {0, 0, 0, 0, 0, 0, 0, 0} - local ran - local ItemStatsInfo = "" - local statsNames = { - RPD.textById("Hp"), - RPD.textById("Sp"), - RPD.textById("PhysStr"), - RPD.textById("MagStr"), - RPD.textById("Fast"), - RPD.textById("magDef"), - RPD.textById("SpRegen"), - RPD.textById("luck") - } - for i = 1, cycles do - ran = math.random(1,8) - statsList[ran] = statsList[ran] +1 - end - - local statMax_Fix - for i = 1,8 do - for j = 1,statsList[i] do - - if i == 6 then - statMax_Fix = math.floor(statMax/2) - else - statMax_Fix = statMax - end - stats[i] = stats[i] + math.random(1,statMax_Fix) - end - if statsList[i] ~= 0 then - ItemStatsInfo = ItemStatsInfo.." "..statsNames[i]..": +"..tostring(stats[i]).."\n" - end - end - return {ItemStatsInfo,stats} - end, - - createItem = function(name, cell, count) - for i = 1, count do - local itemC = RPD.ItemFactory:itemByName(name) - RPD.Dungeon.level:drop(itemC, cell) + + switch = true + for i = 1, 28 do + local twoStats = weaponS[i] + if twoStats[1] ~= 0 or twoStats[2] ~= 0 then + if switch == true then + switch = false + itStInfo = itStInfo .. "\n" + end + end + if twoStats[1] ~= 0 then + plus = "" + if twoStats[1] > 0 then + plus = "+" + end + + itStInfo = itStInfo .. " " .. weaponStNames[i] .. ": " .. plus .. tostring(twoStats[1]) + if twoStats[2] ~= 0 then + plus = "" + if twoStats[2] > 0 then + plus = "+" + end + itStInfo = itStInfo .. " / " .. plus .. tostring(twoStats[2] * 100) .. "%\n" + else + itStInfo = itStInfo .. "\n" + end + elseif twoStats[2] ~= 0 then + plus = "" + if twoStats[2] > 0 then + plus = "+" + end + itStInfo = itStInfo .. " " .. weaponStNames[i] .. ": " .. plus .. tostring(twoStats[2] * 100) .. "%\n" + end + end + + itStInfo = itStInfo .. " " .. RPD.textById("Weight") .. ": " .. str .. "\n" + + return itStInfo + + end, + + + getItemStats = function(cycles, statMax) + local statsList = { 0, 0, 0, 0, 0, 0, 0, 0 } + local stats = { 0, 0, 0, 0, 0, 0, 0, 0 } + local ran + local ItemStatsInfo = "" + local statsNames = { + RPD.textById("Hp"), + RPD.textById("Sp"), + RPD.textById("PhysStr"), + RPD.textById("MagStr"), + RPD.textById("Fast"), + RPD.textById("magDef"), + RPD.textById("SpRegen"), + RPD.textById("luck") + } + for i = 1, cycles do + ran = math.random(1, 8) + statsList[ran] = statsList[ran] + 1 + end + + local statMax_Fix + for i = 1, 8 do + for j = 1, statsList[i] do + + if i == 6 then + statMax_Fix = math.floor(statMax / 2) + else + statMax_Fix = statMax + end + stats[i] = stats[i] + math.random(1, statMax_Fix) + end + if statsList[i] ~= 0 then + ItemStatsInfo = ItemStatsInfo .. " " .. statsNames[i] .. ": +" .. tostring(stats[i]) .. "\n" + end + end + return { ItemStatsInfo, stats } + end, + + createItem = function(name, cell, count) + for i = 1, count do + local itemC = RPD.ItemFactory:itemByName(name) + RPD.Dungeon.level:drop(itemC, cell) + end + end, + + + itemByName = function(name) + return RPD.ItemFactory:itemByName(name) + end, + + + intRoll = function(int1, int2) + local rolled + if int1 >= int2 then + rolled = math.random(int2, int1) + else + rolled = math.random(int1, int2) + end + return rolled + end, + + + unpackAll = function(tables) + local pack = {} + for i = 1, #tables do + local table = tables[i] + for j = 1, #table do + pack[#pack + 1] = table[j] + end + end + return pack + end, + + + distance = function(pos) + local y + local x + local level = RPD.Dungeon.level + local hx = level:cellX(RPD.Dungeon.hero:getPos()) + local hy = level:cellY(RPD.Dungeon.hero:getPos()) + local ex = level:cellX(pos) + local ey = level:cellY(pos) + if ex > hx then + x = ex - hx + else + x = hx - ex + end + if ey > hy then + y = ey - hy + else + y = hy - ey + end + return math.max(x, y) - 1 + end, + + + spawnMob = function(mob, pos, thisIsAPet) + local maybeMob = RPD.MobFactory:mobByName(mob) + maybeMob:setPos(pos) + if thisIsAPet then + RPD.Dungeon.level:spawnMob(RPD.Mob:makePet(maybeMob, RPD.Dungeon.hero)); + else + RPD.Dungeon.level:spawnMob(maybeMob) end - end, - - - itemByName = function(name) - return RPD.ItemFactory:itemByName(name) - end, - - - intRoll = function(int1,int2) - local rolled - if int1 >= int2 then - rolled = math.random(int2,int1) - else - rolled = math.random(int1,int2) - end - return rolled - end, - - - unpackAll = function(tables) - local pack = {} - for i = 1,#tables do - local table = tables[i] - for j = 1,#table do - pack[#pack+1] = table[j] - end end - return pack - end, - - - distance = function(pos) - local y - local x - local level=RPD.Dungeon.level - local hx= level:cellX(RPD.Dungeon.hero:getPos()) - local hy= level:cellY(RPD.Dungeon.hero:getPos()) - local ex= level:cellX(pos) - local ey= level:cellY(pos) - if ex>hx then - x=ex-hx - else - x=hx-ex - end - if ey>hy then - y=ey-hy - else - y= hy-ey - end - return math.max(x,y)-1 - end, - - - spawnMob = function(mob, pos, thisIsAPet) -local maybeMob = RPD.MobFactory:mobByName(mob) -maybeMob:setPos(pos) -if thisIsAPet then -RPD.Dungeon.level:spawnMob(RPD.Mob:makePet(maybeMob,RPD.Dungeon.hero)); -else -RPD.Dungeon.level:spawnMob(maybeMob) -end -end - - } + +} return RPG \ No newline at end of file diff --git a/scripts/lib/forgedBow.lua b/scripts/lib/forgedBow.lua index 1f4b62b..852cfc8 100644 --- a/scripts/lib/forgedBow.lua +++ b/scripts/lib/forgedBow.lua @@ -191,7 +191,7 @@ forgedWeapon.makeWeapon = function() RPG.weaponOtherDmg(enemy,dmg,self.data.addstats) local f =2 +hits +self.data.rareScale local chanceRoll = math.random(1,12) - if chanceRoll <= f and dmg > 0 and RPG.noBloodMobs[enemy:getMobClassName()] ~= "false" then + if chanceRoll <= f and dmg > 0 and not RPG.noBloodMobs[enemy:getMobClassName()] then hits = 0 local bleed = RPD.affectBuff(enemy,"FastBleeding",3) bleed:level( math.max(1, RPG.smartInt(2+dmg*(0.4 +0.1*self.data.rareScale)/3)) ) diff --git a/scripts/lib/forgedDagger.lua b/scripts/lib/forgedDagger.lua index 3440da6..c33cbb7 100644 --- a/scripts/lib/forgedDagger.lua +++ b/scripts/lib/forgedDagger.lua @@ -133,7 +133,7 @@ forgedWeapon.makeWeapon = function() postAttack = function(self,item,enemy) RPG.weaponOtherDmg(enemy,dmg,self.data.addstats) local chanceRoll = math.random(1,12) - if chanceRoll <= 4 +hits +self.data.rareScale and dmg > 0 and RPG.noBloodMobs[enemy:getMobClassName()] ~= "false" then + if chanceRoll <= 4 +hits +self.data.rareScale and dmg > 0 and not RPG.noBloodMobs[enemy:getMobClassName()] then hits = 0 local bleed = RPD.affectBuff(enemy,"FastBleeding",2) bleed:level( math.max(1, RPG.smartInt(2 + dmg*(0.4 +0.1*self.data.rareScale) /2)) ) diff --git a/scripts/lib/forgedLongsword.lua b/scripts/lib/forgedLongsword.lua index 2bf9dfe..803e54d 100644 --- a/scripts/lib/forgedLongsword.lua +++ b/scripts/lib/forgedLongsword.lua @@ -138,7 +138,7 @@ forgedWeapon.makeWeapon = function() postAttack = function(self,item,enemy) RPG.weaponOtherDmg(enemy,dmg,self.data.addstats) local chanceRoll = math.random(1,12) - if chanceRoll <= 3 +hits +self.data.rareScale and dmg > 0 and RPG.noBloodMobs[enemy:getMobClassName()] ~= "false" then + if chanceRoll <= 3 +hits +self.data.rareScale and dmg > 0 and not RPG.noBloodMobs[enemy:getMobClassName()] then hits = 0 local bleed = RPD.affectBuff(enemy,"FastBleeding",4) bleed:level( math.max(1, RPG.smartInt(2 +dmg*(0.4 +0.1*self.data.rareScale ) /4)) ) diff --git a/scripts/lib/forgedMagicWand.lua b/scripts/lib/forgedMagicWand.lua index b69dab2..ab7641e 100644 --- a/scripts/lib/forgedMagicWand.lua +++ b/scripts/lib/forgedMagicWand.lua @@ -108,7 +108,7 @@ forgedWeapon.makeWeapon = function() local dmg = RPG.getDamage(user:getEnemy(),dmgRoll,"mag","") local chanceRoll = math.random(1,12) - if chanceRoll <= 2 +hits +self.data.rareScale and dmg > 0 then + if chanceRoll <= 2 + (hits or 0) +(self.data.rareScale or 0) and dmg > 0 then hits = 0 dmg = math.max(dmg + RPG.getDamage(user:getEnemy(),0,"mag","")*(0.5 +0.1*self.data.rareScale), RPG.getDamage(user:getEnemy(),0,"mag","")*(1 +0.1*self.data.rareScale) ) RPG.flyText(user:getEnemy(),RPD.textById("stabbed"),"red") diff --git a/scripts/lib/forgedSword.lua b/scripts/lib/forgedSword.lua index b999422..6b0c3d6 100644 --- a/scripts/lib/forgedSword.lua +++ b/scripts/lib/forgedSword.lua @@ -134,7 +134,7 @@ forgedWeapon.makeWeapon = function() postAttack = function(self,item,enemy) RPG.weaponOtherDmg(enemy,dmg,self.data.addstats) local chanceRoll = math.random(1,12) - if chanceRoll <= 2 +hits +self.data.rareScale and dmg > 0 and RPG.noBloodMobs[enemy:getMobClassName()] ~= "false" then + if chanceRoll <= 2 +hits +self.data.rareScale and dmg > 0 and not RPG.noBloodMobs[enemy:getMobClassName()] then hits = 0 local bleed = RPD.affectBuff(enemy,"FastBleeding",3) bleed:level( math.max(1, RPG.smartInt(2 +dmg*(0.4 +0.1*self.data.rareScale ) /3)) ) diff --git a/strings_ru.json b/strings_ru.json index aa47707..20e91e3 100644 --- a/strings_ru.json +++ b/strings_ru.json @@ -131,7 +131,7 @@ ["ReboundD"," Отскок от врага на некоторое расстояние и отталкивание врага на клетку от вас.\n\n Дальность отскока растёт с уровнем навыка вплоть до 3. Навык имеет максимум 3 уровень."] ["ReboundLimit","** Вы можете сделать отскок лишь вплотную с врагом"] ["SealOfKiN","Высвобождение ки: Печать"] -["SealOfKiD"," Ки принимает форму печати. Печати, что используют ниндзя способны нанести урон врагу или наделить пользователя магическии щитом.\n\n При использовании на героя, он получает магический щит, что поглощает входящий урон. При использовании в сторону, пользователь кинет печать, если печать столкнется с врагом, то печать нанесёт ему урон, и наложит на него \"Метку ки\ на 3 хода.Если на выбранном враге уже действует \"метка ки\", то вы получаете \"Невидимость\" на 3 хода. Прочность щита с печати и урон с печати увеличивается с ростом \"Магической силы\" и уровня скилла."] +["SealOfKiD"," Ки принимает форму печати. Печати, что используют ниндзя способны нанести урон врагу или наделить пользователя магическии щитом.\n\n При использовании на героя, он получает магический щит, что поглощает входящий урон. При использовании в сторону, пользователь кинет печать, если печать столкнется с врагом, то печать нанесёт ему урон, и наложит на него \"Метку ки\" на 3 хода.Если на выбранном враге уже действует \"метка ки\", то вы получаете \"Невидимость\" на 3 хода. Прочность щита с печати и урон с печати увеличивается с ростом \"Магической силы\" и уровня скилла."] ["ShadowCloneN","Техника теневого клонирования"] ["ShadowCloneD"," Древняя техника ниндзюцу, позволяющая пользователю создавать теневых клонов, а самому уходить в невидимость на время. Является базовой техникой.\n\n Клон исчезает через время. Длительность невидимости и клона растёт с уровнем навыка."] ["ShadowCloneLimit","** Вы не можете разместить там своего клона."] diff --git a/version.json b/version.json index 75f23a7..9a6c337 100644 --- a/version.json +++ b/version.json @@ -1,9 +1,9 @@ { - "version":26, + "version":28, "name":"Remixed RPG", "description":"Добавляет в игру механики RPG игр. Мод находиться в стадии беты", "author":"Назипов Инсаф", "url":"https://vk.com/remixed_skyrim", - "rpd_version":610 + "rpd_version":1191 } \ No newline at end of file