Conversation
| break; | ||
| case AI_BALL_SPALL: | ||
| this->NextPos(&hex); | ||
| if(hex > 43) |
There was a problem hiding this comment.
for area spells: fireball, fireblast, meteorshower and coldring
There was a problem hiding this comment.
No, I mean: what's special about hex 43?
|
Very good work! With all this AI code imported, how did you test it? What's next? |
|
Not sure how to test this properly |
|
@gandalfgray For your original patch, how did you test it? |
Sometimes by printing some values to special file (during battle, for example). Sometimes just by playing. Sometimes things are obious. |
| || creatureIdx == CREATURE_BONE_DRAGON) { | ||
| numDragons++; | ||
| if(stack->OtherArmyAdjacent(cr->owningSide, cr->stackIdx)) | ||
| if(stack->OtherArmyAdjacent(otherSide, cr->stackIdx)) |
There was a problem hiding this comment.
Да, 1-owningSide и otherSide - одно и то же
| int numShooters = 0; | ||
| for(int j = 0; this->numCreatures[otherSide] > j; ++j) { | ||
| if(this->creatures[owningSide][j].creature.creature_flags & SHOOTER) | ||
| if(this->creatures[otherSide][j].creature.creature_flags & SHOOTER) |
There was a problem hiding this comment.
Да, otherSide и 1-owningSide - то же самое :)
| if(stack->GetAttackMask(stack->occupiedHex, 1, -1) == 255) { | ||
| int hexXCoord = stack->occupiedHex % 13; | ||
| int distFromOptimalColumn; | ||
| if(!this->currentActionSide) |
There was a problem hiding this comment.
Здесь должно быть:
if(!(stack->owningSide))
| case SPELL_CURSE: | ||
| aiSpellType = AI_TARGET_DAMAGE_OR_DEBUFF_SPELL; | ||
| targetSide = 1 - this->currentActionSide; | ||
| default: |
| if(aiSpellType == AI_TARGET_BUFF_SPELL | ||
| || aiSpellType == AI_TARGET_DAMAGE_OR_DEBUFF_SPELL | ||
| || aiSpellType == AI_MASS_DEBUFF_SPELL | ||
| || aiSpellType == AI_MASS_BUFF_SPELL |
There was a problem hiding this comment.
As written, only AI_MASS_DEBUFF_SPELL will reach this line. What's with the rest of this?
| break; | ||
| case AI_BALL_SPALL: | ||
| this->NextPos(&hex); | ||
| if(hex > 43) |
There was a problem hiding this comment.
No, I mean: what's special about hex 43?
| if(this->creatures[otherSide][j].creature.creature_flags & SHOOTER) | ||
| numShooters++; | ||
| } | ||
| double shooterVal = numShooters / this->numCreatures[otherSide]; |
There was a problem hiding this comment.
This does integer division. It will basically always be zero. Is it supposed to be this way?
| if(hasAdjacentDragons) | ||
| dragonsVal = 1.0; | ||
| else | ||
| dragonsVal = numDragons / this->numCreatures[otherSide]; |
There was a problem hiding this comment.
This will basically always return 0. Should it be this way?
There was a problem hiding this comment.
fightValue multiplier is missing, sorry.
My last comment concerned raw 211 (if(!(stack->owningSide)) instead of if(!this->currentActionSide))
After I see my comment was ignored and progress completely stopped I did not add new comments.
| } | ||
| } | ||
|
|
||
| int combatManager::RawEffectSpellInfluence(army *stack, int eff) { |
There was a problem hiding this comment.
The argument should be STACK_MODIFYING_EFFECT, not int.
| dragonsVal = 1.0; | ||
| else | ||
| dragonsVal = numDragons / this->numCreatures[otherSide]; | ||
| preResult = 0.28 * dragonsVal; |
There was a problem hiding this comment.
dragonsVal cannot be higher than 1.
Therefore preResult cannot be higher than 0.28.
preResult gets rounded to an int, i.e.: 0.
Therefore: The effect of dragon slayer is always 0 and the AI never casts it.
Is this right?
There was a problem hiding this comment.
BTW, looking at the decompiled code, this problem seems to have already been there.
No description provided.