コード例 #1
0
        public TBAGW.EnemyAIInfo ToEnemy(TBAGW.MapZone mz, List <BasicTile> playerZone)
        {
            TBAGW.EnemyAIInfo temp = mz.zoneEncounterInfo.enemies.Find(e => e.enemyName.Equals(name, StringComparison.OrdinalIgnoreCase) ||
                                                                       name.Equals(e.enemyCharBase.CharacterName, StringComparison.OrdinalIgnoreCase) ||
                                                                       name.Equals(e.enemyCharBase.displayName, StringComparison.OrdinalIgnoreCase));

            if (temp == null)
            {
                return(null);
            }

            bool      bGenerateLocation = true;
            Vector2   pos  = new Vector2(location.x * 64, location.y * 64);
            BasicTile tile = new BasicTile();

            if (mz.Contains(pos))
            {
                tile = GameProcessor.loadedMap.possibleTilesGameZoneForEnemyINITIALIZATION(mz.zoneTiles).Except(playerZone).ToList().Find(t => t.positionGrid == new Vector2(location.x, location.y));
                if (tile != default(TBAGW.BasicTile))
                {
                    Console.WriteLine("From LuaScriptBattle, script enemy has correct spawn location!");
                    bGenerateLocation = false;

                    //int randomNum = GamePlayUtility.Randomize(0, temp.Count);
                    //var randomTile = temp[randomNum];
                }
            }

            if (bGenerateLocation)
            {
                Console.WriteLine("From LuaScriptBattle, script enemy has incorrect spawn location!");
                var tiles = GameProcessor.loadedMap.possibleTilesGameZoneForEnemyINITIALIZATION(mz.zoneTiles).Except(playerZone).ToList();
                if (tiles.Count < PlayerSaveData.heroParty.Count)
                {
                    return(null);
                }
                int randomNum = GamePlayUtility.Randomize(0, tiles.Count);
                tile = tiles[randomNum];
            }

            CombatProcessor.encounterEnemies.Add(temp.enemyCharBase);
            CombatProcessor.encounterEnemies.Last().spriteGameSize = new Rectangle(((Rectangle)tile.mapPosition).X, ((Rectangle)tile.mapPosition).Y, ((Rectangle)tile.mapPosition).Width, ((Rectangle)tile.mapPosition).Height);

            CombatProcessor.encounterEnemies.Last().position      = CombatProcessor.encounterEnemies.Last().spriteGameSize.Location.ToVector2();
            CombatProcessor.encounterEnemies.Last().rotationIndex = rot % 4;
            CombatProcessor.encounterEnemies.Last().UpdatePosition();

            //temp.enemyCharBase.spriteGameSize = new Rectangle(((Rectangle)tile.mapPosition).X, ((Rectangle)tile.mapPosition).Y, ((Rectangle)tile.mapPosition).Width, ((Rectangle)tile.mapPosition).Height);
            //item.spriteGameSize.Width = 64;
            //item.spriteGameSize.Height = 64;
            //temp.enemyCharBase.spriteGameSize = new Rectangle(((Rectangle)tile.mapPosition).X, ((Rectangle)tile.mapPosition).Y, ((Rectangle)tile.mapPosition).Width, ((Rectangle)tile.mapPosition).Height);
            //temp.enemyCharBase.rotationIndex = rot % 4;
            //temp.enemyCharBase.position = temp.enemyCharBase.spriteGameSize.Location.ToVector2();
            //GameProcessor.encounterEnemies = enemies;
            //CombatProcessor.encounterEnemies.Add(temp.enemyCharBase);
            //CombatProcessor.encounterEnemies.Last().spriteGameSize = new Rectangle(((Rectangle)tile.mapPosition).X, ((Rectangle)tile.mapPosition).Y, ((Rectangle)tile.mapPosition).Width, ((Rectangle)tile.mapPosition).Height);
            return(null);
        }
コード例 #2
0
        public void GenerateTurn(BaseCharacter bs, MapZone zone, List <BasicTile> bt)
        {
            bAttackedThisCT = false;
            abiUsedInfo     = null;
            character       = bs;
            turns.Clear();
            characterArea.Clear();
            int temp     = bs.trueSTATChart().currentPassiveStats[(int)STATChart.PASSIVESTATS.AP];
            int maxMoves = bs.trueSTATChart().currentPassiveStats[(int)STATChart.PASSIVESTATS.MOB];

            for (int i = 1; i < temp; i++)
            {
                turns.Add(new TurnInfo(maxMoves));
                characterArea.Add(MapListUtility.returnMapRadius((i - 1) * maxMoves, i * maxMoves, bt, bs));
            }
        }