Skip to content

Non-standard Attack Error #13

@ProperAttorney

Description

@ProperAttorney

Describe the bug
Non-standard attacks cause the attackbonus loop to error out.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Longbow attack that uses a counter as the first node.
  2. Try to use !hunt
  3. Error occurs.

Expected behavior
The alias is able to parse custom attacks to find the attackbonus

Additional context

Traceback (most recent call last):
  Line 204, col 11
            ibonus = i.raw.automation[0].effects[0].attackBonus
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NotDefined: 'SafeDict' object has no attribute attackBonus
This is an issue in a user-created command; do not report this on the official bug tracker.
for i in c.attacks:
    if any([j in i.name.lower() for j in ["bow", "javelin", "spear", "trident", "gun", "yklwa"]]):
        ibonus = i.raw.automation[0].effects[0].attackBonus
        for g in globals:
            ibonus = ibonus.replace(g, str(globals[g]))
        abonus = vroll(ibonus)
        huntlist.append(abonus.total)
        attacklist.append(i.name)

I imagine that it happens because they made a modified longbow attack action that uses counters and the attackbonus is now in effect[1]. I've run into this situation before when making something that searched attacks and did the following to deal with it

possibleAttacks = {x.name:{"hit": int(str(x)[str(x).find("Attack: ")+9:str(x).find(" to hit.")]), "verb": x.verb, "proper": x.proper} for x in character().attacks if "Attack:" in str(x)}
maxAttack = max(possibleAttacks, key=lambda x: possibleAttacks[x].hit)
roll_str = f'1d20+{possibleAttacks[maxAttack]["hit"]}'

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions