Skip to content

Commit

Permalink
Merge pull request #20 from Putnam3145/3.0
Browse files Browse the repository at this point in the history
3.0
  • Loading branch information
Putnam3145 authored Jul 30, 2017
2 parents 18de452 + 86eef32 commit 80149dd
Show file tree
Hide file tree
Showing 64 changed files with 3,505 additions and 17,672 deletions.
130 changes: 0 additions & 130 deletions raw/classes_setup.py

This file was deleted.

310 changes: 0 additions & 310 deletions raw/dfhack_input.txt

This file was deleted.

2 changes: 0 additions & 2 deletions raw/fortbent_onload.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ modtools/reaction-trigger -reactionName ALCHEMIZE_TROLL_ADV -command [ fortbent/

fortbent/grist

base/roses-init -classSystem

fortbent/heroic_just

fortbent/claspect_assign
Expand Down
48 changes: 45 additions & 3 deletions raw/init.d/fortbent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,54 @@ eventful.onReport.lord_english_appear=function(reportId)
end
end
end
local putnamSkills=dfhack.script_environment('modtools/putnam_skills')

local stateEvents={}
eventful.onUnitAttack.addSburbExperience=function(attackerId,defenderId,woundId)
local wound
for k,v in ipairs(df.unit.find(defenderId).body.wounds) do
if woundId==v.id then wound=v end
end
putnamSkills.addExperienceToAllSkillsWithLevelCriterion(df.unit.find(attackerId),math.floor(math.sqrt(wound.contact_area)+0.5)+1,'sburb')
putnamSkills.addExperienceToAllSkillsWithLevelCriterion(df.unit.find(defenderId),1,'sburb')
end

eventful.onUnitDeath.addSburbExperience=function(unit_id)
local deadUnit=df.unit.find(unit_id)
local expValue=(deadUnit.body.blood_max/500)
expValue=expValue+deadUnit.body.physical_attrs.STRENGTH.value/1000
expValue=expValue+deadUnit.body.physical_attrs.AGILITY.value/1000
expValue=expValue+deadUnit.body.physical_attrs.TOUGHNESS.value/1000
expValue=expValue+deadUnit.body.physical_attrs.ENDURANCE.value/1000
expValue=expValue+deadUnit.status.current_soul.mental_attrs.WILLPOWER.value/1500
expValue=expValue+deadUnit.status.current_soul.mental_attrs.SPATIAL_SENSE.value/1000
expValue=expValue+deadUnit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.value/1000
expValue=expValue+deadUnit.status.current_soul.mental_attrs.FOCUS.value/2000
if df.incident.find(deadUnit.counters.death_id) then
local killerId=df.incident.find(deadUnit.counters.death_id).killer
if df.unit.find(killerId) then
putnamSkills.addExperienceToAllSkillsWithLevelCriterion(df.unit.find(killerId),expValue,'sburb')
end
end
end

eventful.onItemCreated.addSburbExperience=function(item_id)
local item=df.item.find(item_id)
if pcall(function() tostring(item.maker) end) and df.unit.find(item.maker) then
putnamSkills.addExperienceToAllSkillsWithLevelCriterion(df.unit.find(item.maker),(item.quality+1)^2,'sburb')
end
end

stateEvents[SC_MAP_LOADED]=function() eventful.enableEvent(eventful.eventType.INTERACTION,5) eventful.enableEvent(eventful.eventType.REPORT,5) end
local stateEvents={}

stateEvents[SC_WORLD_LOADED]=stateEvents[SC_MAP_LOADED]
stateEvents[SC_MAP_LOADED]=function()
eventful.enableEvent(eventful.eventType.INTERACTION,1)
eventful.enableEvent(eventful.eventType.REPORT,1)
eventful.enableEvent(eventful.eventType.UNIT_ATTACK,5)
eventful.enableEvent(eventful.eventType.UNIT_DEATH,10)
eventful.enableEvent(eventful.eventType.ITEM_CREATED,5)
dfhack.script_environment('modtools/persist_timeout').onLoad()
dfhack.run_command('fortbent/classes')
end

function onStateChange(op)
local stateChangeFunc=stateEvents[op]
Expand Down
Loading

0 comments on commit 80149dd

Please sign in to comment.