예제 #1
0
        public bool CanUseSpecSpell()
        {
            if (attackType == null)
            {
                return(false);
            }
            SpellPart sp = attackType.AvailableSpell;

            if (sp != null)
            {
                return(sp.Available(attackType));
            }
            return(false);
        }
예제 #2
0
        public void JustHitStrategy()
        {
            Transform enemies = BattleControll.battleControll.enemyUnitsParent.transform;

            for (int i = 0; i < regions.Count; i++)
            {
                if (!regions[i].NextTurnRepose(1))
                {
                    regions.RemoveAt(i);
                }
            }
            for (int i = 0; i < enemies.childCount; i++)
            {
                UnitLogic enamy = enemies.GetChild(i).GetComponent <UnitLogic>();
                enamy.NextTurnRepose(Effect.actionCall.OnStartTurn);
                if (NeedRefreshPos)
                {
                    PositionReload(enamy);
                }

                if (enamy.unitlogic.totem != null)
                {
                    enamy.unitlogic.totem.Execute(Effect.actionCall.OnStartTurn);
                }
            }

            BattleControll.heroLogic.LinkedSpells();
            for (int i = 0; i < enemies.childCount; i++)
            {
                UnitLogic enamy = enemies.GetChild(i).GetComponent <UnitLogic>();
                int       act   = enamy.unitlogic.UnitAction;

                if (enamy.unitlogic.attackType != null)
                {
                    SpellPart sp = enamy.unitlogic.attackType.AvailableSpell;
                    if (sp.Available(enamy.unitlogic.attackType))
                    {
                        try
                        {
                            switch (sp.spell.spellTarget)
                            {
                            case Spell.SpellTarget.Enemy & Spell.SpellTarget.Alies:
                                sp.spell.Execute(null, BattleControll.heroLogic);
                                break;

                            case  Spell.SpellTarget.Enemy:
                                sp.spell.Execute(null, BattleControll.heroLogic);
                                break;

                            case Spell.SpellTarget.Alies:

                                break;

                            default:
                                sp.spell.Execute(null, null, true);
                                break;
                            }
                        }
                        catch
                        {
                            Debug.Log("eerr");
                        }
                        finally
                        {
                            enamy.unitlogic.UnitAction -= sp.spell.EnergyCost;
                            act -= sp.spell.EnergyCost;
                        }
                    }
                }

                if (enamy.spells.Length > 0)
                {
                    for (int sp = 0; sp < enamy.spells.Length; sp++)
                    {
                        SpellInBattle spell = enamy.spells[sp];
                        if (spell.spellImage.passiveSettings.IsPassiveSkill)
                        {
                            continue;
                        }
                        if (spell.Reloading())
                        {
                            if (spell.spellImage.spellTarget == Spell.SpellTarget.Enemy)
                            {
                                spell.Realizeto(enamy, BattleControll.heroLogic);
                                enamy.unitlogic.UnitAction--;
                                act -= spell.spellImage.EnergyCost;
                            }
                        }
                    }
                }

                if (enamy.unitlogic.CanAttack(BattleControll.heroLogic))
                {
                    for (int q = 0; q < act; q++)
                    {
                        if (enamy.unitlogic.UnitAction > 0)
                        {
                            enamy.unitlogic.AttackUnit(BattleControll.heroLogic, 1);
                        }
                    }
                    BattleLogic.battleLogic.addAction(null, null, -1, 0.5f);
                }
            }

            for (int i = 0; i < regions.Count; i++)
            {
                if (!regions[i].NextTurnRepose(0))
                {
                    regions.RemoveAt(i);
                }
            }

            for (int i = 0; i < enemies.childCount; i++)
            {
                UnitLogic enamy = enemies.GetChild(i).GetComponent <UnitLogic>();
                enamy.EffectsTick(Effect.actionCall.OnEndTurn);
                if (enamy.unitlogic.totem != null)
                {
                    enamy.unitlogic.totem.Execute(Effect.actionCall.OnEndTurn);
                }
            }
            NeedRefreshPos = false;
            BattleLogic.battleLogic.addAction(() =>
            {
                BattleControll.battleControll.SpawnEnemies();
                GoToFirstLine();
                TurnController.turnController.NextTurn();
                RealizeLogicToNextTurn();
            }, null);
        }