Esempio n. 1
0
def san_new_map(attachee, triggerer):
    randy1 = game.random_range(1, 12)  # added by ShiningTed
    #	if (attachee.map == 5065):				## Removed by Livonya
    #		leader = attachee.leader_get()		## Removed by Livonya
    #		if (leader != OBJ_HANDLE_NULL):		## Removed by Livonya
    #			leader.begin_dialog( attachee, 270 )## Removed by Livonya
    if ((attachee.map == 5111) and (game.global_flags[200] == 0)):
        game.global_flags[200] = 1
        leader = attachee.leader_get()
        if (leader != OBJ_HANDLE_NULL):
            leader.begin_dialog(attachee, 290)
    if (attachee.map == 5066):
        leader = attachee.leader_get()
        if (leader != OBJ_HANDLE_NULL):
            leader.begin_dialog(attachee, 300)
    if (game.global_flags[833] == 0
            and (attachee.map == 5001 or attachee.map == 5051)):
        leader = attachee.leader_get()
        if (leader != OBJ_HANDLE_NULL):
            leader.begin_dialog(attachee, 600)
    if ((attachee.map == 5013) and randy1 >= 6):  # added by ShiningTed
        attachee.float_line(12029, triggerer)
    if ((attachee.map == 5042) and randy1 >= 8):  # added by ShiningTed
        attachee.float_line(12060, triggerer)
    return RUN_DEFAULT
