Skip to content

Commit

Permalink
beta 2.1 机关方式再次修改,对c5m4这种有限尸潮做了细分
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasylidong committed May 25, 2024
1 parent 0bb454b commit 157d3cb
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 24 deletions.
38 changes: 38 additions & 0 deletions addons/sourcemod/gamedata/trigger_horde_notify.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"Games"
{
"left4dead2"
{
"Functions"
{
"CDirector::OnMapInvokedPanicEvent"
{
"signature" "CDirector::OnMapInvokedPanicEvent"
"callconv" "thiscall"
"return" "int"
"this" "address"
"arguments"
{
"a1"
{
"type" "cbaseentity"
}
"a2"
{
"type" "int"
}
}
}
}

"Signatures"
{
"CDirector::OnMapInvokedPanicEvent"
{
"library" "server"
"linux" "@_ZN9CDirector22OnMapInvokedPanicEventEP11CBasePlayer20panic_event_reason_t"
"windows" "\x55\x8B\x2A\x8B\x2A\x2A\x53\x56\x57\x8B\x2A\x83\x2A\x2A\x0F\x85\x2A\x2A\x2A\x2A\x89"
/* 55 8B ? 8B ? ? 53 56 57 8B ? 83 ? ? 0F 85 ? ? ? ? 89 */
}
}
}
}
Binary file modified addons/sourcemod/plugins/optional/AnneHappy/infected_control.smx
Binary file not shown.
Binary file not shown.
47 changes: 32 additions & 15 deletions addons/sourcemod/scripting/AnneHappy/infected_control.sp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ int
g_iTeleportIndex = 0, //当前传送队列长度
g_iSpawnMaxCount = 0, //当前可生成特感数量
g_iSurvivorNum = 0, //活着的生还者数量
g_iHordeStatus = 0, // 是不是处于无限尸潮的机关中
g_iBaitTimeCheckTime = 0, //检测到玩家Bait的次数,方便进行何种惩罚
g_iLadderBaitTimeCheckTime = 0, //检测到玩家梯子Bait的次数,方便进行何种惩罚
g_iSurvivors[MAXPLAYERS + 1] = { 0 }; //活着生还者的索引
Expand Down Expand Up @@ -137,7 +138,6 @@ bool
g_bAddDamageToSmoker, //是否对smoker增伤(一般alone模式开启)
g_bIgnoreIncappedSurvivorSight, //是否忽略倒地生还者的视线
g_bIsLate = false, // text插件是否发送开启刷特命令
g_bIsInfiniteHordeActive = false, // 是不是处于无限尸潮的机关中
g_bSmokerAvailable = false, // ai_smoker_new是否存在
g_bAntiBaitMode = false, //抗诱饵模式是否开启
g_bSIPoolAvailable = false, //特感池是否存在
Expand Down Expand Up @@ -327,7 +327,7 @@ stock Action Cmd_StartSpawn(int client, int args)
if (L4D_HasAnySurvivorLeftSafeArea())
{
#if TESTBUG
PrintToChatAll("目前是测试版本v2.0");
PrintToChatAll("目前是测试版本v2.1");
#endif
ResetStatus();
CreateTimer(0.1, SpawnFirstInfected);
Expand Down Expand Up @@ -462,7 +462,7 @@ void InitStatus()
g_bPickRushMan = false;
g_bShouldCheck = false;
g_bIsLate = false;
g_bIsInfiniteHordeActive = false;
g_iHordeStatus = 0;
g_iSpawnMaxCount = 0;
g_fLastSISpawnStartTime = 0.0;
g_fUnpauseNextSpawnTime = 0.0;
Expand Down Expand Up @@ -1071,7 +1071,7 @@ int IsSurvivorBait()
{
// 前置条件,没有坦克或者1个生还倒地的情况
//if( intensity >= g_fSIAttackIntent || IsAnyTankOrAboveHalfSurvivorDownOrDied() || IsPanicEventInProgress())
if( IsAnyTankOrAboveHalfSurvivorDownOrDied(1) || g_bIsInfiniteHordeActive)
if( IsAnyTankOrAboveHalfSurvivorDownOrDied(1) || g_iHordeStatus)
{
#if TESTBUG
Debug_Print("[前置条件]未满足");
Expand Down Expand Up @@ -2268,37 +2268,54 @@ stock static bool navIsAheadAnotherNav(Address source, Address target) {
// ========================================================Forward ============================/
// status:
// 1 无限尸潮
// 2 有限尸潮或者尸潮下一波已经没了
// 0 尸潮停止
// 2 警报车尸潮
// 3 有限尸潮
// 4 救援关尸潮
public void L4D2_HordeStatus(int status)
{
if(status){
if(status == 1){
#if TESTBUG
Debug_Print("<尸潮状态> 目前状态为在无限尸潮");
#endif
#endif
g_iHordeStatus = 1;
}
else if(status >= 2){
else if(status == 2){
#if TESTBUG
Debug_Print("<尸潮状态> 目前状态为在只有最后一波了,设置定时器%.1f后重置尸潮状态值, 需要刷尸潮数量为%d", (status - 1) * 10.0, L4D2Direct_GetPendingMobCount());
Debug_Print("<尸潮状态> 打警报车触发尸潮,10s后重置尸潮状态");
#endif
CreateTimer((status - 1) * 10.0, ResetHordeStatus, _, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(10.0, ResetHordeStatus, _, TIMER_FLAG_NO_MAPCHANGE);
g_iHordeStatus = 2;
}
else if(status == 3 && g_iHordeStatus != 1)
{
#if TESTBUG
Debug_Print("<尸潮状态> 有限尸潮机关,60s后重置尸潮状态");
#endif
g_iHordeStatus = 3;
CreateTimer(60.0, ResetHordeStatus, _, TIMER_FLAG_NO_MAPCHANGE);
}
else if(status == 4)
{
#if TESTBUG
Debug_Print("<尸潮状态> 救援尸潮");
#endif
g_iHordeStatus = 4;
}
g_bIsInfiniteHordeActive = true;
}
else{
#if TESTBUG
Debug_Print("<尸潮状态> 目前状态为在尸潮活动中");
Debug_Print("<尸潮状态> 尸潮活动即将结束");
#endif
g_bIsInfiniteHordeActive = false;
g_iHordeStatus = 0;
}
}

Action ResetHordeStatus(Handle timer)
{
g_bIsInfiniteHordeActive = false;
g_iHordeStatus = 0;
#if TESTBUG
Debug_Print("<尸潮状态> 1已重置尸潮状态为非无限尸潮模式");
Debug_Print("<尸潮状态> 尸潮活动已结束,已重置尸潮状态为非无限尸潮模式");
#endif
return Plugin_Stop;
}
9 changes: 0 additions & 9 deletions addons/sourcemod/scripting/AnneHappy/l4d2_horde_equaliser.sp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ public Action L4D_OnSpawnMob(int &amount)

// Excluded map -- don't block any infinite hordes on this one
if (commonLimit < 0) {
if(!IsInfiniteHordeActive())SendForward(3);
else{
SendForward(1);
}
return Plugin_Continue;
}

Expand All @@ -185,15 +181,10 @@ public Action L4D_OnSpawnMob(int &amount)
if (commonTotal >= commonLimit) {
SetPendingMobCount(0);
amount = 0;
SendForward(0);
return Plugin_Handled;
}
// commonTotal += amount;
}
else
{
SendForward(2);
}

// ...or not.
return Plugin_Continue;
Expand Down
Loading

0 comments on commit 157d3cb

Please sign in to comment.