-
-
Notifications
You must be signed in to change notification settings - Fork 256
Open
Labels
Description
It would be appreciate if we could have the capacity to add suggestion for the "Character" and "BuffName" parameters.
[ConsoleMethod("buff", "Apply a buff to the given character")]
public static void ApplyBuff(string character, string buffName)
{
if (GameFlowManager.Instance.CurrentState is Battle battle)
{
if (character == "player")
{
BattleCharacter battleCharacter = battle.BattleCharacters.FirstOrDefault(x => x.Agent is BattlePlayerAgent);
if (battleCharacter == null)
{
Debug.LogWarning($"The is no battle character owned by the player during the execution of the command \"buff\".");
}
List<BattleBuffDefinition> battleBuffDefinitions = AssetProviderManager.Instance.Get<BattleBuffDefinition>();
BattleBuffDefinition battleBuffDefinition = battleBuffDefinitions.FirstOrDefault(x => x.name == buffName);
if (battleBuffDefinition == null)
{
Debug.LogWarning($"Could not find the buff with the name \"{buffName}\" during the execution of the command \"buff\".");
}
battleCharacter.BattleBuffApplier.Apply(battleBuffDefinition, battleCharacter);
}
else
{
Debug.LogWarning($"Could not resolve \"{character}\" as a valid parameter for the command \"buff\".");
}
}
else
{
Debug.LogWarning("The command \"buff\" can only be used in a \"Battle\".");
}
}