public override void Heuristic(float[] action) { int dir = TargetInRange(); if (GetStatValueByName("HP") < (Mathf.RoundToInt(MaxHP * 0.35f))) { action[0] = -1f; action[1] = 2f; // Defend when hp drops under a certain threshold } if (dir != -1) { action[0] = 0f; action[1] = dir; } else { action[0] = 1f; dir = RunnawayDir(); if (dir != -1) { action[1] = dir; } else { action[1] = HexCalculator.RandomDir(); } } }
public override void Heuristic(float[] action) { int attackDir = TargetInRange(); int protectDir = AllyInRange(); if (protectDir != -1) // Prioritizes children protection { action[0] = protectDir; action[1] = 3f; } else if (GetStatValueByName("HP") < (Mathf.RoundToInt(MaxHP * 0.35f))) { action[0] = -1f; action[1] = 2f; // Defend when hp drops under a certain threshold } else if (attackDir != -1) { action[0] = 0f; action[1] = attackDir; } else { action[0] = 1f; attackDir = RunnawayDir(); if (attackDir != -1) { action[1] = attackDir; } else { action[1] = HexCalculator.RandomDir(); } } }