Exemplo n.º 1
0
def ImbueArrowPerform(attachee, args, evt_obj):
    cur_seq = tpactions.get_cur_seq()
    tgtLoc = cur_seq.spell_packet.loc.loc_and_offsets
    arrowTgt = evt_obj.d20a.target
    min_dist = 10000
    if arrowTgt == OBJ_HANDLE_NULL:
        for p in range(0, 32):
            tgt = cur_seq.spell_packet.get_target(p)
            if tgt == OBJ_HANDLE_NULL:
                break
            dist_to_tgt = tgt.distance_to(tgtLoc.get_location(), tgtLoc.off_x,
                                          tgtLoc.off_y)
            #print "Distance to tgt " + str(tgt) + ": " + str(dist_to_tgt)
            if arrowTgt == OBJ_HANDLE_NULL or dist_to_tgt < min_dist:
                if dist_to_tgt < 1 or (not tgt.is_friendly(attachee)):
                    min_dist = dist_to_tgt
                    arrowTgt = tgt
    evt_obj.d20a.target = arrowTgt
    #print "Imbue arrow: target is " + str(arrowTgt)

    # roll to hit
    evt_obj.d20a.flags |= D20CAF_RANGED
    evt_obj.d20a.to_hit_processing()
    isCritical = 0
    if evt_obj.d20a.flags & D20CAF_CRITICAL:
        isCritical = 1

    #print "Imbue arrow: setting new spell ID"
    evt_obj.d20a.filter_spell_targets(cur_seq.spell_packet)
    new_spell_id = tpactions.get_new_spell_id()
    tpactions.register_spell_cast(cur_seq.spell_packet, new_spell_id)
    evt_obj.d20a.spell_id = new_spell_id
    cur_seq.spell_action.spell_id = new_spell_id
    cur_seq.spell_packet.debit_spell()
    #print "Imbue arrow: spell ID registered " + str(new_spell_id)

    # provoke hostility if applicable
    for p in range(0, 32):
        tgt = cur_seq.spell_packet.get_target(p)
        if tgt == OBJ_HANDLE_NULL:
            break
        if game.is_spell_harmful(cur_seq.spell_packet.spell_enum, attachee,
                                 tgt):
            attachee.attack(tgt)

    attachee.d20_send_signal(S_Spell_Cast, new_spell_id)
    for p in range(0, 32):
        tgt = cur_seq.spell_packet.get_target(p)
        if tgt == OBJ_HANDLE_NULL:
            break
        tgt.d20_send_signal(S_Spell_Cast, new_spell_id)

    if attachee.anim_goal_push_attack(arrowTgt, game.random_range(0, 2),
                                      isCritical, 0):
        new_anim_id = attachee.anim_goal_get_new_id()
        evt_obj.d20a.flags |= D20CAF_NEED_ANIM_COMPLETED
        evt_obj.d20a.anim_id = new_anim_id

    return 0
Exemplo n.º 2
0
def pythonActionPerformStorm(attachee, args, evt_obj):
    currentSequence = tpactions.get_cur_seq()
    spellPacket = currentSequence.spell_packet
    newSpellId = tpactions.get_new_spell_id()
    #evt_obj.d20a.spell_id = newSpellId
    spellPacket.caster_level = 17  #set caster level manually, SLA is cast as a level 17 cleric
    tpactions.register_spell_cast(spellPacket, newSpellId)
    tpactions.trigger_spell_effect(evt_obj.d20a.spell_id)
    return 0
Exemplo n.º 3
0
def OnStudyTargetPerform(attachee, args, evt_obj):
	#print "Performing Death Attack - Study Target"
	if evt_obj.d20a.target == OBJ_HANDLE_NULL:
		print "no target! PLS HANDLE ME"
	old_spell_id = args.get_arg(2)
	if old_spell_id:
		spell_packet = tpdp.SpellPacket(old_spell_id)
		prev_tgt = spell_packet.get_target(0)
		if prev_tgt != OBJ_HANDLE_NULL and prev_tgt.d20_query("Is Death Attack Target"):
			prev_tgt.d20_send_signal("Death Attack Target End", old_spell_id)
			prev_tgt.float_text_line("Target removed", tf_white)

	# put the new spell_id in arg2
	new_spell_id = tpactions.get_new_spell_id()
	args.set_arg(2, new_spell_id)
	# register the spell in the spells_cast repository so it triggers the spell scripts (Spell3210 - Death Attack.py)
	cur_seq = tpactions.get_cur_seq()
	tpactions.register_spell_cast(cur_seq.spell_packet, new_spell_id)
	tpactions.trigger_spell_effect(new_spell_id)
	return 0
