コード例 #1
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public Actor(int x, int y, Player player)
 {
     TileX = x;
     TileY = y;
     texture = Assets.blackMageActor;
     camera = Camera.getInstance();
     this.player = player;
     this.remainingMovement = this.movement;
 }
コード例 #2
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
        public Monster Spawn(Type monsterType, int x, int y, Player player, bool free=false)
        {
            Monster monster = null;

            // This acts as a factory. Any new monsters need a block of logic here
            if (monsterType == typeof(BlackMage))
                monster = new BlackMage(x, y, player);
            else if (monsterType == typeof(BlueDragon))
                monster = new BlueDragon(x, y, player);
            else if (monsterType == typeof(HeavyKnight))
                monster = new HeavyKnight(x, y, player);
            else if (monsterType == typeof(Archer))
                monster = new Archer(x, y, player);
            else if (monsterType == typeof(BlackKnight))
                monster = new BlackKnight(x, y, player);
            else if (monsterType == typeof(Assassin))
                monster = new Assassin(x, y, player);
            else
                throw new System.ArgumentException("Monster type not registered in the MonsterManager.Spawn factory", "monsterType");

            // The UI is responsible for ensuring we have enough mana because we can do this
            if (!free)
                player.mana -= monster.manaCost;

            this.monsterCollection.Add(monster);
            player.monsterCollection.Add(monster);
            return monster;
        }
コード例 #3
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public Monster(int x, int y, Player player)
     : base(x, y, player)
 {
     // Default values for everything in case we don't define in a subclass
     this.name = "???";
     this.XP = 0;
     this.maxXP = 100;
     this.HP = this.maxHP = this.previousHP = 10;
     this.rangedAP = 1;
     this.rangedAccuracy = 50;
     this.rangedAttacks = 3;
     this.meleeAP = 2;
     this.meleeAccuracy = 75;
     this.meleeAttacks = 2;
     this.armor = 0;
     this.critRate = 5;
     this.monsterLevel = 1;  // Used in deciding relative XP gain from battles with this monster
     this.texture = Assets.blackMageActor;
     this.status = UI.getInstance().MakeMonsterStatusDialog(this);
 }
コード例 #4
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public BlueDragon(int x, int y, Player player)
     : base(x, y, player)
 {
     this.texture = Assets.blueDragonActor;
     this.xOffset = -10.0;
     this.name = "Blue Dragon";
     this.armor = 1;
     this.HP = this.maxHP = this.previousHP = 80;
     this.meleeAccuracy = 85;
     this.meleeAP = 8;
     this.rangedAccuracy = 60;
     this.rangedAP = 6;
     this.manaCost = 70;
     this.monsterLevel = 3;
     this.movement = this.remainingMovement = 7;
 }
コード例 #5
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public HeavyKnight(int x, int y, Player player)
     : base(x, y, player)
 {
     this.texture = Assets.heavyKnightActor;
     this.yOffset = -18.0;
     this.name = "Heavy Knight";
     this.armor = 2;
     this.HP = this.maxHP = this.previousHP = 50;
     this.meleeAccuracy = 75;
     this.meleeAP = 6;
     this.rangedAccuracy = 50;
     this.rangedAP = 5;
     this.manaCost = 40;
     this.monsterLevel = 2;
 }
コード例 #6
0
ファイル: Map.cs プロジェクト: TwoLeggedMammal/Summons
        public bool[,] GetActorLocations(int startX, int startY, Player player, bool myTeamOnly = true)
        {
            // We don't want to move into the same spot as a teammate
            bool[,] teammateMap = new bool[height, width];

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    teammateMap[j, i] = false;
                }
            }

            foreach (Monster actor in MonsterManager.getInstance().monsterCollection)
            {
                if ((actor.TileX != startX || actor.TileY != startY) && (!myTeamOnly || actor.player == player))
                {
                    teammateMap[actor.TileY, actor.TileX] = true;
                }
            }

            return teammateMap;
        }
コード例 #7
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public BlackMage(int x, int y, Player player)
     : base(x, y, player)
 {
     this.texture = Assets.blackMageActor;
     this.name = "Black Mage";
     this.HP = this.maxHP = this.previousHP = 25;
     this.meleeAccuracy = 70;
     this.meleeAP = 3;
     this.rangedAccuracy = 66;
     this.rangedAP = 12;
     this.manaCost = 30;
     this.prefersMelee = false;
     this.monsterLevel = 2;
 }
コード例 #8
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public Archer(int x, int y, Player player)
     : base(x, y, player)
 {
     this.texture = Assets.archerActor;
     this.yOffset = -19.0;
     this.name = "Archer";
     this.armor = 0;
     this.HP = this.maxHP = this.previousHP = 45;
     this.meleeAccuracy = 75;
     this.meleeAP = 5;
     this.rangedAccuracy = 70;
     this.rangedAP = 8;
     this.manaCost = 20;
     this.prefersMelee = false;
 }
コード例 #9
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public Assassin(int x, int y, Player player)
     : base(x, y, player)
 {
     this.texture = Assets.assassinActor;
     this.yOffset = -6.0;
     this.name = "Assassin";
     this.armor = 0;
     this.HP = this.maxHP = this.previousHP = 40;
     this.meleeAccuracy = 90;
     this.meleeAP = 2;
     this.meleeAttacks = 7;
     this.rangedAccuracy = 80;
     this.rangedAP = 4;
     this.manaCost = 25;
     this.critRate = 40;
 }
コード例 #10
0
ファイル: Player.cs プロジェクト: TwoLeggedMammal/Summons
 public void EndTurn()
 {
     // Make it the next players turn
     this.currentPlayer = this.playerCollection[(this.playerCollection.IndexOf(this.currentPlayer) + 1) % this.playerCollection.Count];
     StartTurn();
 }
