@@ -64,7 +64,6 @@ local SPECIAL_BUFFS = {
6464-- === 内部状态 ===
6565local Players = {}
6666local Multi0 , Multi1 -- 玩家引用
67- local Self , Enemy -- 自己和敌人引用
6867local ControlPoints = {} -- 控制点列表
6968local ControlPointTimes = {} -- 控制点创建时间记录
7069local ControlPointCounter = 0 -- 控制点计数器
@@ -404,30 +403,30 @@ local function checkVictoryConditions()
404403 end
405404
406405 -- 检查Multi1(敌方)是否还有建筑
407- local enemyBuildings = Utils .Where (Map .ActorsInWorld , function (actor )
406+ local Multi1Buildings = Utils .Where (Map .ActorsInWorld , function (actor )
408407 return actor .Owner == Multi1 and actor .HasProperty (" StartBuildingRepairs" ) and not actor .IsDead
409408 end )
410409
411- if # enemyBuildings == 0 then
410+ if # Multi1Buildings == 0 then
412411 gameCompleted = true
413- Multi0 .MarkCompletedObjective (SovietObjective1 )
414- if AlliedObjective1 then Multi1 .MarkFailedObjective (AlliedObjective1 ) end
415- debugMsg (" Multi0 wins! All enemy buildings destroyed." )
416- Media .DisplayMessage (" Victory! All enemy buildings destroyed." , " Menacing" )
412+ Multi0 .MarkCompletedObjective (SovietObjective )
413+ if AlliedObjective then Multi1 .MarkFailedObjective (AlliedObjective ) end
414+ debugMsg (" Multi0 wins! All Multi1 buildings destroyed." )
415+ Media .DisplayMessage (" Victory! All Multi1 buildings destroyed." , " Menacing" )
417416 return
418417 end
419418
420419 -- 检查Multi0(玩家)是否还有建筑
421- local playerBuildings = Utils .Where (Map .ActorsInWorld , function (actor )
420+ local Multi0Buildings = Utils .Where (Map .ActorsInWorld , function (actor )
422421 return actor .Owner == Multi0 and actor .HasProperty (" StartBuildingRepairs" ) and not actor .IsDead
423422 end )
424423
425- if # playerBuildings == 0 then
424+ if # Multi0Buildings == 0 then
426425 gameCompleted = true
427- if AlliedObjective1 then Multi1 .MarkCompletedObjective (AlliedObjective1 ) end
428- Multi0 .MarkFailedObjective (SovietObjective1 )
429- debugMsg (" Multi1 wins! All player buildings destroyed." )
430- Media .DisplayMessage (" Defeat! All your buildings are destroyed." , " Menacing" )
426+ if AlliedObjective then Multi1 .MarkCompletedObjective (AlliedObjective ) end
427+ Multi0 .MarkFailedObjective (SovietObjective )
428+ debugMsg (" Multi1 wins! All Multi0 buildings destroyed." )
429+ Media .DisplayMessage (" Defeat! All Multi0 buildings are destroyed." , " Menacing" )
431430 end
432431end
433432
@@ -501,33 +500,19 @@ WorldLoaded = function()
501500 if not p .IsNonCombatant then
502501 table.insert (Players , p )
503502 end
504- if p .IsLocalPlayer then
505- Self = p
506- end
507503 end
508504 -- debugMsg(string.format("PlayersNum:%d", #Players))
509505 Multi0 = Players [1 ]
510506 Multi1 = Players [2 ]
511507
512- if not Self then
513- debugMsg (" Warning: Self not found" )
514- end
515508 if not Multi0 then
516509 debugMsg (" Warning: Multi0 not found" )
517510 end
518511 if not Multi1 then
519512 debugMsg (" Warning: Multi1 not found" )
520513 end
521514
522- -- 设置敌人引用
523- if Self .Name == Multi0 .Name then
524- Enemy = Multi1
525- elseif Self .Name == Multi1 .Name then
526- Enemy = Multi0
527- else
528- debugMsg (" Warning: Could not determine enemy player" )
529- end
530-
515+
531516 InitObjectives (Multi0 )
532517 InitObjectives (Multi1 )
533518
0 commit comments