Exemplo n.º 1
0
        protected void LoadTurnEvent(int eventId, int turnId, CreatureFaction turnPhase, Action <IGameAction> action)
        {
            TurnEventCondition condition = new TurnEventCondition(turnId, turnPhase);
            GameEvent          even      = new GameEvent(eventId, condition, action);

            eventManager.RegisterEvent(even);
        }
Exemplo n.º 2
0
        protected void LoadTeamEvent(int eventId, CreatureFaction faction, Action <IGameAction> action)
        {
            TeamEliminatedCondition condition = new TeamEliminatedCondition(faction);
            GameEvent even = new GameEvent(eventId, condition, action);

            eventManager.RegisterEvent(even);
        }
Exemplo n.º 3
0
        public void SwitchCreature(int creatureId, CreatureFaction faction)
        {
            FDCreature creature = GetCreature(creatureId);

            if (creature != null)
            {
                DisposeCreature(creatureId, false);
                switch (faction)
                {
                case CreatureFaction.Friend:
                    this.Friends.Add(creature);
                    break;

                case CreatureFaction.Npc:
                    this.Npcs.Add(creature);
                    break;

                case CreatureFaction.Enemy:
                    this.Enemies.Add(creature);
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 4
0
        public TurnEventCondition(int turnId, CreatureFaction phase)
        {
            this.Type = ConditionType.Turn;

            this.TurnId    = turnId;
            this.TurnPhase = phase;
        }
Exemplo n.º 5
0
        public void ComposeCreature(CreatureFaction faction, int creatureId, int definitionId, FDPosition position, int dropItem = 0)
        {
            CreatureDefinition creatureDef = DefinitionStore.Instance.GetCreatureDefinition(definitionId);
            FDCreature         creature    = new FDCreature(creatureId, faction, creatureDef, position);

            switch (faction)
            {
            case CreatureFaction.Friend:
                this.Friends.Add(creature);
                break;

            case CreatureFaction.Enemy:
                if (dropItem > 0)
                {
                    creature.Data.DropItem = dropItem;
                }
                this.Enemies.Add(creature);
                break;

            case CreatureFaction.Npc:
                this.Npcs.Add(creature);
                break;

            default:
                break;
            }

            CreatureComposePack pack = new CreatureComposePack(creatureId, creatureDef.AnimationId, position);

            gameCallback.OnHandlePack(pack);
        }
Exemplo n.º 6
0
        public List <FDCreature> GetCreatureInRange(FDRange range, CreatureFaction faction)
        {
            List <FDCreature> candidates = null;

            switch (faction)
            {
            case CreatureFaction.Friend:
                candidates = this.Friends;
                break;

            case CreatureFaction.Npc:
                candidates = this.Npcs;
                break;

            case CreatureFaction.Enemy:
                candidates = this.Enemies;
                break;
            }

            List <FDCreature> result = new List <FDCreature>();

            foreach (FDCreature candidate in candidates)
            {
                if (range.Contains(candidate.Position))
                {
                    result.Add(candidate);
                }
            }

            return(result);
        }
Exemplo n.º 7
0
        public AIHandler(IGameAction gameAction, CreatureFaction faction)
        {
            this.gameAction = gameAction;
            this.Faction    = faction;

            if (this.Faction == CreatureFaction.Enemy)
            {
                creatureList = gameAction.GetAllEnemies();
            }
            else if (this.Faction == CreatureFaction.Npc)
            {
                creatureList = gameAction.GetAllNpcs();
            }
        }
Exemplo n.º 8
0
        public Creature(CreatureFaction faction)
        {
            // Set the internal values
            Inventory = new int[27];
            for (int i = 0; i <= 26; i++)
            {
                Inventory[i] = -1;
            }

            if (faction == CreatureFaction.PC)
            {
                name              = "You";
                body              = 5;
                mind              = 5;
                finesse           = 5;
                hp                = 13;
                currenthp         = hp;
                mp                = 0;
                faction           = CreatureFaction.PC;
                type              = CreatureType.Humanoid;
                graphic           = '@';
                colour            = new TCODColor(0, 0, 0);
                status            = CreatureStatus.Alive;
                attackDescription = string.Empty;
                speech            = string.Empty;
                action            = string.Empty;
                location          = new Point(0, 0);
            }
            else
            {
                name              = String.Empty;
                body              = 0;
                mind              = 0;
                finesse           = 0;
                faction           = CreatureFaction.None;
                type              = CreatureType.None;
                graphic           = ' ';
                colour            = new TCODColor(0, 0, 0);
                status            = CreatureStatus.None;
                attackDescription = string.Empty;
                speech            = string.Empty;
                action            = string.Empty;
                location          = new Point(0, 0);
            }
        }
Exemplo n.º 9
0
        public FDCreature(int creatureId, CreatureFaction faction, CreatureDefinition definition, FDPosition position)
        {
            this.Faction = faction;

            this.Data = new CreatureData();
            this.Data = CreatureData.FromDefinition(creatureId, definition);

            this.Definition      = definition;
            this.Position        = position;
            this.PreMovePosition = position;

            this.Data.LastGainedExperience = 0;

            if (this.Definition.Occupation == 154 || this.Definition.Occupation == 155 || this.Definition.DefinitionId == 747)
            {
                this.Data.AIType = CreatureData.AITypes.AIType_Defensive;
            }
            else
            {
                this.Data.AIType = CreatureData.AITypes.AIType_Aggressive;
            }
        }
Exemplo n.º 10
0
        private void StartNewTurnPhase()
        {
            // Turn Id and Phase ++
            if (turnId == 0)
            {
                turnId    = 1;
                turnPhase = CreatureFaction.Friend;
            }
            else
            {
                if (turnPhase == CreatureFaction.Friend)
                {
                    if (this.Npcs.Count > 0)
                    {
                        turnPhase = CreatureFaction.Npc;
                    }
                    else
                    {
                        turnPhase = CreatureFaction.Enemy;
                    }
                }
                else if (turnPhase == CreatureFaction.Npc)
                {
                    turnPhase = CreatureFaction.Enemy;
                }
                else if (turnPhase == CreatureFaction.Enemy)
                {
                    turnId++;
                    turnPhase = CreatureFaction.Friend;
                }
            }

            // Notify turn events
            eventManager.NotifyTurnEvents();

            // Reset Creature status
            foreach (FDCreature creature in this.Friends)
            {
                creature.OnTurnStart();
            }

            foreach (FDCreature creature in this.Enemies)
            {
                creature.OnTurnStart();
            }

            foreach (FDCreature creature in this.Npcs)
            {
                creature.OnTurnStart();
            }

            // Update UICreature on UI
            gameCallback.OnHandlePack(new CreatureRefreshAllPack());

            // AI Call

            // Show turn icon
            if (this.turnPhase == CreatureFaction.Friend)
            {
            }
        }
 public TeamEliminatedCondition(CreatureFaction faction)
 {
     this.Faction = faction;
 }