Ejemplo n.º 1
0
    public void Execute(Actions action)
    {
        OLD_TEventEntity objective;

        switch (action)
        {
        case Actions.Wait:
        default:
            return;

        case Actions.Heal:
            HealMyPlanets();
            return;

        case Actions.Upgrade:
            LevelUpMyPlanets();
            return;

        case Actions.AttackNeutral:
            //print("Hay neutrales");
            if (ThereAreNeutralPlanets())
            {
                objective = OLD_TEffector.GetNearestPlanet(myPlayer, map, true);
                Attack(objective, Random.value > 0.25f);
            }
            return;

        case Actions.AttackEnemy:
            objective = OLD_TEffector.GetNearestPlanet(myPlayer, map);
            Attack(objective, Random.value > 0.25f);
            return;
        }
    }
Ejemplo n.º 2
0
    public OLD_TPlayer(int id, List <OLD_TEventEntity> planets, AIType AI, OLD_TEventEntity[] level, bool takeSnapshot = false)
    {
        this.id      = id;
        this.planets = planets;
        if (takeSnapshot)
        {
            TakeSnapshot();
        }

        switch (AI)
        {
        case AIType.Dumb:
            this.AI = new DumbAI();
            break;

        case AIType.Random:
            this.AI = new RandomAI();
            break;

        case AIType.Classic:
            this.AI = new OLD_TClasicAI(this, level);
            break;
        }
        effector = new OLD_TEffector(this, level);
    }
Ejemplo n.º 3
0
    public Actions Decide()
    {
        bool attack       = false;
        bool attackNeutal = false;

        if (PlanetsNeedHealing())
        {
            return(Actions.Heal);
        }

        if (PlanetsNotAtMaximmumLevel() && Random.value > 0.5f)
        {
            return(Actions.Upgrade);
        }

        if (Random.value > 0.4f)
        {
            if (Random.value > 0.5f)
            {
                attack = true;
            }
            else
            {
                attackNeutal = true;
            }
        }

        OLD_TEventEntity objective;

        if (ThereAreNeutralPlanets() && !attack)
        {
            //print("Hay neutrales");
            objective = OLD_TEffector.GetNearestPlanet(myPlayer, map, true);
            if (myPlayer.GetCurrentUnitsNumber() > OLD_TEffector.CountNecessaryUnitsToConquer(objective, myPlayer) * 1.5f || attackNeutal)
            {
                return(Actions.AttackNeutral);
            }
        }
        else
        {
            objective = OLD_TEffector.GetNearestPlanet(myPlayer, map);
            if (myPlayer.GetCurrentUnitsNumber() > OLD_TEffector.CountNecessaryUnitsToConquer(objective, myPlayer) * 1.5f || attack)
            {
                return(Actions.AttackEnemy);
            }
        }
        return(Actions.Wait);
    }