[DiscordArchive] can some1 explain this to me ?
[DiscordArchive] can some1 explain this to me ?
Archived author: Rymercyble • Posted: 2023-05-05T03:17:40.112000+00:00
Original source
can some1 explain this to me ?
```cpp
int32 thisLevel = getLevelForTarget(victim);
int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
```
these naming ~~schemes~~ mess is too much for me so
`this` is attacker
`victim` is target
`thisLevel` is level of target ?? if so why the hell is it called THISlevel
`getLevelForTarget(victim)` returns level of target
`victim->getLevelForTarget(this)` returns level of attacker ?? if so why its not done like this `getLevelForTarget(this)` ??
Archived author: Rymercyble • Posted: 2023-05-05T03:19:04.419000+00:00
Original source
i feel like goal of ppl writing such code was to just confuse every1 so nobody can work on it
Archived author: Anchy • Posted: 2023-05-05T04:48:48.808000+00:00
Original source
who wrote that
Archived author: Anchy • Posted: 2023-05-05T04:49:04.674000+00:00
Original source
was it me
Archived author: Anchy • Posted: 2023-05-05T04:49:16.959000+00:00
Original source
also you could PR to fix it
Archived author: Anchy • Posted: 2023-05-05T04:50:25.217000+00:00
Original source
if it were me I would just:
```cpp
int32 levelDiff = static_cast<int32>(this->GetLevel()) - victim->GetLevel();
```
Archived author: Anchy • Posted: 2023-05-05T04:50:34.385000+00:00
Original source
that code is kind of over-engineered
Archived author: Rymercyble • Posted: 2023-05-05T04:51:13.907000+00:00
Original source
its either from TC or sunwell
Archived author: Anchy • Posted: 2023-05-05T04:51:21.624000+00:00
Original source
you might still have to cast though
Archived author: Rymercyble • Posted: 2023-05-05T04:52:18.338000+00:00
Original source
also name of `getLevelForTarget` itself is weird bcs when u write it like this `victim->getLevelForTarget(this)` it just doesnt make sense