Example #1
0
        void ApplyAction(SingleAction sa_)
        {
            switch (sa_.type)
            {
            case (ActionType.Skill):
                CastSkill(sa_.key, sa_.location, sa_.actorKey);
                break;

            case (ActionType.Move):
                CastMove(sa_.location, sa_.actorKey);
                break;

            case (ActionType.TakeDamage):
                ApplyDamageAction(sa_);
                break;
            }
        }
Example #2
0
        //AI
        public Turn getBestOption()
        {
            Turn t           = new Turn(new SingleAction[] { new SingleAction(ActionType.Move, 10, actors[actorKey].tsPos, actorKey) });
            int  bestFitness = 0;

            for (int k = 0; k < CurrentActor().skills.Count; k++)
            {
                foreach (Creature c in inRangeActors(pointsInRange(CurrentActor().tsPos, CurrentActor().skills[k].range)))
                {
                    int fitness = 0;
                    fitness = CurrentActor().skills[k].damage;

                    if (fitness > bestFitness)
                    {
                        bestFitness = fitness;

                        SingleAction option = new SingleAction(ActionType.Skill, k, c.tsPos, actorKey);
                        t = new Turn(new SingleAction[] { option });
                    }
                }
            }
            return(t);
        }
Example #3
0
 void ApplyDamageAction(SingleAction sa_)
 {
     actors[sa_.actorKey].hp           -= sa_.damage;
     actors[sa_.actorKey].currentAction = ActionType.TakeDamage;
 }