Temple+ Modding Question

Discussion in 'General Modification' started by _doug_, Feb 21, 2018.

Remove all ads!
  1. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    338
    Likes Received:
    119
    Thanks, will look into that.

    Will do.

    After looking at the code, I tried:
    Code:
    evt_obj.attack_packet.set_flags(D20CAF_CRITICAL)
    which leads to the same behaviour as above, then I tried:
    Code:
    evt_obj.attack_packet.set_flags(D20CAF_HIT)
    which does lead to normal hits but does not confirm the crit automatically.

    I also considered just adding +100 to the roll, it just has the auto fail on a 1 problem (this screenshot also demonstrates the confirmation visual bug; the +100 is actually only added to the confirm roll, not to the attack roll. The Attack Roll window has actually a wrong information shown.)
    Screenshot 2021-03-05 160756.jpg
    Looking at the code, I might just add the reroll crit query and set it 1, this would mean I fail 1 in about 400 confirmation rolls only) which might be the easiest solution.

    To be clear, I use the
    Code:
    dolorousBlowSpell.AddHook(ET_OnConfirmCriticalBonus, EK_NONE, dolorousBlowSpellBonusToConfirmCrit,())
    hook.
     
  2. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    @Sagenlicht I took a look at Dolorous Blow and noticed you directly manipulate the weapon's crit range field there. This approach is not recommended and can easily lead to bugs. Why did you choose not to use the Get_Keen_Bonus method?
     
  3. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    338
    Likes Received:
    119
    Because it does not work, at least I have not found any way to get a keen bonus to work with any query. I tried to apply it to the weapon as well as to wielder and I also tried has_keen_bonus both with no effect.

    But I get your point, I was unsure if it's a good idea myself. So I tried some things and now I have found a way to get it work and not to stack with either Keen Edge spell and the Improved Crit Feat, which is actually makes me a happy panda.

    Code:
    def dolorousBlowSpellModifyThreatRange(attachee, args, evt_obj):
        appliedKeenRange =  evt_obj.bonus_list.get_sum()
        print "Range old ", appliedKeenRange
        getKeenRange = attachee.item_worn_at(item_wear_weapon_primary).obj_get_int(obj_f_weapon_crit_range)
        if appliedKeenRange == getKeenRange:
            evt_obj.bonus_list.add(getKeenRange, 0 , "~Dolorous Blow~[TAG_SPELLS_DOLORUS_BLOW] Bonus")
            print "Range new ", evt_obj.bonus_list.get_sum()
        else:
            print "Already keen"
        return 0
    
    def dolorousBlowSpellAnswerToKeenQuery(attachee, args, evt_obj):
        if args.get_arg(1):
            evt_obj.return_val = 1
        return 0
    
    def dolorousBlowSpellBonusToConfirmCrit(attachee, args, evt_obj):
        flags = evt_obj.attack_packet.get_flags()
        flags |= D20CAF_CRITICAL
        evt_obj.attack_packet.set_flags(flags)
        return 0
    
    def dolorousBlowSpellTooltip(attachee, args, evt_obj):
        if args.get_arg(1) == 1:
            evt_obj.append("Dolorous Blow ({} round)".format(args.get_arg(1)))
        else:
            evt_obj.append("Dolorous Blow ({} rounds)".format(args.get_arg(1)))
    
    def dolorousBlowSpellEffectTooltip(attachee, args, evt_obj):
        if args.get_arg(1) == 1:
            evt_obj.append(tpdp.hash("DOLOROUS_BLOW"), -2, " ({} round)".format(args.get_arg(1)))
        else:
            evt_obj.append(tpdp.hash("DOLOROUS_BLOW"), -2, " ({} rounds)".format(args.get_arg(1)))
        return 0
    
    def dolorousBlowSpellHasSpellActive(attachee, args, evt_obj):
        spellPacket = tpdp.SpellPacket(args.get_arg(0))
        if evt_obj.data1 == spellPacket.spell_enum:
            evt_obj.return_val = 1
        return 0
    
    def dolorousBlowSpellKilled(attachee, args, evt_obj):
        args.remove_spell()
        args.remove_spell_mod()
        return 0
    
    def dolorousBlowSpellSpellEnd(attachee, args, evt_obj):
        print "Dolorous BlowSpellEnd"
        return 0
    
    dolorousBlowSpell = PythonModifier("sp-Dolorous Blow", 3) # spell_id, duration, keenFlag
    dolorousBlowSpell.AddHook(ET_OnConfirmCriticalBonus, EK_NONE, dolorousBlowSpellBonusToConfirmCrit,())
    dolorousBlowSpell.AddHook(ET_OnGetCriticalHitRange, EK_NONE, dolorousBlowSpellModifyThreatRange,())
    dolorousBlowSpell.AddHook(ET_OnD20Query, EK_Q_Item_Has_Keen_Bonus, dolorousBlowSpellAnswerToKeenQuery, ())
    #dolorousBlowSpell.AddHook(ET_OnD20Query, EK_Q_Weapon_Get_Keen_Bonus, dolorousBlowSpellAnswerToKeenQuery, ())
    dolorousBlowSpell.AddHook(ET_OnGetTooltip, EK_NONE, dolorousBlowSpellTooltip, ())
    dolorousBlowSpell.AddHook(ET_OnGetEffectTooltip, EK_NONE, dolorousBlowSpellEffectTooltip, ())
    dolorousBlowSpell.AddHook(ET_OnD20Signal, EK_S_Spell_End, dolorousBlowSpellSpellEnd, ())
    dolorousBlowSpell.AddHook(ET_OnD20Query, EK_Q_Critter_Has_Spell_Active, dolorousBlowSpellHasSpellActive, ())
    dolorousBlowSpell.AddHook(ET_OnD20Signal, EK_S_Killed, dolorousBlowSpellKilled, ())
    dolorousBlowSpell.AddSpellDispelCheckStandard()
    dolorousBlowSpell.AddSpellTeleportPrepareStandard()
    dolorousBlowSpell.AddSpellTeleportReconnectStandard()
    dolorousBlowSpell.AddSpellCountdownStandardHook()
    Shall I redo the spell Keen Edge as well, so it does not stack with the feat improved crit too?
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Come to think about it, I think Get Keen Bonus only affects the display in the inventory.
     
  5. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    338
    Likes Received:
    119
    EDIT:
    Ok to be more clear:

    There is no way in Pyhton to access existing DR values of a critter right? I would need to lower existing DR values to a minimum of 5.

    Code:
    .def("add_physical_damage_res", [](DamagePacket& damPkt, int amount, int bypassingAttackPower, int damMesLine){
                damPkt.AddPhysicalDR(amount, bypassingAttackPower, damMesLine);
            }, "Adds physical (Slashing/Piercing/Crushing) damage resistance.")
    
            *SNIP*
    
            .def("add_damage_resistance", [](DamagePacket& damPkt, int amount, int damType, int damMesLine) {
                auto _damType = (DamageType)damType;
                damPkt.AddDR(amount, _damType, damMesLine);
            }, "Adds damage resistance.")
    If I do know the DR of the critter I simply could add a negative value

    Now I think, I made my thought process clear, just took me about 3 edits :/
     
    Last edited: Mar 7, 2021
  6. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Sorry, it's still not clear what you're asking for here... what spell is it?
     
  7. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    338
    Likes Received:
    119
    https://dndtools.net/spells/spell-compendium--86/vulnerability--4756/
    I would like to modify existing DR values of critters. I could use this:
    Code:
    .def("add_physical_damage_res", [](DamagePacket& damPkt, int amount, int bypassingAttackPower, int damMesLine){
                damPkt.AddPhysicalDR(amount, bypassingAttackPower, damMesLine);
            }, "Adds physical (Slashing/Piercing/Crushing) damage resistance.")
    
            *SNIP*
    
            .def("add_damage_resistance", [](DamagePacket& damPkt, int amount, int damType, int damMesLine) {
                auto _damType = (DamageType)damType;
                damPkt.AddDR(amount, _damType, damMesLine);
            }, "Adds damage resistance.")
    and add a negative value. But beforehand I would need to know if the critter has a DR and if yes what kind of DR it is (e.g.= DR 10/magic.) Basically I need access to the DR list of a critter.

    I think this is the part where the c++ checks if there is a DR (in damage.cpp):
    Code:
    int DamagePacket::AddPhysicalDR(int amount, int bypasserBitmask, int damageMesLine){
        return damage.AddPhysicalDR(this, amount, bypasserBitmask, (unsigned)damageMesLine);
    }
    
    int DamagePacket::AddDR(int amount, DamageType damType, int damageMesLine){
    
        if (this->damResCount < 5u){
            this->damageResistances[this->damResCount].damageReductionAmount = amount;
            this->damageResistances[this->damResCount].dmgFactor = 0.0f;
            this->damageResistances[this->damResCount].type = damType;
            this->damageResistances[this->damResCount].attackPowerType = D20DAP_UNSPECIFIED;
            this->damageResistances[this->damResCount].typeDescription = damage.GetMesline(damageMesLine);
            this->damageResistances[this->damResCount++].causedBy = nullptr;
            return TRUE;
        }
        return  FALSE;
     
  8. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    That'll require extending the API for sure. Modifying modifiers is usually messy...
    I'd put it on the backburner for now.
     
  9. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    338
    Likes Received:
    119
    Sure, will add the spell to the maybe later list :)
     
  10. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Hey Sitra, had an idea for Temple+ - if you have multiple characters selected (eg the whole party) and you hit 'search', then everyone searches, not just the lead character. Useful for finding secret stuff quickly with whole party.
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Huh, I always thought that's how it is, but it turns out your party only pitches in for a +2 bonus.
    Wouldn't it be more by the RAW to instead select the highest search skill member?
     
  12. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    316
    Likes Received:
    143
    Sounds like they are applying the "aid another" bonus with the +2.
     
  13. Daryk

    Daryk Veteran Member

    Joined:
    Jan 14, 2012
    Messages:
    1,177
    Likes Received:
    34
    I find it amusing we're arguing intent and implementation simultaneously...
     
  14. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    If they are, that's awesome and shouldn't be changed, but I was thinking of scenarios where the party is spread out and it would be nice to just hit one button and have everyone search a wide area. You may still need to send your highest Search skill guy around to double check, but you are going to do that anyway.
     
  15. Endarire

    Endarire Ronald Rynnwrathi

    Joined:
    Jan 7, 2004
    Messages:
    982
    Likes Received:
    120
    +1 to Ted.

    Also, if the party is focused on searching a small area, each party member and familiar and animal companion aiding should provide +2.
     
Our Host!