From 439bdffb150eab0bb3b6e14e568bdf671da5aa3e Mon Sep 17 00:00:00 2001 From: Mofurka Date: Sun, 5 Jul 2026 20:01:15 +0500 Subject: [PATCH 1/2] feat: update damage calculation, cuz kontrkzaklinanie affects damage. Now its dont. feat: add ?gathering? pool so events are now connected via pools --- .../irdenstatmanager/irdenstatmanager.lua | 2 +- .../scripted/irdenstatmanager/irdenutils.lua | 4 +- .../resources/ismresources.lua | 85 ++++++++++++++----- irden_bonuses.config | 3 +- irden_events.config | 8 ++ 5 files changed, 75 insertions(+), 27 deletions(-) diff --git a/interface/scripted/irdenstatmanager/irdenstatmanager.lua b/interface/scripted/irdenstatmanager/irdenstatmanager.lua index 5d5c0a1..b3ab327 100644 --- a/interface/scripted/irdenstatmanager/irdenstatmanager.lua +++ b/interface/scripted/irdenstatmanager/irdenstatmanager.lua @@ -834,7 +834,7 @@ function attack(btnName, data) local attackBonus = irdenUtils.getBonusByTag(data.attackBonus) local damageBonus = irdenUtils.getBonusByTag(data.damageBonus) - local baseDamageBonus = math.max((irdenUtils.addBonusToStat(baseAttackBonus, data.stat) + irdenUtils.addBonusToStat(self.irden.stats[self.characterStats[data.dmgStat]] or 0, data.dmgStat)) // data.dmgDivider, 1) + local baseDamageBonus = math.max((irdenUtils.addBonusToStat(baseAttackBonus, data.stat, nil, true) + irdenUtils.addBonusToStat(self.irden.stats[self.characterStats[data.dmgStat]] or 0, data.dmgStat, nil, true)) // data.dmgDivider, 1) local weaponDamageBonus = data.type == "other" and {value = 0, name = 'Атака'} or irdenUtils.getBonusByTag(widget.getData("lytArmory.rg" .. data.type .. "Weapons." .. self.irden["gear"]["weapon"][data.type]).damageBonus) local shieldDamageBonus = irdenUtils.getBonusByTag(widget.getData("lytArmory.rgShields." .. self.irden["gear"]["armour"]["shield"]).damageBonus) diff --git a/interface/scripted/irdenstatmanager/irdenutils.lua b/interface/scripted/irdenstatmanager/irdenutils.lua index a0ba0f6..ca083cd 100644 --- a/interface/scripted/irdenstatmanager/irdenutils.lua +++ b/interface/scripted/irdenstatmanager/irdenutils.lua @@ -96,11 +96,11 @@ function irdenUtils.getMaxStamina(type, irden) end end -function irdenUtils.addBonusToStat(base, stat, irden) +function irdenUtils.addBonusToStat(base, stat, irden, forDamage) local ird = irden or self.irden for groupName, bonusGroup in pairs(ird.bonusGroups) do for _, bonus in ipairs(bonusGroup.bonuses) do - if bonus.tag == stat and bonus.ready then + if bonus.tag == stat and bonus.ready and not (forDamage and bonus.affectsDamage == false) then base = base + bonus.value end end diff --git a/interface/scripted/irdenstatmanager/resources/ismresources.lua b/interface/scripted/irdenstatmanager/resources/ismresources.lua index 3eb8cd1..6fd9cdb 100644 --- a/interface/scripted/irdenstatmanager/resources/ismresources.lua +++ b/interface/scripted/irdenstatmanager/resources/ismresources.lua @@ -50,7 +50,7 @@ function loadResources() mouseTransparent = true }) - + -- Slider widget.addChild("lytResources.lytButtons", { @@ -70,7 +70,7 @@ function loadResources() value = "???", position = vec2.add(position, sliderAttemptsOffset), mouseTransparent = true - }, "lblCurrent" .. event.event) + }, "lblCurrent" .. event.event) -- Left attempts @@ -111,23 +111,55 @@ function perfectAttempts(stat) return 1 + (irdenUtils.addBonusToStat(self.irden["stats"][self.characterStats[stat]], stat) + 1) // 2 end +function getResourceEvent(eventName) + if not self.eventsByName then + self.eventsByName = {} + for _, ev in ipairs(root.assetJson("/irden_events.config")) do + self.eventsByName[ev.event] = ev + end + end + return self.eventsByName[eventName] +end + +function getGroupPoolMax(group) + if group == "miningPool" then + return perfectAttempts("END") + + irdenUtils.getBonusByTag("RESOURSE_QUARRY").value + + 2 * irdenUtils.getBonusByTag("RESOURSE_MINING").value + elseif group == "huntingPool" then + return 2 + + irdenUtils.getBonusByTag("RESOURSE_HUNTING").value + + irdenUtils.getBonusByTag("RESOURSE_FISHING").value + end + return 0 +end + function getMaxResourceAttempts(type) - local attempts = { - prey = 2 + irdenUtils.getBonusByTag("RESOURSE_HUNTING").value, - fishing = 2 + irdenUtils.getBonusByTag("RESOURSE_FISHING").value, - herbalism = irdenUtils.addBonusToStat(self.irden["stats"][self.characterStats[self.eventStats["herbalism"]]], self.eventStats["herbalism"]) // 5 + irdenUtils.getBonusByTag("RESOURSE_HERBALISM").value, - mining = perfectAttempts("END") // 2 + irdenUtils.getBonusByTag("RESOURSE_MINING").value, - quarry = perfectAttempts("END") + irdenUtils.getBonusByTag("RESOURSE_QUARRY").value, - chopping = perfectAttempts("END") // 2 + irdenUtils.getBonusByTag("RESOURSE_CHOPPING").value, - riches = irdenUtils.addBonusToStat(self.irden["stats"][self.characterStats[self.eventStats["riches"]]], self.eventStats["riches"]) // 5 + irdenUtils.getBonusByTag("RESOURSE_RICHES").value, - wooddoing = perfectAttempts("END") + irdenUtils.getBonusByTag("RESOURSE_WOODDOING").value - } - - return attempts[type] or "?" + local event = getResourceEvent(type) + if event and event.attemptGroup then + return getGroupPoolMax(event.attemptGroup) // (event.attemptCost or 1) + end + + local attempts = { + herbalism = irdenUtils.addBonusToStat(self.irden["stats"][self.characterStats[self.eventStats["herbalism"]]], self.eventStats["herbalism"]) // 5 + irdenUtils.getBonusByTag("RESOURSE_HERBALISM").value, + chopping = perfectAttempts("END") // 2 + irdenUtils.getBonusByTag("RESOURSE_CHOPPING").value, + riches = irdenUtils.addBonusToStat(self.irden["stats"][self.characterStats[self.eventStats["riches"]]], self.eventStats["riches"]) // 5 + irdenUtils.getBonusByTag("RESOURSE_RICHES").value, + wooddoing = perfectAttempts("END") + irdenUtils.getBonusByTag("RESOURSE_WOODDOING").value + } + + return attempts[type] or "?" end function getLeftResourceAttempts(type) - return (self.irden.eventAttempts and self.irden.eventAttempts[type] and self.irden.eventAttempts[type]) or getMaxResourceAttempts(type) + local event = getResourceEvent(type) + if event and event.attemptGroup then + local pool = self.irden.eventAttempts and self.irden.eventAttempts[event.attemptGroup] + if not pool then + pool = getGroupPoolMax(event.attemptGroup) + end + return pool // (event.attemptCost or 1) + end + return (self.irden.eventAttempts and self.irden.eventAttempts[type] and self.irden.eventAttempts[type]) or getMaxResourceAttempts(type) end function setResourseAttempts() @@ -135,7 +167,7 @@ function setResourseAttempts() widget.setSliderRange("lytResources.lytButtons.slResource" .. event.event, 0, getLeftResourceAttempts(event.event), 1) widget.setSliderValue("lytResources.lytButtons.slResource" .. event.event, getLeftResourceAttempts(event.event)) - + widget.setText("lytResources.lytButtons.lblTotal" .. event.event, getMaxResourceAttempts(event.event)) widget.setText("lytResources.lytButtons.lblLeft" .. event.event, getLeftResourceAttempts(event.event)) widget.setText("lytResources.lytButtons.lblCurrent" .. event.event, widget.getSliderValue("lytResources.lytButtons.slResource" .. event.event)) @@ -150,18 +182,25 @@ end function resources(_, data) local type = data.type - local function decreaseLeftAttempts(type, n_attempts) - self.irden.eventAttempts = self.irden.eventAttempts or {} - self.irden.eventAttempts[type] = self.irden.eventAttempts[type] or getMaxResourceAttempts(type) - self.irden.eventAttempts[type] = math.max(self.irden.eventAttempts[type] - n_attempts, 0) - end + local function decreaseLeftAttempts(eventName, n_attempts) + self.irden.eventAttempts = self.irden.eventAttempts or {} + local event = getResourceEvent(eventName) + if event and event.attemptGroup then + local key = event.attemptGroup + local pool = self.irden.eventAttempts[key] or getGroupPoolMax(key) + self.irden.eventAttempts[key] = math.max(pool - n_attempts * (event.attemptCost or 1), 0) + else + self.irden.eventAttempts[eventName] = self.irden.eventAttempts[eventName] or getMaxResourceAttempts(eventName) + self.irden.eventAttempts[eventName] = math.max(self.irden.eventAttempts[eventName] - n_attempts, 0) + end + end if not self.editMode then local n_attempts = widget.getSliderValue("lytResources.lytButtons.slResource" .. data.event) n_attempts = n_attempts > 0 and n_attempts or 1 sendMessageToServer("statmanager", { - type = "resourceEvent", + type = "resourceEvent", action = data.action, source = world.entityName(player.id()), minCrit = self.irden.overrides.events[data.event] and self.irden.overrides.events[data.event].minCrit, @@ -171,7 +210,7 @@ function resources(_, data) }) decreaseLeftAttempts(data.event, n_attempts) elseif not widget.active("lytEditResource") then - for i, stat in ipairs({"STR", "END", "PER", "REF", "MAG", "WIL", "INT", "DET"}) do + for i, stat in ipairs({"STR", "END", "PER", "REF", "MAG", "WIL", "INT", "DET"}) do if stat == data.stat then widget.setSelectedOption("lytEditResource.rgStat", i - 2) break diff --git a/irden_bonuses.config b/irden_bonuses.config index 8ccb6b1..533440d 100644 --- a/irden_bonuses.config +++ b/irden_bonuses.config @@ -78,7 +78,8 @@ "name": "Контрзаклинание", "oneTimed": true, "value": -5, - "tag": "MAG" + "tag": "MAG", + "affectsDamage": false }, { "name": "Прицельный выстрел", diff --git a/irden_events.config b/irden_events.config index 4f6cb97..f962499 100644 --- a/irden_events.config +++ b/irden_events.config @@ -8,6 +8,8 @@ "type": "treshold", "treshold": 18, "onCrit": "richesCrit", + "attemptGroup": "miningPool", + "attemptCost": 2, "name": "Добыча руды" }, { @@ -19,6 +21,8 @@ "type": "treshold", "treshold": 18, "onCrit": "quarryCrit", + "attemptGroup": "miningPool", + "attemptCost": 1, "name": "Добыча камня" }, { @@ -40,6 +44,8 @@ "type": "treshold", "treshold": 18, "onCrit": "preyCrit", + "attemptGroup": "huntingPool", + "attemptCost": 1, "name": "Охота" }, { @@ -51,6 +57,8 @@ "type": "treshold", "onCrit": "fishingCrit", "treshold": 18, + "attemptGroup": "huntingPool", + "attemptCost": 1, "name": "Рыбалка" }, { From 80ae77dca40c8aad98c2bc0b0c171779ec84532e Mon Sep 17 00:00:00 2001 From: Mofurka Date: Sun, 5 Jul 2026 20:21:16 +0500 Subject: [PATCH 2/2] chore: bump version to 4.25.15 for PR and update CHANGELOG.txt --- CHANGELOG.txt | 4 +++- _metadata | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index fa51a36..3bdfc64 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1 +1,3 @@ -- Теперь бонус к здоровью от выносливости расчитывается по формуле HEALTH = 20 + (ENDURANCE * 2) \ No newline at end of file +- Пофикшены дебафы от контр. заклинания, которые во время действия на персонажа воздействовали на урон и точность, а не только на точность; +- Попытки добычи руды и камня теперь связаны между собой; +- Попытки охоты и рыбалки теперь связаны между собой; diff --git a/_metadata b/_metadata index 2f440b8..d5c5ac8 100644 --- a/_metadata +++ b/_metadata @@ -9,5 +9,5 @@ "requires" : [], "steamContentId" : "3226136810", "tags" : "Miscellaneous|User Interface|Mechanics", - "version" : "4.25.14" + "version" : "4.25.15" }