Open VictorECDSA opened 9 months ago
Join us on Discord for the latest news.
@ClaudeZsb
Join us on Discord for the latest news.
Thanks, I have join the discord.
@ClaudeZsb
Thanks for responding. I don't know whether I have misunderstood. If not, how about change code like this:
function _addRaceSynergy(uint256 _counter, uint256 _effects, uint256 _enemyEffects)
private
view
returns (uint256, uint256)
{
for (uint256 i; i < RACE_NUMBER; ++i) {
RaceSynergyEffectData memory data;
if (count / (4 * base) > 0) {
data = RaceSynergyEffect.get(4 * base);
}
if (data.effect <= 0 && count / (2 * base) > 0) {
data = RaceSynergyEffect.get(2 * base);
}
if (data.effect > 0) {
... ...
}
@ClaudeZsb
Thanks for responding. I don't know whether I have misunderstood. If not, how about change code like this:
function _addRaceSynergy(uint256 _counter, uint256 _effects, uint256 _enemyEffects) private view returns (uint256, uint256) { for (uint256 i; i < RACE_NUMBER; ++i) { RaceSynergyEffectData memory data; if (count / (4 * base) > 0) { data = RaceSynergyEffect.get(4 * base); } if (data.effect <= 0 && count / (2 * base) > 0) { data = RaceSynergyEffect.get(2 * base); } if (data.effect > 0) { ... ... }
You're right. This does fix the bug. Great thanks. Would you like to create a PR for fixing it?
And for the second if
, I would prefer data.effect == 0 &&...
.
@ClaudeZsb
Thanks for responding. I don't know whether I have misunderstood. If not, how about change code like this:
function _addRaceSynergy(uint256 _counter, uint256 _effects, uint256 _enemyEffects) private view returns (uint256, uint256) { for (uint256 i; i < RACE_NUMBER; ++i) { RaceSynergyEffectData memory data; if (count / (4 * base) > 0) { data = RaceSynergyEffect.get(4 * base); } if (data.effect <= 0 && count / (2 * base) > 0) { data = RaceSynergyEffect.get(2 * base); } if (data.effect > 0) { ... ... }
You're right. This does fix the bug. Great thanks. Would you like to create a PR for fixing it?
And for the second
if
, I would preferdata.effect == 0 &&...
.
Yes, I would like create a PR for it. It is my honor to join such a charming project !
And for the second 'if', it is my coding habit that use '<=' or '>=' instead of '=='. I think it can avoid boundary risks in special cases.
For example, about the RaceSynergyEffect of troll, only config 2-count (no 4-count):
Lets say the count if bigger than 4, then the judgement 'count / (4 base) > 0' is true, but 'data = RaceSynergyEffect.get(4 base)' is empty. Even though 2-count effect has been configed, but the result is no effect.
Don't know if this is in line with the intent of the design, thank you!