Exemplo n.º 4
0
def PhaseArrowPerform(attachee, args, evt_obj):
    cur_seq = tpactions.get_cur_seq()
    arrowTgt = evt_obj.d20a.target
    min_dist = 10000
    #print "Phase arrow: target is " + str(arrowTgt)

    # roll to hit
    evt_obj.d20a.flags |= D20CAF_RANGED
    evt_obj.d20a.to_hit_processing()
    isCritical = 0
    if evt_obj.d20a.flags & D20CAF_CRITICAL:
        isCritical = 1

    if attachee.anim_goal_push_attack(arrowTgt, game.random_range(0, 2),
                                      isCritical, 0):
        new_anim_id = attachee.anim_goal_get_new_id()
        #print "new anim id: " + str(new_anim_id)
        evt_obj.d20a.flags |= D20CAF_NEED_ANIM_COMPLETED
        evt_obj.d20a.anim_id = new_anim_id

    return 0
Exemplo n.º 5
0
def SeekerArrowPerform(attachee, args, evt_obj):
    cur_seq = tpactions.get_cur_seq()
    arrowTgt = evt_obj.d20a.target
    min_dist = 10000
    #print "Seeker arrow: target is " + str(arrowTgt)

    # roll to hit
    # cover bonus won't be applied because it doesn't appear in the ActionCheck callback
    # TODO: apply a negator condition for the concealment chances
    evt_obj.d20a.flags |= D20CAF_RANGED
    evt_obj.d20a.to_hit_processing()
    isCritical = 0
    if evt_obj.d20a.flags & D20CAF_CRITICAL:
        isCritical = 1

    if attachee.anim_goal_push_attack(arrowTgt, game.random_range(0, 2),
                                      isCritical, 0):
        new_anim_id = attachee.anim_goal_get_new_id()
        #print "new anim id: " + str(new_anim_id)
        evt_obj.d20a.flags |= D20CAF_NEED_ANIM_COMPLETED
        evt_obj.d20a.anim_id = new_anim_id

    return 0
Exemplo n.º 6
0
def ImbueArrowActionFrame(attachee, args, evt_obj):
    #print "Imbue Arrow Action Frame"
    cur_seq = tpactions.get_cur_seq()

    tgt = evt_obj.d20a.target
    #print "Imbue Arrow Target: " + str(tgt)
    wpn = attachee.item_worn_at(item_wear_weapon_primary)
    if tgt != OBJ_HANDLE_NULL and wpn != OBJ_HANDLE_NULL:
        projectileProto = wpn.get_weapon_projectile_proto()
        tgtLoc = cur_seq.spell_packet.loc
        projectileHandle = evt_obj.d20a.create_projectile_and_throw(
            projectileProto, tgtLoc.loc_and_offsets)
        projectileHandle.obj_set_float(obj_f_offset_z, 60.0)
        cur_seq.spell_packet.spell_id = evt_obj.d20a.spell_id
        cur_seq.spell_packet.set_projectile(0, projectileHandle)
        ammoItem = OBJ_HANDLE_NULL
        if evt_obj.d20a.projectile_append(projectileHandle, ammoItem):
            #print "Imbue Arrow Action Frame: Projectile Appended"
            attachee.apply_projectile_particles(projectileHandle,
                                                evt_obj.d20a.flags)
            evt_obj.d20a.flags |= D20CAF_NEED_PROJECTILE_HIT
    else:
        tpactions.trigger_spell_effect(evt_obj.d20a.spell_id)
    return 0