Current implementation of Sneaking in ToEE T+

Discussion in 'General Modification' started by anatoliy, Mar 7, 2020.

Remove all ads!
  1. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    200
    There is a critter flag “OCF_IS_MOVING_SILENTLY” which indicates Sneaking state of any NPC/PC. Pressing Sneak button in ToEE Menu would execute standard built-in action – “D20A_SNEAK”, which would call “PerformSneak” function in T+.

    PerformSneak
    The function is intended to check, whether NPC is allowed to stay in the Sneaking state. If current mode is no combat then yes, no check.

    When Combat, then -20 penalty is added.

    Skill Hide is rolled for this NPC with the penalty applied.

    Then for each combatant which is foe, who has Line of Sight of NPC check is done – if NPC does not have “Hide in Plain Sight” feature then fail, otherwise Spot roll for foe compared to initial Hide roll of NPC. If at least one foe spotted NPC, Sneak state would be removed, and failed roll would be printed in Combat History window.

    Success rolls, “Hide in Plain Sight” inquiry, etc does not print in Combat History window.

    Overall even “Hide in Plain Sight” feature of the NPC is insufficient, as -20 penalty is extremely high.

    Sneak_Attack condition
    A Rogue class applies "Sneak_Attack" condition on NPC instance, which post-processes damage of successful NPC attack, and would grant additional damage when NPC is in Sneak state or other circumstances.

    Essentially any time Rogue deals damage, "Sneak_Attack" would check, if there are circumstances, that allow adding Sneak Damage, and they are the following:

    • Target is Flanked
    • NPC is Sneaking and Target cannot overcome it
    • Target cannot sense NPC (LOS, Invisibility)
    • Attack is Critical, and NPC has “Telling Blow” feature
    If any of these circumstances pass the Sneak Damage is calculated and applied.

    Sneak Attack Bonus
    There is no implementation of Sneak Attack bonus in ToEE.

    Sneak Action Cost
    In ToEE and T+ Sneak is Move Action cost.
     
    Last edited: Mar 7, 2020
  2. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    200
    A -20 penalty to combat sneaking obliterates necessity to expand Sneak implementation further. So the question is - why -20?

    Let's see expanded description of Hiding in D&D 3.5 - How to Stealth article.
    There are following predicates for Hide:
    • Character MUST be concealed or covered (no LOS) or have HiPS (Hide in Plain Sight feat);
    • Character MUSTN'T be observed.
    Conceal
    In ToEE it is: nothing. There is different thing - dispTypeGetDefenderConcealmentMissChance, which is added by:
    • Invisibility
    • Blur
    • etc
    Cover
    In ToEE cover is applied, when Line of Sight function goes through a Map Tile with Has Cover flagged.

    Observed
    In ToEE, if combatant has LOS, then he always observes NPC. I think it is justification of -20 penalty.
     
  3. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,655
    Likes Received:
    352
    Great work @anatoliy :) what were your plans for this?
     
  4. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    200
    Thanks @Shiningted :)

    I'm working on Cormyr module, as a hobby project mostly. I'm running this printed module as DM for my local team, 9 sessions already.
    So the Cormyr module rely on Hide in many encounters, as it is Shadow Plane theme, with Dark template. Which allow Hide in Plain Sight for some creatures.

    Unfortunately there are quite a few limitations in ToEE T+ engine, which I'm trying to address. Mostly by talking to Sitra in private chats. As some of changes needs T+ cpp alterations.

    For example, one of thing I created recently is fix for lack of Sneak Attack enemy AC issue. As I noted above, currently target won't have AC penalty from Sneak Attack.

    Sneak extension - flatfooted against sneak attack.

    The code:
    Code:
    from templeplus.pymod import PythonModifier
    from toee import *
    
    ###################################################
    
    def GetConditionName():
        return "Sneak_Attack_Ex"
    
    print("Registering " + GetConditionName())
    ###################################################
    
    def SneakAttackEx_OnGetAcModifierFromAttacker(attachee, args, evt_obj):
        if (evt_obj.attack_packet.target.has_feat(feat_uncanny_dodge)):
            evt_obj.bonus_list.add_zeroed(165) # {165}{Dex bonus retained due to ~Uncanny Dodge~[TAG_CLASS_FEATURES_UNCANNY_DODGE]}
        else:
            evt_obj.bonus_list.add_cap(8, 0, 153, "Sneak Attack") # {153}{Condition: ~Flatfooted~[TAG_FLAT_FOOTED]}
            evt_obj.bonus_list.add_cap(3, 0, 153, "Sneak Attack")
        return 0
    
    
    modObj = PythonModifier(GetConditionName(), 2)
    modObj.MapToFeat(feat_sneak_attack)
    modObj.AddHook(ET_OnGetAcModifierFromAttacker, EK_NONE, SneakAttackEx_OnGetAcModifierFromAttacker, ())
    Tested in this video, 52nd second. The code taken from vanilla flatfooted condition function FlatfootedAcBonus(100E9C00).
     
Our Host!