res = require 'resources' windower.register_event('gain buff', function(buff) local buff_name = res.buffs[buff].name if buff_name == 'Protect' then print('foo') end end)