Esempio n. 2
0
def san_end_combat(attachee, triggerer, generated_from_timed_event_call=0):
    if attachee.is_unconscious() == 1:
        return RUN_DEFAULT
    curr = attachee.stat_level_get(stat_hp_current) - attachee.stat_level_get(
        stat_subdual_damage)
    maxx = attachee.stat_level_get(stat_hp_max)
    xx = attachee.location & (0xFFFF)
    hp_percent_lareth = 100 * curr / maxx
    ggv400 = game.global_vars[400]
    ggv401 = game.global_vars[401]
    if generated_from_timed_event_call == 0 and game.global_flags[834] == 0:
        if ((ggv401 >> 15) & 7) == 1:
            closest_distance_1 = game.leader.distance_to(attachee)
            for pc in game.party:
                closest_distance_1 = min(closest_distance_1,
                                         pc.distance_to(attachee))

            if closest_distance_1 <= 25 or xx > 480:
                for ppq in range(3, 26):
                    game.timevent_add(san_start_combat,
                                      (attachee, triggerer, 1, ppq),
                                      ppq * 2500 + game.random_range(0, 20), 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

    if generated_from_timed_event_call == 0:
        # Wake up sleeping guy script
        bbb = attachee.obj_get_int(obj_f_critter_strategy)
        if bbb == 80:  # if using the 'seek beacon' strategy
            bbb = attachee.obj_get_int(
                obj_f_pad_i_0)  # retrieve previous strat
            attachee.obj_set_int(obj_f_critter_strategy, bbb)
            for obj in game.obj_list_cone(attachee, OLC_NPC, 20, 0, 360):
                if obj.name in range(14074, 14078) and obj != attachee:
                    obj_pad3 = obj.obj_get_int(obj_f_npc_pad_i_3)
                    if obj_pad3 & (2**8) != 0:  # is a beacon object
                        obj.destroy()
    #	if can_see_party(attachee):
    #		flash_signal(10)
    #		attachee.obj_set_int(obj_f_critter_strategy, 82)
    #	game.timevent_add(san_end_combat, ( attachee, triggerer, 1), 300, 1)
    #else:
    #	if can_see_party(attachee):
    #		flash_signal(10)
    #		attachee.obj_set_int(obj_f_critter_strategy, 82)
    dummy = 1
    return RUN_DEFAULT
Esempio n. 3
0
def san_dialog(attachee, triggerer):
    if (game.global_flags[840] == 1 and attachee.name == 14614):
        triggerer.begin_dialog(attachee, 500)
    elif (game.global_flags[840] == 1 and attachee.name == 14617):
        triggerer.begin_dialog(attachee, 600)
    elif (not attachee.has_met(triggerer)):
        triggerer.begin_dialog(attachee, 1)
    elif (attachee.leader_get() != OBJ_HANDLE_NULL):
        triggerer.begin_dialog(attachee, 200)
    elif (game.global_flags[837] == 1):
        triggerer.begin_dialog(attachee, 100)

    else:
        rr = game.random_range(1, 13)
        rr = rr + 79
        attachee.float_line(rr, triggerer)
    return SKIP_DEFAULT
Esempio n. 4
0
def san_join(attachee, triggerer):
    if (game.story_state <= 1 and game.global_flags[806] == 0):
        game.story_state = 2
    if (game.global_flags[340] == 1 and game.global_flags[806] == 0):
        # Playing demo version
        game.global_flags[834] = 1
        triggerer.begin_dialog(attachee, 380)

    # Make his surviving fellows disappear
    for obj in game.obj_list_vicinity(attachee.location, OLC_NPC):
        if obj.name in (range(14074, 14078)) and obj.stat_level_get(
                stat_hp_current) >= 0 and obj.leader_get() == OBJ_HANDLE_NULL:
            obj.runoff(obj.location - 3)
            game.global_vars[756] += 1
            game.timevent_add(destroy, (obj), 1000 + game.random_range(0, 200),
                              1)
    return RUN_DEFAULT
Esempio n. 5
0
def run_off(attachee, triggerer):
    record_time_stamp(425)
    for pc in game.party:
        attachee.ai_shitlist_remove(pc)
        attachee.reaction_set(pc, 50)
    attachee.runoff(attachee.location - 3)

    obj_list = game.obj_list_vicinity(attachee.location, OLC_NPC)
    for obj in game.obj_list_vicinity(attachee.location - 35, OLC_NPC):
        if not (obj in obj_list):
            obj_list += (obj, )
    for obj in game.obj_list_vicinity(attachee.location + 35, OLC_NPC):
        if not (obj in obj_list):
            obj_list += (obj, )
    for obj in game.obj_list_vicinity(attachee.location + 60, OLC_NPC):
        if not (obj in obj_list):
            obj_list += (obj, )
    for obj in obj_list:
        if obj.name in (range(14074, 14078)) and obj.stat_level_get(
                stat_hp_current) >= 0 and obj.leader_get() == OBJ_HANDLE_NULL:
            obj.runoff(obj.location - 3)
            game.global_vars[756] += 1
            game.timevent_add(destroy, (obj), 1000 + game.random_range(0, 200),
                              1)


#	if game.global_flags[277] == 0:
##Raimol rats the party out to the traders
#		for obj in game.party:
#			if obj.name == 8050:
#				a = game.encounter_queue
#				b = 1
#				for enc_id in a:
#					if enc_id == 3000:
#						b = 0
#				if b == 1:
#					game.global_flags[420] = 1
#					game.encounter_queue.append(3000)
    return RUN_DEFAULT
Esempio n. 6
0
def san_start_combat(attachee, triggerer):
    while (attachee.item_find(8903) != OBJ_HANDLE_NULL):
        attachee.item_find(8903).destroy()
    #if (attachee.d20_query(Q_Is_BreakFree_Possible)): # workaround no longer necessary!
    #	create_item_in_inventory( 8903, attachee )

    if (attachee.name == 14328
            and game.random_range(1, 100) <= 40):  ## Bodak Death Gaze
        attachee.spells_pending_to_memorized()

    if (attachee.name == 14309
            and game.random_range(1, 100) <= 25):  ## Gorgon Breath Attack
        attachee.spells_pending_to_memorized()

    if (attachee.name == 14109
            and game.random_range(1, 100) <= 25):  ## Ice Lizard Breath Attack
        attachee.spells_pending_to_memorized()

    if (attachee.name == 14342 and attachee.has_wielded(4083)):  ## Lamia
        attachee.item_find(4083).destroy()
        return RUN_DEFAULT
    if (attachee.name == 14342 and attachee.item_find(4083) == OBJ_HANDLE_NULL
            and game.random_range(1, 100) <= 50):
        create_item_in_inventory(4083, attachee)
        attachee.item_wield_best_all()

    if (attachee.name == 14295
            and not attachee.d20_query(Q_Critter_Is_Blinded)):  ## Basilisk
        attachee.spells_pending_to_memorized()

    if (attachee.name == 14258):  ## Guardian Vrock
        game.global_vars[762] = game.global_vars[762] + 1
        if (game.global_vars[762] >= 3):
            damage_dice = dice_new('1d8')
            game.particles('Mon-Vrock-Spores', attachee)
            for obj in game.obj_list_vicinity(attachee.location, OLC_CRITTERS):
                if (obj.distance_to(attachee) <= 10 and obj.name != 14258
                        and obj.name != 14361):
                    obj.spell_damage(attachee, D20DT_POISON, damage_dice,
                                     D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 261)
                    game.particles('Mon-Vrock-Spores-Hit', obj)

#		damage_dice = dice_new( '1d8' )
#		game.particles( 'Mon-Vrock-Spores', attachee)
#		for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS):
#			if (obj.distance_to(attachee) <= 10 and obj.name != 14258):
#				obj.damage( OBJ_HANDLE_NULL, D20DT_POISON, damage_dice, D20DAP_NORMAL)
#				obj.spell_damage( attachee, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 261 )
#				obj.condition_add_with_args( "Poisoned", 273 , 10)
#				obj.condition_add_with_args( 'sp-Vrock Spores', 273, 10, 0)

#				game.particles( 'Mon-Vrock-Spores-Hit', obj )

#	if ((attachee.name == 14259 or attachee.name == 14360) and game.random_range(1,3) <= 3):
#		create_item_in_inventory( 8909, attachee )

#################################
# Spiritual Weapon Shenanigens	#
#################################
    Spiritual_Weapon_Begone(attachee)

    return RUN_DEFAULT
Esempio n. 7
0
def council_events():
    ### this script is fired from first_heartbeat in the Hommlet Exterior map 5001
    if (game.leader.map == 5001 and game.global_vars[435] == 4
            and game.global_flags[435] == 0 and game.global_flags[432] == 1):
        #### spawns everyone that was inside Towne Hall
        game.global_flags[435] = 1
        burne = game.obj_create(14453, location_from_axis(578, 406))
        burne.scripts[10] = 0
        burne.scripts[19] = 0
        burne.obj_set_int(obj_f_critter_description_unknown, 20000)
        burne.move(location_from_axis(578, 406), 0.0, 0.0)
        burne.rotation = 1
        destroy_weapons(burne, 4058, 0, 0)
        jaroo = game.obj_create(14005, location_from_axis(583, 412))
        jaroo.scripts[10] = 0
        jaroo.scripts[19] = 0
        jaroo.obj_set_int(obj_f_critter_description_unknown, 20001)
        jaroo.move(location_from_axis(583, 412), 0.0, 0.0)
        jaroo.rotation = 0
        destroy_weapons(jaroo, 4047, 4111, 0)
        rufus = game.obj_create(14006, location_from_axis(571, 407))
        rufus.scripts[10] = 0
        rufus.scripts[19] = 0
        rufus.obj_set_int(obj_f_critter_description_unknown, 8071)
        rufus.move(location_from_axis(571, 407), 0.0, 0.0)
        rufus.rotation = 3
        terjon = game.obj_create(14007, location_from_axis(570, 412))
        terjon.scripts[10] = 0
        terjon.scripts[19] = 0
        terjon.obj_set_int(obj_f_critter_description_unknown, 20003)
        terjon.move(location_from_axis(570, 412), 0.0, 0.0)
        terjon.rotation = 4.5
        destroy_weapons(terjon, 4124, 6054, 0)
        renton = game.obj_create(14012, location_from_axis(583, 409))
        renton.scripts[10] = 0
        renton.scripts[19] = 0
        renton.obj_set_int(obj_f_critter_description_unknown, 20007)
        renton.move(location_from_axis(583, 409), 0.0, 0.0)
        renton.rotation = 1
        destroy_weapons(renton, 4096, 4036, 6074)
        nevets = game.obj_create(14102, location_from_axis(576, 407))
        nevets.scripts[10] = 0
        nevets.scripts[19] = 0
        nevets.obj_set_int(obj_f_critter_description_unknown, 20058)
        nevets.move(location_from_axis(576, 407), 0.0, 0.0)
        nevets.rotation = 3
        miller = game.obj_create(14031, location_from_axis(571, 412))
        miller.scripts[10] = 0
        miller.scripts[19] = 0
        miller.obj_set_int(obj_f_critter_description_unknown, 20026)
        miller.move(location_from_axis(571, 412), 3.0, 0.0)
        miller.rotation = 3
        miller.condition_add_with_args("Prone", 0, 0)
        gundi = game.obj_create(14016, location_from_axis(582, 411))
        gundi.scripts[10] = 0
        gundi.scripts[19] = 0
        gundi.obj_set_int(obj_f_critter_description_unknown, 20011)
        gundi.move(location_from_axis(582, 411), -10.0, -10.0)
        gundi.rotation = 3
        gundi.condition_add_with_args("Prone", 0, 0)
        crybaby = game.obj_create(14002, location_from_axis(575, 417))
        crybaby.move(location_from_axis(575, 417), 0.0, 0.0)
        crybaby.scripts[10] = 0
        crybaby.scripts[19] = 0
        crybaby.rotation = 5.5
        crybaby.scripts[19] = 0
        crybaby.object_flag_unset(OF_OFF)
        if (game.global_vars[436] == 4):
            game.timevent_add(proactivity, (crybaby, 3000), 2000)
        else:
            game.timevent_add(proactivity, (crybaby, 3000), 7000)

        randy1 = game.random_range(1, 2)
        randy1 = 2
        #remove randomness for testing purposes
        if (randy1 == 1):
            gremag = game.obj_create(14014, location_from_axis(365, 653))
            gremag.condition_add_with_args("Invisible", 0, 0)
            gremag.object_flag_set(OF_DONTDRAW)
            rannos = game.obj_create(14018, location_from_axis(366, 655))
            rannos.condition_add_with_args("Invisible", 0, 0)
            rannos.object_flag_set(OF_DONTDRAW)
            dlg_popup = game.obj_create(14806, location_from_axis(364, 653))
        else:
            gremag = game.obj_create(14014, location_from_axis(318, 495))
            gremag.condition_add_with_args("Invisible", 0, 0)
            gremag.object_flag_set(OF_DONTDRAW)
            rannos = game.obj_create(14018, location_from_axis(320, 496))
            rannos.condition_add_with_args("Invisible", 0, 0)
            rannos.object_flag_set(OF_DONTDRAW)
            dlg_popup = game.obj_create(14806, location_from_axis(317, 494))
            #dlg_popup.object_flag_unset(OF_DONTDRAW)
            #dlg_popup.object_flag_unset(OF_CLICK_THROUGH)
        #### damage section, tough ones:
        if (game.global_vars[436] != 4):
            lightly_damage(renton)
            lightly_damage(terjon)
            lightly_damage(rufus)
            lightly_damage(jaroo)
            lightly_damage(burne)
            game.timevent_add(heal_script, (terjon, rufus), 8500)
            game.timevent_add(heal_script, (jaroo, renton), 9500)
        #### damage section, frail but important ones:
        if (game.global_vars[436] != 4):
            if (game.global_vars[436] != 6 and game.global_vars[436] != 7):
                lightly_damage(nevets)
                lightly_damage(gundi)
                game.timevent_add(heal_script, (jaroo, gundi), 700)
                game.timevent_add(heal_script, (jaroo, nevets), 5800)
            else:
                heavily_damage(nevets)
                heavily_damage(gundi)
        #### damage section, frail and unimportant ones:
        if (get_v(436) != 4):
            if (get_v(436) == 3):
                lightly_damage(miller)
                game.timevent_add(float_comment, (terjon, 3000), 3500)
                game.timevent_add(heal_script, (terjon, miller), 3510)
            else:
                heavily_damage(miller)
    return
Esempio n. 8
0
def money_script():
    # money script by Agetian
    # strip all money
    game.global_flags[500] = 1
    # added by Gaear - denotes you are playing NC
    if (game.leader.money_get() >= 50000):
        game.party[0].money_adj(-game.party[0].money_get())
        #add 200-300 gold pocket money
        game.party[0].money_adj(game.random_range(20000, 30000))
    for pc in game.party:
        lsw = pc.item_find_by_proto(4036)
        scm = pc.item_find_by_proto(4045)
        # get rid of an extra longsword (4036) and scimitar(4045)
        for pp in range(0, 24):
            invItem = pc.inventory_item(pp)
            if (invItem.proto == 4036 and invItem != lsw):
                invItem.destroy()
            if (invItem.proto == 4045 and invItem != scm):
                invItem.destroy()
        # give money per PHB (for each class)
        if (pc.stat_level_get(stat_level_barbarian) > 0):
            pc.money_adj(game.random_range(4000, 16000))
        if (pc.stat_level_get(stat_level_bard) > 0):
            pc.money_adj(game.random_range(4000, 16000))
        if (pc.stat_level_get(stat_level_cleric) > 0):
            pc.money_adj(game.random_range(5000, 20000))
        if (pc.stat_level_get(stat_level_druid) > 0):
            pc.money_adj(game.random_range(2000, 8000))
        if (pc.stat_level_get(stat_level_fighter) > 0):
            pc.money_adj(game.random_range(6000, 24000))
        if (pc.stat_level_get(stat_level_monk) > 0):
            pc.money_adj(game.random_range(5000, 20000))
        if (pc.stat_level_get(stat_level_paladin) > 0):
            pc.money_adj(game.random_range(6000, 24000))
        if (pc.stat_level_get(stat_level_ranger) > 0):
            pc.money_adj(game.random_range(6000, 24000))
        if (pc.stat_level_get(stat_level_rogue) > 0):
            pc.money_adj(game.random_range(5000, 20000))
        if (pc.stat_level_get(stat_level_sorcerer) > 0):
            pc.money_adj(game.random_range(3000, 12000))
        if (pc.stat_level_get(stat_level_wizard) > 0):
            pc.money_adj(game.random_range(3000, 12000))
    return
Esempio n. 9
0
def san_start_combat(attachee,
                     triggerer,
                     generated_from_timed_event_call=0,
                     talk_stage=-999):
    if attachee.is_unconscious() == 1:
        return RUN_DEFAULT

    #if generated_from_timed_event_call == 0 and attachee.distance_to( party_closest(attachee) ) > 45:
    #	attachee.move( party_closest(attachee).location, 0 , 0)
    #	for pp in range(0, 41):
    #		attachee.scripts[pp] = 998
    #	game.leader.ai_follower_add(attachee)
    #	#game.timevent_add( lareth_abandon, (attachee, triggerer), 20, 1)
    #

    curr = attachee.stat_level_get(stat_hp_current) - attachee.stat_level_get(
        stat_subdual_damage)
    maxx = attachee.stat_level_get(stat_hp_max)
    xx = attachee.location & (0xFFFF)
    hp_percent_lareth = 100 * curr / maxx
    ggv400 = game.global_vars[400]
    ggv401 = game.global_vars[401]
    pad3 = attachee.obj_get_int(obj_f_npc_pad_i_3)

    if (attachee.map == 5005) and (party_too_far_from_lareth(attachee)) and (
            generated_from_timed_event_call == 0):
        if ((pad3 & (2**2)) == 0):
            # Delay for one round, letting him cast Shield of Faith - he'll need it :)
            pad3 |= (2**2)
            attachee.obj_set_int(obj_f_npc_pad_i_3, pad3)
            return
        # Party is too far from Lareth, gotta nudge him in the right direction
        # spawn a beacon and change Lareth's strat to approach it
        if xx > 478:
            beacon_loc = 498L + ((550L) << 32)
        else:
            beacon_loc = 487L + ((540L) << 32)
        obj_beacon = game.obj_create(14074, beacon_loc)
        obj_beacon.object_flag_set(OF_DONTDRAW)
        obj_beacon.object_flag_set(OF_CLICK_THROUGH)
        obj_beacon.move(beacon_loc, 0, 0)
        obj_beacon.stat_base_set(stat_dexterity, -30)
        obj_beacon.obj_set_int(obj_f_npc_pad_i_3, 2**8)
        obj_beacon.attack(game.leader)
        obj_beacon.add_to_initiative()

        attachee.obj_set_int(
            obj_f_pad_i_0, attachee.obj_get_int(
                obj_f_critter_strategy))  # Record original strategy
        attachee.obj_set_int(obj_f_critter_strategy,
                             80)  # set Lareth's strat to "seek beacon"

        grease_detected = 0
        for spell_obj in game.obj_list_cone(closest_pc_1, OLC_GENERIC, 40, 0,
                                            360):
            # Check for active GREASE spell object
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 200 + (1 << 15):
                grease_detected = 1
                grease_obj = spell_obj
        if grease_detected:
            # In case Lareth slips and doesn't execute his san_end_combat (wherein the beacon object is destroyed) - spawn a couple of timed events to guarantee the beacon doesn't survive
            game.timevent_add(kill_beacon_obj, (obj_beacon, attachee), 3700, 1)
            game.timevent_add(kill_beacon_obj, (obj_beacon, attachee), 3900, 1)
        return RUN_DEFAULT

    # strategy 81 - Approach Party strategy
    if attachee.obj_get_int(obj_f_critter_strategy
                            ) == 81 and generated_from_timed_event_call == 0:
        if can_see_party(attachee):
            attachee.obj_set_int(obj_f_critter_strategy, 82)

    if attachee.obj_get_int(obj_f_critter_strategy
                            ) != 81 and generated_from_timed_event_call == 0:
        # Should Lareth cast Obscuring Mist?
        # First, find closest party member - the most likely target for an archer
        closest_pc_1 = game.leader
        for pc in game.party[0].group_list():
            if pc.distance_to(attachee) < closest_pc_1.distance_to(attachee):
                closest_pc_1 = pc

        # Then, check for spell objects with the Obscuring Mist ID, which are also identified as active
        player_in_obscuring_mist = 0
        for spell_obj in game.obj_list_cone(closest_pc_1, OLC_GENERIC, 30, 0,
                                            360):
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 333 + (
                    1 << 15) and spell_obj.distance_to(closest_pc_1) <= 17.5:
                player_in_obscuring_mist = 1

        player_cast_web = 0
        player_cast_entangle = 0
        for spell_obj in game.obj_list_vicinity(attachee.location,
                                                OLC_GENERIC):
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 531 + (1 << 15):
                player_cast_web = 1
            if spell_obj.obj_get_int(obj_f_secretdoor_dc) == 153 + (1 << 15):
                player_cast_entangle = 1

        # Assess level of ranged weapon threat
        ranged_threat = 0
        for pc in game.party[0].group_list():
            pc_weap = pc.item_worn_at(3).obj_get_int(obj_f_weapon_type)
            if pc_weap in [14, 17, 46, 48, 68] and pc.is_unconscious() == 0:
                # 14 - light crossbow
                # 17 - heavy crossbow
                # 46 - shortbow
                # 48 - longbow
                # 68 - repeating crossbow
                if ranged_threat == 0:
                    ranged_threat = 1
                if pc.has_feat(feat_point_blank_shot) or (
                        pc.stat_level_get(stat_level_fighter) +
                        pc.stat_level_get(stat_level_ranger)) >= 1:
                    if ranged_threat < 2:
                        ranged_threat = 2
                if pc.has_feat(feat_precise_shot) and (
                        pc.stat_level_get(stat_level_fighter) +
                        pc.stat_level_get(stat_level_ranger)) >= 1:
                    if ranged_threat < 3:
                        ranged_threat = 3

        if (attachee.map == 5005
                and xx > 478) and ((ggv401 >> 25) & 3 == 0) and (
                    (ranged_threat == 3) or
                    (ranged_threat > 1 and player_in_obscuring_mist == 1) or
                    (ranged_threat > 0 and
                     (player_cast_entangle or player_cast_web))):
            # Cast Obscuring Mist, if:
            #  1. Haven't cast it yet  - (ggv401 >> 25) & 3
            #  2. Ranged threat exists (emphasized when player casts web or is in obscuring mist)
            # Give him a potion of Obscuring Mist, to simulate him having that scroll (just like I do...)
            if attachee.item_find_by_proto(8899) == OBJ_HANDLE_NULL:
                attachee.item_get(game.obj_create(8899, attachee.location))
            ggv401 += 1 << 25
            game.global_vars[401] = ggv401
            lareth_is_threatened = 0
            if closest_pc_1.distance_to(attachee) <= 3:
                lareth_is_threatened = 1
            if lareth_is_threatened == 1:
                attachee.obj_set_int(obj_f_critter_strategy,
                                     85)  # Obscuring Mist + 5ft step
            else:
                attachee.obj_set_int(obj_f_critter_strategy,
                                     86)  # Just Obscuring Mist
        elif (pad3 &
              (2**1) == 0) and (player_cast_entangle or player_cast_web):
            attachee.obj_set_int(obj_f_critter_strategy, 87)  # Dispel strat
            pad3 |= (2**1)
            attachee.obj_set_int(obj_f_npc_pad_i_3, pad3)
        elif attachee.map == 5005 and player_entrenched_in_corridor(attachee):
            attachee.obj_set_int(obj_f_critter_strategy, 89)
        else:
            attachee.obj_set_int(obj_f_critter_strategy, 82)

    if (hp_percent_lareth < 50) and (generated_from_timed_event_call == 0
                                     or generated_from_timed_event_call == 1
                                     and talk_stage == 667):

        if (ggv400 & (2**6)) == 0:
            found_pc = OBJ_HANDLE_NULL
            obj_list = game.obj_list_vicinity(attachee.location, OLC_NPC)

            # Extending the range a little...

            for obj in game.obj_list_vicinity(attachee.location - 35, OLC_NPC):
                if not (obj in obj_list):
                    obj_list += (obj, )

            for obj in game.obj_list_vicinity(attachee.location + 35, OLC_NPC):
                if not (obj in obj_list):
                    obj_list += (obj, )

            for obj in obj_list:
                for pc in game.leader.group_list():
                    if pc.type == obj_t_pc and pc.is_unconscious() == 0:
                        found_pc = pc
                    #if obj.name in ([attachee.name] + range(14074, 14078)):
                    obj.ai_shitlist_remove(pc)
                    obj.reaction_set(pc, 50)
                    obj.remove_from_initiative(obj)
                    if pc.type == obj_t_npc:
                        pc.ai_shitlist_remove(obj)
                for obj2 in game.obj_list_vicinity(attachee.location, OLC_ALL):
                    if obj2.type == obj_t_pc or obj2.type == obj_t_npc:
                        obj2.reaction_set(obj, 50)
                        try:
                            obj2.ai_shitlist_remove(obj)
                        finally:
                            dummy = 1
                        obj2.remove_from_initiative(obj2)

            if generated_from_timed_event_call == 0:
                game.timevent_add(san_start_combat,
                                  (attachee, triggerer, 1, 667), 100, 1)
            elif found_pc != OBJ_HANDLE_NULL:
                ggv400 |= 2**6
                game.global_vars[400] = ggv400
                game.global_flags[834] = 1
                found_pc.begin_dialog(attachee, 160)
                return SKIP_DEFAULT

    elif generated_from_timed_event_call == 0 and game.global_flags[834] == 0:
        if ((ggv401 >> 15) & 7) == 0:
            ggv401 += 1 << 15
            game.global_vars[401] = ggv401
        elif ((ggv401 >> 15) & 7) == 1:
            closest_distance_1 = game.leader.distance_to(attachee)
            for pc in game.party:
                closest_distance_1 = min(closest_distance_1,
                                         pc.distance_to(attachee))
            if closest_distance_1 < 45:
                for ppq in range(3, 26):
                    game.timevent_add(san_start_combat,
                                      (attachee, triggerer, 1, ppq),
                                      ppq * 2500 + game.random_range(0, 20), 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

    elif generated_from_timed_event_call == 1 and game.global_flags[834] == 0:
        if (hp_percent_lareth > 75) and (
                ggv400 & (2**4)) == 0 and attachee.d20_query(Q_Prone) == 0:
            if talk_stage >= 3 and ((ggv401 >> 15) & 31) == 2:
                attachee.float_line(6000, triggerer)
                game.sound(4201, 1)
                game.sound(4201, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 3 and ((ggv401 >> 15) & 31) == 3:
                game.sound(4202, 1)
                game.sound(4202, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 3 and ((ggv401 >> 15) & 31) == 4:
                game.sound(4203, 1)
                game.sound(4203, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 8 and ((ggv401 >> 15) & 31) == 5:
                attachee.float_line(6001, triggerer)
                game.sound(4204, 1)
                game.sound(4204, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 8 and ((ggv401 >> 15) & 31) == 6:
                game.sound(4205, 1)
                game.sound(4205, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 13 and ((ggv401 >> 15) & 31) == 7:
                attachee.float_line(6002, triggerer)
                game.sound(4206, 1)
                game.sound(4206, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 13 and ((ggv401 >> 15) & 31) == 8:
                game.sound(4207, 1)
                game.sound(4207, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 18 and ((ggv401 >> 15) & 31) == 9:
                attachee.float_line(6003, triggerer)
                game.sound(4208, 1)
                game.sound(4208, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 18 and ((ggv401 >> 15) & 31) == 10:
                game.sound(4209, 1)
                game.sound(4209, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

            elif talk_stage >= 22 and ((ggv401 >> 15) & 31) == 11:
                attachee.float_line(6004, triggerer)
                game.sound(4210, 1)
                game.sound(4210, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 22 and ((ggv401 >> 15) & 31) == 12:
                attachee.float_line(6004, triggerer)
                game.sound(4211, 1)
                game.sound(4211, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401
            elif talk_stage >= 22 and ((ggv401 >> 15) & 31) == 13:
                attachee.float_line(6004, triggerer)
                game.sound(4212, 1)
                game.sound(4212, 1)
                ggv401 += 1 << 15
                game.global_vars[401] = ggv401

        elif (hp_percent_lareth <= 75) and (ggv400 & (2**4)) == 0:
            if ((ggv401 >> 15) & 31) > 2:
                attachee.float_line(6005, triggerer)
                game.sound(4200, 1)
                game.sound(4200, 1)
            game.timevent_add(san_start_combat, (attachee, triggerer, 1, 667),
                              5500, 1)
            ggv400 |= 2**4
            game.global_vars[400] = ggv400

    #################################
    # Spiritual Weapon Shenanigens	#
    #################################
    Spiritual_Weapon_Begone(attachee)

    return RUN_DEFAULT