kakaroto / Beyond20

D&D Beyond Character Sheet Integration in Roll20
GNU General Public License v3.0
497 stars 145 forks source link

Customize Spell Name and damage dice goes crazy #900

Closed GammaKappaMu closed 2 years ago

GammaKappaMu commented 2 years ago

Hello. I chanced the name of Chaos Bolt and now when I roll damage it rolls 9d8. I removed the name and now it rolls just 2s8 but not the additional 1d6 noted (On a hit, the target takes 2d8 + 1d6 damage).

Aeristoka commented 2 years ago

Please add more specifics, name you changed it to, screenshots, etc.

Also, please test with Beyond20 Disabled, as Beyond20 may not be the culprit here.

GammaKappaMu commented 2 years ago

Spell: Sorcerer 1 - Chaos Bolt -> Ikol's Chaotic Balls Image 01: Normal with Beyond 20 Image 02: Name change and Beyond 20 Image 03: Name Change Beyond 20 inactiv chaos bolt 01 chaos bolt 02 chaos bolt 03 e

Aeristoka commented 2 years ago

yep, specifically because Chaos Bolt has a VERY specific section of code to handle it, and pare down to just one roll.

You changed the name, so it can't find that the Spell is correct. Change the name back to the default.

Aeristoka commented 2 years ago
//Moved after the new resolveRolls so it can access the roll results
if (request.name.includes("Chaos Bolt")) {
    for (let [i, dmg_roll] of damage_rolls.entries()) {
        const [dmg_type, roll, flags] = dmg_roll;
        if (dmg_type == "Chaotic energy Damage" && roll.dice[0].faces == 8) {
            const chaos_bolt_damages = ["Acid", "Cold", "Fire", "Force", "Lightning", "Poison", "Psychic", "Thunder"];
            const damage_choices = {}
            for (let r of roll.dice[0].rolls)
                damage_choices[chaos_bolt_damages[r.roll - 1]] = null;
            //console.log("Damage choices : ", damage_choices, damage_choices.length);
            let chaotic_type = null;
            if (Object.keys(damage_choices).length == 1) {
                damage_rolls.push(["Chaotic energy leaps from the target to a different creature of your choice within 30 feet of it", "", DAMAGE_FLAGS.MESSAGE]);
                chaotic_type = Object.keys(damage_choices)[0];
            } else {
                chaotic_type = await this.queryDamageType(request.name, damage_choices);
            }
            damage_rolls[i] = [chaotic_type + " Damage", roll, flags];
            critical_damage_types[0] = chaotic_type;
            break;
        }
    }
}

Specifically all this