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.
67 lines
3.3 KiB
C#
67 lines
3.3 KiB
C#
// ------------------------------------------------------------------------
|
|
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ------------------------------------------------------------------------
|
|
|
|
namespace Pal3.Battle
|
|
{
|
|
using System;
|
|
|
|
public sealed partial class BattleSession
|
|
{
|
|
// MainPanel 0x220 is a separate released command, not ordinary magic.
|
|
// Its GDB record still supplies the element and effect linker.
|
|
public string CanSubmitElementWheel(string controller, int skillId) =>
|
|
ValidateCommand(new BattleCommand(controller, BattleAction.Skill, null, skillId), false, true);
|
|
|
|
public bool SubmitElementWheel(string controller, int skillId) =>
|
|
SubmitCommand(new BattleCommand(controller, BattleAction.Skill, null, skillId), false, true);
|
|
|
|
private string ValidateElementWheelController(Actor actor, BattleCommand command, BattleAbilityDefinition ability)
|
|
{
|
|
if (Definitions?.Variant != "PAL3A" || command.Action != BattleAction.Skill || command.Target != null ||
|
|
command.AbilityId is < 264 or > 268 || ability == null || ability.Range != BattleTargetRange.None)
|
|
return "Choose a PAL3A five-spirit wheel element.";
|
|
if (actor.Initial.Side != BattleSide.Ally || NativeActorIndex(actor) != 0 || WaitingActor != command.Actor)
|
|
return "The spirit wheel needs Nangong Huang as the current ready controller.";
|
|
if (_pal3AForms.TryGetValue(command.Actor, out Pal3AFormState form) && form.Pending)
|
|
return "The original form transition is still running.";
|
|
if (_spiritWheel.Charges[ElementWheelCoreElement(command.AbilityId)] != 9)
|
|
return "This spirit wheel element needs nine charges.";
|
|
if (_catalog is IBattleAbilityEffects && _catalog is not IBattleElementWheelTimings)
|
|
return "The original spirit wheel presentation is missing.";
|
|
return null;
|
|
}
|
|
|
|
private static int ElementWheelCoreElement(int skillId) => skillId switch
|
|
{
|
|
264 => 0,
|
|
265 => 1,
|
|
266 => 3,
|
|
267 => 2,
|
|
268 => 4,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(skillId))
|
|
};
|
|
|
|
private AttackTiming ElementWheelTiming(string actor, BattleAbilityDefinition ability) =>
|
|
_catalog is IBattleElementWheelTimings wheel ? wheel.ElementWheel(actor, ability) :
|
|
(_catalog as IBattleAbilityTimings)?.Ability(actor, ability);
|
|
|
|
private bool ResolveElementWheelMarker(Actor source, ActionRun run)
|
|
{
|
|
if (!run.ElementWheel)
|
|
return false;
|
|
if (!run.AbilityResolved)
|
|
{
|
|
run.AbilityResolved = true;
|
|
ResolveAiSceneMagic(source, run.Ability);
|
|
int element = ElementWheelCoreElement(run.Ability.Id);
|
|
_spiritWheel = BattlePal3ARules.Gain(_spiritWheel, element, -9);
|
|
Add(BattleEventKind.ControlChanged, source.Initial.InstanceId, actionId: run.Id,
|
|
detail: "spirit wheel element " + element + " consumed");
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|