public UICommands GetThirdCommand(Transform chess) { UICommands uiCmds = UICommands.none; CharacterProperty chessP = chess.GetComponent <CharacterProperty>(); AIMoveStore chessAI = new AIMoveStore(chess); if (chessP.Summoner) { if (chessAI.CmdsLeft.Contains(UICommands.Attack) && MapHelper.Attackable(chess)) { if (KillAble(chess, 0, chessP.Damage)) { uiCmds = UICommands.Attack; } else if (chessAI.CmdsLeft.Contains(UICommands.Defense)) { uiCmds = UICommands.Defense; } } else if (chessAI.CmdsUsed.Contains(UICommands.Move)) { uiCmds = UICommands.Defense; } else if (chessAI.CmdsUsed.Contains(UICommands.Defense) || chessAI.CmdsLeft.Contains(UICommands.Summon)) { //check if summonable Transform summonGF = GetSummonGF(chess); Transform summonPos = GetSummonPosition(chess); if (summonGF != null && summonPos != null) { uiCmds = UICommands.Summon; } } } else { if (MapHelper.Attackable(chess)) { if (KillAble(chess, 0, chessP.Damage) || KillAble(chess, 1, 0)) { if (!chessAI.CmdsUsed.Contains(UICommands.Attack)) { uiCmds = UICommands.Attack; } } else if (chessAI.CmdsLeft.Contains(UICommands.Defense)) { uiCmds = UICommands.Defense; } else if (chessAI.CmdsLeft.Contains(UICommands.Move)) { uiCmds = UICommands.Move; } } } return(uiCmds); }
public UICommands GetSecondCommand(Transform chess) { UICommands uiCmds = UICommands.none; CharacterProperty chessP = chess.GetComponent <CharacterProperty>(); AIMoveStore chessAI = new AIMoveStore(chess); if (chessAI.CmdsUsed.Count <= 1) { if (chessP.Summoner) { if (chessAI.CmdsLeft.Contains(UICommands.Attack) && MapHelper.Attackable(chess)) { if (KillAble(chess, 0, chessP.Damage)) { uiCmds = UICommands.Attack; } else if (chessAI.CmdsLeft.Contains(UICommands.Defense)) { uiCmds = UICommands.Defense; } } else if (chessAI.CmdsUsed.Contains(UICommands.Move)) { uiCmds = UICommands.Defense; } else if (chessAI.CmdsUsed.Contains(UICommands.Defense)) { //check if summonable Transform summonGF = GetSummonGF(chess); Transform summonPos = GetSummonPosition(chess); if (summonGF != null && summonPos != null) { uiCmds = UICommands.Summon; } } } else { if (MapHelper.Attackable(chess)) { if (KillAble(chess, 0, chessP.Damage) || KillAble(chess, 1, 0)) { if (chessAI.CmdsLeft.Contains(UICommands.Attack)) { uiCmds = UICommands.Attack; } } else { Transform[] skills = chess.GetComponent <SkillSets>().Skills; foreach (Transform skill in skills) { if (currentSelect.player.GetComponent <ManaCounter>().Mana >= skill.GetComponent <SkillProperty>().SkillCost) { SkillProperty skillProperty = skill.GetComponent <SkillProperty>(); if (skillProperty.SType == SkillType.EnhanceSelf && skillProperty.Mode == PowerType.Damage) { int newDamage = chessP.Damage + skillProperty.ModeValue; if (KillAble(chess, 0, newDamage) && chessAI.CmdsLeft.Contains(UICommands.Skill)) { uiCmds = UICommands.Skill; } else if (chessAI.CmdsLeft.Contains(UICommands.Move)) { uiCmds = UICommands.Move; } } else if (chessAI.CmdsLeft.Contains(UICommands.Move)) { uiCmds = UICommands.Move; } } else if (chessAI.CmdsLeft.Contains(UICommands.Move)) { uiCmds = UICommands.Move; } } } } } } else { print("what a f**k, it's not second move"); } return(uiCmds); }
public UICommands GetThirdCommand(Transform chess) { UICommands uiCmds = UICommands.none; CharacterProperty chessP = chess.GetComponent<CharacterProperty>(); AIMoveStore chessAI = new AIMoveStore(chess); if(chessP.Summoner){ if(chessAI.CmdsLeft.Contains(UICommands.Attack) && MapHelper.Attackable(chess)){ if(KillAble(chess,0, chessP.Damage)){ uiCmds = UICommands.Attack; }else if(chessAI.CmdsLeft.Contains(UICommands.Defense)){ uiCmds = UICommands.Defense; } }else if(chessAI.CmdsUsed.Contains(UICommands.Move)){ uiCmds = UICommands.Defense; }else if(chessAI.CmdsUsed.Contains(UICommands.Defense) || chessAI.CmdsLeft.Contains(UICommands.Summon)){ //check if summonable Transform summonGF = GetSummonGF(chess); Transform summonPos = GetSummonPosition(chess); if(summonGF!=null && summonPos!=null) uiCmds = UICommands.Summon; } }else{ if(MapHelper.Attackable(chess)){ if(KillAble(chess, 0, chessP.Damage) || KillAble(chess, 1, 0)){ if(!chessAI.CmdsUsed.Contains(UICommands.Attack)) uiCmds = UICommands.Attack; }else if(chessAI.CmdsLeft.Contains(UICommands.Defense)){ uiCmds = UICommands.Defense; }else if(chessAI.CmdsLeft.Contains(UICommands.Move)){ uiCmds = UICommands.Move; } } } return uiCmds; }
public UICommands GetSecondCommand(Transform chess) { UICommands uiCmds = UICommands.none; CharacterProperty chessP = chess.GetComponent<CharacterProperty>(); AIMoveStore chessAI = new AIMoveStore(chess); if(chessAI.CmdsUsed.Count<=1){ if(chessP.Summoner){ if(chessAI.CmdsLeft.Contains(UICommands.Attack) && MapHelper.Attackable(chess)){ if(KillAble(chess,0, chessP.Damage)){ uiCmds = UICommands.Attack; }else if(chessAI.CmdsLeft.Contains(UICommands.Defense)){ uiCmds = UICommands.Defense; } }else if(chessAI.CmdsUsed.Contains(UICommands.Move)){ uiCmds = UICommands.Defense; }else if(chessAI.CmdsUsed.Contains(UICommands.Defense)){ //check if summonable Transform summonGF = GetSummonGF(chess); Transform summonPos = GetSummonPosition(chess); if(summonGF!=null && summonPos!=null) uiCmds = UICommands.Summon; } }else{ if(MapHelper.Attackable(chess)){ if(KillAble(chess, 0, chessP.Damage) || KillAble(chess, 1, 0)){ if(chessAI.CmdsLeft.Contains(UICommands.Attack)) uiCmds = UICommands.Attack; }else{ Transform[] skills = chess.GetComponent<SkillSets>().Skills; foreach(Transform skill in skills){ if(currentSelect.player.GetComponent<ManaCounter>().Mana>=skill.GetComponent<SkillProperty>().SkillCost){ SkillProperty skillProperty = skill.GetComponent<SkillProperty>(); if(skillProperty.SType == SkillType.EnhanceSelf && skillProperty.Mode == PowerType.Damage){ int newDamage = chessP.Damage + skillProperty.ModeValue; if(KillAble(chess, 0, newDamage) && chessAI.CmdsLeft.Contains(UICommands.Skill)) uiCmds = UICommands.Skill; else if(chessAI.CmdsLeft.Contains(UICommands.Move)) uiCmds = UICommands.Move; }else if(chessAI.CmdsLeft.Contains(UICommands.Move)){ uiCmds = UICommands.Move; } }else if(chessAI.CmdsLeft.Contains(UICommands.Move)){ uiCmds = UICommands.Move; } } } } } }else{ print("what a f**k, it's not second move"); } return uiCmds; }