private static Dictionary <Directions, TerrainSorcererStreet> GetNextTerrains(SorcererStreetMap Map, int ActiveTerrainX, int ActiveTerrainY, int LayerIndex, Directions PlayerDirection) { Dictionary <Directions, TerrainSorcererStreet> DicNextTerrain = new Dictionary <Directions, TerrainSorcererStreet>(); if (ActiveTerrainY - 1 >= 0) { DicNextTerrain.Add(Directions.Up, Map.GetTerrain(ActiveTerrainX, ActiveTerrainY - 1, LayerIndex)); } if (ActiveTerrainY + 1 < Map.MapSize.Y) { DicNextTerrain.Add(Directions.Down, Map.GetTerrain(ActiveTerrainX, ActiveTerrainY + 1, LayerIndex)); } if (ActiveTerrainX - 1 >= 0) { DicNextTerrain.Add(Directions.Left, Map.GetTerrain(ActiveTerrainX - 1, ActiveTerrainY, LayerIndex)); } if (ActiveTerrainX + 1 < Map.MapSize.X) { DicNextTerrain.Add(Directions.Right, Map.GetTerrain(ActiveTerrainX + 1, ActiveTerrainY, LayerIndex)); } Directions[] TerrainDirections = DicNextTerrain.Keys.ToArray(); foreach (Directions ActiveDirection in TerrainDirections) { if (PlayerDirection == Directions.Left && ActiveDirection == Directions.Right) { DicNextTerrain.Remove(ActiveDirection); } else if (PlayerDirection == Directions.Right && ActiveDirection == Directions.Left) { DicNextTerrain.Remove(ActiveDirection); } else if (PlayerDirection == Directions.Up && ActiveDirection == Directions.Down) { DicNextTerrain.Remove(ActiveDirection); } else if (PlayerDirection == Directions.Down && ActiveDirection == Directions.Up) { DicNextTerrain.Remove(ActiveDirection); } else if (DicNextTerrain[ActiveDirection].TerrainTypeIndex == 0) { DicNextTerrain.Remove(ActiveDirection); } } return(DicNextTerrain); }
public override void Load() { TerrainSorcererStreet ActiveTerrain = Map.GetTerrain(ActivePlayer.GamePiece); Map.GlobalSorcererStreetBattleContext.Invader = Invader; Map.GlobalSorcererStreetBattleContext.Defender = ActiveTerrain.DefendingCreature; Map.GlobalSorcererStreetBattleContext.InvaderPlayer = ActivePlayer; Map.GlobalSorcererStreetBattleContext.DefenderPlayer = ActiveTerrain.Owner; Map.GlobalSorcererStreetBattleContext.Invader.ResetBonuses(); Map.GlobalSorcererStreetBattleContext.Defender.ResetBonuses(); Map.GlobalSorcererStreetBattleContext.InvaderFinalHP = Map.GlobalSorcererStreetBattleContext.Invader.CurrentHP; Map.GlobalSorcererStreetBattleContext.DefenderFinalHP = Map.GlobalSorcererStreetBattleContext.Defender.CurrentHP; Map.GlobalSorcererStreetBattleContext.InvaderFinalST = Map.GlobalSorcererStreetBattleContext.Invader.CurrentST; Map.GlobalSorcererStreetBattleContext.DefenderFinalST = Map.GlobalSorcererStreetBattleContext.Defender.CurrentST; Map.GlobalSorcererStreetBattleContext.InvaderCard = new SimpleAnimation("Invader", "Invader", Invader.sprCard); Map.GlobalSorcererStreetBattleContext.InvaderCard.Position = new Vector2(10, 30); Map.GlobalSorcererStreetBattleContext.InvaderCard.Scale = new Vector2(0.5f); Map.GlobalSorcererStreetBattleContext.DefenderCard = new SimpleAnimation("Defender", "Defender", ActiveTerrain.DefendingCreature.sprCard); Map.GlobalSorcererStreetBattleContext.DefenderCard.Position = new Vector2(Constants.Width - 210, 30); Map.GlobalSorcererStreetBattleContext.DefenderCard.Scale = new Vector2(0.5f); ListActionMenuChoice.AddToPanelListAndSelect(new ActionPanelBattleItemSelectionPhase(ListActionMenuChoice, Map, ActivePlayer)); }
public ActionPanelBattleLandModifierPhase(ActionPanelHolder ListActionMenuChoice, SorcererStreetMap Map, SorcererStreetUnit PlayerUnit) : base(PanelName, ListActionMenuChoice, null, false) { this.Map = Map; this.PlayerUnit = PlayerUnit; this.ActiveTerrain = Map.GetTerrain(PlayerUnit); }
public override void DrawPlayers(CustomSpriteBatch g) { for (int P = 0; P < ActiveMap.ListPlayer.Count; P++) { g.Draw(GameScreen.sprPixel, new Rectangle((int)ActiveMap.ListPlayer[P].GamePiece.X * ActiveMap.TileSize.X, (int)ActiveMap.ListPlayer[P].GamePiece.Y * ActiveMap.TileSize.Y, ActiveMap.TileSize.X / 2, ActiveMap.TileSize.Y / 2), Color.FromNonPremultiplied(127, 127, 127, 127)); g.DrawString(ActiveMap.fntArial12, "P", new Vector2(ActiveMap.ListPlayer[P].GamePiece.X * ActiveMap.TileSize.X + 2, ActiveMap.ListPlayer[P].GamePiece.Y * ActiveMap.TileSize.Y), Color.Red); } for (int X = MapSize.X - 1; X >= 0; --X) { for (int Y = MapSize.Y - 1; Y >= 0; --Y) { if (ActiveMap.GetTerrain(X, Y, 0).DefendingCreature != null) { g.Draw(GameScreen.sprPixel, new Rectangle((int)X * ActiveMap.TileSize.X + 16, (int)Y * ActiveMap.TileSize.Y, ActiveMap.TileSize.X / 2, ActiveMap.TileSize.Y / 2), Color.FromNonPremultiplied(127, 127, 127, 127)); g.DrawString(ActiveMap.fntArial12, "C", new Vector2(X * ActiveMap.TileSize.X + 2 + 16, Y * ActiveMap.TileSize.Y), Color.Red); } } } }
public override void OnSelect() { for (int X = 0; X < Map.MapSize.X; ++X) { for (int Y = 0; Y < Map.MapSize.Y; ++Y) { TerrainSorcererStreet ActiveTerrain = Map.GetTerrain(X, Y, Map.ActiveLayerIndex); if (ActiveTerrain.TerrainTypeIndex == 0) { continue; } if (ActiveTerrain.DefendingCreature != null) { Map.GlobalSorcererStreetBattleContext.UserCreature = Map.GlobalSorcererStreetBattleContext.Invader; Map.GlobalSorcererStreetBattleContext.OpponentCreature = Map.GlobalSorcererStreetBattleContext.Defender; ActiveTerrain.DefendingCreature.ActivateSkill(RequirementName); Map.GlobalSorcererStreetBattleContext.UserCreature = Map.GlobalSorcererStreetBattleContext.Defender; Map.GlobalSorcererStreetBattleContext.OpponentCreature = Map.GlobalSorcererStreetBattleContext.Invader; ActiveTerrain.DefendingCreature.ActivateSkill(RequirementName); } } } ContinueBattlePhase(); }
private void Init() { for (int X = 0; X < Map.MapSize.X; ++X) { for (int Y = 0; Y < Map.MapSize.Y; ++Y) { for (int L = 0; L < Map.ListLayer.Count; ++L) { TerrainSorcererStreet ActiveTerrain = Map.GetTerrain(X, Y, L); if (ActiveTerrain.TerrainTypeIndex == 0) { continue; } if (ActiveTerrain.DefendingCreature != null) { Map.GlobalSorcererStreetBattleContext.UserCreature = Map.GlobalSorcererStreetBattleContext.Invader; Map.GlobalSorcererStreetBattleContext.OpponentCreature = Map.GlobalSorcererStreetBattleContext.Defender; ActiveTerrain.DefendingCreature.ActivateSkill(RequirementName); Map.GlobalSorcererStreetBattleContext.UserCreature = Map.GlobalSorcererStreetBattleContext.Defender; Map.GlobalSorcererStreetBattleContext.OpponentCreature = Map.GlobalSorcererStreetBattleContext.Invader; ActiveTerrain.DefendingCreature.ActivateSkill(RequirementName); } } } } }
public override void DoRead(ByteReader BR) { float X = BR.ReadFloat(); float Y = BR.ReadFloat(); int LayerIndex = BR.ReadInt32(); Map.GetTerrain((int)X, (int)Y, LayerIndex); }