def p4e2snipe(this):
    if this.status == globe.enstatus["dead"]:
        if this.frame == this.delay1 + 1:
            tmp = orbit.quickcreate(1,
                                    point=this.point,
                                    speed=8.5,
                                    bltype=lbltype["redround"])
            scgame.blmanager.create_enbl(lbltype["redround"], tmp)
            this.mtheta = tmp.gettheta() + random.random() * 4 - 2
        elif this.frame % 2 == 0:
            for i in range(-3, 3):
                tmp = orbit.quickcreate(0,
                                        point=this.point,
                                        theta=(this.mtheta + i * 45 - 2),
                                        speed=8.5,
                                        bltype=lbltype["redround"])
                scgame.blmanager.create_enbl(lbltype["redround"], tmp)
                tmp = orbit.quickcreate(0,
                                        point=this.point,
                                        theta=(this.mtheta + i * 45),
                                        speed=8.5,
                                        bltype=lbltype["redround"])
                scgame.blmanager.create_enbl(lbltype["redround"], tmp)
                tmp = orbit.quickcreate(0,
                                        point=this.point,
                                        theta=(this.mtheta + i * 45 + 2),
                                        speed=8.5,
                                        bltype=lbltype["redround"])
                scgame.blmanager.create_enbl(lbltype["redround"], tmp)
def downrand(this):
    if this.frame % 100 == 0:
        tmp = orbit.quickcreate(0,
                                point=this.point,
                                theta=int(random.random() * 180.0 + 90),
                                speed=3,
                                bltype=lbltype["redsword"])
        scgame.blmanager.create_enbl(lbltype["redsword"], tmp)
        tmp = orbit.quickcreate(0,
                                point=this.point,
                                theta=int(random.random() * 180.0 + 90),
                                speed=3,
                                bltype=lbltype["blueball"])
        scgame.blmanager.create_enbl(lbltype["blueball"], tmp)
def roundrand2(this):
    if this.frame % 16 == 0:
        if random.random() > 0.25:
            tmp = orbit.quickcreate(0,
                                    point=this.point,
                                    theta=int(random.random() * 180.0),
                                    speed=0.8,
                                    bltype=lbltype["orangerice"])
            scgame.blmanager.create_enbl(lbltype["orangerice"], tmp)
        else:
            tmp = orbit.quickcreate(0,
                                    point=this.point,
                                    theta=int(random.random() * 360.0),
                                    speed=0.8,
                                    bltype=lbltype["orangerice"])
            scgame.blmanager.create_enbl(lbltype["orangerice"], tmp)
def selfsniper(this):
    if this.frame % 12 == 0 and this.frame <= 90:
        tmp = orbit.quickcreate(1,
                                point=this.point,
                                speed=7,
                                bltype=lbltype["bluecircle"])
        scgame.blmanager.create_enbl(lbltype["bluecircle"], tmp)
