small update
boss prototype, auto planter, visual reworks, bug fixes
This commit is contained in:
+36
-11
@@ -20,6 +20,12 @@ FLOOR_RARE_PLANTS = ["Marigold", "Daffodil", "Peony", "Primrose",
|
||||
# Low-rarity tank plants used as enemy tanks on later floors.
|
||||
FLOOR_TANK_PLANTS = ["Marigold", "Daffodil", "Venus Flytrap"]
|
||||
|
||||
# Floor enemies scale up faster and hit harder / are beefier than player units
|
||||
# of the same level (a flat boost on top of the leveled stats).
|
||||
FLOOR_ENEMY_LEVEL_STEP = 4 # +1 enemy level every 4 floors (was every 5)
|
||||
FLOOR_ENEMY_ATK_MULT = 1.20 # +20% attack (more damage)
|
||||
FLOOR_ENEMY_HP_MULT = 1.25 # +25% max health (tankier)
|
||||
|
||||
|
||||
def floor_enemy_count(floor: int) -> int:
|
||||
"""Number of enemies on a battle floor: 1 on floors 1-3, 2 on 4-9, 3 on
|
||||
@@ -39,7 +45,11 @@ def floor_enemy_names(floor: int, player_type: str) -> List[str]:
|
||||
4 from floor 16. Teams mix pinwheels, butterflies and toadstools, and
|
||||
duplicates are allowed (e.g. two pinwheels). Tank plants join from floor
|
||||
40 and low-rarity plants from floor 45, replacing critter slots so a team
|
||||
never exceeds 4 enemies."""
|
||||
never exceeds 4 enemies. Boss floors field the boss alone."""
|
||||
from . import bosses
|
||||
boss = bosses.boss_for_floor(floor)
|
||||
if boss:
|
||||
return [boss]
|
||||
count = floor_enemy_count(floor)
|
||||
# Lead with an attacker; the rest cycle through the trio so each floor gets
|
||||
# a deterministic mix of roles (with repeats) built from the critters.
|
||||
@@ -58,24 +68,29 @@ def floor_enemy_names(floor: int, player_type: str) -> List[str]:
|
||||
|
||||
def roll_enemy_types(names: List[str], player_type: str, floor: int) -> List[str]:
|
||||
"""Types for a floor's enemies (parallel to `names`). The floor 1-3 pinwheel is
|
||||
always the type the player is strong against; other critters roll a random
|
||||
type; plants keep their own fixed type."""
|
||||
import random
|
||||
always the type the player is strong against; other critters get a fixed type
|
||||
derived from the floor (no rerolling — the same floor always fields the same
|
||||
team, and duplicate types within a team are allowed); plants keep their own
|
||||
fixed type."""
|
||||
from . import bosses
|
||||
types = []
|
||||
for i, n in enumerate(names):
|
||||
if n in VARIABLE_TYPE_UNITS:
|
||||
if bosses.is_boss(n):
|
||||
types.append(bosses.boss_type(n))
|
||||
elif n in VARIABLE_TYPE_UNITS:
|
||||
if floor <= 3:
|
||||
types.append(TYPE_BEATS.get(player_type, "garden"))
|
||||
else:
|
||||
types.append(random.choice(ALL_TYPES))
|
||||
types.append(ALL_TYPES[(floor * 7 + i * i) % len(ALL_TYPES)])
|
||||
else:
|
||||
types.append(POOL[n]["type"])
|
||||
return types
|
||||
|
||||
|
||||
def floor_enemy_level(floor: int) -> int:
|
||||
"""Enemy level for a floor (ramps toward ~20 at floor 100)."""
|
||||
return 1 + (floor - 1) // 5
|
||||
"""Enemy level for a floor (ramps one level every FLOOR_ENEMY_LEVEL_STEP
|
||||
floors, steeper than the old every-5 curve)."""
|
||||
return 1 + (floor - 1) // FLOOR_ENEMY_LEVEL_STEP
|
||||
|
||||
|
||||
def make_floor_enemies(floor: int, player_type: str) -> List[Unit]:
|
||||
@@ -88,11 +103,21 @@ def make_floor_enemies(floor: int, player_type: str) -> List[Unit]:
|
||||
|
||||
def build_floor_enemies(names: List[str], types: List[str], floor: int) -> List[Unit]:
|
||||
"""Build enemy units from an already-rolled name/type list (so the picker and
|
||||
the actual battle always show the same enemies)."""
|
||||
the actual battle always show the same enemies). Floor enemies also get a
|
||||
flat attack/health boost so they out-stat player units of the same level.
|
||||
Boss floors build the boss instead."""
|
||||
from . import bosses
|
||||
if names and bosses.is_boss(names[0]):
|
||||
return [bosses.make_boss(names[0], floor)]
|
||||
level = floor_enemy_level(floor)
|
||||
stage = max(1, min(5, 1 + (floor - 1) // 20))
|
||||
return [make_leveled(n, TEAM_ENEMY, level, stage, ptype=t)
|
||||
for n, t in zip(names, types)]
|
||||
units = [make_leveled(n, TEAM_ENEMY, level, stage, ptype=t)
|
||||
for n, t in zip(names, types)]
|
||||
for u in units:
|
||||
u.attack = int(u.attack * FLOOR_ENEMY_ATK_MULT)
|
||||
u.max_hp = int(u.max_hp * FLOOR_ENEMY_HP_MULT)
|
||||
u.hp = u.max_hp
|
||||
return units
|
||||
|
||||
|
||||
def difficulty_pool(difficulty: int) -> List[str]:
|
||||
|
||||
Reference in New Issue
Block a user