{"action":"created","issue":{"url":"https://api.github.com/repos/rathena/rathena/issues/639","labels_url":"https://api.github.com/repos/rathena/rathena/issues/639/labels{/name}","comments_url":"https://api.github.com/repos/rathena/rathena/issues/639/comments","events_url":"https://api.github.com/repos/rathena/rathena/issues/639/events","html_url":"https://github.com/rathena/rathena/issues/639","id":106723229,"number":639,"title":"tick_def2 not always adjusted by pc_sc_def_rate","user":{"login":"theultramage","id":1738190,"avatar_url":"https://avatars.githubusercontent.com/u/1738190?v=3","gravatar_id":"","url":"https://api.github.com/users/theultramage","html_url":"https://github.com/theultramage","followers_url":"https://api.github.com/users/theultramage/followers","following_url":"https://api.github.com/users/theultramage/following{/other_user}","gists_url":"https://api.github.com/users/theultramage/gists{/gist_id}","starred_url":"https://api.github.com/users/theultramage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theultramage/subscriptions","organizations_url":"https://api.github.com/users/theultramage/orgs","repos_url":"https://api.github.com/users/theultramage/repos","events_url":"https://api.github.com/users/theultramage/events{/privacy}","received_events_url":"https://api.github.com/users/theultramage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-16T08:21:31Z","updated_at":"2015-09-17T19:40:44Z","closed_at":null,"body":"When tick_def2 (numeric status duration reduction) was implemented into the existing code in https://github.com/rathena/rathena/commit/a3dc2d9cf45e0bd89259b77bfa5adae08f1b5ea0, a coding mistake was made in two places in skill_castend_nodamage_id():\r\n```\r\n\t\tif (tick_def > 0 && battle_config.pc_sc_def_rate != 100) {\r\n\t\t\ttick_def = tick_def*battle_config.pc_sc_def_rate/100;\r\n\t\t\ttick_def2 = tick_def2*battle_config.pc_sc_def_rate/100;\r\n```\r\n```\r\n\t\tif (tick_def > 0 && battle_config.mob_sc_def_rate != 100) {\r\n\t\t\ttick_def = tick_def*battle_config.mob_sc_def_rate/100;\r\n\t\t\ttick_def2 = tick_def2*battle_config.mob_sc_def_rate/100;\r\n```\r\n\r\nThe if condition is checking tick_def only. If the server happens to be using non-default status def rates, statuses which only have a tick_def2 resistance will not get their rates adjusted.\r\n\r\nThe solution is to either break them up into separate checks, or, remove the 'tick_def > 0' check entirely since it's not needed and doesn't really save much cpu time, and adds complexity. If you look at surrounding code, it has dropped the nonzero checks, and even the '!= 100' check in some cases."},"comment":{"url":"https://api.github.com/repos/rathena/rathena/issues/comments/141204179","html_url":"https://github.com/rathena/rathena/issues/639#issuecomment-141204179","issue_url":"https://api.github.com/repos/rathena/rathena/issues/639","id":141204179,"user":{"login":"theultramage","id":1738190,"avatar_url":"https://avatars.githubusercontent.com/u/1738190?v=3","gravatar_id":"","url":"https://api.github.com/users/theultramage","html_url":"https://github.com/theultramage","followers_url":"https://api.github.com/users/theultramage/followers","following_url":"https://api.github.com/users/theultramage/following{/other_user}","gists_url":"https://api.github.com/users/theultramage/gists{/gist_id}","starred_url":"https://api.github.com/users/theultramage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theultramage/subscriptions","organizations_url":"https://api.github.com/users/theultramage/orgs","repos_url":"https://api.github.com/users/theultramage/repos","events_url":"https://api.github.com/users/theultramage/events{/privacy}","received_events_url":"https://api.github.com/users/theultramage/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T19:40:44Z","updated_at":"2015-09-17T19:40:44Z","body":"There are no custom modifications here, but the problem only arises when *_sc_def_rate is not 100.\r\nAnd no you did not put any checks in, read the commit diff. The checks were already there, but only for tick_def. You shoved additional code (for tick_def2) inside tick_def-only checks."}}