Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- Теперь бонус к здоровью от выносливости расчитывается по формуле HEALTH = 20 + (ENDURANCE * 2)
- Пофикшены дебафы от контр. заклинания, которые во время действия на персонажа воздействовали на урон и точность, а не только на точность;
- Попытки добычи руды и камня теперь связаны между собой;
- Попытки охоты и рыбалки теперь связаны между собой;
2 changes: 1 addition & 1 deletion _metadata
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"requires" : [],
"steamContentId" : "3226136810",
"tags" : "Miscellaneous|User Interface|Mechanics",
"version" : "4.25.14"
"version" : "4.25.15"
}
2 changes: 1 addition & 1 deletion interface/scripted/irdenstatmanager/irdenstatmanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions interface/scripted/irdenstatmanager/irdenutils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
85 changes: 62 additions & 23 deletions interface/scripted/irdenstatmanager/resources/ismresources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function loadResources()
mouseTransparent = true
})



-- Slider
widget.addChild("lytResources.lytButtons", {
Expand All @@ -70,7 +70,7 @@ function loadResources()
value = "???",
position = vec2.add(position, sliderAttemptsOffset),
mouseTransparent = true
}, "lblCurrent" .. event.event)
}, "lblCurrent" .. event.event)


-- Left attempts
Expand Down Expand Up @@ -111,31 +111,63 @@ 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()
for _, event in ipairs(root.assetJson("/irden_events.config")) do
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))
Expand All @@ -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,
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion irden_bonuses.config
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"name": "Контрзаклинание",
"oneTimed": true,
"value": -5,
"tag": "MAG"
"tag": "MAG",
"affectsDamage": false
},
{
"name": "Прицельный выстрел",
Expand Down
8 changes: 8 additions & 0 deletions irden_events.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"type": "treshold",
"treshold": 18,
"onCrit": "richesCrit",
"attemptGroup": "miningPool",
"attemptCost": 2,
"name": "Добыча руды"
},
{
Expand All @@ -19,6 +21,8 @@
"type": "treshold",
"treshold": 18,
"onCrit": "quarryCrit",
"attemptGroup": "miningPool",
"attemptCost": 1,
"name": "Добыча камня"
},
{
Expand All @@ -40,6 +44,8 @@
"type": "treshold",
"treshold": 18,
"onCrit": "preyCrit",
"attemptGroup": "huntingPool",
"attemptCost": 1,
"name": "Охота"
},
{
Expand All @@ -51,6 +57,8 @@
"type": "treshold",
"onCrit": "fishingCrit",
"treshold": 18,
"attemptGroup": "huntingPool",
"attemptCost": 1,
"name": "Рыбалка"
},
{
Expand Down
Loading