Night-Stalkers / lm-scripts

PySnip Scripts
GNU General Public License v3.0
8 stars 4 forks source link

Kraken_V2.py goals #4

Open Monstarules opened 4 years ago

Monstarules commented 4 years ago

Okay guys, going to start an issue for this gamemode since the code is the most shotty out of all of the gamemodes.

Now, code cleanup is about 1/4 of the way done, and we're testing the script on the servers. Here are some issues I know we have had with the pre-existent script:

IMPORTANT

OPTIONAL

Any other glitches and issues that we find, please comment them here. A lot of the code was improperly indented and not well documented, and I'm positive a few new issues might pop up.

hourai-dev commented 4 years ago

Good idea. I'll give it a test run as soon as I can.

Monstarules commented 4 years ago

Right so time for some updates!

Good news: The game properly ends if all players are eaten. Tentacles are somewhat smarter. Several processes have been sped up. A few grammar fixes have been added.

Bad news: The spawn sequences still need lots of work. They were always janky in the first place, and now they're even worse in some cases! Metadata for these maps needs to be checked for accuracies because sometimes they fail too.

The lines specifically involved in the code being janky are all contained in the spawn sequence. I'm going ahead and commenting above these lines in the code so that we can work this one out. I'm also going to be adding debug text in as well.

Monstarules commented 4 years ago

Here is the jank in question. I'm trying to think about the best way to redo this.

# Janky code starts here.
def progress_normal(caller = None):
    boss.phase += 1
    round_start()

    # We have started
    print "$M-DEBUG: BOSS PROGRESS ENTERED\n"

    if boss.phase == 1: # PHASE 1
        print "$M-DEBUG: Phase 1 entered\n"
        boss.on_last_tentacle_death = progress_delay
        spawn_tentacles(2)
    elif boss.phase == 2: # PHASE 2
        print "$M-DEBUG: Phase 1 passed, Phase 2 entered\n"
        boss.on_last_tentacle_death = round_end
        spawn_tentacles(4)
    elif boss.phase == 3: # PHASE 3
        print "$M-DEBUG: Phase 2 passed, Phase 3 entered\n"
        boss.on_last_tentacle_death = round_end
        spawn_tentacles(3, fast = True)
    elif boss.phase == 4: # PHASE 4
        print "$M-DEBUG: Phase 3 passed, Phase 4 entered\n"
        boss.on_last_tentacle_death = None
        boss.on_death = round_end_delay
        boss.size = 7
        boss.create_head(squid_head())
        eye = Eye(boss, KRAKEN_EYE_SMALL, 0, 5, -1, hits = 5)
        eye.on_hit = major_hit_and_progress
        reactor.callLater(7.0-float(FAST_RUN)*6.0, eye.create)
        spawn_tentacles(3, arena = True, no_hit = True)
    elif boss.phase == 5: # Phase 5
        print "$M-DEBUG: Phase 4 passed, Phase 5 entered\n"
        spawn_tentacles(4, respawn = True)
    elif boss.phase == 6: # Phase 6
        print "$M-DEBUG: Phase 5 passed, Phase 6 entered\n"
        falling_blocks_start ()
        reactor.callLater(15.0-float(FAST_RUN)*14.0, round_end)
    elif boss.phase == 7: # Phase 7
        print "$M-DEBUG: Phase 6 passed, Phase 7 entered\n"
        boss.on_last_tentacle_death = round_end
        spawn_tentacles (4, respawn = False, fast = True, arena = True)
    elif boss.phase == 8: # Phase 8
        print "$M-DEBUG: Phase 7 passed, Phase 8 entered\n"
        red_sky()
        boss.on_last_tentacle_death = None
        boss.on_death = victory
        boss.on_removed = cleanup
        boss.finally_call = finally_call
        boss.origin.y -= 24
        boss.size = 16
        boss.create_head(squid_head_large())
        eye = Eye(boss, KRAKEN_EYE_SMALL, 0, 16, -2, hits = 4)
        eye.on_hit = major_hit_and_pain
        reactor.callLater(16.0-float(FAST_RUN)*15.0, eye.create)
        eye = Eye(boss, KRAKEN_EYE_SMALL, 0, 14, -6, hits = 4)
        eye.on_hit = major_hit_and_pain
        reactor.callLater(16.0-float(FAST_RUN)*15.0, eye.create)
        reactor.callLater(18.0-float(FAST_RUN)*17.0, spawn_tentacles, 5, respawn = True)
Monstarules commented 4 years ago

Twoday and I have nailed down some further issues revolving around the spawn_tentacles command as well.

Monstarules commented 4 years ago

Also added in a few other issues that I've noticed, re-read the top for the most up-to-date issues.

    def respawn_tentacle(caller = None):
        if boss and not boss.dead:
            reactor.callLater(5.0-float(FAST_RUN)*4.0, spawn_tentacles, 1, True)

    def spawn_tentacles(amount, respawn = False, fast = False, arena = False,
        no_hit = False):
        if not hardcore:
            toughness = max(3.0, min(10.0, len(protocol.players) * 0.5))
        else:
            toughness = max(5.0, min(13.0, len(protocol.players) * 0.85))
        if boss and not boss.dead:
            for i in xrange(amount):
                origin = randring_arena() if arena else randring()
                t = Tentacle(protocol, boss, origin)
                t.max_hp = toughness
                t.growth_timer = uniform(i * 1.0, i * 1.2)
                if hardcore:
                    t.initial_growth_interval *= 0.8
                if fast:
                    t.initial_growth_interval *= 0.5
                else:
                    t.follow_timer = 2.0
                t.growth_interval = t.initial_growth_interval
                if respawn:
                    t.on_removed = respawn_tentacle
                elif not no_hit:
                    t.on_death = minor_hit
                    t.on_removed = minor_hit