def p2e2roundrand(this):
    if this.frame % 10 == 0:
        tmp = orbit.quickcreate(0,
                                point=this.point,
                                theta=int(random.random() * 180),
                                speed=4,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
def p3e1roundsnipe(this):
    if this.proc == 1:
        if this.frame % 70 == 0:
            tmp = orbit.quickcreate(1,
                                    point=this.point,
                                    speed=5.5,
                                    bltype=lbltype["greencircle"])
            scgame.blmanager.create_enbl(lbltype["bluecircle"], tmp)
            mtheta = tmp.gettheta()
            for i in range(-3, 3):
                if i == 0:
                    continue
                tmp = orbit.quickcreate(0,
                                        point=this.point,
                                        theta=(mtheta + i * 30),
                                        speed=4,
                                        bltype=lbltype["greencircle"])
                scgame.blmanager.create_enbl(lbltype["greencircle"], tmp)
def enbossNSC1(this):
    if this.frame % 4 == 0:
        tmp = orbit.quickcreate(
            0,
            point=(random.random() * globe.game_active_rect.width +
                   globe.game_active_rect.left, globe.game_active_rect.top),
            theta=180 + 30 * random.random() - 15,
            speed=5,
            bltype=lbltype["blueball"])
        scgame.blmanager.create_enbl(lbltype["blueball"], tmp)
def p5e1roundrand(this):
    if this.proc == 1:
        if this.frame % 2 == 0:
            for i in range(6):
                tmp = orbit.quickcreate(0,
                                        point=this.point,
                                        theta=(int(this.frame**2 / 13) % 360 +
                                               i * 60),
                                        speed=4.7,
                                        bltype=lbltype["bluerice"])
                scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
def init():
    global lbltype
    global lentype
    global orb
    global scgame
    scgame = globe.scgame
    lbltype = {}
    lentype = {}
    orb = {}

    random.seed(int(time.time()))

    lbltype["bluecircle"] = bullet.BulletType(scgame.rs.image["bullet1"][3][5],
                                              6)
    lbltype["orangerice"] = bullet.BulletType(scgame.rs.image["bullet1"][4][3],
                                              (0, 0, 8, 6))
    lbltype["bluerice"] = bullet.BulletType(scgame.rs.image["bullet1"][4][2],
                                            (0, 0, 8, 6))
    lbltype["redrice"] = bullet.BulletType(scgame.rs.image["bullet1"][4][6],
                                           (0, 0, 8, 6))
    lbltype["greencircle"] = bullet.BulletType(
        scgame.rs.image["bullet1"][3][7], 6)

    lbltype["redround"] = bullet.BulletType(scgame.rs.image["bullet1"][2][2],
                                            6)

    lbltype["redsword"] = bullet.BulletType(scgame.rs.image["bullet2"][3][1],
                                            (0, 0, 25, 4))

    lbltype["blueball"] = bullet.BulletType(scgame.rs.image["bullet2"][1][3],
                                            12)

    lbltype["bluetama"] = bullet.BulletType(scgame.rs.image["bullet2"][6][1],
                                            18)

    lentype["p1e1"] = globe.entype["maoyu1"].copy()
    lentype["p1e1"].fbuff = create_smallp
    lentype["p1e1"].maxhealth = 3000

    lentype["p1e2"] = globe.entype["maoyu2"].copy()
    lentype["p1e2"].fbuff = create_no
    lentype["p1e1"].maxhealth = 3000

    lentype["p2e1"] = globe.entype["sprite4"].copy()
    lentype["p2e1"].fbuff = create_point
    lentype["p2e1"].maxhealth = 5000

    lentype["p2e2"] = globe.entype["sprite5"].copy()
    lentype["p2e2"].fbuff = create_smallp
    lentype["p2e2"].maxhealth = 6000

    lentype["p3e1"] = globe.entype["sprite7"].copy()
    lentype["p3e1"].fbuff = create_pandpoint
    lentype["p3e1"].maxhealth = 20000

    lentype["p3e2"] = globe.entype["sprite2"].copy()
    lentype["p3e2"].fbuff = create_pandpoint
    lentype["p3e2"].maxhealth = 15000

    lentype["p4e1"] = globe.entype["guihuo2"].copy()
    lentype["p4e1"].bump = True
    lentype["p4e1"].fbuff = create_d_point
    lentype["p4e1"].maxhealth = 6000

    lentype["p4e2"] = globe.entype["guihuo0"].copy()
    lentype["p4e2"].bump = True
    lentype["p4e2"].fbuff = create_d_smallp
    lentype["p4e2"].maxhealth = 6000

    lentype["p5e1"] = globe.entype["butterfly"].copy()
    lentype["p5e1"].bump = True
    lentype["p5e1"].fbuff = create_life
    lentype["p5e1"].maxhealth = 240000

    lentype["ebinto"] = globe.entype["cirno"].copy()
    lentype["ebinto"].bump = True
    lentype["ebinto"].fbuff = create_no
    lentype["ebinto"].maxhealth = 10000

    lentype["eb1NSC"] = globe.entype["cirno"].copy()
    lentype["eb1NSC"].bump = True
    lentype["eb1NSC"].fbuff = create_no
    lentype["eb1NSC"].maxhealth = 560000

    lentype["eb1SC"] = globe.entype["cirno"].copy()
    lentype["eb1SC"].bump = True
    lentype["eb1SC"].fbuff = create_no
    lentype["eb1SC"].maxhealth = 720000

    orb["p1e1"] = orbit.quickcreate(102, p1=(96, 0), p2=(128, 196), speed=3)
    orb["p1e1"].create_bullet = selfsniper

    orb["p1e2"] = orbit.quickcreate(102, p1=(288, 0), p2=(256, 196), speed=3)
    orb["p1e2"].create_bullet = selfsniper

    orb["p1e3"] = orbit.quickcreate(102,
                                    p1=(96, globe.game_active_rect.bottom),
                                    p2=(128,
                                        globe.game_active_rect.bottom - 196),
                                    speed=1.5)
    orb["p1e3"].create_bullet = roundrand

    orb["p1e4"] = orbit.quickcreate(102,
                                    p1=(288, globe.game_active_rect.bottom),
                                    p2=(256,
                                        globe.game_active_rect.bottom - 196),
                                    speed=1.5)
    orb["p1e4"].create_bullet = roundrand2

    orb["p2e1"] = orbit.quickcreate(101, point=(0, 0), speedx=0, speedy=3)
    orb["p2e1"].create_bullet = p2e1roundrand

    orb["p2e2"] = orbit.quickcreate(101, point=(0, 0), speedx=0, speedy=3)
    orb["p2e2"].create_bullet = p2e2roundrand

    orb["p3e1"] = orbit.quickcreate(103,
                                    p1=(0, 0),
                                    p2=(1, 1),
                                    speed=2,
                                    time=600)
    orb["p3e1"].create_bullet = p3e1roundsnipe

    orb["p4e1"] = orbit.quickcreate(104, point=(0, 0), delay1=180, delay2=6)
    orb["p4e1"].create_bullet = p4e2snipe

    orb["p4e2"] = orbit.quickcreate(104, point=(0, 0), delay1=180, delay2=6)
    orb["p4e2"].create_bullet = p4e2snipe

    orb["p5e1"] = orbit.quickcreate(103,
                                    p1=(0, 0),
                                    p2=(1, 1),
                                    speed=2,
                                    time=850)
    orb["p5e1"].create_bullet = p5e1roundrand

    orb["ebinto"] = orbit.L1BossRunInto(
        (globe.game_active_rect.centerx + 50, globe.game_active_rect.top),
        (globe.game_active_rect.centerx, 80), 4, 1)
    orb["ebinto"].create_bullet = create_no

    orb["ebstay"] = orbit.quickcreate(101,
                                      point=(globe.game_active_rect.centerx,
                                             80),
                                      speedx=0,
                                      speedy=0)
    orb["ebstay"].create_bullet = enbossNSC1

    orb["eb1NSC-1SC"] = orbit.L1BossRunInto(
        (globe.game_active_rect.centerx, 80),
        (globe.game_active_rect.centerx, 150), 4, 1)
    orb["eb1NSC-1SC"].create_bullet = enbossSC1
def enbossSC1(this):

    tmp = boss.rect
    tmp.centerx = globe.game_active_rect.centerx
    tmp.centery = boss.rect.centery

    pt = [
        tmp.topleft, (tmp.centerx - 50, tmp.centery + 50), tmp.topright,
        (tmp.left + 50, tmp.centery + 50)
    ]

    if this.frame % 8 == 0:
        tmp = orbit.quickcreate(0,
                                point=pt[0],
                                theta=(this.frame) / 2,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
        tmp = orbit.quickcreate(0,
                                point=pt[0],
                                theta=(this.frame) / 2 + 180,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)

        tmp = orbit.quickcreate(0,
                                point=pt[2],
                                theta=(-this.frame) / 2,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
        tmp = orbit.quickcreate(0,
                                point=pt[2],
                                theta=(-this.frame) / 2 - 180,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)

        tmp = orbit.quickcreate(0,
                                point=pt[1],
                                theta=(this.frame) / 2 + 90,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
        tmp = orbit.quickcreate(0,
                                point=pt[1],
                                theta=(this.frame) / 2 + 270,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)

        tmp = orbit.quickcreate(0,
                                point=pt[3],
                                theta=(-this.frame) / 2 - 90,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
        tmp = orbit.quickcreate(0,
                                point=pt[3],
                                theta=(-this.frame) / 2 + 90,
                                speed=4.5,
                                bltype=lbltype["bluerice"])
        scgame.blmanager.create_enbl(lbltype["bluerice"], tmp)
        if this.frame % 20 == 0:
            tmp = orbit.quickcreate(1,
                                    point=this.point,
                                    speed=3,
                                    bltype=lbltype["blueball"])
            scgame.blmanager.create_enbl(lbltype["blueball"], tmp)