feat: remove Effect_CheckFactionGoodwill
删除了 Effect_CheckFactionGoodwill 类,并更正了 Effect_StoreFactionGoodwill 中的错误日志。
This commit is contained in:
Binary file not shown.
@@ -549,50 +549,6 @@ namespace WulaFallenEmpire
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Effect_CheckFactionGoodwill : Effect
|
public class Effect_CheckFactionGoodwill : Effect
|
||||||
{
|
|
||||||
public FactionDef factionDef;
|
|
||||||
public string variableName;
|
|
||||||
public List<Effect> successEffects;
|
|
||||||
public List<Effect> failureEffects;
|
|
||||||
|
|
||||||
public override void Execute(Dialog_CustomDisplay dialog = null)
|
|
||||||
{
|
|
||||||
if (factionDef == null)
|
|
||||||
{
|
|
||||||
Log.Error("[WulaFallenEmpire] Effect_CheckFactionGoodwill has a null faction Def.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Faction targetFaction = Find.FactionManager.FirstFactionOfDef(factionDef);
|
|
||||||
if (targetFaction == null)
|
|
||||||
{
|
|
||||||
Log.Warning($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{factionDef.defName}'.");
|
|
||||||
ExecuteEffects(failureEffects, dialog);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int requiredGoodwill = Find.World.GetComponent<EventVariableManager>().GetVariable<int>(variableName);
|
|
||||||
int currentGoodwill = Faction.OfPlayer.GoodwillWith(targetFaction);
|
|
||||||
if (currentGoodwill >= requiredGoodwill)
|
|
||||||
{
|
|
||||||
ExecuteEffects(successEffects, dialog);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ExecuteEffects(failureEffects, dialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExecuteEffects(List<Effect> effects, Dialog_CustomDisplay dialog)
|
|
||||||
{
|
|
||||||
if (effects.NullOrEmpty()) return;
|
|
||||||
foreach (var effect in effects)
|
|
||||||
{
|
|
||||||
effect.Execute(dialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public class Effect_StoreFactionGoodwill : Effect
|
|
||||||
{
|
{
|
||||||
public FactionDef factionDef;
|
public FactionDef factionDef;
|
||||||
public string variableName;
|
public string variableName;
|
||||||
@@ -601,7 +557,7 @@ public class Effect_StoreFactionGoodwill : Effect
|
|||||||
{
|
{
|
||||||
if (factionDef == null || string.IsNullOrEmpty(variableName))
|
if (factionDef == null || string.IsNullOrEmpty(variableName))
|
||||||
{
|
{
|
||||||
Log.Error("[WulaFallenEmpire] Effect_StoreFactionGoodwill is not configured correctly.");
|
Log.Error("[WulaFallenEmpire] Effect_CheckFactionGoodwill is not configured correctly.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,7 +572,7 @@ public class Effect_StoreFactionGoodwill : Effect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Warning($"[EventSystem] Effect_StoreFactionGoodwill: Faction '{factionDef.defName}' not found. Storing 0 in variable '{variableName}'.");
|
Log.Warning($"[EventSystem] Effect_CheckFactionGoodwill: Faction '{factionDef.defName}' not found. Storing 0 in variable '{variableName}'.");
|
||||||
eventVarManager.SetVariable(variableName, 0);
|
eventVarManager.SetVariable(variableName, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user