Még adatcentrikusabb csatarendszer + pár screenshot

This commit is contained in:
markojozsef
2026-09-30 12:17:16 +02:00
parent 5c7db0e77e
commit 2d1bae444c
5 changed files with 61 additions and 25 deletions

View File

@@ -1,5 +0,0 @@
# TODO
- menü rendszer
- overworld
- csata
- minden más

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@@ -26,19 +26,7 @@ def move_phoenix(user, target):
return Action("Phoenix Down", user, target, Damage(0, 0, 0, 30), StatusChange(2, 0, 0))
def move_softenup(user, target):
return Action("Esuna (remove stoneskin)", user, target, Damage(0, 0, 0, 0), StatusChange(2, 0, 0))
MOVES = {
"attack": ("Physical attack", move_attack, True),
"fire": ("Fira (fire magic)", move_fire, True),
"ice": ("Blizzara (ice magic)", move_ice, True),
"cure": ("Cure (heal ally)", move_cure, False),
"defend": ("Defend (self def_up)", move_defend, None), # self-only, forced
"break": ("Break (inflict stone)", move_break, True),
"death": ("Death (instant KO)", move_death, True),
"phoenix": ("Phoenix Down (revive ally)",move_phoenix, False),
"unstone": ("Esuna (cure stone)", move_softenup,False),
}
return Action("Esuna", user, target, Damage(0, 0, 0, 0), StatusChange(2, 0, 0))
def enemy_turn_test(e,ep, ap,d):
living = [p for p in ap if not p.ko]
@@ -75,7 +63,7 @@ def enemy_turn_test(e,ep, ap,d):
act = random.choice(["attack", "fire", "ice"])
target = random.choice(living)
_, builder, _ = MOVES[act]
_, builder, _ = d["moves"][act]
print(f" ({e.name} chooses {act} -> {target.name})")
return builder(e, target)
@@ -92,6 +80,60 @@ battles = [
Combatant("Cyan", 130, 38, 70, 40, 20, 20, False, False),
],
"enemy_turn_func": enemy_turn_test,
"mus_id": "mus_fnafsux"
"mus_id": "mus_fnafsux",
"init_ai_data": {
"moves": {
"attack": ("Physical attack", move_attack, True),
"fire": ("Fira", move_fire, True),
"ice": ("Blizzara", move_ice, True),
"cure": ("Cure", move_cure, False),
"defend": ("Defend", move_defend, None),
"break": ("Break", move_break, True),
"death": ("Death", move_death, True),
"phoenix": ("Phoenix Down", move_phoenix, False),
"unstone": ("Esuna", move_softenup,False),
}
},
"menus": [
{ # Locke
"Attack": "phys_att",
"": "unselectable",
"": "unselectable",
"Item": "items"
},
{ # Terra
"Attack": "phys_att",
"Magic": "magic",
"": "unselectable",
"Item": "items"
},
{ # Celes
"Attack": "phys_att",
"Magic": "magic",
"": "unselectable",
"Item": "items"
},
{ # Cyan
"Attack": "phys_att",
"": "unselectable",
"": "unselectable",
"Item": "items"
}
],
"spells": [
{}, # Locke
{ # Terra
"Fira": ("Fira", move_fire, True),
"Blizzara": ("Blizzara", move_ice, True),
},
{ # Celes
"Fira": ("Fira", move_fire, True),
"Blizzara": ("Blizzara", move_ice, True),
},
{} # Cyan
],
"inventory": [
["Phoenix Down",67, ("Phoenix Down", move_phoenix, False)]
]
}
]

View File

@@ -17,13 +17,12 @@ enemy_ai_data = {}
party_text = text.TextRenderer(3, 206, 210)
ene_text = text.TextRenderer(123, 206, 210)
menu_text = text.TextRenderer(3, 36, 210)
menu_text = text.TextRenderer(3, 76, 210)
menu_open = 0
menu_queue = []
menu = []
battle_id = 0
def switch(game):
@@ -31,7 +30,7 @@ def switch(game):
enemies = battle_data.battles[battle_id]["enemies"]
party_members = battle_data.battles[battle_id]["party_members"]
enemy_turn = battle_data.battles[battle_id]["enemy_turn_func"]
enemy_ai_data = {}
enemy_ai_data = battle_data.battles[battle_id]["init_ai_data"]
battle_music = assets.sounds[battle_data.battles[battle_id]["mus_id"]].play(loops=True)
def update(game, dt):
@@ -66,10 +65,10 @@ def update(game, dt):
enetext = ""
for m in party_members:
partytext += f"=={m.name}==\nHP: {m.hp}\n\n"
partytext += f"=={m.name}==\nHP: {m.hp}\n"
for e in enemies:
enetext += f"=={e.name}==\nHP: {e.hp}\n\n"
enetext += f"=={e.name}==\nHP: {e.hp}\n"
if len(menu_queue) != 0 and menu_open == 0:
whose = menu_queue.pop(0)