mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 17:38:10 +08:00
* build: migrate C# formatting and add offscreen editor test support Host IMGUI tests on a detached panel without creating a native editor window. * feat(core): decode native battle records, geometry and animation metadata Read the two game variants’ battle tables and model data, with binary-reader and original-resource coverage. * feat(battle): implement deterministic combat rules and action settlement Implement actors, inventory, formation, action timing, status interruption, AI, stage ownership and deterministic replay. Keep the domain and its regression suite independent of Unity. * feat(battle): project native HUD state and input commands Add the presentation assembly and tests for command routing, lineup selection, floating numbers and stage messages. * feat(rendering): add battle lighting, actor appearance and native shadows Support baked and toon lighting, actor and weapon rendering, display refresh rate and resource ownership. * feat(effects): drive battle effects through shared resource previews Bind battle control nodes to action owners. Share preview lighting, geometry and effect resources with the existing Unity editors. * refactor(game): isolate story battle targeting and actor lifetimes Preserve scene ownership, bound story battle targeting and stop debug attacks when their actor leaves the scene. * feat(editor): compile original game data into battle scenarios Build per-variant animation and ability catalogs, encounter music, scene lighting profiles, random parties, equipment and test inventory from the original resources. * feat(editor): play battle sessions with animated previews and synced media Drive the preview scene, camera, effects, hit feedback, result choreography, music and movies from simulation snapshots and events. * feat(editor): add the battle workbench, native HUD and input controls Expose scenario authoring, replay, diagnostics, responsive command menus and mouse, touch and gamepad targeting. Include the editor workflow and HUD integration tests.
51 lines
2.6 KiB
C#
51 lines
2.6 KiB
C#
// ------------------------------------------------------------------------
|
|
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ------------------------------------------------------------------------
|
|
|
|
namespace Pal3.BattleEditor
|
|
{
|
|
using System;
|
|
using System.Linq;
|
|
using Battle;
|
|
using Core.Contract.Enums;
|
|
|
|
// Editor-only initial state: unlock legal personal skills without changing
|
|
// growth, costs, equipment, form restrictions or the original-data factory.
|
|
public static class BattleTestLoadoutBuilder
|
|
{
|
|
// A test inventory belongs to a newly authored scenario, never to a
|
|
// loaded preset or the game's persistent inventory.
|
|
public static BattleScenario CreateScenario(BattleData data)
|
|
{
|
|
var scenario = new BattleScenario { Variant = BattleData.Variant, DataFingerprint = data?.Fingerprint ?? "" };
|
|
if (data == null)
|
|
return scenario;
|
|
foreach (BattleAbilityDefinition item in data.Database.GameItemInfos.Values.Where(item => item.Id > 0)
|
|
.Select(BattleDefinitionCompiler.Item).Where(item => item.BattleUsable && item.Supported).OrderBy(item => item.Id))
|
|
{
|
|
scenario.Items.Add(new BattleItem { Id = item.Id, Count = 99 });
|
|
if (item.IsTreasure)
|
|
scenario.TreasureUses.Add(new BattleItem { Id = item.Id, Count = 3 });
|
|
}
|
|
return scenario;
|
|
}
|
|
|
|
public static BattleParticipant Create(BattleData data, int actorId, BattleSide side, BattleSlot slot)
|
|
{
|
|
if (data == null)
|
|
throw new ArgumentNullException(nameof(data));
|
|
BattleParticipant actor = data.CreateParticipant(actorId, side, slot);
|
|
int identity = BattleData.PlayerIdentity(actorId);
|
|
if (side != BattleSide.Ally || identity < 0 || data.Database.CombatActorInfos[actorId].Type != CombatActorType.MainActor)
|
|
return actor;
|
|
actor.Skills = data.Database.SkillOrder.Where(id => id > 0).Select(id => data.Database.SkillInfos[id])
|
|
.Where(skill => (int)skill.Type is >= 0 and <= 3 && skill.ApplicableActors.Contains((PlayerActorId)identity))
|
|
.Select(skill => new BattleSkill { Id = checked((int)skill.Id), Level = 4, Mastered = true }).ToList();
|
|
// Weapon magic is selected through the captured magic sword. The
|
|
// PAL3A five-spirit wheel and Nangong form use their own commands.
|
|
return actor;
|
|
}
|
|
}
|
|
}
|