{"action":"closed","issue":{"url":"https://api.github.com/repos/jleclanche/fireplace/issues/237","repository_url":"https://api.github.com/repos/jleclanche/fireplace","labels_url":"https://api.github.com/repos/jleclanche/fireplace/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/jleclanche/fireplace/issues/237/comments","events_url":"https://api.github.com/repos/jleclanche/fireplace/issues/237/events","html_url":"https://github.com/jleclanche/fireplace/issues/237","id":118799307,"number":237,"title":"Aura buffs keep getting reapplied instead of refreshing the tick","user":{"login":"beheh","id":929769,"avatar_url":"https://avatars.githubusercontent.com/u/929769?v=3","gravatar_id":"","url":"https://api.github.com/users/beheh","html_url":"https://github.com/beheh","followers_url":"https://api.github.com/users/beheh/followers","following_url":"https://api.github.com/users/beheh/following{/other_user}","gists_url":"https://api.github.com/users/beheh/gists{/gist_id}","starred_url":"https://api.github.com/users/beheh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beheh/subscriptions","organizations_url":"https://api.github.com/users/beheh/orgs","repos_url":"https://api.github.com/users/beheh/repos","events_url":"https://api.github.com/users/beheh/events{/privacy}","received_events_url":"https://api.github.com/users/beheh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jleclanche/fireplace/labels/engine","name":"engine","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-25T09:56:29Z","updated_at":"2016-02-08T02:03:13Z","closed_at":"2016-02-08T02:03:13Z","body":"Currently, when an Aura affects an Entity, the following happens (example):\r\n\r\n- initial buff is applied with tick 1\r\n- game ticks from 1 to 2\r\n- `refresh_auras` reapplies the same buff again with tick 2\r\n- the initial buff is `.destroy`ed, since it times out (tick < game.tick)\r\n\r\nThis can be seen in a [corresponding log](https://gist.githubusercontent.com/beheh/8d7cecaa67428726e3cf/raw/c0768282064b8877e20915dfa583dcd0ae524258/gistfile1.txt). The following would be much cleaner and allow us to reliably track when an aura buff is really destroyed (= source is removed, silenced...):\r\n\r\n- initial buff is applied with tick 1\r\n- game ticks from 1 to 2\r\n- `refresh_auras` sees that the entity already has the same buff from the same source, and sets it tick to 2\r\n- the buff is only `.destroy`ed once the source is actually gone\r\n\r\nThis allows us to for example reliably reducing the damage on max_health decrease, thus fixing #226.\r\n\r\nI *think* that `class TargetableByAuras` tries to do something like this in `refresh_buff` and `refresh_tags`, but I don't fully understand slots and tags. I've hacked(!) something together [here](https://github.com/jleclanche/fireplace/compare/master...beheh:enchantmenthealth).\r\n\r\nThis should also improve the performance of `refresh_auras`."}}