All Questions


Geoffrey Megardon(Nodragem)

Defender Weakness


You are using the following condition:

elif Types.WEAKNESS_MAPPING[element] in defender.stats.weaknesses:
multiplier = 1.5

Should it not be?

elif element in defender.stats.weaknesses:
multiplier = 1.5
Let's take the example where we have an attack of Element = CODE and defender of Affinity = ART. I would expect that defender to be weak to the attack (CODE is strong against ART). It is not clear what stats.weaknesses contains at this stage, but I would expect to automatically add CODE in the list of my character's weakness if its affinity is ART. Then I would simply test `if element in defender.stats.weakness`?

  • Nathan Lovato replied

    Definitely, we should simplify the code this way.

    I'm looking at the code right now and I don't remember why there's that indirection. The BattlerAI class does it the way you wrote.

    I'm logging this to review it thoroughly again and ensure the simplification doesn't have unexpected ramifications.