Batch 4-b: verify combat on the port route
The fake server spawns a stray dog outside the village's BANPK safe disc and answers CG_TARGET/CG_ATTACK with GC_TARGET/GC_DAMAGE_INFO/GC_DEAD. port.login_flow and python_game_render_test hold the left button on it (MBF_SMART -> __OnPressActor) until it dies. Adds the host/test helper PythonBoot::Evaluate / Metin2PythonHost.evaluate. python_3d_surface: emission is now multiplied by the texture, like D3D's emissive-then-MODULATE, which removes the grey click-glow quad and the grey wash on characters. Damage numbers wait on CPythonSystem (4-g). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6ea0fa9889
commit
85e176bdd5
@@ -48,6 +48,7 @@
|
||||
#include "GameLib/FlyingData.h"
|
||||
#include "GameLib/FlyingObjectManager.h"
|
||||
#include "EffectLib/EffectManager.h"
|
||||
#include "EterLib/Camera.h"
|
||||
#include "GameLib/ItemManager.h"
|
||||
#include "UserInterface/PythonItem.h"
|
||||
#include "UserInterface/StdAfx.h"
|
||||
@@ -596,7 +597,7 @@ int main(int argc, char** argv)
|
||||
};
|
||||
std::printf("port_login_flow_test: %s\n", tail_info().c_str());
|
||||
CHECK(tail_info().find("ItemTail (Map 1,") != std::string::npos);
|
||||
CHECK(tail_info().find("ChrTail (Map 1,") != std::string::npos);
|
||||
CHECK(tail_info().find("ChrTail (Map 2,") != std::string::npos); // the actor and the stray dog
|
||||
// Holding ALT (game.GameWindow.ShowName) makes OnRender show every tail in range and project it after
|
||||
// app.RenderGame; the item tail keeps that screen rect, which is what textTail.Pick tests.
|
||||
PythonBoot::UIKey(DIK_LMENU, true);
|
||||
@@ -682,6 +683,57 @@ int main(int argc, char** argv)
|
||||
std::printf("port_login_flow_test: %s\n", e.c_str());
|
||||
}
|
||||
}
|
||||
// 9. (批次 4-b) Combat: a left click on the stray dog reaches CPythonPlayer::__OnClickActor, which targets it
|
||||
// (CG_TARGET → GC_TARGET, uitarget shows the HP board) and walks into range to attack. Each attack frame's
|
||||
// hit (CPythonPlayerEventHandler::OnHit) sends CG_ATTACK; the fake server answers GC_DAMAGE_INFO + GC_TARGET,
|
||||
// and GC_DEAD on the third hit.
|
||||
if (server)
|
||||
{
|
||||
CInstanceBase* mob = CPythonCharacterManager::Instance().GetInstancePtr(FakeLoginServer::kMobVID);
|
||||
CHECK(mob != nullptr);
|
||||
if (mob)
|
||||
{
|
||||
CHECK(!mob->IsDead());
|
||||
// Project the dog's body with RenderGame's perspective and the current camera (after the frame the
|
||||
// graphic state holds the UI's ortho projection).
|
||||
auto dog_on_screen = [&] {
|
||||
UI::CWindowManager& wm = UI::CWindowManager::Instance();
|
||||
D3DXMATRIX proj, identity;
|
||||
D3DXMatrixPerspectiveFovRH(&proj, D3DXToRadian(30.0f), wm.GetAspect(), 100.0f,
|
||||
CPythonBackground::Instance().GetFarClip());
|
||||
D3DXMatrixIdentity(&identity);
|
||||
D3DVIEWPORT8 viewport = {0, 0, (DWORD) wm.GetScreenWidth(), (DWORD) wm.GetScreenHeight(), 0.0f, 1.0f};
|
||||
const D3DXVECTOR3 body = mob->GetGraphicThingInstanceRef().GetPosition() + D3DXVECTOR3(0.0f, 0.0f, 40.0f);
|
||||
D3DXVECTOR3 screen;
|
||||
D3DXVec3Project(&screen, &body, &viewport, &proj,
|
||||
&CCameraManager::Instance().GetCurrentCamera()->GetViewMatrix(), &identity);
|
||||
return std::make_pair((int) screen.x, (int) screen.y);
|
||||
};
|
||||
auto [sx, sy] = dog_on_screen();
|
||||
std::printf("port_login_flow_test: stray dog on screen at %d %d\n", sx, sy);
|
||||
PythonBoot::UIMouseMove(sx, sy);
|
||||
pump_until(0.1, [] { return false; });
|
||||
// game.GameWindow.OnMouseLeftButtonDown → player.SetMouseState(MBT_LEFT, MBS_PRESS): MBF_SMART on an
|
||||
// actor is __OnPressActor, which walks into range (__ReserveClickActor) and attacks while the button is
|
||||
// held; the cursor follows the dog as the camera follows the actor, as a player's hand would.
|
||||
PythonBoot::UIMouseButton(1, true, sx, sy);
|
||||
const std::string mob_vid = std::to_string(FakeLoginServer::kMobVID);
|
||||
CHECK(pump_until(2, [&] { return server->Has("game2:target " + mob_vid); }));
|
||||
CHECK(pump_until(2, [] { return py_true("_stream.curPhaseWindow.targetBoard.IsShow()"); }));
|
||||
CHECK(pump_until(10, [&] {
|
||||
std::tie(sx, sy) = dog_on_screen();
|
||||
PythonBoot::UIMouseMove(sx, sy);
|
||||
return mob->IsDead();
|
||||
}));
|
||||
PythonBoot::UIMouseButton(1, false, sx, sy);
|
||||
size_t attacks = 0;
|
||||
for (const auto& e : server->Events())
|
||||
if (e == "game2:attack 0 " + mob_vid)
|
||||
++attacks;
|
||||
std::printf("port_login_flow_test: %zu attack(s) until the stray dog died\n", attacks);
|
||||
CHECK(attacks >= (size_t) FakeLoginServer::kMobHits);
|
||||
}
|
||||
}
|
||||
if (server)
|
||||
{
|
||||
const std::vector<std::string> expected = {
|
||||
@@ -700,7 +752,8 @@ int main(int argc, char** argv)
|
||||
for (const auto& e : events)
|
||||
if (e.rfind(prefix, 0) == 0 && e.find(":move ") == std::string::npos &&
|
||||
e.find(":pickup ") == std::string::npos &&
|
||||
e.find(":exchange ") == std::string::npos && e.find(":chat ") == std::string::npos)
|
||||
e.find(":exchange ") == std::string::npos && e.find(":chat ") == std::string::npos &&
|
||||
e.find(":target ") == std::string::npos && e.find(":attack ") == std::string::npos)
|
||||
got.push_back(e);
|
||||
CHECK(want == got);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user