Spell Magic Weapon - alter target to PC / NPC

Discussion in 'General Modification' started by anatoliy, Jun 8, 2021.

Remove all ads!
  1. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    201
    Magic Weapon spell is Touch spell, target of which is any weapon. Either of caster's or other NPC's weapon.

    I think designer did not understood the spell's applicability. Me as well.

    Until I started to dig around magic items accessibility in D&D 3.5 books. Apparently +1 weapon should be accessible around level 6!

    So essentially until Fighter get his hands on magic weapon, he would have difficulty fighting with Damage Reduction x / magic creatures. That's where Magic Weapon spell comes handy.

    Moreover, +2 weapon is supposed to be found around level 11 (!!!). Meaning that Greater Magic Weapon hour/caster level will become major thing.

    Now vanilla implementation of Magic Weapon will open inventory.

    I propose to alter it to select one critter and apply Magic Weapon condition on primary weapon. If primary already has effect, then on secondary weapon.

    Thoughts?
     
  2. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    I agree that the current flow of enchant weapon -> transfer to fighter is annoying. But ideally I'd prefer to have it open the inventory on the target. BTW does rhat work if you right xlick on someone to open the radial?
     
  3. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    201
    Vanilla spell will immediately open Inventory. If you change inventory to someone else, spell will be cancelled.
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Again, to emphasize: if you bring up the radial menu by right clicking on a party member it will set the d20action target. Are you sure that doesn't make it open their inventory?
     
    anatoliy likes this.
  5. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    201
    Just checked. It will always bring up caster's inventory, even over adjacent PC.
     
  6. Endarire

    Endarire Ronald Rynnwrathi

    Joined:
    Jan 7, 2004
    Messages:
    982
    Likes Received:
    120
    Magic weapon and its greater versions are temporary bonuses whereas permanent magic weapons cost more.

    Regardless, I agree that these spells should be touch range or they should just apply to all equipped weapons on a subject. (Click the person, not the object.) It ain't RAW but it's faster and simpler.
     
  7. dolio

    dolio Established Member Supporter

    Joined:
    May 30, 2005
    Messages:
    345
    Likes Received:
    85
    It probably wouldn't be difficult to change it to a touch spell that affects whatever weapon the target is currently wielding (but only main hand, I guess).

    Being able to select something in another person's inventory would be nice, though (there are other spells I'm interested in that might benefit from that). The flexibility of the inventory targeting is kind of attractive, even if it's annoying to manage in other cases.
     
  8. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    201
    I did it for zmod games by clicking on a PC, then check for primary weapon if it's already has this condition, if so, then choose secondary weapon.

    Spell292 - Magic Weapon.py
    Code:
    import toee
    
    def OnBeginSpellCast( spell ):
        print("Magic Weapon OnBeginSpellCast")
        print("spell.target_list={}".format(spell.target_list))
        print("spell.caster={}  caster.level= {}".format(spell.caster, spell.caster_level))
        toee.game.particles("sp-transmutation-conjure", spell.caster)
        return
    
    def    OnSpellEffect(spell):
        assert isinstance(spell, toee.PySpell)
        print "Magic Weapon:: OnSpellEffect(spell.caster: {}, caster.level: {}, target_list: {}, )".format(spell.caster, spell.caster_level, spell.target_list)
    
        spell.duration = 10 * spell.caster_level # minute per caster level
        target_item = spell.target_list[0]
    
        weapon = None
        target_type = None
        if (target_item.obj):
            target_type = target_item.obj.type
    
        while (True):
            if target_type == toee.obj_t_weapon:
                weapon = target_item.obj
    
            if (target_type == toee.obj_t_npc):
                if (not spell.caster.is_friendly(target_item.obj)):
                    break
    
            if (target_type == toee.obj_t_pc or target_type == toee.obj_t_npc):
                weapon = target_item.obj.item_worn_at(toee.item_wear_weapon_primary)
                if (weapon and weapon.d20_query_has_spell_condition(toee.sp_Magic_Weapon)):
                    weapon = None
                if (not weapon):
                    weapon = target_item.obj.item_worn_at(toee.item_wear_weapon_secondary)
    
            if (weapon and weapon.d20_query_has_spell_condition(toee.sp_Magic_Weapon)):
                weapon = None
    
            break
    
        if weapon:
            print("sp-Magic Weapon: {}".format(weapon))
            if (weapon != target_item.obj):
                target_item.obj = weapon
            weapon.d20_status_init()
            weapon.condition_add_with_args('sp-Magic Weapon', spell.id, spell.duration, 0)
            target_item.partsys_id = toee.game.particles('sp-Detect Magic 2 Med', spell.caster)
        else:
            # not an item!
            target_item.obj.float_mesfile_line('mes\\spell.mes', 30003)
            toee.game.particles( 'Fizzle', spell.caster)
            spell.target_list.remove_target(target_item.obj)
            spell.spell_end(spell.id)
    
    def OnBeginRound( spell ):
        print "Magic Weapon OnBeginRound"
    
    def OnEndSpellCast( spell ):
        print "Magic Weapon OnEndSpellCast"
     
Our Host!