コード例 #11
0
ファイル: Player.cs プロジェクト: TwoLeggedMammal/Summons
        public void SpawnPlayers()
        {
            // We look at the map data to determine where to spawn players. Chars a-d are designated spawn points, but also towers.
            // Currently capped at 2 players.
            Coordinate player1Spawn = Map.getInstance().GetSpawnPoint(1);
            Player player1 = new Player(1, false);
            this.playerCollection.Add(player1);  // player 1 is human
            Monster blackMage = MonsterManager.getInstance().Spawn(typeof(BlackMage), Convert.ToInt32(player1Spawn.x), Convert.ToInt32(player1Spawn.y), this.playerCollection[0], true);
            player1.summoner = blackMage;
            foreach (Tower tower in Map.getInstance().towers)
            {
                if (tower.X == player1Spawn.x && tower.Y == player1Spawn.y)
                    tower.Capture(blackMage, false);
            }

            Coordinate player2Spawn = Map.getInstance().GetSpawnPoint(2);
            Player player2 = new Player(2, true);
            this.playerCollection.Add(player2);  // player 2 is ai
            Monster blackKnight = MonsterManager.getInstance().Spawn(typeof(BlackKnight), Convert.ToInt32(player2Spawn.x), Convert.ToInt32(player2Spawn.y), this.playerCollection[1], true);
            player2.summoner = blackKnight;
            foreach (Tower tower in Map.getInstance().towers)
            {
                if (tower.X == player2Spawn.x && tower.Y == player2Spawn.y)
                    tower.Capture(blackKnight, false);
            }

            foreach (Player player in this.playerCollection)
            {
                if (player.isAi)
                {
                    AI ai = new AI(player);
                    player.ai = ai;
                }
            }

            // Player 1 goes first
            this.currentPlayer = player1;

            UI.getInstance().monsterSummonDialog = new MonsterSummonDialog();
        }
コード例 #12
0
ファイル: Map.cs プロジェクト: TwoLeggedMammal/Summons
 public void Capture(Actor monster, bool alert = true)
 {
     if (this.owner != monster.player)
     {
         if (this.owner != null)
         {
             this.owner.towersOwned--;  // Remove from the old owner's tower count
         }
         this.owner = monster.player;
         this.owner.towersOwned++;  // Add to the new owner's tower count
         if (alert)
             EventsManager.getInstance().RecordEvent(EventsManager.Event.TOWER_CAPTURED, monster);
     }
 }
コード例 #13
0
ファイル: Map.cs プロジェクト: TwoLeggedMammal/Summons
 public Tower(int x, int y)
 {
     owner = null;
     this.X = x;
     this.Y = y;
     this.xOffset = 25;
     this.yOffset = -15;
 }
コード例 #14
0
ファイル: Map.cs プロジェクト: TwoLeggedMammal/Summons
        public void LoadSummonOverlay(Player player)
        {
            Monster summoner = player.summoner;
            this.summonLocations = new List<Coordinate>();
            bool[,] actorLocations = this.GetActorLocations(-1, -1, player, false);

            for (int i = summoner.TileX - 1; i < summoner.TileX + 2; i++)
            {
                for (int j = summoner.TileY - 1; j < summoner.TileY + 2; j++)
                {
                    // See if this is an elligible location for a spawn point
                    if (!actorLocations[j, i] && Map.tileMoveCost[this.mapData[j][i]] <= 1.0)
                    {
                        summonLocations.Add(new Coordinate(i, j));
                    }
                }
            }
        }
コード例 #15
0
ファイル: Dialog.cs プロジェクト: TwoLeggedMammal/Summons
        public void BuildControls(Player player)
        {
            // One button for each monster we could summon
            summonOptions = player.summonOptions;
            this.buttonCollection.Clear();

            int posX = 0;
            int posY = 0;

            for (int i = 0; i < summonOptions.Count; i++)
            {
                SummonMonsterButton button = new SummonMonsterButton(this,
                    posX,
                    posY,
                    summonOptions[i]);
                this.buttonCollection.Add(button);

                if (posX + button.width > width)
                {
                    posX = 0;
                    posY += button.height + padding;
                    button.x = posX;
                    button.y = posY;
                }
                posX += button.width + padding;
            }
        }
コード例 #16
0
ファイル: Actor.cs プロジェクト: TwoLeggedMammal/Summons
 public BlackKnight(int x, int y, Player player)
     : base(x, y, player)
 {
     this.texture = Assets.blackKnightActor;
     this.yOffset = -12.0;
     this.name = "Black Knight";
     this.armor = 2;
     this.HP = this.maxHP = this.previousHP = 75;
     this.meleeAccuracy = 80;
     this.meleeAP = 8;
     this.rangedAccuracy = 50;
     this.rangedAP = 5;
     this.manaCost = 60;
     this.monsterLevel = 3;
 }
コード例 #17
0
ファイル: AI.cs プロジェクト: TwoLeggedMammal/Summons
 public AI(Player player)
 {
     this.player = player;
     delay = 0.0;
     movedThisTurn = new Dictionary<Monster, bool>();
 }
コード例 #18
0
ファイル: Map.cs プロジェクト: TwoLeggedMammal/Summons
 public Stack<Coordinate> FindPath(int startX, int startY, int destX, int destY, Player player)
 {
     Stack<Coordinate> path = new Stack<Coordinate>();
     bool[,] teammateMap = GetActorLocations(startX, startY, player);
     double[,] moveMap = GetMovementMap(startX, startY, null, 30.0, teammateMap);
     return ExtractPath(startX, startY, moveMap, destX, destY);
 }